19from ROOT
import Belle2
20from unittest
import TestCase
21from ROOT
import gRandom
25logLevel = b2.LogLevel.INFO
28eclDigitsDatastoreName =
'ECLDigits'
29unpackerOutputDatastoreName =
'someECLUnpackerDatastoreName'
34 Adds ECLDigits with very large/small time/amplitude values
40 amps = [0, 1, 100000, 262015]
41 times = [-2048, -100, 0, 100, 2047]
42 qualitys = [0, 1, 2, 3]
43 chis = [0, 1, 254, 511]
44 paramNames = ["amp",
"time",
"quality",
"chi"]
46 self.
digitParams = [dict(zip(paramNames, params))
for params
in itertools.product(amps, times, qualitys, chis)]
55 usedCellIds = list(map(
lambda eclDigit: eclDigit.getCellId(), eclDigitsFromSimulation))
60 if (digitParam[
'quality'] != 2)
and (digitParam[
'chi'] != 0):
64 if (digitParam[
'quality'] == 2)
and (digitParam[
'time'] != 0):
68 cellId = int(gRandom.Uniform(1, 8736))
69 while cellId
in usedCellIds:
70 cellId = int(gRandom.Uniform(1, 8736))
72 usedCellIds.append(cellId)
77 eclDigit.setCellId(cellId)
78 eclDigit.setAmp(digitParam[
'amp'])
79 eclDigit.setTimeFit(digitParam[
'time'])
80 eclDigit.setQuality(digitParam[
'quality'])
81 eclDigit.setChi(digitParam[
'chi'])
84 newDigit = eclDigitsFromSimulation.appendNew()
85 newDigit.__assign__(eclDigit)
90 module which checks if two collections of ECLDigits are equal
94 """ use a some information to sort the ECLDigits list
95 Returns a python-list containing the ECLDigits
98 py_list = [x
for x
in unsortedPyStoreArray]
116 if not len(eclDigitsFromSimulation_unsorted) == len(eclDigitsPackedUnpacked_unsorted):
117 b2.B2FATAL(
"Different number of ECLDigits from simulation and after packing+unpacking")
119 eclDigitsPackedUnpacked = self.
sortECLDigits(eclDigitsPackedUnpacked_unsorted)
120 eclDigitsFromSimulation = self.
sortECLDigits(eclDigitsFromSimulation_unsorted)
122 tc = TestCase(
'__init__')
125 for idx
in range(len(eclDigitsPackedUnpacked)):
126 digit = eclDigitsFromSimulation[idx]
127 digitPackedUnpacked = eclDigitsPackedUnpacked[idx]
129 b2.B2DEBUG(5,
'MC digit: cellid = ' +
130 str(digit.getCellId()) +
132 str(digit.getAmp()) +
134 str(digit.getTimeFit()) +
136 str(digit.getQuality()) +
138 str(digit.getChi()) +
139 '\nUnpackedDigit: cellid = ' +
140 str(digitPackedUnpacked.getCellId()) +
142 str(digitPackedUnpacked.getAmp()) +
144 str(digitPackedUnpacked.getTimeFit()) +
146 str(digitPackedUnpacked.getQuality()) +
148 str(digitPackedUnpacked.getChi()))
150 tc.assertEqual(digit.getCellId(), digitPackedUnpacked.getCellId())
151 tc.assertEqual(digit.getAmp(), digitPackedUnpacked.getAmp())
152 tc.assertEqual(digit.getTimeFit(), digitPackedUnpacked.getTimeFit())
153 tc.assertEqual(digit.getQuality(), digitPackedUnpacked.getQuality())
154 tc.assertEqual(digit.getChi(), digitPackedUnpacked.getChi())
157main = b2.create_path()
159eventinfosetter = b2.register_module(
'EventInfoSetter')
160eventinfosetter.param({
'evtNumList': [10]})
161main.add_module(eventinfosetter)
164particlegun = b2.register_module(
'ParticleGun')
165particlegun.param(
'pdgCodes', [13, -13])
166particlegun.param(
'nTracks', 10)
167main.add_module(particlegun)
171b2.set_module_parameters(main, type=
"Geometry", useDB=
False, components=[
"ECL"])
177ecl_packer = b2.register_module(
'ECLPacker')
178main.add_module(ecl_packer)
181ecl_unpacker = b2.register_module(
'ECLUnpacker')
183ecl_unpacker.param(
'ECLDigitsName', unpackerOutputDatastoreName)
184main.add_module(ecl_unpacker)
188main.add_module(eclPackUnpackerChecker, logLevel=logLevel)
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
A (simplified) python wrapper for StoreArray.
def sortECLDigits(self, unsortedPyStoreArray)
digitParams
ecl digit parameters
def add_simulation(path, components=None, bkgfiles=None, bkgOverlay=True, forceSetPXDDataReduction=False, usePXDDataReduction=True, cleanupPXDDataReduction=True, generate_2nd_cdc_hits=False, simulateT0jitter=True, isCosmics=False, FilterEvents=False, usePXDGatedMode=False, skipExperimentCheckForBG=False, save_slow_pions_in_mc=False)