13 from geometry
import check_components
14 from pxd
import add_pxd_packer, add_pxd_unpacker
15 from svd
import add_svd_packer, add_svd_unpacker
16 from neurotrigger
import add_neuro_2d_unpackers
19 def add_packers(path, components=None):
21 This function adds the raw data packer modules to a path.
25 check_components(components)
28 if "Gearbox" not in path:
29 path.add_module(
"Gearbox")
31 if "Geometry" not in path:
32 path.add_module(
"Geometry")
35 if components
is None or 'PXD' in components:
39 if components
is None or 'SVD' in components:
43 if components
is None or 'CDC' in components:
44 cdcpacker = b2.register_module(
'CDCPacker')
45 path.add_module(cdcpacker)
48 if components
is None or 'ECL' in components:
49 eclpacker = b2.register_module(
'ECLPacker')
50 path.add_module(eclpacker)
53 if components
is None or 'TOP' in components:
54 toppacker = b2.register_module(
'TOPPacker')
55 path.add_module(toppacker)
58 if components
is None or 'ARICH' in components:
59 arichpacker = b2.register_module(
'ARICHPacker')
60 path.add_module(arichpacker)
63 if components
is None or 'KLM' in components:
64 klmpacker = b2.register_module(
'KLMPacker')
65 path.add_module(klmpacker)
68 def add_unpackers(path, components=None, writeKLMDigitRaws=False, addTOPRelations=False):
70 This function adds the raw data unpacker modules to a path.
72 :param components: list of geometry components to include reconstruction for, or None for all components.
73 :param writeKLMDigitRaws: flag for creating the KLMDigitRaw object and storing it in the datastore. The KLMDQM
74 module needs it for filling some histograms.
75 :param addTOPRelations: flag for creating relations in TOPUnpacker and TOPRawDigitConverter
79 check_components(components)
82 if "Gearbox" not in path:
83 path.add_module(
"Gearbox")
85 if "Geometry" not in path:
86 path.add_module(
"Geometry")
89 if 'SimulateEventLevelTriggerTimeInfo' not in path:
90 path.add_module(
'TTDUnpacker')
93 if components
is None or 'PXD' in components:
94 add_pxd_unpacker(path)
97 if components
is None or 'SVD' in components:
98 add_svd_unpacker(path)
101 if components
is None or 'CDC' in components:
102 cdcunpacker = b2.register_module(
'CDCUnpacker')
103 cdcunpacker.param(
'enableStoreCDCRawHit',
True)
104 cdcunpacker.param(
'enablePrintOut',
False)
105 path.add_module(cdcunpacker)
108 if components
is None or 'ECL' in components:
109 eclunpacker = b2.register_module(
'ECLUnpacker')
110 eclunpacker.param(
"storeTrigTime",
True)
111 path.add_module(eclunpacker)
114 if components
is None or 'TOP' in components:
115 topunpacker = b2.register_module(
'TOPUnpacker')
116 topunpacker.param(
'addRelations', addTOPRelations)
117 path.add_module(topunpacker)
118 topconverter = b2.register_module(
'TOPRawDigitConverter')
119 topconverter.param(
'addRelations', addTOPRelations)
120 path.add_module(topconverter)
123 if components
is None or 'ARICH' in components:
124 arichunpacker = b2.register_module(
'ARICHUnpacker')
125 path.add_module(arichunpacker)
128 if components
is None or 'KLM' in components:
129 klmunpacker = b2.register_module(
'KLMUnpacker')
130 klmunpacker.param(
'WriteDigitRaws', writeKLMDigitRaws)
131 path.add_module(klmunpacker)
134 if components
is None or 'TRG' in components:
136 trggdlunpacker = b2.register_module(
'TRGGDLUnpacker')
137 path.add_module(trggdlunpacker)
138 trggdlsummary = b2.register_module(
'TRGGDLSummary')
139 path.add_module(trggdlsummary)
140 trgeclunpacker = b2.register_module(
'TRGECLUnpacker')
141 path.add_module(trgeclunpacker)
142 trggrlunpacker = b2.register_module(
'TRGGRLUnpacker')
143 path.add_module(trggrlunpacker)
144 trgtopunpacker = b2.register_module(
'TRGTOPUnpacker')
145 path.add_module(trgtopunpacker)
147 nmod_tsf = [0, 1, 2, 3, 4, 5, 6]
148 for mod_tsf
in nmod_tsf:
149 path.add_module(
'TRGCDCTSFUnpacker', TSFMOD=mod_tsf)
151 nmod_t3d = [0, 1, 2, 3]
152 for mod_t3d
in nmod_t3d:
153 path.add_module(
'TRGCDCT3DUnpacker', T3DMOD=mod_t3d)
156 add_neuro_2d_unpackers(path)
159 def add_raw_output(path, filename='raw.root', additionalBranches=None):
161 This function adds an output module for raw data to a path.
163 if additionalBranches
is None:
164 additionalBranches = []
165 output = b2.register_module(
'RootOutput')
166 output.param(
'outputFileName', filename)
167 branches = [
'RawPXDs',
'RawSVDs',
'RawCDCs',
'RawTOPs',
'RawARICHs',
'RawECLs',
'RawKLMs']
168 branches += additionalBranches
169 output.param(
'branchNames', branches)
170 path.add_module(output)
173 def add_raw_seqoutput(path, filename='raw.sroot', additionalObjects=None, fileNameIsPattern=False):
175 This function adds an seqroot output module for raw data to a path.
177 :param bool fileNameIsPattern: If true the filename needs to be a printf pattern with a placeholder for the
178 filenumber starting at 0, for example "raw-f%06d.root"
180 if additionalObjects
is None:
181 additionalObjects = []
182 output = b2.register_module(
'SeqRootOutput')
183 output.param(
'outputFileName', filename)
184 output.param(
'fileNameIsPattern', fileNameIsPattern)
185 objects = [
'EventMetaData',
'RawPXDs',
'RawSVDs',
'RawCDCs',
'RawTOPs',
'RawARICHs',
'RawECLs',
'RawKLMs']
186 objects += additionalObjects
187 output.param(
'saveObjs', objects)
188 path.add_module(output)