14def add_svd_reconstruction(path, isROIsimulation=False, createRecoDigits=False, applyMasking=False):
16 Adds the SVD reconstruction to the path.
18 Reconstruction starts with :ref:`SVDShaperDigits<svdshapers>`
19 and :ref:`SVDEventInfo<svdeventinfo>`
and provides
20 :ref:`SVDClusters<svdclusters>`
and :ref:`SVDSpacePoints<svdsps>`.
22 @param path: add the modules to this basf2 path.
23 @param isROIsimulation: SVD reconstruction can be run during simulation\
24 in order to simulate the PXD Data Reduction
with ROI finding.
25 @param createRecoDigits:
if True, :ref:`SVDRecoDigits<svdrecos>` are created.
26 @param applyMasking:
if True, hot strips found
in :ref:`SVDHotStripsCalibration<svdhotstrips>` are masked.
31 nameTrackingInfoModule =
"RegisterEventLevelTrackingInfo__ROI"
32 nameEventTrackingInfo =
"EventLevelTrackingInfo__ROI"
33 nameSVDTrackingEventLevelMdstInfoFiller =
"SVDTrackingEventLevelMdstInfoFiller__ROI"
35 nameTrackingInfoModule =
"RegisterEventLevelTrackingInfo"
36 nameEventTrackingInfo =
"EventLevelTrackingInfo"
37 nameSVDTrackingEventLevelMdstInfoFiller =
"SVDTrackingEventLevelMdstInfoFiller"
39 if nameTrackingInfoModule
not in path:
40 registerEventlevelTrackingInfo = b2.register_module(
'RegisterEventLevelTrackingInfo')
41 registerEventlevelTrackingInfo.set_name(nameTrackingInfoModule)
42 registerEventlevelTrackingInfo.param(
'EventLevelTrackingInfoName', nameEventTrackingInfo)
43 path.add_module(registerEventlevelTrackingInfo)
46 clusterizerName =
'__ROISVDClusterizer'
47 timeGroupComposerName =
'__ROISVDTimeGrouping'
48 recocreatorName =
'__ROISVDRecoDigitCreator'
49 dataFormatName =
'__ROISVDDataFormat'
51 clustersName =
'__ROIsvdClusters'
53 missingAPVsClusterCreatorName =
'__ROISVDMissingAPVsClusterCreator'
55 clusterizerName =
'SVDClusterizer'
56 timeGroupComposerName =
'SVDTimeGrouping'
57 recocreatorName =
'SVDRecoDigitCreator'
58 dataFormatName =
'SVDDataFormat'
62 missingAPVsClusterCreatorName =
'SVDMissingAPVsClusterCreator'
67 shaperDigitsName =
'__ROISVDShaperDigitsUnmasked'
68 maskingName =
'__ROISVDStripMasking'
70 shaperDigitsName =
'SVDShaperDigitsUnmasked'
71 maskingName =
'SVDStripMasking'
73 if maskingName
not in [e.name()
for e
in path.modules()]:
74 masking = b2.register_module(
'SVDStripMasking')
75 masking.set_name(maskingName)
76 masking.param(
'ShaperDigitsUnmasked', shaperDigitsName)
77 path.add_module(masking)
80 if dataFormatName
not in [e.name()
for e
in path.modules()]:
81 dataFormat = b2.register_module(
'SVDDataFormatCheck')
82 dataFormat.param(
'ShaperDigits', shaperDigitsName)
84 if clusterizerName
not in [e.name()
for e
in path.modules()]:
85 clusterizer = b2.register_module(
'SVDClusterizer')
86 clusterizer.set_name(clusterizerName)
87 clusterizer.param(
'ShaperDigits', shaperDigitsName)
88 clusterizer.param(
'Clusters', clustersName)
89 path.add_module(clusterizer)
91 if missingAPVsClusterCreatorName
not in [e.name()
for e
in path.modules()]:
92 missingAPVCreator = b2.register_module(
'SVDMissingAPVsClusterCreator')
93 missingAPVCreator.set_name(missingAPVsClusterCreatorName)
94 path.add_module(missingAPVCreator)
96 if nameSVDTrackingEventLevelMdstInfoFiller
not in path:
97 svdTrackingEventLevelMdstInfoFiller = b2.register_module(
'SVDTrackingEventLevelMdstInfoFiller')
98 svdTrackingEventLevelMdstInfoFiller.set_name(nameSVDTrackingEventLevelMdstInfoFiller)
99 svdTrackingEventLevelMdstInfoFiller.param(
'EventLevelTrackingInfoName', nameEventTrackingInfo)
100 svdTrackingEventLevelMdstInfoFiller.param(
'svdClustersName', clustersName)
101 path.add_module(svdTrackingEventLevelMdstInfoFiller)
103 if timeGroupComposerName
not in [e.name()
for e
in path.modules()]:
104 svdTimeGrouping = b2.register_module(
'SVDTimeGrouping')
105 svdTimeGrouping.set_name(timeGroupComposerName)
106 svdTimeGrouping.param(
'SVDClusters', clustersName)
107 path.add_module(svdTimeGrouping)
110 add_svd_SPcreation(path, isROIsimulation)
112 if createRecoDigits
and not isROIsimulation:
115 add_svd_create_recodigits(path, recocreatorName, shaperDigitsName)
118def add_svd_create_recodigits(path, recocreatorName="SVDRecoDigitCreator", shaperDigitsName=""):
120 Adds the strip reconstruction to the path.
122 Produce :ref:`SVDRecoDigits<svdrecos>` from :ref:`SVDShaperDigits<svdshapers>`.
124 @param path: add the modules to this basf2 path.
125 @param recocreatorName: name of the module.
126 @param shaperDigitsName: name of the SVDShaperDigits StoreArray.
129 if recocreatorName
not in [e.name()
for e
in path.modules()]:
130 recoDigitCreator = b2.register_module(
'SVDRecoDigitCreator')
131 recoDigitCreator.param(
'ShaperDigits', shaperDigitsName)
132 recoDigitCreator.param(
'timeAlgorithm6Samples',
"CoG3")
133 recoDigitCreator.param(
'timeAlgorithm3Samples',
"CoG3")
134 recoDigitCreator.param(
'chargeAlgorithm6Samples',
"MaxSample")
135 recoDigitCreator.param(
'chargeAlgorithm3Samples',
"MaxSample")
136 recoDigitCreator.param(
'useDB',
False)
137 path.add_module(recoDigitCreator)
140def add_rel5_svd_reconstruction(path, isROIsimulation=False, applyMasking=False):
142 Adds the old (up to release-05) SVD recontruction to the path.
144 Reconstruction starts with :ref:`SVDShaperDigits<svdshapers>`
and
145 :ref:`SVDEventInfo<svdeventinfo>`
and provides :ref:`SVDClusters<svdclusters>`
146 and :ref:`SVDSpacePoints<svdsps>`.
148 @param path: add the modules to this basf2 path.
149 @param isROIsimulation: SVD reconstruction can be run during simulation\
150 in order to simulate the PXD Data Reduction
with ROI finding.
151 @param applyMasking:
if True, hot strips found
in :ref:`SVDHotStripsCalibration<svdhotstrips>` are masked.
156 nameTrackingInfoModule =
"RegisterEventLevelTrackingInfo__ROI"
157 nameEventTrackingInfo =
"EventLevelTrackingInfo__ROI"
158 nameSVDTrackingEventLevelMdstInfoFiller =
"SVDTrackingEventLevelMdstInfoFiller__ROI"
160 nameTrackingInfoModule =
"RegisterEventLevelTrackingInfo"
161 nameEventTrackingInfo =
"EventLevelTrackingInfo"
162 nameSVDTrackingEventLevelMdstInfoFiller =
"SVDTrackingEventLevelMdstInfoFiller"
164 if nameTrackingInfoModule
not in path:
165 registerEventlevelTrackingInfo = b2.register_module(
'RegisterEventLevelTrackingInfo')
166 registerEventlevelTrackingInfo.set_name(nameTrackingInfoModule)
167 registerEventlevelTrackingInfo.param(
'EventLevelTrackingInfoName', nameEventTrackingInfo)
168 path.add_module(registerEventlevelTrackingInfo)
171 fitterName =
'__ROISVDCoGTimeEstimator'
172 clusterizerName =
'__ROISVDSimpleClusterizer'
173 timeGroupComposerName =
'__ROISVDTimeGrouping'
174 dataFormatName =
'__ROISVDDataFormat'
175 clusterName =
'__ROIsvdClusters'
176 recoDigitsName =
'__ROIsvdRecoDigits'
177 shaperDigitsName =
""
178 missingAPVsClusterCreatorName =
'__ROISVDMissingAPVsClusterCreator'
180 fitterName =
'SVDCoGTimeEstimator'
181 clusterizerName =
'SVDSimpleClusterizer'
182 timeGroupComposerName =
'SVDTimeGrouping'
183 dataFormatName =
'SVDDataFormat'
186 shaperDigitsName =
""
187 missingAPVsClusterCreatorName =
'SVDMissingAPVsClusterCreator'
192 shaperDigitsName =
'__ROISVDShaperDigitsUnmasked'
193 maskingName =
'__ROISVDStripMasking'
195 shaperDigitsName =
'SVDShaperDigitsUnmasked'
196 maskingName =
'SVDStripMasking'
198 if maskingName
not in [e.name()
for e
in path.modules()]:
199 masking = b2.register_module(
'SVDStripMasking')
200 masking.set_name(maskingName)
201 masking.param(
'ShaperDigitsUnmasked', shaperDigitsName)
202 path.add_module(masking)
204 if dataFormatName
not in [e.name()
for e
in path.modules()]:
205 dataFormat = b2.register_module(
'SVDDataFormatCheck')
206 dataFormat.param(
'ShaperDigits', shaperDigitsName)
208 if fitterName
not in [e.name()
for e
in path.modules()]:
209 fitter = b2.register_module(
'SVDCoGTimeEstimator')
210 fitter.set_name(fitterName)
211 fitter.param(
'RecoDigits', recoDigitsName)
212 path.add_module(fitter)
214 if clusterizerName
not in [e.name()
for e
in path.modules()]:
215 clusterizer = b2.register_module(
'SVDSimpleClusterizer')
216 clusterizer.set_name(clusterizerName)
217 clusterizer.param(
'RecoDigits', recoDigitsName)
218 clusterizer.param(
'Clusters', clusterName)
219 clusterizer.param(
'useDB',
True)
220 path.add_module(clusterizer)
222 if missingAPVsClusterCreatorName
not in [e.name()
for e
in path.modules()]:
223 missingAPVCreator = b2.register_module(
'SVDMissingAPVsClusterCreator')
224 missingAPVCreator.set_name(missingAPVsClusterCreatorName)
225 path.add_module(missingAPVCreator)
227 if nameSVDTrackingEventLevelMdstInfoFiller
not in path:
228 svdTrackingEventLevelMdstInfoFiller = b2.register_module(
'SVDTrackingEventLevelMdstInfoFiller')
229 svdTrackingEventLevelMdstInfoFiller.set_name(nameSVDTrackingEventLevelMdstInfoFiller)
230 svdTrackingEventLevelMdstInfoFiller.param(
'EventLevelTrackingInfoName', nameEventTrackingInfo)
231 svdTrackingEventLevelMdstInfoFiller.param(
'svdClustersName', clusterName)
232 path.add_module(svdTrackingEventLevelMdstInfoFiller)
234 if timeGroupComposerName
not in [e.name()
for e
in path.modules()]:
235 svdTimeGrouping = b2.register_module(
'SVDTimeGrouping')
236 svdTimeGrouping.set_name(timeGroupComposerName)
237 svdTimeGrouping.param(
'SVDClusters', clusterName)
238 path.add_module(svdTimeGrouping)
241 add_svd_SPcreation(path, isROIsimulation)
244def add_svd_simulation(path, useConfigFromDB=False, daqMode=2, relativeShift=9):
246 Adds the SVD simulation to the path.
248 Simulation ends with :ref:`SVDShaperDigits<svdshapers>`
and :ref:`SVDEventInfo<svdeventinfo>`.
250 @param path: add the modules to this basf2 path.
251 @param useConfigFromDB:
if True, read the SVD configuration
from :ref:`SVDGlobalConfigParameters<svdglobalconfig>`.
252 @param daqMode: = 2
for the default 6-sample mode, = 1
for the 3-sample mode, = 3
for the 3-mixed-6 sample mode.
253 @param relativeShift: relative time shift between the 3-sample
and the 6-sample mode
in units of 1/4 of APV clock.\
254 If ``useConfigFromDB``
is True, the value of this parameter
is overwritten.
257 svdevtinfoset = b2.register_module("SVDEventInfoSetter")
258 svdevtinfoset.param(
"useDB", useConfigFromDB)
259 path.add_module(svdevtinfoset)
261 digitizer = b2.register_module(
'SVDDigitizer')
262 path.add_module(digitizer)
264 if not useConfigFromDB:
265 if daqMode != 2
and daqMode != 1
and daqMode != 3:
266 message =
'OOPS the acquisition mode that you want to simulate is not available.\n' \
267 'Please choose among daqMode = 2 (6-sample) and daqMode = 1 (3-sample).'
271 svdevtinfoset.param(
"daqMode", daqMode)
272 svdevtinfoset.param(
"relativeShift", relativeShift)
275def add_svd_unpacker(path):
277 Adds the SVD Unpacker to the path.
279 The unpacker produces :ref:`SVDShaperDigits<svdshapers>` and :ref:`SVDEventInfo<svdeventinfo>`.
281 @param path: add the modules to this basf2 path.
284 unpacker = b2.register_module('SVDUnpacker')
285 path.add_module(unpacker)
288def add_svd_unpacker_simulate3sampleDAQ(path, latencyShift=-1, relativeShift=-1):
290 Adds the SVD Unpacker to the path, emulating the 3-sample mode from the 6-sample mode.
292 @param path: add the modules to this basf2 path.
293 @param latencyShift: relative time shift between the 3-sample
and the 6-sample mode,
in APV clocks.\
294 0 <= latencyShift <=3
295 @param relativeShift: relative time shift between the 3-sample
and the 6-sample mode,
in units of 1/4 of APV clock.\
296 0 <= relativeShift <=12
298 .. warning:: at least one between ``relativeShift``
and ``latencyShift`` should be set (different
from -1).
301 if relativeShift != -1
and latencyShift != -1:
302 b2.B2FATAL(
"OOPS please choose only one between relativeShift and latencyShift. Exiting now.")
304 unpacker = b2.register_module(
'SVDUnpacker')
305 unpacker.param(
"SVDEventInfo",
"SVDEventInfoOriginal")
306 unpacker.param(
"svdShaperDigitListName",
"SVDShaperDigitsOriginal")
307 path.add_module(unpacker)
310 emulator = b2.register_module(
"SVD3SamplesEmulator")
311 emulator.param(
"SVDEventInfo",
"SVDEventInfoOriginal")
312 emulator.param(
"SVDShaperDigits",
"SVDShaperDigitsOriginal")
313 if latencyShift == -1:
314 emulator.param(
"chooseStartingSample",
False)
316 emulator.param(
"chooseStartingSample",
True)
317 if latencyShift < 0
or latencyShift > 3:
318 b2.B2FATAL(
"the latencyShift must be an integer >=0 and <= 3")
320 emulator.param(
"StartingSample", latencyShift)
322 if relativeShift == -1:
323 emulator.param(
"chooseRelativeShift",
False)
325 emulator.param(
"chooseRelativeShift",
True)
326 if relativeShift < 0
or relativeShift > 12:
327 b2.B2FATAL(
"the relativeShift must be an integer >=0 and <= 12")
329 emulator.param(
"relativeShift", relativeShift)
331 emulator.param(
"outputSVDEventInfo",
"SVDEventInfo")
332 emulator.param(
"outputSVDShaperDigits",
"SVDShaperDigits3SampleAll")
333 path.add_module(emulator)
336 zsonline = b2.register_module(
"SVDZeroSuppressionEmulator")
337 zsonline.param(
"ShaperDigits",
"SVDShaperDigits3SampleAll")
338 zsonline.param(
"ShaperDigitsIN",
"SVDShaperDigits")
339 path.add_module(zsonline)
342def add_svd_packer(path):
344 Adds the SVD Packer to the path.
346 @param path: add the modules to this basf2 path.
349 packer = b2.register_module('SVDPacker')
350 path.add_module(packer)
353def add_svd_SPcreation(path, isROIsimulation=False):
355 Adds the SVD SpacePoint Creator to the path.
357 @param path: add the modules to this basf2 path.
358 @param isROIsimulation: SVD reconstruction can be run during simulation\
359 in order to simulate the PXD Data Reduction
with ROI finding.
364 nameTrackingInfoModule =
"RegisterEventLevelTrackingInfo__ROI"
365 nameEventTrackingInfo =
"EventLevelTrackingInfo__ROI"
367 nameTrackingInfoModule =
"RegisterEventLevelTrackingInfo"
368 nameEventTrackingInfo =
"EventLevelTrackingInfo"
370 if nameTrackingInfoModule
not in path:
371 registerEventlevelTrackingInfo = b2.register_module(
'RegisterEventLevelTrackingInfo')
372 registerEventlevelTrackingInfo.set_name(nameTrackingInfoModule)
373 registerEventlevelTrackingInfo.param(
'EventLevelTrackingInfoName', nameEventTrackingInfo)
374 path.add_module(registerEventlevelTrackingInfo)
377 svdSPCreatorName =
'__ROISVDSpacePointCreator'
378 svd_clusters =
'__ROIsvdClusters'
379 nameSPs =
'SVDSpacePoints__ROI'
381 svdSPCreatorName =
'SVDSpacePointCreator'
383 nameSPs =
'SVDSpacePoints'
385 if svdSPCreatorName
not in [e.name()
for e
in path.modules()]:
386 spCreatorSVD = b2.register_module(
'SVDSpacePointCreator')
387 spCreatorSVD.set_name(svdSPCreatorName)
388 spCreatorSVD.param(
'NameOfInstance',
'SVDSpacePoints')
389 spCreatorSVD.param(
'SpacePoints', nameSPs)
390 spCreatorSVD.param(
'SVDClusters', svd_clusters)
391 spCreatorSVD.param(
'EventLevelTrackingInfoName', nameEventTrackingInfo)
392 path.add_module(spCreatorSVD)