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