12from ROOT
import Belle2
13from ROOT
import TH2F, TFile, gDirectory
25 ''' A module to histogram width and amplitude of TOPDigits '''
28 ''' Open output file and book histograms '''
31 self.
tfile = TFile.Open(
'hitHeightAndWidth.root',
'recreate')
32 dirs = [gDirectory.mkdir(
'slot_' + f
'{slot:02d}')
for slot
in range(1, 17)]
39 for slot
in range(1, 17):
41 h = TH2F(
'WidthVSAmplitude',
'Slot ' + str(slot) +
42 ';amplitude [ADC counts]; width [ns]', 2000, 0, 2000, 200, 0, 10)
44 hh = [TH2F(
'WidthVSample_ch' + f
'{ch:03d}',
'Slot ' + str(slot) +
', channel ' + str(ch) +
45 ';sample; width [ns]', 256, 0, 256, 200, 0, 10)
for ch
in range(512)]
49 ''' Event processor: fill histograms '''
53 if digit.getHitQuality() == 0:
55 slotID = digit.getModuleID()
56 hwchan = digit.getChannel()
57 self.
hist[slotID - 1].Fill(digit.getPulseHeight(), digit.getPulseWidth())
58 self.
histSampling[slotID - 1][hwchan].Fill(digit.getModulo256Sample(), digit.getPulseWidth())
61 ''' Write histograms to file '''
68b2.set_log_level(b2.LogLevel.ERROR)
71b2.conditions.override_globaltags()
72b2.conditions.append_globaltag(
'online')
75main = b2.create_path()
79roinput = b2.register_module(
'RootInput')
80main.add_module(roinput)
83main.add_module(
'TOPGeometryParInitializer')
86unpack = b2.register_module(
'TOPUnpacker')
87main.add_module(unpack)
90converter = b2.register_module(
'TOPRawDigitConverter')
91main.add_module(converter)
95main.add_module(histogramModule)
98progress = b2.register_module(
'Progress')
99main.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.