12from geometry
import check_components
13from pxd
import add_pxd_packer, add_pxd_unpacker
14from svd
import add_svd_packer, add_svd_unpacker
15from neurotrigger
import add_neuro_2d_unpackers
18def add_packers(path, components=None):
20 This function adds the raw data packer modules to a path.
24 check_components(components)
27 if "Gearbox" not in path:
28 path.add_module(
"Gearbox")
30 if "Geometry" not in path:
31 path.add_module(
"Geometry")
34 if components
is None or 'PXD' in components:
38 if components
is None or 'SVD' in components:
42 if components
is None or 'CDC' in components:
43 cdcpacker = b2.register_module(
'CDCPacker')
44 path.add_module(cdcpacker)
47 if components
is None or 'ECL' in components:
48 eclpacker = b2.register_module(
'ECLPacker')
49 path.add_module(eclpacker)
52 if components
is None or 'TOP' in components:
53 toppacker = b2.register_module(
'TOPPacker')
54 path.add_module(toppacker)
57 if components
is None or 'ARICH' in components:
58 arichpacker = b2.register_module(
'ARICHPacker')
59 path.add_module(arichpacker)
62 if components
is None or 'KLM' in components:
63 klmpacker = b2.register_module(
'KLMPacker')
64 path.add_module(klmpacker)
67def add_unpackers(path, components=None, writeKLMDigitRaws=False, addTOPRelations=False):
69 This function adds the raw data unpacker modules to a path.
71 :param components: list of geometry components to include reconstruction for,
or None for all components.
72 :param writeKLMDigitRaws: flag
for creating the KLMDigitRaw object
and storing it
in the datastore. The KLMDQM
73 module needs it
for filling some histograms.
74 :param addTOPRelations: flag
for creating relations
in TOPUnpacker
and TOPRawDigitConverter
78 check_components(components)
81 if "Gearbox" not in path:
82 path.add_module(
"Gearbox")
84 if "Geometry" not in path:
85 path.add_module(
"Geometry")
88 if 'SimulateEventLevelTriggerTimeInfo' not in path:
89 path.add_module(
'TTDUnpacker')
92 if components
is None or 'PXD' in components:
93 add_pxd_unpacker(path)
96 if components
is None or 'SVD' in components:
97 add_svd_unpacker(path)
100 if components
is None or 'CDC' in components:
101 cdcunpacker = b2.register_module(
'CDCUnpacker')
102 cdcunpacker.param(
'enableStoreCDCRawHit',
True)
103 cdcunpacker.param(
'enablePrintOut',
False)
104 path.add_module(cdcunpacker)
107 if components
is None or 'ECL' in components:
108 eclunpacker = b2.register_module(
'ECLUnpacker')
109 eclunpacker.param(
"storeTrigTime",
True)
110 path.add_module(eclunpacker)
113 if components
is None or 'TOP' in components:
114 topunpacker = b2.register_module(
'TOPUnpacker')
115 topunpacker.param(
'addRelations', addTOPRelations)
116 path.add_module(topunpacker)
117 topconverter = b2.register_module(
'TOPRawDigitConverter')
118 topconverter.param(
'addRelations', addTOPRelations)
119 path.add_module(topconverter)
122 if components
is None or 'ARICH' in components:
123 arichunpacker = b2.register_module(
'ARICHUnpacker')
124 path.add_module(arichunpacker)
127 if components
is None or 'KLM' in components:
128 klmunpacker = b2.register_module(
'KLMUnpacker')
129 klmunpacker.param(
'WriteDigitRaws', writeKLMDigitRaws)
130 path.add_module(klmunpacker)
133 if components
is None or 'TRG' in components:
135 trggdlunpacker = b2.register_module(
'TRGGDLUnpacker')
136 path.add_module(trggdlunpacker)
137 trggdlsummary = b2.register_module(
'TRGGDLSummary')
138 path.add_module(trggdlsummary)
139 trgeclunpacker = b2.register_module(
'TRGECLUnpacker')
140 path.add_module(trgeclunpacker)
141 trggrlunpacker = b2.register_module(
'TRGGRLUnpacker')
142 path.add_module(trggrlunpacker)
143 trgtopunpacker = b2.register_module(
'TRGTOPUnpacker')
144 path.add_module(trgtopunpacker)
146 nmod_tsf = [0, 1, 2, 3, 4, 5, 6]
147 for mod_tsf
in nmod_tsf:
148 path.add_module(
'TRGCDCTSFUnpacker', TSFMOD=mod_tsf)
150 nmod_t3d = [0, 1, 2, 3]
151 for mod_t3d
in nmod_t3d:
152 path.add_module(
'TRGCDCT3DUnpacker', T3DMOD=mod_t3d)
155 add_neuro_2d_unpackers(path)
158def add_raw_output(path, filename='raw.root', additionalBranches=None):
160 This function adds an output module for raw data to a path.
162 if additionalBranches
is None:
163 additionalBranches = []
164 output = b2.register_module(
'RootOutput')
165 output.param(
'outputFileName', filename)
166 branches = [
'RawPXDs',
'RawSVDs',
'RawCDCs',
'RawTOPs',
'RawARICHs',
'RawECLs',
'RawKLMs']
167 branches += additionalBranches
168 output.param(
'branchNames', branches)
169 path.add_module(output)
172def add_raw_seqoutput(path, filename='raw.sroot', additionalObjects=None, fileNameIsPattern=False):
174 This function adds an seqroot output module for raw data to a path.
176 :param bool fileNameIsPattern: If true the filename needs to be a printf pattern
with a placeholder
for the
177 filenumber starting at 0,
for example
"raw-f%06d.root"
179 if additionalObjects
is None:
180 additionalObjects = []
181 output = b2.register_module(
'SeqRootOutput')
182 output.param(
'outputFileName', filename)
183 output.param(
'fileNameIsPattern', fileNameIsPattern)
184 objects = [
'EventMetaData',
'RawPXDs',
'RawSVDs',
'RawCDCs',
'RawTOPs',
'RawARICHs',
'RawECLs',
'RawKLMs']
185 objects += additionalObjects
186 output.param(
'saveObjs', objects)
187 path.add_module(output)