13 from ROOT
import Belle2
14 from ROOT
import TH2F, TFile, gDirectory
26 ''' A module to histogram width and amplitude of TOPDigits '''
29 ''' Open output file and book histograms '''
32 self.
tfiletfile = TFile.Open(
'hitHeightAndWidth.root',
'recreate')
33 dirs = [gDirectory.mkdir(
'slot_' +
'{:0=2d}'.format(slot))
for slot
in range(1, 17)]
40 for slot
in range(1, 17):
42 h = TH2F(
'WidthVSAmplitude',
'Slot ' + str(slot) +
43 ';amplitude [ADC counts]; width [ns]', 2000, 0, 2000, 200, 0, 10)
44 self.
histhist.append(h)
45 hh = [TH2F(
'WidthVSample_ch' +
'{:0=3d}'.format(ch),
'Slot ' + str(slot) +
', channel ' + str(ch) +
46 ';sample; width [ns]', 256, 0, 256, 200, 0, 10)
for ch
in range(512)]
50 ''' Event processor: fill histograms '''
54 if digit.getHitQuality() == 0:
56 slotID = digit.getModuleID()
57 hwchan = digit.getChannel()
58 self.
histhist[slotID - 1].Fill(digit.getPulseHeight(), digit.getPulseWidth())
59 self.
histSamplinghistSampling[slotID - 1][hwchan].Fill(digit.getModulo256Sample(), digit.getPulseWidth())
62 ''' Write histograms to file '''
64 self.
tfiletfile.Write()
65 self.
tfiletfile.Close()
69 b2.set_log_level(b2.LogLevel.ERROR)
72 b2.conditions.override_globaltags()
73 b2.conditions.append_globaltag(
'online')
76 main = b2.create_path()
80 roinput = b2.register_module(
'RootInput')
81 main.add_module(roinput)
84 main.add_module(
'TOPGeometryParInitializer')
87 unpack = b2.register_module(
'TOPUnpacker')
88 main.add_module(unpack)
91 converter = b2.register_module(
'TOPRawDigitConverter')
92 main.add_module(converter)
96 main.add_module(histogramModule)
99 progress = b2.register_module(
'Progress')
100 main.add_module(progress)
A (simplified) python wrapper for StoreArray.
hist
Width VS amplitude plot in each slot.
histSampling
Width as function of the sample number in each channel.