15 from ROOT
import Belle2
16 from ROOT
import TH2F, TFile
29 ''' A module to histogram width and amplitude of calibration pulses'''
32 hist = [TH2F(
'WidthVSAmplitude_Slot_' + str(k + 1),
'With VS amplidute of the Digits in slot ' + str(k + 1),
33 2000, 0., 2000, 80, 0., 20)
for k
in range(16)]
36 histSampling = [[TH2F(
'WidthVSample_Slot_' + str(k + 1) +
'_Channel_' + str(j),
37 'With VS amplidute of the Digits in slot ' + str(k + 1) +
' channel ' + str(j),
43 20)
for k
in range(16)]
for j
in range(512)]
45 outname =
'calpulseCheck.root'
48 ''' Sets the output file name '''
54 ''' Event processor: fill histograms '''
59 slotID = digit.getModuleID()
60 hwchan = digit.getChannel()
61 self.
histhist[slotID - 1].Fill(digit.getPulseHeight(), digit.getPulseWidth())
62 self.
histSamplinghistSampling[hwchan][slotID - 1].Fill(digit.getModulo256Sample(), digit.getPulseWidth())
65 ''' Write histograms to file '''
69 self.
histhist[k].GetXaxis().SetTitle(
"TOPDigit amplitude [ADC counts]")
70 self.
histhist[k].GetYaxis().SetTitle(
"TOPDigit width [ns]")
71 self.
histhist[k].Write()
74 self.
histSamplinghistSampling[j][k].GetXaxis().SetTitle(
"TOPDigit sample%256")
75 self.
histSamplinghistSampling[j][k].GetYaxis().SetTitle(
"TOPDigit width [ns]")
83 print(
'usage: basf2', argvs[0],
'runNumber outfileName')
89 files = glob.glob(
'/ghi/fs01/belle2/bdata/Data/sRaw/e0001/r0' + str(runnumber) +
'/sub00/*.sroot')
92 b2.set_log_level(b2.LogLevel.ERROR)
95 b2.use_central_database(
'data_reprocessing_proc8')
98 main = b2.create_path()
101 roinput = b2.register_module(
'SeqRootInput')
102 roinput.param(
'inputFileNames', files)
103 main.add_module(roinput)
115 main.add_module(
'TOPGeometryParInitializer')
118 unpack = b2.register_module(
'TOPUnpacker')
119 main.add_module(unpack)
122 featureExtractor = b2.register_module(
'TOPWaveformFeatureExtractor')
123 main.add_module(featureExtractor)
126 converter = b2.register_module(
'TOPRawDigitConverter')
127 converter.param(
'useSampleTimeCalibration',
False)
128 converter.param(
'useChannelT0Calibration',
False)
129 converter.param(
'useModuleT0Calibration',
False)
130 converter.param(
'useCommonT0Calibration',
False)
132 converter.param(
'calpulseHeightMin', 450)
133 converter.param(
'calpulseHeightMax', 900)
134 converter.param(
'calpulseWidthMin', 2.0)
135 converter.param(
'calpulseWidthMax', 8.0)
136 converter.param(
'lookBackWindows', 29)
137 main.add_module(converter)
141 histogramModule.setOutputName(outfile)
142 main.add_module(histogramModule)
145 progress = b2.register_module(
'Progress')
146 main.add_module(progress)
153 print(b2.statistics(b2.statistics.TERM))
a (simplified) python wrapper for StoreArray.
list histSampling
Width as function of the sample number in each channel.
def setOutputName(self, outputname)
string outname
Default output name.
list hist
Width VS amplitude plot in each slot.