7 from ROOT
import Belle2
8 from ROOT
import TH2F, TFile
22 ''' A module to histogram width and amplitude of calibration pulses'''
25 hist = [TH2F(
'WidthVSAmplitude_Slot_' + str(k + 1),
'With VS amplidute of the Digits in slot ' + str(k + 1),
26 2000, 0., 2000, 80, 0., 20)
for k
in range(16)]
29 histSampling = [[TH2F(
'WidthVSample_Slot_' + str(k + 1) +
'_Channel_' + str(j),
30 'With VS amplidute of the Digits in slot ' + str(k + 1) +
' channel ' + str(j),
36 20)
for k
in range(16)]
for j
in range(512)]
38 outname =
'calpulseCheck.root'
41 ''' Sets the output file name '''
47 ''' Event processor: fill histograms '''
51 quality = digit.getHitQuality()
52 slotID = digit.getModuleID()
53 hwchan = digit.getChannel()
54 self.
hist[slotID - 1].Fill(digit.getPulseHeight(), digit.getPulseWidth())
55 self.
histSampling[hwchan][slotID - 1].Fill(digit.getModulo256Sample(), digit.getPulseWidth())
58 ''' Write histograms to file '''
60 tfile = TFile(self.
outname,
'recreate')
62 self.
hist[k].GetXaxis().SetTitle(
"TOPDigit amplitude [ADC counts]")
63 self.
hist[k].GetYaxis().SetTitle(
"TOPDigit width [ns]")
67 self.
histSampling[j][k].GetXaxis().SetTitle(
"TOPDigit sample%256")
68 self.
histSampling[j][k].GetYaxis().SetTitle(
"TOPDigit width [ns]")
76 print(
'usage: basf2', argvs[0],
'runNumber outfileName')
82 files = glob.glob(
'/ghi/fs01/belle2/bdata/Data/sRaw/e0001/r0' + str(runnumber) +
'/sub00/*.sroot')
85 set_log_level(LogLevel.ERROR)
88 use_central_database(
'data_reprocessing_proc8')
94 roinput = register_module(
'SeqRootInput')
95 roinput.param(
'inputFileNames', files)
96 main.add_module(roinput)
108 main.add_module(
'TOPGeometryParInitializer')
111 unpack = register_module(
'TOPUnpacker')
112 main.add_module(unpack)
115 featureExtractor = register_module(
'TOPWaveformFeatureExtractor')
116 main.add_module(featureExtractor)
119 converter = register_module(
'TOPRawDigitConverter')
120 converter.param(
'useSampleTimeCalibration',
False)
121 converter.param(
'useChannelT0Calibration',
False)
122 converter.param(
'useModuleT0Calibration',
False)
123 converter.param(
'useCommonT0Calibration',
False)
125 converter.param(
'calpulseHeightMin', 450)
126 converter.param(
'calpulseHeightMax', 900)
127 converter.param(
'calpulseWidthMin', 2.0)
128 converter.param(
'calpulseWidthMax', 8.0)
129 converter.param(
'lookBackWindows', 29)
130 main.add_module(converter)
134 histogramModule.setOutputName(outfile)
135 main.add_module(histogramModule)
138 progress = register_module(
'Progress')
139 main.add_module(progress)
146 print(statistics(statistics.TERM))