5 from geometry
import check_components
6 from ROOT
import Belle2
7 from pxd
import add_pxd_packer, add_pxd_unpacker
8 from svd
import add_svd_packer, add_svd_unpacker
9 from iov_conditional
import make_conditional_at
10 from neurotrigger
import add_neuro_2d_unpackers
13 def add_packers(path, components=None):
15 This function adds the raw data packer modules to a path.
19 check_components(components)
22 if "Gearbox" not in path:
23 path.add_module(
"Gearbox")
25 if "Geometry" not in path:
26 path.add_module(
"Geometry")
29 if components
is None or 'PXD' in components:
33 if components
is None or 'SVD' in components:
37 if components
is None or 'CDC' in components:
38 cdcpacker = register_module(
'CDCPacker')
39 path.add_module(cdcpacker)
42 if components
is None or 'ECL' in components:
43 eclpacker = register_module(
'ECLPacker')
44 path.add_module(eclpacker)
47 if components
is None or 'TOP' in components:
48 toppacker = register_module(
'TOPPacker')
49 path.add_module(toppacker)
52 if components
is None or 'ARICH' in components:
53 arichpacker = register_module(
'ARICHPacker')
54 path.add_module(arichpacker)
57 if components
is None or 'KLM' in components:
58 klmpacker = register_module(
'KLMPacker')
59 path.add_module(klmpacker)
62 def add_unpackers(path, components=None, writeKLMDigitRaws=False):
64 This function adds the raw data unpacker modules to a path.
66 :param components: list of geometry components to include reconstruction for, or None for all components.
67 :param writeKLMDigitRaws: flag for creating the KLMDigitRaw object and storing it in the datastore. The KLMDQM
68 module needs it for filling some histograms.
72 check_components(components)
75 if "Gearbox" not in path:
76 path.add_module(
"Gearbox")
78 if "Geometry" not in path:
79 path.add_module(
"Geometry")
82 if components
is None or 'PXD' in components:
83 add_pxd_unpacker(path)
86 if components
is None or 'SVD' in components:
87 add_svd_unpacker(path)
90 if components
is None or 'CDC' in components:
91 cdcunpacker = register_module(
'CDCUnpacker')
92 cdcunpacker.param(
'enableStoreCDCRawHit',
True)
93 cdcunpacker.param(
'enablePrintOut',
False)
94 path.add_module(cdcunpacker)
97 if components
is None or 'ECL' in components:
98 eclunpacker = register_module(
'ECLUnpacker')
99 eclunpacker.param(
"storeTrigTime",
True)
100 path.add_module(eclunpacker)
103 if components
is None or 'TOP' in components:
104 topunpacker = register_module(
'TOPUnpacker')
105 path.add_module(topunpacker)
106 topconverter = register_module(
'TOPRawDigitConverter')
107 path.add_module(topconverter)
110 if components
is None or 'ARICH' in components:
111 arichunpacker = register_module(
'ARICHUnpacker')
112 path.add_module(arichunpacker)
115 if components
is None or 'KLM' in components:
116 klmunpacker = register_module(
'KLMUnpacker')
117 klmunpacker.param(
'WriteDigitRaws', writeKLMDigitRaws)
118 path.add_module(klmunpacker)
121 if components
is None or 'TRG' in components:
123 trggdlunpacker = register_module(
'TRGGDLUnpacker')
124 path.add_module(trggdlunpacker)
125 trggdlsummary = register_module(
'TRGGDLSummary')
126 path.add_module(trggdlsummary)
127 trgeclunpacker = register_module(
'TRGECLUnpacker')
128 path.add_module(trgeclunpacker)
129 trggrlunpacker = register_module(
'TRGGRLUnpacker')
130 path.add_module(trggrlunpacker)
131 trgtopunpacker = register_module(
'TRGTOPUnpacker')
132 path.add_module(trgtopunpacker)
134 nmod_tsf = [0, 1, 2, 3, 4, 5, 6]
135 for mod_tsf
in nmod_tsf:
136 path.add_module(
'TRGCDCTSFUnpacker', TSFMOD=mod_tsf)
138 nmod_t3d = [0, 1, 2, 3]
139 for mod_t3d
in nmod_t3d:
140 path.add_module(
'TRGCDCT3DUnpacker', T3DMOD=mod_t3d)
143 add_neuro_2d_unpackers(path)
146 def add_raw_output(path, filename='raw.root', additionalBranches=[]):
148 This function adds an output module for raw data to a path.
151 output = register_module(
'RootOutput')
152 output.param(
'outputFileName', filename)
153 branches = [
'RawPXDs',
'RawSVDs',
'RawCDCs',
'RawTOPs',
'RawARICHs',
'RawECLs',
'RawKLMs']
154 branches += additionalBranches
155 output.param(
'branchNames', branches)
156 path.add_module(output)
159 def add_raw_seqoutput(path, filename='raw.sroot', additionalObjects=[], fileNameIsPattern=False):
161 This function adds an seqroot output module for raw data to a path.
163 :param bool fileNameIsPattern: If true the filename needs to be a printf pattern with a placeholder for the
164 filenumber starting at 0, for example "raw-f%06d.root"
167 output = register_module(
'SeqRootOutput')
168 output.param(
'outputFileName', filename)
169 output.param(
'fileNameIsPattern', fileNameIsPattern)
170 objects = [
'EventMetaData',
'RawPXDs',
'RawSVDs',
'RawCDCs',
'RawTOPs',
'RawARICHs',
'RawECLs',
'RawKLMs']
171 objects += additionalObjects
172 output.param(
'saveObjs', objects)
173 path.add_module(output)