19 from ROOT
import gROOT
21 from ROOT
import TArrow, TCanvas, TFile, TH1F, TLatex, TLegend, TLine, gPad, gStyle
24 def plotInterimFEDataNtupleSummary(root_output, FitWidth=2, IsOfflineFEDisabled=False):
29 pdf_output = root_output[0:root_output.rfind(
".root")] +
"_Summary.pdf"
31 print(root_output +
" --> " + pdf_output)
33 gStyle.SetFrameFillStyle(0)
34 gStyle.SetFillStyle(0)
37 gStyle.SetStatStyle(0)
38 gStyle.SetOptStat(112210)
39 gStyle.SetOptFit(1110)
40 canvas = TCanvas(
"cv1",
"cv1", 800, 800)
41 canvas.SetFillStyle(0)
42 canvas.Print((pdf_output +
"["))
44 f = TFile(root_output)
46 nEntries = tr.GetEntries()
50 latex.SetTextSize(0.03)
51 latex.SetTextAlign(33)
53 print(
"making summary plot for all the slots...")
57 gPad.SetFrameFillStyle(0)
59 tr.Draw(
"eventNum[0]>>hNHit",
"(nHit>0)*(Sum$(offlineFlag<=0))")
60 tr.Draw(
"eventNum[0]>>hHeader",
"(nHit>0)*(nFEHeader)")
61 tr.Draw(
"eventNum[0]>>hEmptyHeader",
"(nHit>0)*(nEmptyFEHeader)")
62 tr.Draw(
"eventNum[0]>>hWfm",
"(nHit>0)*(nWaveform)")
63 tr.Draw(
"eventNum[0]>>hError",
"(nHit>0)*(errorFlag>0)")
64 hNHit = gROOT.FindObject(
"hNHit")
65 if hNHit.Integral() < 1:
66 print(
"ERROR : no hits were found.")
68 hHeader = gROOT.FindObject(
"hHeader")
69 hEmptyHeader = gROOT.FindObject(
"hEmptyHeader")
70 hWfm = gROOT.FindObject(
"hWfm")
71 hError = gROOT.FindObject(
"hError")
72 BinWidth = hNHit.GetXaxis().GetBinUpEdge(1) - hNHit.GetXaxis().GetBinLowEdge(1)
73 hNHit.Scale(1. / BinWidth)
74 hHeader.Scale(1. / BinWidth)
75 hEmptyHeader.Scale(1. / BinWidth)
76 hWfm.Scale(1. / BinWidth)
77 hError.Scale(1. / BinWidth)
79 hNHit.SetTitle(root_output +
" - # hits/headers/waveforms")
81 hHeader.SetLineColor(2)
82 hEmptyHeader.SetLineColor(3)
84 hError.SetLineColor(6)
85 legend = TLegend(0.6, 0.175, 0.875, 0.4)
86 legend.SetFillStyle(0)
87 legend.SetBorderSize(0)
88 legend.AddEntry(hNHit,
"nHit (no offline FE)")
89 legend.AddEntry(hHeader,
"# of FE headers")
90 legend.AddEntry(hEmptyHeader,
"# of empty FE headers")
91 legend.AddEntry(hWfm,
"# of waveforms")
92 hNHit.GetXaxis().SetTitle(
"event number")
93 ytitle =
"average # every " + str(BinWidth) +
" events"
94 hNHit.GetYaxis().SetTitle(ytitle)
95 hNHit.GetYaxis().SetRangeUser(0, 1.05 * hHeader.GetBinContent(hHeader.GetMaximumBin()))
98 hHeader.Draw(
"samehist")
99 hEmptyHeader.Draw(
"samehist")
100 hWfm.Draw(
"samehist")
102 if hWfm.Integral() > 0:
103 evtFracNoWfm = 1 - hWfm.Integral() / hNHit.Integral()
104 print(
"fraction of events without waveform : " + str(int(1000 * evtFracNoWfm) / 10) +
"%")
105 latex.DrawLatex(0.875, 0.175,
"fraction of no-waveform events : " + str(int(1000 * evtFracNoWfm) / 10) +
"%")
109 gPad.SetFrameFillStyle(0)
111 if hError.GetEntries() > 0:
112 hError.SetStats(
False)
113 hError.SetTitle(root_output +
" - error rate")
114 hError.GetXaxis().SetTitle(
"event number")
115 ytitle =
"fraction of events with any errors for every" + str(BinWidth) +
" events"
116 hError.GetYaxis().SetTitle(ytitle)
119 latex.SetTextSize(0.1)
120 latex.SetTextAlign(22)
121 latex.DrawLatex(0.5, 0.5,
"NO ERROR DETECTED")
125 gPad.SetFrameFillStyle(0)
127 hSlotNumAll = TH1F(
"hSlotNumAll",
"", 17, -0.5, 16.5)
128 hSlotNumNoCalCh = TH1F(
"hSlotNumNoCalCh",
"", 17, -0.5, 16.5)
129 basicHitSelection =
"hitQuality>0"
130 basicHitSelectionSingle = basicHitSelection +
"&& offlineFlag<=0"
131 tr.Draw(
"Sum$(" + basicHitSelectionSingle +
")>>hNHitAllSlots(100,-0.5,499.5)")
132 tr.Draw(
"Sum$(" + basicHitSelectionSingle +
"&&!isCalCh)>>hNHitAllSlotsNoCalCh(100,-0.5,499.5)")
133 tr.Draw(
"rawTime>>hRawTimeAll(128,-128,640)",
"hitQuality%10<4 && hitQuality>0")
134 hNHitAll = [gROOT.FindObject(
"hNHitAllSlots")]
135 hNHitNoCalCh = [gROOT.FindObject(
"hNHitAllSlotsNoCalCh")]
136 hRawTimeList = [gROOT.FindObject(
"hRawTimeAll")]
138 nSlotEntriesNoCalCh = []
139 nSlotEntriesCalCh = []
140 nSlotEntriesCalChWfm = []
144 strMultiplicity =
"0"
145 for slot
in range(1, 17):
146 slotCut =
" && slotNum==" + str(slot)
147 tr.Draw(
"Sum$(" + basicHitSelectionSingle + slotCut +
")>>hNHitAll" + str(slot) +
"(90,2.5,92.5)")
148 tr.Draw(
"Sum$(" + basicHitSelectionSingle +
" && !isCalCh" + slotCut +
")>>hNHitNoCalCh" + str(slot) +
"(90,2.5,92.5)")
149 tr.Draw(
"rawTime>>hRawTime" + str(slot) +
"(128,-128,1152)",
150 "hitQuality>0 " + slotCut)
151 hNHitAllTmp = gROOT.FindObject(
"hNHitAll" + str(slot))
152 hNHitNoCalChTmp = gROOT.FindObject(
"hNHitNoCalCh" + str(slot))
153 hRawTimeTmp = gROOT.FindObject(
"hRawTime" + str(slot))
154 hNHitAll.append(hNHitAllTmp)
155 hNHitNoCalCh.append(hNHitNoCalChTmp)
156 hRawTimeList.append(hRawTimeTmp)
157 nSlotEntriesAllTmp = hNHitAllTmp.Integral(hNHitAllTmp.GetXaxis().FindBin(3), hNHitAllTmp.GetXaxis().GetNbins() + 1)
158 nSlotEntriesNoCalChTmp = hNHitNoCalChTmp.Integral(
159 hNHitNoCalChTmp.GetXaxis().FindBin(3),
160 hNHitNoCalChTmp.GetXaxis().GetNbins() + 1)
161 hSlotNumAll.SetBinContent(slot + 1, nSlotEntriesAllTmp)
162 hSlotNumNoCalCh.SetBinContent(slot + 1, nSlotEntriesNoCalChTmp)
163 nSlotEntriesAll.append(nSlotEntriesAllTmp)
164 nSlotEntriesCalCh.append(-1)
165 nSlotEntriesCalChWfm.append(-1)
166 nSlotEntriesNoCalCh.append(nSlotEntriesNoCalChTmp)
167 nHitMeanAll.append(hNHitAllTmp.GetMean())
168 nHitMeanNoCalCh.append(hNHitNoCalChTmp.GetMean())
169 nHitMeanLaser.append(-1)
170 strMultiplicity += (
" + (Sum$(" + basicHitSelectionSingle + slotCut +
")>=3)")
173 hSlotNumAll.SetLineColor(1)
174 hSlotNumNoCalCh.SetLineColor(2)
175 hSlotNumAll.SetFillStyle(0)
176 hSlotNumNoCalCh.SetFillStyle(0)
177 hSlotNumAll.SetStats(
False)
179 hSlotNumAll.GetYaxis().SetRangeUser(0, nEntries * 1.2)
180 hSlotNumAll.SetTitle(
"hit event number (nHit>=3) for each slot and multiplicity")
181 hSlotNumAll.GetXaxis().SetTitle(
"slot number")
185 line.DrawLine(-0.5, nEntries, 16.5, nEntries)
186 hSlotNumNoCalCh.Draw(
"same")
187 tr.Draw(strMultiplicity +
">>hMultiplicity",
"",
"same")
188 hMultiplicity = gROOT.FindObject(
"hMultiplicity")
189 hMultiplicity.SetFillStyle(0)
190 hMultiplicity.SetLineColor(3)
191 legendSlot = TLegend(0.5, 0.65, 0.875, 0.875)
192 legendSlot.SetFillStyle(0)
193 legendSlot.SetBorderSize(0)
194 legendSlot.AddEntry(hSlotNumAll,
"all channels, single hit")
195 legendSlot.AddEntry(hSlotNumNoCalCh,
"w/o cal. channels, single hit")
196 legendSlot2 = TLegend(legendSlot)
197 legendSlot2.AddEntry(hMultiplicity,
"# of hit modules")
202 gPad.SetFrameFillStyle(0)
204 hNHitAll[0].SetLineColor(1)
205 hNHitNoCalCh[0].SetLineColor(2)
206 hNHitAll[0].SetStats(
False)
207 hNHitAll[0].SetTitle(
"# of total FE hits for all available slots")
208 hNHitAll[0].GetXaxis().SetTitle(
"# of hits")
210 hNHitNoCalCh[0].Draw(
"same")
215 canvas.Print(pdf_output)
219 for slot
in range(1, 17):
221 hRawTime = hRawTimeList[slot]
222 hRawTime.SetStats(
False)
223 hRawTime.SetTitle(
"rawTime distribution")
224 hRawTime.GetXaxis().SetTitle(
"rawTime")
225 ytitle =
"Entries [/(" + str(hRawTime.GetXaxis().GetBinUpEdge(1) - hRawTime.GetXaxis().GetBinLowEdge(1)) +
" samples)]"
226 hRawTime.GetYaxis().SetTitle(ytitle)
227 slotstr =
"slot" +
"{0:02d}".format(slot)
228 hRawTime.SetTitle(
"rawTime distribution : " + slotstr)
230 canvas.Print(pdf_output)
233 for slot
in range(1, 17):
235 slotCut =
"slotNum==" + str(slot)
236 if tr.GetEntries(slotCut) < 1:
237 print(
"slot : " + str(slot) +
" : no events")
240 print(
"slot : " + str(slot) +
" : processing...")
242 slotstr =
"slot" +
"{0:02d}".format(slot)
244 gStyle.SetStatX(0.875)
245 gStyle.SetStatY(0.875)
251 gPad.SetFrameFillStyle(0)
253 tr.Draw(
"TMath::FloorNint((pixelId-1)/64+1):TMath::FloorNint((pixelId-1)%64+1)>>hCalMap" +
254 str(slot) +
"(64,0.5,64.5,8,0.5,8.5)", (
"isCalCh && offlineFlag<=0 && " + slotCut),
"colz")
255 hCalMap = gROOT.FindObject(
"hCalMap" + str(slot))
256 hCalMap.SetStats(
False)
257 hCalMap.Scale(1. / nEntries)
258 hCalMap.SetTitle(root_output +
" - occupancy map only in cal. ch. (hits/evt) : " + slotstr)
262 gPad.SetFrameFillStyle(0)
264 tr.Draw(
"Sum$((isCalCh)*(offlineFlag<=0)*(" + slotCut +
"))>>hCalEff" + str(slot) +
"(65,-0.5,64.5)")
265 hCalEff = gROOT.FindObject(
"hCalEff" + str(slot))
266 hCalEff.GetXaxis().SetTitle(
"# of hits identified in cal. ch.")
267 hCalEff.SetTitle(
"# of hits in cal. ch. for each event : " + slotstr)
268 IsCosmicRayData =
True if (hCalEff.GetMean() < 1.)
else False
269 tr.Draw(
"Sum$((hitQuality>=200)*(" + slotCut +
"))>>hCalEffOfflineFE" + str(slot) +
"(65,-0.5,64.5)",
"",
"same")
270 hCalEffOfflineFE = gROOT.FindObject(
"hCalEffOfflineFE" + str(slot))
271 hCalEffOfflineFE.SetLineColor(2)
272 hCalEff.GetYaxis().SetRangeUser(0, max(hCalEff.GetBinContent(hCalEff.GetMaximumBin()),
273 hCalEffOfflineFE.GetBinContent(hCalEffOfflineFE.GetMaximumBin())) * 1.3)
274 legendEff = TLegend(0.15, 0.875, 0.5, 0.7)
275 legendEff.SetFillStyle(0)
276 legendEff.AddEntry(hCalEff,
"w/o offline FE (" + str(int(hCalEff.GetMean() * 10 + 0.5) / 10.) +
")")
277 if IsOfflineFEDisabled:
278 legendEff.AddEntry(hCalEffOfflineFE,
"w/ offline FE (disabled)")
280 legendEff.AddEntry(hCalEffOfflineFE,
"w/ offline FE (" + str(int(hCalEffOfflineFE.GetMean() * 10 + 0.5) / 10.) +
")")
283 nSlotEntriesCalCh[slot - 1] = hCalEff.GetMean()
284 nSlotEntriesCalChWfm[slot - 1] = hCalEffOfflineFE.GetMean()
288 gPad.SetFrameFillStyle(0)
291 cut =
"refTime>0 && hitQuality>0 && hitQuality<50 && " + slotCut
292 if IsOfflineFEDisabled:
293 ytitle_hLaser =
"Laser timing distribution (w/o offline FE) : " + slotstr
295 cut +=
" && hitQuality>=10"
296 ytitle_hLaser =
"Laser timing distribution (w/ offline FE) : " + slotstr
297 tr.Draw(
"time-refTime>>hLaserTime" + str(slot) +
"(180,-125,55)", cut +
" && !isCalCh")
298 tr.Draw(
"time-refTime>>hLaserTimeCal" + str(slot) +
"(180,-125,55)", cut +
" && isCalCh",
"same")
299 hLaserTime = gROOT.FindObject(
"hLaserTime" + str(slot))
300 hLaserTimeCal = gROOT.FindObject(
"hLaserTimeCal" + str(slot))
301 hLaserTime.GetXaxis().SetTitle(
"hit time - ref. time [ns]")
302 BinWidth = hLaserTime.GetXaxis().GetBinUpEdge(1) - hLaserTime.GetXaxis().GetBinLowEdge(1)
303 ytitle =
"Entries[/(" + str(BinWidth) +
" ns)]"
304 hLaserTime.GetYaxis().SetTitle(ytitle)
305 hLaserTime.SetTitle(ytitle_hLaser)
306 hLaserTimeCal.SetLineColor(2)
312 if hLaserTime.Integral(1, int(hLaserTime.GetXaxis().GetNbins() / 2)) < 0.5 * hLaserTime.Integral():
313 gStyle.SetStatX(0.475)
314 gStyle.SetStatY(0.875)
317 legendTime = TLegend(legX1, 0.875, legX2, 0.7)
318 legendTime.SetFillStyle(0)
319 legendTime.SetBorderSize(0)
320 legendTime.AddEntry(hLaserTime,
"non-cal. channel")
321 legendTime.AddEntry(hLaserTimeCal,
"cal. channel")
323 if hLaserTime.Integral() > 10:
326 BinTime = hLaserTime.GetXaxis().GetBinLowEdge(1)
328 while BinTime < hLaserTime.GetXaxis().GetBinUpEdge(hLaserTime.GetXaxis().GetNbins()):
329 tmpHeight = hLaserTime.GetBinContent(iBin)
330 BinTime = hLaserTime.GetXaxis().GetBinCenter(iBin)
331 if tmpHeight > MaxHeight:
332 MaxHeight = tmpHeight
335 hLaserTime.Fit(
"gaus",
"+",
"", PeakTime - FitWidth, PeakTime + FitWidth)
336 if hLaserTime.GetFunction(
"gaus"):
337 func = hLaserTime.GetFunction(
"gaus")
338 PeakTime = func.GetParameter(1)
339 PeakHeight = func.GetParameter(0)
341 PeakHeight = hLaserTime.GetBinContent(hLaserTime.GetXaxis().FindBin(PeakTime))
342 cutDirectHit +=
" && TMath::Abs(time-refTime-(" + str(PeakTime) +
"))<" + str(FitWidth)
343 cutReflHit +=
" && TMath::Abs(time-refTime-(" + str(PeakTime + DelayTimeRefl) +
"))<" + str(ReflHalfTimwRange)
347 arrow.SetLineColor(3)
348 line.DrawLine(PeakTime - FitWidth, 0.5, PeakTime - FitWidth, PeakHeight / 10.)
349 line.DrawLine(PeakTime + FitWidth, 0.5, PeakTime + FitWidth, PeakHeight / 10.)
370 arrow.DrawArrow(PeakTime - FitWidth, 5, PeakTime + FitWidth, 5, 0.01,
"<>")
385 gPad.SetFrameFillStyle(0)
387 tr.Draw(
"TMath::FloorNint((pixelId-1)/64+1):TMath::FloorNint((pixelId-1)%64+1)>>hLaserMap" +
388 str(slot) +
"(64,0.5,64.5,8,0.5,8.5)", cutDirectHit,
"colz")
389 hLaserMap = gROOT.FindObject(
"hLaserMap" + str(slot))
390 hLaserMap.Scale(1. / tr.GetEntries())
391 hLaserMap.SetStats(
False)
392 hLaserMap.SetTitle(root_output +
" - laser direct hit occupancy (hits/event)")
396 gPad.SetFrameFillStyle(0)
398 tr.Draw(
"TMath::FloorNint((pixelId-1)/64+1):TMath::FloorNint((pixelId-1)%64+1)>>hLaserReflMap" +
399 str(slot) +
"(64,0.5,64.5,8,0.5,8.5)",
400 (
"hitQuality>0 && hitQuality%10!=4 && " + slotCut
if IsCosmicRayData
else cutReflHit),
"colz")
401 hLaserReflMap = gROOT.FindObject(
"hLaserReflMap" + str(slot))
402 hLaserReflMap.Scale(1. / tr.GetEntries())
403 hLaserReflMap.SetStats(
False)
404 hLaserReflMap.SetTitle(root_output + (
" - hit map for the whole timing region (hits/event)"
405 if IsCosmicRayData
else " - laser reflected hit occupancy (hits/event)"))
409 gPad.SetFrameFillStyle(0)
411 hNHitAll[slot].SetStats(
False)
412 hNHitAll[slot].SetTitle(
"number of hits for " + slotstr)
413 hNHitAll[slot].SetLineColor(1)
414 hNHitNoCalCh[slot].SetLineColor(2)
415 hNHitAll[slot].Draw()
416 hNHitNoCalCh[slot].Draw(
"same")
417 latex.SetTextSize(0.05)
418 latex.SetTextAlign(33)
419 latex.DrawLatex(0.875, 0.785,
"underflow : " + str(int(hNHitAll[slot].GetBinContent(0) * 1000 / nEntries) / 10) +
"%")
420 latex.DrawLatex(0.875, 0.685,
"underflow : " + str(int(hNHitNoCalCh[slot].GetBinContent(0) * 1000 / nEntries) / 10) +
"%")
422 tr.Draw(
"Sum$(" + basicHitSelection +
"&& " + slotCut +
"&&TMath::Abs(time-refTime-(" +
423 str(PeakTime) +
"))<" + str(FitWidth) +
")>>hNHitLaser" + str(slot),
"",
"same")
424 hNHitLaser = gROOT.FindObject(
"hNHitLaser" + str(slot))
425 hNHitLaser.SetFillStyle(0)
426 hNHitLaser.SetLineColor(3)
427 nHitMeanLaser[slot - 1] = hNHitLaser.GetMean()
428 hMax = max(hNHitLaser.GetBinContent(hNHitLaser.GetMaximumBin()),
429 hNHitAll[slot].GetBinContent(hNHitAll[slot].GetMaximumBin()),
430 hNHitNoCalCh[slot].GetBinContent(hNHitNoCalCh[slot].GetMaximumBin()))
431 hNHitAll[slot].GetYaxis().SetRangeUser(0, 1.1 * hMax)
433 legstr =
"Laser direct hit (" + (
"single hit" if IsOfflineFEDisabled
else "multi hit") +
")"
434 legendSlot.AddEntry(hNHitLaser, legstr)
435 legendSlot.SetY1(0.55)
438 hMax = max(hNHitAll[slot].GetBinContent(hNHitAll[slot].GetMaximumBin()),
439 hNHitNoCalCh[slot].GetBinContent(hNHitNoCalCh[slot].GetMaximumBin()))
440 hNHitAll[slot].GetYaxis().SetRangeUser(0, 1.1 * hMax)
445 gPad.SetFrameFillStyle(0)
447 if IsOfflineFEDisabled
or IsCosmicRayData:
448 hRawTime = hRawTimeList[slot]
449 hRawTime.SetStats(
False)
450 hRawTime.SetTitle(
"rawTime distribution")
451 hRawTime.GetXaxis().SetTitle(
"rawTime")
452 ytitle =
"Entries [/(" + str(hRawTime.GetXaxis().GetBinUpEdge(1) - hRawTime.GetXaxis().GetBinLowEdge(1)) +
" samples)]"
453 hRawTime.GetYaxis().SetTitle(ytitle)
454 hRawTime.SetTitle(
"rawTime distribution : " + slotstr)
457 tr.Draw(
"time-refTime:TMath::FloorNint((pixelId-1)/8)>>hCalPulseInterval" + str(slot) +
"(64,-0.5,63.5,100,19,24)",
460 "hitQuality>=200 && " + slotCut,
"colz")
461 hCalPulseInterval = gROOT.FindObject(
"hCalPulseInterval" + str(slot))
462 hCalPulseInterval.GetXaxis().SetTitle(
"asic number = (pixelId-1)/8")
463 hCalPulseInterval.GetYaxis().SetTitle(
"time interval of double cal. pulses [ns]")
464 hCalPulseInterval.SetTitle(
"time interval of double calibration pulses : " + slotstr)
465 hCalPulseInterval.SetStats(
False)
468 gPad.SetFrameFillStyle(0)
471 tr.Draw(
"sample>>hSample" + str(slot) +
"(256,-0.5,255.5)",
472 "slotNum==" + str(slot) + (
"&&hitQuality>0&&hitQuality%10!=4" if IsCosmicRayData
473 else "&&hitQuality>=100&&hitQuality<200"))
474 hSample = gROOT.FindObject(
"hSample" + str(slot))
475 hSample.SetFillStyle(0)
476 hSample.SetLineColor(1)
477 hSample.SetStats(
False)
478 hSample.SetTitle(
"entries of each sample# for TBC : " + slotstr)
479 hSample.GetXaxis().SetTitle(
"Sample# for each hit" if IsCosmicRayData
480 else "Sample# of the first calibration pulse")
482 hSample.GetXaxis().GetBinLowEdge(1),
484 hSample.GetXaxis().GetBinUpEdge(
485 hSample.GetXaxis().GetNbins()),
488 canvas.Print(pdf_output)
490 canvas.Print((pdf_output +
"]"))
492 print(
" (nEvt >=3hits) (mean nhit) (no cal.ch) (nCalHit) (nCalHit wfm) (nHitLaser)")
493 for iSlot
in range(0, 16):
494 print(
"slot" +
"{0:02d}".format(iSlot + 1) +
495 " " +
"{0:7d}".format(int(nSlotEntriesAll[iSlot])) +
" \t " + str(
'%03.2f' % nHitMeanAll[iSlot]) +
496 " \t " + str(
'%03.2f' % nHitMeanNoCalCh[iSlot]) +
" \t" + str(
'%03.2f' % nSlotEntriesCalCh[iSlot]) +
497 " \t " + str(
'%03.2f' % nSlotEntriesCalChWfm[iSlot]) +
" \t " + str(
'%03.2f' % nHitMeanLaser[iSlot]))
499 print(
"nEntries = " + str(nEntries))
503 def plotInterimFEDataNtupleAdvanced(root_output, FitWidth=5):
505 pdf_output = root_output[0:root_output.rfind(
".root")] +
"_Advanced.png"
506 root_out = root_output[0:root_output.rfind(
".root")] +
"_Advanced.root"
508 print(root_output +
" --> " + pdf_output)
510 gStyle.SetFrameFillStyle(0)
511 gStyle.SetFillStyle(0)
514 gStyle.SetStatStyle(0)
515 gStyle.SetOptStat(112210)
516 gStyle.SetOptFit(1110)
517 canvas = TCanvas(
"cv2",
"cv2", 1600, 1600)
518 canvas.SetFillStyle(0)
520 f = TFile(root_output)
525 gPad.SetFrameFillStyle(0)
527 tr.Draw(
"rawTdc-refTdc:winNum>>hTimeVSWin(512, 0, 512, 60, -160, -130)",
"refTdc>0 && !isCalCh",
"colz")
528 hTimeVSWin = gROOT.FindObject(
"hTimeVSWin")
529 hTimeVSWin.GetXaxis().SetTitle(
"hit first window")
530 hTimeVSWin.GetYaxis().SetTitle(
"hit time - ref. time [ns]")
531 hTimeVSWin.SetStats(
False)
532 hTimeVSWin.SetTitle(root_output +
" hit time - ref time VS window number.")
535 gPad.SetFrameFillStyle(0)
537 tr.Draw(
"rawTdc-refTdc:sample>>hTimeVSSample(2560, 0, 256, 60, -160, -130)",
"refTdc>0 && !isCalCh",
"colz")
538 hTimeVSSample = gROOT.FindObject(
"hTimeVSSample")
539 hTimeVSSample.SetStats(
False)
540 hTimeVSSample.GetXaxis().SetTitle(
"hit sample [sample]")
541 hTimeVSSample.GetYaxis().SetTitle(
"hit time - ref. time [ns]")
542 hTimeVSSample.SetTitle(
"hit time - ref time VS hit time.")
546 gPad.SetFrameFillStyle(0)
548 tr.Draw(
"rawTdc-refTdc:pixelId>>hTimeVSPixel(512, 0, 512, 60, -160, -130 )",
"refTdc>0 && !isCalCh",
"colz")
549 hTimeVSPixel = gROOT.FindObject(
"hTimeVSPixel")
550 hTimeVSPixel.SetStats(
False)
551 hTimeVSPixel.GetXaxis().SetTitle(
"pixel ID")
552 hTimeVSPixel.GetYaxis().SetTitle(
"hit time - ref. time [ns]")
553 hTimeVSPixel.SetTitle(
"hit time - ref time VS pixel ID.")
557 gPad.SetFrameFillStyle(0)
559 tr.Draw(
"height:sample>>hHeightVSSample(256, 0, 256, 200, 0, 1000)",
"",
"colz")
560 hHeightVSSample = gROOT.FindObject(
"hHeightVSSample")
561 hHeightVSSample.SetStats(
False)
562 hHeightVSSample.GetXaxis().SetTitle(
"hit sample [sample]")
563 hHeightVSSample.GetYaxis().SetTitle(
"hit amplitude [ADC] ")
564 hHeightVSSample.SetTitle(
"amplitude VS hit time (incl calpulse).")
569 gPad.SetFrameFillStyle(0)
571 tr.Draw(
"sample>>hHitTime(400, -50, 350)")
572 hHitTime = gROOT.FindObject(
"hHitTime")
573 hHitTime.SetStats(
False)
574 hHitTime.GetXaxis().SetTitle(
"hit sample [sample]")
575 hHitTime.GetYaxis().SetTitle(
"entries / 1 sample ")
576 hHitTime.SetTitle(
"hit sample (incl calpulse).")
580 gPad.SetFrameFillStyle(0)
582 tr.Draw(
"Sum$(!isCalCh)>>hHitEff(200, 0, 200)",
"rawTdc-refTdc > -160 && rawTdc-refTdc < -130")
583 hHitEff = gROOT.FindObject(
"hHitEff")
584 hHitEff.GetXaxis().SetTitle(
"# of hits candidates per event")
585 hHitEff.SetTitle(
"# of laser hit candidates for each event in -160 < time < -130")
586 print(
"mean nHit value : " + str(hHitEff.GetMean()))
588 pave = hHitEff.FindObject(
"stats")
594 canvas.Print(pdf_output)
596 root_plot_out = TFile(root_out,
"recreate")
597 hTimeVSSample.Write()
599 hHeightVSSample.Write()
604 root_plot_out.Close()
608 if __name__ ==
'__main__':
612 plotInterimFEDataNtupleSummary(args[1])
616 print(args[0] +
" (output of plotInterimFEData)")