13ROOT.gStyle.SetOptStat(0)
17 print(f
"Usage: {sys.argv[0]} <name of root ntuple>")
20f = ROOT.TFile.Open(sys.argv[1])
25calChannel =
"ch % 8 == 0"
26signalChannel =
"ch % 8 != 0"
29nTRDHist = ROOT.TH1D(
"nTRDHist",
"all channels;number of TOPRawDigits;waveforms", 1000, 0, 30)
30t.Draw(
"nTOPRawDigits>>nTRDHist")
31c.SaveAs(
"nTOPRawDigits_All.pdf")
33c.SaveAs(
"nTOPRawDigits_All_logy.pdf")
38t.Draw(
"nTOPRawDigits>>nTRDHist", calChannel)
39c.SaveAs(
"nTOPRawDigits_cal.pdf")
41c.SaveAs(
"nTOPRawDigits_cal_logy.pdf")
46t.Draw(
"nTOPRawDigits>>nTRDHist", signalChannel)
47c.SaveAs(
"nTOPRawDigits_sig.pdf")
49c.SaveAs(
"nTOPRawDigits_sig_logy.pdf")
53t.Draw(
"fePeakHt:fePeak1Ht", calChannel,
"hist")
54c.SaveAs(
"fePeakHt_vs_fePeak1Ht_cal.pdf")
57wd_adcHist = ROOT.TH2D(
"wd_adcHist",
"Width vs Pulse height;width;height", 130, 0, 130, 1100, 50, 1150)
58t.Draw(
"fePeakHt:fePeakWd>>wd_adcHist",
"",
"colz")
59c.SaveAs(
"fePeakWd_vs_fePeakHt.pdf")
63wd_adcHist.SetTitle(
"Width vs Pulse height in the calibration channel;width;height")
64t.Draw(
"fePeakHt:fePeakWd>>wd_adcHist", calChannel,
"colz")
65c.SaveAs(
"fePeakWd_vs_fePeakHt_cal.pdf")
69wd_adcHist.SetTitle(
"Width vs Pulse height in the signal channel;width;height")
70t.Draw(
"fePeakHt:fePeakWd>>wd_adcHist", signalChannel,
"colz")
71c.SaveAs(
"fePeakWd_vs_fePeakHt_sig.pdf")
75wd_tdcHist = ROOT.TH2D(
"wd_tdcHist",
"Width vs TDC;TDC;width", 256, 1, 257, 130, 0, 130)
76t.Draw(
"fePeakWd:fePeakTDC>>wd_tdcHist",
"",
"colz")
77c.SaveAs(
"fePeakWd_vs_TDC.pdf")
80ht_tdcHist = ROOT.TH2D(
"ht_tdcHist",
"Height vs TDC;TDC;height", 256, 1, 257, 1100, 50, 1150)
81t.Draw(
"fePeakHt:fePeakTDC>>ht_tdcHist",
"",
"colz")
82c.SaveAs(
"fePeakHt_vs_TDC.pdf")
86ch_tdcHist = ROOT.TH2D(
"ch_tdcHist",
"Channel vs TDC;TDC;channel number", 256, 1, 257, 512, 0, 512)
87t.Draw(
"ch:fePeakTDC>>ch_tdcHist",
"",
"colz")
89c.SaveAs(
"fePeakTDC_vs_ch.pdf")
92adcHist = ROOT.TH1D(
"adcHist",
"ADC counts;ADC", 1000, 0, 1000)
93adcHist.SetLineWidth(2)
94adcHist.SetLineColor(4)
95t.Draw(
"fePeakHt>>adcHist", calChannel)
96adcHist.SetTitle(
"ADC counts in the calibration channel")
97c.SaveAs(
"ADC_distribution_peak0_cal.pdf")
101adcHist.SetLineWidth(2)
102adcHist.SetLineColor(4)
103t.Draw(
"fePeakHt>>adcHist", signalChannel)
104adcHist.SetTitle(
"ADC counts in the signal channels")
105c.SaveAs(
"ADC_distribution_peak0_sig.pdf")
108tdcHist = ROOT.TH1D(
"tdcHist",
"tdcHist;TDC;waveforms", 256, 1, 257)
109tdcHist.SetLineWidth(2)
110tdcHist.SetLineColor(4)
111t.Draw(
"fePeakTDC>>tdcHist", calChannel)
112tdcHist.SetTitle(
"TDC distribution calibration channel")
113c.SaveAs(
"TDC_distribution_peak0_cal.pdf")
117tdcHist.SetLineWidth(2)
118tdcHist.SetLineColor(4)
119t.Draw(
"fePeakTDC>>tdcHist", signalChannel)
120tdcHist.SetTitle(
"TDC distribution signal channels")
121c.SaveAs(
"TDC_distribution_peak0_signal.pdf")
125tdcHist.SetLineWidth(2)
126tdcHist.SetLineColor(4)
127t.Draw(
"fePeak1TDC>>tdcHist", calChannel +
"&& nTOPRawDigits > 2")
128tdcHist.SetTitle(
"TDC distribution 2nd peak calibration channel")
130c.SaveAs(
"fePeak1TDC_calChannel.pdf")
135tdcHist.SetLineWidth(2)
136tdcHist.SetLineColor(4)
137t.Draw(
"fePeak1TDC>>tdcHist", signalChannel +
"&& nTOPRawDigits > 1")
138tdcHist.SetTitle(
"TDC distribution 2nd peak signal channel")
140c.SaveAs(
"fePeak1TDC_signalChannel.pdf")
149h0 = ROOT.TH1D(
"feh0",
"all Channels", 1000, 50, 1050)
150t.Draw(
"fePeakHt>>feh0")
151for iCanv
in range(1, 9):
153 h = ROOT.TH1D(f
"feh{int(iCanv)}", f
"channel {int(iCanv)};ADC;waveforms", 1000, 50, 1050)
154 t.Draw(f
"fePeakHt>>feh{int(iCanv)}", f
"ch % 8 == {int(iCanv - 1)}")
156c.SaveAs(
"fePeakHt_byChannel.pdf")
162h0 = ROOT.TH1D(
"fe_asic0",
"all ASICs", 1000, 50, 1050)
163t.Draw(
"fePeakHt>>fe_asic0")
164for iASIC, iCanv
in enumerate([1, 3, 7, 9]):
166 h = ROOT.TH1D(f
"fe_asic{int(iCanv)}", f
"ASIC {int(iASIC)};ADC;waveforms", 1000, 50, 1050)
167 t.Draw(f
"fePeakHt>>fe_asic{int(iCanv)}", f
"(ch/8) % 4 == {int(iASIC)}")
169c.SaveAs(
"fePeakHt_byASIC.pdf")
175h0 = ROOT.TH1D(
"fe_carrier0",
"all Carriers", 1000, 50, 1050)
176t.Draw(
"fePeakHt>>fe_carrier0")
177for iCarrier, iCanv
in enumerate([1, 3, 7, 9]):
179 h = ROOT.TH1D(f
"fe_carrier{int(iCanv)}", f
"Carrier {int(iCarrier)};ADC;waveforms", 1000, 50, 1050)
180 t.Draw(f
"fePeakHt>>fe_carrier{int(iCanv)}", f
"(ch/8/4) % 4 == {int(iCarrier)}")
182c.SaveAs(
"fePeakHt_byCarrier.pdf")
188h0 = ROOT.TH1D(
"fe_boardstack0",
"all board stacks", 1000, 50, 1050)
189t.Draw(
"fePeakHt>>fe_boardstack0")
190for iBS, iCanv
in enumerate([1, 3, 7, 9]):
192 h = ROOT.TH1D(f
"fe_boardstack{int(iCanv)}", f
"board stack {int(iBS)};ADC;waveforms", 1000, 50, 1050)
193 t.Draw(f
"fePeakHt>>fe_boardstack{int(iCanv)}", f
"(ch/8/4/4) % 4 == {int(iBS)}")
195c.SaveAs(
"fePeakHt_byBoardStack.pdf")
198total = t.GetEntries()
200print(f
"Fraction with width > 30: {1.0 * t.Draw('fePeakWd', 'fePeakWd>30', 'goff') / total:.3f}")
201print(f
"Fraction with peaks at window borders: (average occupancy / bin = {1.0 / 256:.3f})")
202print(f
"\ttdc < 2 : {1.0 * t.Draw('fePeakWd', 'fePeakTDC<2', 'goff') / total:.3f}")
203print(f
"\t63 < tdc < 66 : {1.0 * t.Draw('fePeakWd', 'fePeakTDC>63 && fePeakTDC<66', 'goff') / total:.3f}")
204print(f
"\t127 < tdc < 130: {1.0 * t.Draw('fePeakWd', 'fePeakTDC>127 && fePeakTDC<130', 'goff') / total:.3f}")
205print(f
"\t191 < tdc < 194: {1.0 * t.Draw('fePeakWd', 'fePeakTDC>191 && fePeakTDC<194', 'goff') / total:.3f}")
206print(f
"\ttdc > 255 : {1.0 * t.Draw('fePeakWd', 'fePeakTDC>255', 'goff') / total:.3f}")