5 Test EventLevelClusteringInfo counting of out of time ECLCalDigits.
7 Creates 1 ECLCalDigit in each ECL detector region (FWD, Barrel, BWD).
9 The created digits cover all possible combinations of:
10 time above threshold for counting
11 time below threshold for counting
12 energy above threshold for counting
13 energy below threshold for counting
15 In order to be counted, both energy and time have to be above threshold
19 from ROOT
import Belle2
20 from unittest
import TestCase
23 from b2test_utils
import skip_test_if_light
29 expectOutOfTime = {
"FWD": 0,
"BRL": 0,
"BWD": 0}
34 Add combinations of ECLCalDigits above/below threshold to be counted as out of time
39 Prepare ECLCalDigits parameters
46 aboveEnergyThresh = [
True,
False]
47 aboveTimeThresh = [
True,
False]
48 thresholdNames = [
"aboveEnergythresh",
"aboveTimethresh"]
50 thresholdsPerRegion = [dict(zip(thresholdNames, thresholds))
51 for thresholds
in itertools.product(aboveEnergyThresh, aboveTimeThresh)]
53 fwdThresholds, brlThresholds, bwdThresholds = itertools.tee(thresholdsPerRegion, 3)
55 regions = [
"FWD",
"BRL",
"BWD"]
59 for thresholds
in itertools.product(fwdThresholds, brlThresholds, bwdThresholds)]
67 """ module initialize - register ECLCalDigit in datastore """
75 Add ECLCalDigits according to self.digitParams
80 cellId = {
"FWD": 1,
"BRL": 1153,
"BWD": 7777}
94 eclCalDigit.setCellId(cellId[region])
100 energy = digitParam[region][
"aboveEnergythresh"] * (self.
energyThresh + 1)
101 time = digitParam[region][
"aboveTimethresh"] * (self.
timeThresh + 1)
102 eclCalDigit.setEnergy(energy)
103 eclCalDigit.setTime(time)
106 newDigit = eclCalDigits.appendNew()
107 newDigit.__assign__(eclCalDigit)
110 expectOutOfTime[region] = int(digitParam[region][
"aboveEnergythresh"]
and digitParam[region][
"aboveTimethresh"])
111 B2DEBUG(35, region +
": expecting " + str(expectOutOfTime[region]))
112 B2DEBUG(39,
"region = " + region +
", time = " + str(time) +
", energy = " + str(energy))
120 module which checks the number of out of time digits in EventLevelClusteringInfo is as expected
129 tc = TestCase(
'__init__')
131 tc.assertEqual(eventLevelClusteringInfo.getNECLCalDigitsOutOfTimeFWD(), expectOutOfTime[
"FWD"])
132 tc.assertEqual(eventLevelClusteringInfo.getNECLCalDigitsOutOfTimeBarrel(), expectOutOfTime[
"BRL"])
133 tc.assertEqual(eventLevelClusteringInfo.getNECLCalDigitsOutOfTimeBWD(), expectOutOfTime[
"BWD"])
134 tc.assertEqual(eventLevelClusteringInfo.getNECLCalDigitsOutOfTime(),
135 expectOutOfTime[
"FWD"] + expectOutOfTime[
"BRL"] + expectOutOfTime[
"BWD"])
141 eventinfosetter = register_module(
'EventInfoSetter')
142 main.add_module(eventinfosetter)
144 gearbox = register_module(
'Gearbox')
145 main.add_module(gearbox)
147 geometry = register_module(
'Geometry', useDB=
False)
148 geometry.param(
'components', [
'ECL'])
149 main.add_module(geometry)
153 addECLCalDigits.logging.log_level = LogLevel.DEBUG
154 addECLCalDigits.logging.debug_level = 10
157 eventinfosetter.param({
'evtNumList': [len(addECLCalDigits.digitParams)],
'runList': [0]})
159 ECLDigitCalibrator = register_module(
'ECLDigitCalibrator')
160 main.add_module(ECLDigitCalibrator)
163 for param
in ECLDigitCalibrator.available_params():
164 if param.name ==
"backgroundEnergyCut":
165 addECLCalDigits.energyThresh = param.values
166 elif param.name ==
"backgroundTimingCut":
167 addECLCalDigits.timeThresh = param.values