7from BaseDetector
import BaseDetector
11 def __init__(self, name, intree, branchName=None, outtree=None) -> None:
12 super().
__init__(name, intree, branchName, outtree=outtree)
15 if intree.GetBranch(
"MTCDetPoint"):
16 lsOfGlobals = ROOT.gROOT.GetListOfGlobals()
17 if global_variables.modules[
"MTC"]
not in lsOfGlobals:
18 lsOfGlobals.Add(global_variables.modules[
"MTC"])
20 mapping.make_mapping()
24 """Digitize SND/MTC MC hits.
26 Example of fiberID: 123051820, where:
29 - 0: station type (0 for +5 degrees, 1
for -5 degrees, 2
for scint plane)
30 - 5: z-layer number (0-5)
31 - 1820: local fibre ID within the station
32 Example of SiPM
global channel (what
is seen
in the output file): 123001123, where:
35 - 0: station type (0
for +5 degrees, 1
for -5 degrees)
36 - 0: mat number (only 0 by June 2025). In future,
if multiple mats per station are used,
37 this number will be 0-N. Currently, this digit
is allocated by SiPM channel ID!
38 - 1: SiPM number (automatically assigned based on fibre aggregation settings)
39 - 123: number of the SiPM channel (0-N). The channel number depends on the fibre aggregation setting.
44 for k, mc_point
in enumerate(self.
intree.MTCDetPoint):
45 det_id = mc_point.GetDetectorID()
47 station_type = mc_point.GetLayerType()
48 energy_loss = mc_point.GetEnergyLoss()
52 fibre_map = self.sipm_to_fibre_map_U
53 elif station_type == 1:
56 elif station_type == 2:
59 global_channel = det_id
60 if global_channel
not in hit_container:
61 hit_container[global_channel] = []
62 mc_points[global_channel] = {}
63 norm[global_channel] = 0
67 hit_container[global_channel].append([mc_point, weight])
68 d_e = energy_loss * weight
69 mc_points[global_channel][k] = d_e
70 norm[global_channel] += d_e
76 loc_fibre_id = det_id % 1_000_000
77 if loc_fibre_id
not in fibre_map:
80 f
"MTC digitization: no mapping found for fibre ID {loc_fibre_id} in station type {station_type}. Skipping."
84 for sipm_chan, chan_info
in fibre_map[loc_fibre_id].items():
85 global_channel = (det_id // 1_000_000) * 1_000_000 + sipm_chan
86 if global_channel
not in hit_container:
87 hit_container[global_channel] = []
88 mc_points[global_channel] = {}
89 norm[global_channel] = 0
91 weight = chan_info[
"weight"]
92 hit_container[global_channel].append([mc_point, weight])
93 d_e = energy_loss * weight
94 mc_points[global_channel][k] = d_e
95 norm[global_channel] += d_e
97 for det_id
in hit_container:
98 all_points = ROOT.std.vector(
"MTCDetPoint*")()
99 all_weights = ROOT.std.vector(
"Float_t")()
101 for entry
in hit_container[det_id]:
102 all_points.push_back(entry[0])
103 all_weights.push_back(entry[1])
104 det_hit = ROOT.MTCDetHit(det_id, all_points, all_weights)
105 self.
det.push_back(det_hit)
None __init__(self, name, intree, branchName=None, outtree=None)