24from ROOT
import Belle2
25from ROOT
import TFile, TH1F, TH2F
32 cal_channel = int(sys.argv[1])
35 time_cut_lo = float(sys.argv[2])
38 time_cut_hi = float(sys.argv[3])
39use_sample_times =
False
40use_asic_shifts =
False
42 use_sample_times =
True
43 use_asic_shifts =
True
46 b2.conditions.append_testing_payloads(tag)
48 b2.conditions.expert_settings(usable_globaltag_states={
'PUBLISHED',
'RUNNING',
'TESTING',
'VALIDATED',
'OPEN'})
49 b2.conditions.prepend_globaltag(tag)
53 ''' Makes histograms from TOPDigits '''
56 ''' initialize: open root file, book histograms '''
59 self.
tfile = TFile.Open(
'checkCalpulse.root',
'recreate')
61 self.
height_vs_width = TH2F(
"height_vs_width",
"Pulse height vs. width; pulse width [ns]; pulse height [ADC counts]",
62 100, 0, 10, 200, 0, 2000)
64 self.
height_vs_sample = TH2F(
"height_vs_sample",
"Pulse height vs. sample; sample number; pulse height [ADC counts]",
65 256, 0, 256, 200, 0, 2000)
67 self.
width_vs_sample = TH2F(
"width_vs_sample",
"Pulse width vs. sample; sample number; pulse width [ns]",
68 256, 0, 256, 100, 0, 10)
70 self.
time = TH1F(
'time',
'Time distibution; time [ns]', 400, -100, 300)
72 self.
asic_channels = TH1F(
'asic_channels',
'ASIC channel occupancy; ASIC channel number', 8, 0, 8)
75 ''' event processing: fill histograms '''
78 if digit.getHitQuality() == 0:
80 if cal_channel
is not None and digit.getASICChannel() != cal_channel:
82 if time_cut_lo
is not None and digit.getTime() < time_cut_lo:
84 if time_cut_hi
is not None and digit.getTime() > time_cut_hi:
86 self.
height_vs_width.Fill(digit.getPulseWidth(), digit.getPulseHeight())
87 self.
height_vs_sample.Fill(digit.getModulo256Sample(), digit.getPulseHeight())
88 if digit.getPulseHeight() > 100:
89 self.
width_vs_sample.Fill(digit.getModulo256Sample(), digit.getPulseWidth())
90 self.
time.Fill(digit.getTime())
94 ''' terminate: write histograms and close the file '''
97 h.SetTitle(
'Pulse width')
99 h.SetTitle(
'Pulse height')
104main = b2.create_path()
105main.add_module(
'RootInput')
106main.add_module(
'TOPGeometryParInitializer')
107main.add_module(
'TOPUnpacker')
108main.add_module(
'TOPRawDigitConverter',
109 useSampleTimeCalibration=use_sample_times,
110 useAsicShiftCalibration=use_asic_shifts,
111 useChannelT0Calibration=
False,
112 useModuleT0Calibration=
False,
113 useCommonT0Calibration=
False,
115 lookBackWindows=look_back_windows)
118main.add_module(
'Progress')
A (simplified) python wrapper for StoreArray.
height_vs_sample
histogram of pulse height vs.
asic_channels
histogram of asic channel occupancy
width_vs_sample
histogram of pulse width vs.
height_vs_width
histogram of pulse height vs.
time
histogram of time distribution