14 from ROOT
import gROOT
16 from ROOT
import gStyle, gPad, TFile, TTree, TStyle, TCanvas, TH1F, TH2F, TF1, TLegend, TAxis, TPaveStats, TLatex, TLine, TArrow
19 def plotInterimFEDataNtupleSummary(root_output, FitWidth=2, IsOfflineFEDisabled=False):
24 pdf_output = root_output[0:root_output.rfind(
".root")] +
"_Summary.pdf"
26 print(root_output +
" --> " + pdf_output)
28 gStyle.SetFrameFillStyle(0)
29 gStyle.SetFillStyle(0)
32 gStyle.SetStatStyle(0)
33 gStyle.SetOptStat(112210)
34 gStyle.SetOptFit(1110)
35 canvas = TCanvas(
"cv1",
"cv1", 800, 800)
36 canvas.SetFillStyle(0)
37 canvas.Print((pdf_output +
"["))
39 f = TFile(root_output)
41 nEntries = tr.GetEntries()
45 latex.SetTextSize(0.03)
46 latex.SetTextAlign(33)
48 print(
"making summary plot for all the slots...")
52 gPad.SetFrameFillStyle(0)
54 tr.Draw(
"eventNum[0]>>hNHit",
"(nHit>0)*(Sum$(offlineFlag<=0))")
55 tr.Draw(
"eventNum[0]>>hHeader",
"(nHit>0)*(nFEHeader)")
56 tr.Draw(
"eventNum[0]>>hEmptyHeader",
"(nHit>0)*(nEmptyFEHeader)")
57 tr.Draw(
"eventNum[0]>>hWfm",
"(nHit>0)*(nWaveform)")
58 tr.Draw(
"eventNum[0]>>hError",
"(nHit>0)*(errorFlag>0)")
59 hNHit = gROOT.FindObject(
"hNHit")
60 if hNHit.Integral() < 1:
61 print(
"ERROR : no hits were found.")
63 hHeader = gROOT.FindObject(
"hHeader")
64 hEmptyHeader = gROOT.FindObject(
"hEmptyHeader")
65 hWfm = gROOT.FindObject(
"hWfm")
66 hError = gROOT.FindObject(
"hError")
67 BinWidth = hNHit.GetXaxis().GetBinUpEdge(1) - hNHit.GetXaxis().GetBinLowEdge(1)
68 hNHit.Scale(1. / BinWidth)
69 hHeader.Scale(1. / BinWidth)
70 hEmptyHeader.Scale(1. / BinWidth)
71 hWfm.Scale(1. / BinWidth)
72 hError.Scale(1. / BinWidth)
74 hNHit.SetTitle(root_output +
" - # hits/headers/waveforms")
76 hHeader.SetLineColor(2)
77 hEmptyHeader.SetLineColor(3)
79 hError.SetLineColor(6)
80 legend = TLegend(0.6, 0.175, 0.875, 0.4)
81 legend.SetFillStyle(0)
82 legend.SetBorderSize(0)
83 legend.AddEntry(hNHit,
"nHit (no offline FE)")
84 legend.AddEntry(hHeader,
"# of FE headers")
85 legend.AddEntry(hEmptyHeader,
"# of empty FE headers")
86 legend.AddEntry(hWfm,
"# of waveforms")
87 hNHit.GetXaxis().SetTitle(
"event number")
88 ytitle =
"average # every " + str(BinWidth) +
" events"
89 hNHit.GetYaxis().SetTitle(ytitle)
90 hNHit.GetYaxis().SetRangeUser(0, 1.05 * hHeader.GetBinContent(hHeader.GetMaximumBin()))
93 hHeader.Draw(
"samehist")
94 hEmptyHeader.Draw(
"samehist")
97 if hWfm.Integral() > 0:
98 evtFracNoWfm = 1 - hWfm.Integral() / hNHit.Integral()
99 print(
"fraction of events without waveform : " + str(int(1000 * evtFracNoWfm) / 10) +
"%")
100 latex.DrawLatex(0.875, 0.175,
"fraction of no-waveform events : " + str(int(1000 * evtFracNoWfm) / 10) +
"%")
104 gPad.SetFrameFillStyle(0)
106 if hError.GetEntries() > 0:
107 hError.SetStats(
False)
108 hError.SetTitle(root_output +
" - error rate")
109 hError.GetXaxis().SetTitle(
"event number")
110 ytitle =
"fraction of events with any errors for every" + str(BinWidth) +
" events"
111 hError.GetYaxis().SetTitle(ytitle)
114 latex.SetTextSize(0.1)
115 latex.SetTextAlign(22)
116 latex.DrawLatex(0.5, 0.5,
"NO ERROR DETECTED")
120 gPad.SetFrameFillStyle(0)
122 hSlotNumAll = TH1F(
"hSlotNumAll",
"", 17, -0.5, 16.5)
123 hSlotNumNoCalCh = TH1F(
"hSlotNumNoCalCh",
"", 17, -0.5, 16.5)
124 basicHitSelection =
"hitQuality>0"
125 basicHitSelectionSingle = basicHitSelection +
"&& offlineFlag<=0"
126 tr.Draw(
"Sum$(" + basicHitSelectionSingle +
")>>hNHitAllSlots(100,-0.5,499.5)")
127 tr.Draw(
"Sum$(" + basicHitSelectionSingle +
"&&!isCalCh)>>hNHitAllSlotsNoCalCh(100,-0.5,499.5)")
128 tr.Draw(
"rawTime>>hRawTimeAll(128,-128,640)",
"hitQuality%10<4 && hitQuality>0")
129 hNHitAll = [gROOT.FindObject(
"hNHitAllSlots")]
130 hNHitNoCalCh = [gROOT.FindObject(
"hNHitAllSlotsNoCalCh")]
131 hRawTimeList = [gROOT.FindObject(
"hRawTimeAll")]
133 nSlotEntriesNoCalCh = []
134 nSlotEntriesCalCh = []
135 nSlotEntriesCalChWfm = []
139 strMultiplicity =
"0"
140 for slot
in range(1, 17):
141 slotCut =
" && slotNum==" + str(slot)
142 tr.Draw(
"Sum$(" + basicHitSelectionSingle + slotCut +
")>>hNHitAll" + str(slot) +
"(90,2.5,92.5)")
143 tr.Draw(
"Sum$(" + basicHitSelectionSingle +
" && !isCalCh" + slotCut +
")>>hNHitNoCalCh" + str(slot) +
"(90,2.5,92.5)")
144 tr.Draw(
"rawTime>>hRawTime" + str(slot) +
"(128,-128,1152)",
145 "hitQuality>0 " + slotCut)
146 hNHitAllTmp = gROOT.FindObject(
"hNHitAll" + str(slot))
147 hNHitNoCalChTmp = gROOT.FindObject(
"hNHitNoCalCh" + str(slot))
148 hRawTimeTmp = gROOT.FindObject(
"hRawTime" + str(slot))
149 hNHitAll.append(hNHitAllTmp)
150 hNHitNoCalCh.append(hNHitNoCalChTmp)
151 hRawTimeList.append(hRawTimeTmp)
152 nSlotEntriesAllTmp = hNHitAllTmp.Integral(hNHitAllTmp.GetXaxis().FindBin(3), hNHitAllTmp.GetXaxis().GetNbins() + 1)
153 nSlotEntriesNoCalChTmp = hNHitNoCalChTmp.Integral(
154 hNHitNoCalChTmp.GetXaxis().FindBin(3),
155 hNHitNoCalChTmp.GetXaxis().GetNbins() + 1)
156 hSlotNumAll.SetBinContent(slot + 1, nSlotEntriesAllTmp)
157 hSlotNumNoCalCh.SetBinContent(slot + 1, nSlotEntriesNoCalChTmp)
158 nSlotEntriesAll.append(nSlotEntriesAllTmp)
159 nSlotEntriesCalCh.append(-1)
160 nSlotEntriesCalChWfm.append(-1)
161 nSlotEntriesNoCalCh.append(nSlotEntriesNoCalChTmp)
162 nHitMeanAll.append(hNHitAllTmp.GetMean())
163 nHitMeanNoCalCh.append(hNHitNoCalChTmp.GetMean())
164 nHitMeanLaser.append(-1)
165 strMultiplicity += (
" + (Sum$(" + basicHitSelectionSingle + slotCut +
")>=3)")
168 hSlotNumAll.SetLineColor(1)
169 hSlotNumNoCalCh.SetLineColor(2)
170 hSlotNumAll.SetFillStyle(0)
171 hSlotNumNoCalCh.SetFillStyle(0)
172 hSlotNumAll.SetStats(
False)
174 hSlotNumAll.GetYaxis().SetRangeUser(0, nEntries * 1.2)
175 hSlotNumAll.SetTitle(
"hit event number (nHit>=3) for each slot and multiplicity")
176 hSlotNumAll.GetXaxis().SetTitle(
"slot number")
180 line.DrawLine(-0.5, nEntries, 16.5, nEntries)
181 hSlotNumNoCalCh.Draw(
"same")
182 tr.Draw(strMultiplicity +
">>hMultiplicity",
"",
"same")
183 hMultiplicity = gROOT.FindObject(
"hMultiplicity")
184 hMultiplicity.SetFillStyle(0)
185 hMultiplicity.SetLineColor(3)
186 legendSlot = TLegend(0.5, 0.65, 0.875, 0.875)
187 legendSlot.SetFillStyle(0)
188 legendSlot.SetBorderSize(0)
189 legendSlot.AddEntry(hSlotNumAll,
"all channels, single hit")
190 legendSlot.AddEntry(hSlotNumNoCalCh,
"w/o cal. channels, single hit")
191 legendSlot2 = TLegend(legendSlot)
192 legendSlot2.AddEntry(hMultiplicity,
"# of hit modules")
197 gPad.SetFrameFillStyle(0)
199 hNHitAll[0].SetLineColor(1)
200 hNHitNoCalCh[0].SetLineColor(2)
201 hNHitAll[0].SetStats(
False)
202 hNHitAll[0].SetTitle(
"# of total FE hits for all available slots")
203 hNHitAll[0].GetXaxis().SetTitle(
"# of hits")
205 hNHitNoCalCh[0].Draw(
"same")
210 canvas.Print(pdf_output)
214 for slot
in range(1, 17):
216 hRawTime = hRawTimeList[slot]
217 hRawTime.SetStats(
False)
218 hRawTime.SetTitle(
"rawTime distribution")
219 hRawTime.GetXaxis().SetTitle(
"rawTime")
220 ytitle =
"Entries [/(" + str(hRawTime.GetXaxis().GetBinUpEdge(1) - hRawTime.GetXaxis().GetBinLowEdge(1)) +
" samples)]"
221 hRawTime.GetYaxis().SetTitle(ytitle)
222 slotstr =
"slot" +
"{0:02d}".format(slot)
223 hRawTime.SetTitle(
"rawTime distribution : " + slotstr)
225 canvas.Print(pdf_output)
228 for slot
in range(1, 17):
230 slotCut =
"slotNum==" + str(slot)
231 if tr.GetEntries(slotCut) < 1:
232 print(
"slot : " + str(slot) +
" : no events")
235 print(
"slot : " + str(slot) +
" : processing...")
237 slotstr =
"slot" +
"{0:02d}".format(slot)
239 gStyle.SetStatX(0.875)
240 gStyle.SetStatY(0.875)
246 gPad.SetFrameFillStyle(0)
248 tr.Draw(
"TMath::FloorNint((pixelId-1)/64+1):TMath::FloorNint((pixelId-1)%64+1)>>hCalMap" +
249 str(slot) +
"(64,0.5,64.5,8,0.5,8.5)", (
"isCalCh && offlineFlag<=0 && " + slotCut),
"colz")
250 hCalMap = gROOT.FindObject(
"hCalMap" + str(slot))
251 hCalMap.SetStats(
False)
252 hCalMap.Scale(1. / nEntries)
253 hCalMap.SetTitle(root_output +
" - occupancy map only in cal. ch. (hits/evt) : " + slotstr)
257 gPad.SetFrameFillStyle(0)
259 tr.Draw(
"Sum$((isCalCh)*(offlineFlag<=0)*(" + slotCut +
"))>>hCalEff" + str(slot) +
"(65,-0.5,64.5)")
260 hCalEff = gROOT.FindObject(
"hCalEff" + str(slot))
261 hCalEff.GetXaxis().SetTitle(
"# of hits identified in cal. ch.")
262 hCalEff.SetTitle(
"# of hits in cal. ch. for each event : " + slotstr)
263 IsCosmicRayData =
True if (hCalEff.GetMean() < 1.)
else False
264 tr.Draw(
"Sum$((hitQuality>=200)*(" + slotCut +
"))>>hCalEffOfflineFE" + str(slot) +
"(65,-0.5,64.5)",
"",
"same")
265 hCalEffOfflineFE = gROOT.FindObject(
"hCalEffOfflineFE" + str(slot))
266 hCalEffOfflineFE.SetLineColor(2)
267 hCalEff.GetYaxis().SetRangeUser(0, max(hCalEff.GetBinContent(hCalEff.GetMaximumBin()),
268 hCalEffOfflineFE.GetBinContent(hCalEffOfflineFE.GetMaximumBin())) * 1.3)
269 legendEff = TLegend(0.15, 0.875, 0.5, 0.7)
270 legendEff.SetFillStyle(0)
271 legendEff.AddEntry(hCalEff,
"w/o offline FE (" + str(int(hCalEff.GetMean() * 10 + 0.5) / 10.) +
")")
272 if IsOfflineFEDisabled:
273 legendEff.AddEntry(hCalEffOfflineFE,
"w/ offline FE (disabled)")
275 legendEff.AddEntry(hCalEffOfflineFE,
"w/ offline FE (" + str(int(hCalEffOfflineFE.GetMean() * 10 + 0.5) / 10.) +
")")
278 nSlotEntriesCalCh[slot - 1] = hCalEff.GetMean()
279 nSlotEntriesCalChWfm[slot - 1] = hCalEffOfflineFE.GetMean()
283 gPad.SetFrameFillStyle(0)
286 cut =
"refTime>0 && hitQuality>0 && hitQuality<50 && " + slotCut
287 if IsOfflineFEDisabled:
288 ytitle_hLaser =
"Laser timing distribution (w/o offline FE) : " + slotstr
290 cut +=
" && hitQuality>=10"
291 ytitle_hLaser =
"Laser timing distribution (w/ offline FE) : " + slotstr
292 tr.Draw(
"time-refTime>>hLaserTime" + str(slot) +
"(180,-125,55)", cut +
" && !isCalCh")
293 tr.Draw(
"time-refTime>>hLaserTimeCal" + str(slot) +
"(180,-125,55)", cut +
" && isCalCh",
"same")
294 hLaserTime = gROOT.FindObject(
"hLaserTime" + str(slot))
295 hLaserTimeCal = gROOT.FindObject(
"hLaserTimeCal" + str(slot))
296 hLaserTime.GetXaxis().SetTitle(
"hit time - ref. time [ns]")
297 BinWidth = hLaserTime.GetXaxis().GetBinUpEdge(1) - hLaserTime.GetXaxis().GetBinLowEdge(1)
298 ytitle =
"Entries[/(" + str(BinWidth) +
" ns)]"
299 hLaserTime.GetYaxis().SetTitle(ytitle)
300 hLaserTime.SetTitle(ytitle_hLaser)
301 hLaserTimeCal.SetLineColor(2)
307 if hLaserTime.Integral(1, int(hLaserTime.GetXaxis().GetNbins() / 2)) < 0.5 * hLaserTime.Integral():
308 gStyle.SetStatX(0.475)
309 gStyle.SetStatY(0.875)
312 legendTime = TLegend(legX1, 0.875, legX2, 0.7)
313 legendTime.SetFillStyle(0)
314 legendTime.SetBorderSize(0)
315 legendTime.AddEntry(hLaserTime,
"non-cal. channel")
316 legendTime.AddEntry(hLaserTimeCal,
"cal. channel")
318 if hLaserTime.Integral() > 10:
321 BinTime = hLaserTime.GetXaxis().GetBinLowEdge(1)
323 while BinTime < hLaserTime.GetXaxis().GetBinUpEdge(hLaserTime.GetXaxis().GetNbins()):
324 tmpHeight = hLaserTime.GetBinContent(iBin)
325 BinTime = hLaserTime.GetXaxis().GetBinCenter(iBin)
326 if tmpHeight > MaxHeight:
327 MaxHeight = tmpHeight
330 hLaserTime.Fit(
"gaus",
"+",
"", PeakTime - FitWidth, PeakTime + FitWidth)
331 if hLaserTime.GetFunction(
"gaus"):
332 func = hLaserTime.GetFunction(
"gaus")
333 PeakTime = func.GetParameter(1)
334 PeakHeight = func.GetParameter(0)
336 PeakHeight = hLaserTime.GetBinContent(hLaserTime.GetXaxis().FindBin(PeakTime))
337 cutDirectHit +=
" && TMath::Abs(time-refTime-(" + str(PeakTime) +
"))<" + str(FitWidth)
338 cutReflHit +=
" && TMath::Abs(time-refTime-(" + str(PeakTime + DelayTimeRefl) +
"))<" + str(ReflHalfTimwRange)
342 arrow.SetLineColor(3)
343 line.DrawLine(PeakTime - FitWidth, 0.5, PeakTime - FitWidth, PeakHeight / 10.)
344 line.DrawLine(PeakTime + FitWidth, 0.5, PeakTime + FitWidth, PeakHeight / 10.)
365 arrow.DrawArrow(PeakTime - FitWidth, 5, PeakTime + FitWidth, 5, 0.01,
"<>")
380 gPad.SetFrameFillStyle(0)
382 tr.Draw(
"TMath::FloorNint((pixelId-1)/64+1):TMath::FloorNint((pixelId-1)%64+1)>>hLaserMap" +
383 str(slot) +
"(64,0.5,64.5,8,0.5,8.5)", cutDirectHit,
"colz")
384 hLaserMap = gROOT.FindObject(
"hLaserMap" + str(slot))
385 hLaserMap.Scale(1. / tr.GetEntries())
386 hLaserMap.SetStats(
False)
387 hLaserMap.SetTitle(root_output +
" - laser direct hit occupancy (hits/event)")
391 gPad.SetFrameFillStyle(0)
393 tr.Draw(
"TMath::FloorNint((pixelId-1)/64+1):TMath::FloorNint((pixelId-1)%64+1)>>hLaserReflMap" +
394 str(slot) +
"(64,0.5,64.5,8,0.5,8.5)",
395 (
"hitQuality>0 && hitQuality%10!=4 && " + slotCut
if IsCosmicRayData
else cutReflHit),
"colz")
396 hLaserReflMap = gROOT.FindObject(
"hLaserReflMap" + str(slot))
397 hLaserReflMap.Scale(1. / tr.GetEntries())
398 hLaserReflMap.SetStats(
False)
399 hLaserReflMap.SetTitle(root_output + (
" - hit map for the whole timing region (hits/event)"
400 if IsCosmicRayData
else " - laser reflected hit occupancy (hits/event)"))
404 gPad.SetFrameFillStyle(0)
406 hNHitAll[slot].SetStats(
False)
407 hNHitAll[slot].SetTitle(
"number of hits for " + slotstr)
408 hNHitAll[slot].SetLineColor(1)
409 hNHitNoCalCh[slot].SetLineColor(2)
410 hNHitAll[slot].Draw()
411 hNHitNoCalCh[slot].Draw(
"same")
412 latex.SetTextSize(0.05)
413 latex.SetTextAlign(33)
414 latex.DrawLatex(0.875, 0.785,
"underflow : " + str(int(hNHitAll[slot].GetBinContent(0) * 1000 / nEntries) / 10) +
"%")
415 latex.DrawLatex(0.875, 0.685,
"underflow : " + str(int(hNHitNoCalCh[slot].GetBinContent(0) * 1000 / nEntries) / 10) +
"%")
417 tr.Draw(
"Sum$(" + basicHitSelection +
"&& " + slotCut +
"&&TMath::Abs(time-refTime-(" +
418 str(PeakTime) +
"))<" + str(FitWidth) +
")>>hNHitLaser" + str(slot),
"",
"same")
419 hNHitLaser = gROOT.FindObject(
"hNHitLaser" + str(slot))
420 hNHitLaser.SetFillStyle(0)
421 hNHitLaser.SetLineColor(3)
422 nHitMeanLaser[slot - 1] = hNHitLaser.GetMean()
423 hMax = max(hNHitLaser.GetBinContent(hNHitLaser.GetMaximumBin()),
424 hNHitAll[slot].GetBinContent(hNHitAll[slot].GetMaximumBin()),
425 hNHitNoCalCh[slot].GetBinContent(hNHitNoCalCh[slot].GetMaximumBin()))
426 hNHitAll[slot].GetYaxis().SetRangeUser(0, 1.1 * hMax)
428 legstr =
"Laser direct hit (" + (
"single hit" if IsOfflineFEDisabled
else "multi hit") +
")"
429 legendSlot.AddEntry(hNHitLaser, legstr)
430 legendSlot.SetY1(0.55)
433 hMax = max(hNHitAll[slot].GetBinContent(hNHitAll[slot].GetMaximumBin()),
434 hNHitNoCalCh[slot].GetBinContent(hNHitNoCalCh[slot].GetMaximumBin()))
435 hNHitAll[slot].GetYaxis().SetRangeUser(0, 1.1 * hMax)
440 gPad.SetFrameFillStyle(0)
442 if IsOfflineFEDisabled
or IsCosmicRayData:
443 hRawTime = hRawTimeList[slot]
444 hRawTime.SetStats(
False)
445 hRawTime.SetTitle(
"rawTime distribution")
446 hRawTime.GetXaxis().SetTitle(
"rawTime")
447 ytitle =
"Entries [/(" + str(hRawTime.GetXaxis().GetBinUpEdge(1) - hRawTime.GetXaxis().GetBinLowEdge(1)) +
" samples)]"
448 hRawTime.GetYaxis().SetTitle(ytitle)
449 hRawTime.SetTitle(
"rawTime distribution : " + slotstr)
452 tr.Draw(
"time-refTime:TMath::FloorNint((pixelId-1)/8)>>hCalPulseInterval" + str(slot) +
"(64,-0.5,63.5,100,19,24)",
455 "hitQuality>=200 && " + slotCut,
"colz")
456 hCalPulseInterval = gROOT.FindObject(
"hCalPulseInterval" + str(slot))
457 hCalPulseInterval.GetXaxis().SetTitle(
"asic number = (pixelId-1)/8")
458 hCalPulseInterval.GetYaxis().SetTitle(
"time interval of double cal. pulses [ns]")
459 hCalPulseInterval.SetTitle(
"time interval of double calibration pulses : " + slotstr)
460 hCalPulseInterval.SetStats(
False)
463 gPad.SetFrameFillStyle(0)
466 tr.Draw(
"sample>>hSample" + str(slot) +
"(256,-0.5,255.5)",
467 "slotNum==" + str(slot) + (
"&&hitQuality>0&&hitQuality%10!=4" if IsCosmicRayData
468 else "&&hitQuality>=100&&hitQuality<200"))
469 hSample = gROOT.FindObject(
"hSample" + str(slot))
470 hSample.SetFillStyle(0)
471 hSample.SetLineColor(1)
472 hSample.SetStats(
False)
473 hSample.SetTitle(
"entries of each sample# for TBC : " + slotstr)
474 hSample.GetXaxis().SetTitle(
"Sample# for each hit" if IsCosmicRayData
475 else "Sample# of the first calibration pulse")
477 hSample.GetXaxis().GetBinLowEdge(1),
479 hSample.GetXaxis().GetBinUpEdge(
480 hSample.GetXaxis().GetNbins()),
483 canvas.Print(pdf_output)
485 canvas.Print((pdf_output +
"]"))
487 print(
" (nEvt >=3hits) (mean nhit) (no cal.ch) (nCalHit) (nCalHit wfm) (nHitLaser)")
488 for iSlot
in range(0, 16):
489 print(
"slot" +
"{0:02d}".format(iSlot + 1) +
490 " " +
"{0:7d}".format(int(nSlotEntriesAll[iSlot])) +
" \t " + str(
'%03.2f' % nHitMeanAll[iSlot]) +
491 " \t " + str(
'%03.2f' % nHitMeanNoCalCh[iSlot]) +
" \t" + str(
'%03.2f' % nSlotEntriesCalCh[iSlot]) +
492 " \t " + str(
'%03.2f' % nSlotEntriesCalChWfm[iSlot]) +
" \t " + str(
'%03.2f' % nHitMeanLaser[iSlot]))
494 print(
"nEntries = " + str(nEntries))
498 def plotInterimFEDataNtupleAdvanced(root_output, FitWidth=5):
500 pdf_output = root_output[0:root_output.rfind(
".root")] +
"_Advanced.png"
501 root_out = root_output[0:root_output.rfind(
".root")] +
"_Advanced.root"
503 print(root_output +
" --> " + pdf_output)
505 gStyle.SetFrameFillStyle(0)
506 gStyle.SetFillStyle(0)
509 gStyle.SetStatStyle(0)
510 gStyle.SetOptStat(112210)
511 gStyle.SetOptFit(1110)
512 canvas = TCanvas(
"cv2",
"cv2", 1600, 1600)
513 canvas.SetFillStyle(0)
515 f = TFile(root_output)
520 gPad.SetFrameFillStyle(0)
522 tr.Draw(
"rawTdc-refTdc:winNum>>hTimeVSWin(512, 0, 512, 60, -160, -130)",
"refTdc>0 && !isCalCh",
"colz")
523 hTimeVSWin = gROOT.FindObject(
"hTimeVSWin")
524 hTimeVSWin.GetXaxis().SetTitle(
"hit first window")
525 hTimeVSWin.GetYaxis().SetTitle(
"hit time - ref. time [ns]")
526 hTimeVSWin.SetStats(
False)
527 hTimeVSWin.SetTitle(root_output +
" hit time - ref time VS window number.")
530 gPad.SetFrameFillStyle(0)
532 tr.Draw(
"rawTdc-refTdc:sample>>hTimeVSSample(2560, 0, 256, 60, -160, -130)",
"refTdc>0 && !isCalCh",
"colz")
533 hTimeVSSample = gROOT.FindObject(
"hTimeVSSample")
534 hTimeVSSample.SetStats(
False)
535 hTimeVSSample.GetXaxis().SetTitle(
"hit sample [sample]")
536 hTimeVSSample.GetYaxis().SetTitle(
"hit time - ref. time [ns]")
537 hTimeVSSample.SetTitle(
"hit time - ref time VS hit time.")
541 gPad.SetFrameFillStyle(0)
543 tr.Draw(
"rawTdc-refTdc:pixelId>>hTimeVSPixel(512, 0, 512, 60, -160, -130 )",
"refTdc>0 && !isCalCh",
"colz")
544 hTimeVSPixel = gROOT.FindObject(
"hTimeVSPixel")
545 hTimeVSPixel.SetStats(
False)
546 hTimeVSPixel.GetXaxis().SetTitle(
"pixel ID")
547 hTimeVSPixel.GetYaxis().SetTitle(
"hit time - ref. time [ns]")
548 hTimeVSPixel.SetTitle(
"hit time - ref time VS pixel ID.")
552 gPad.SetFrameFillStyle(0)
554 tr.Draw(
"height:sample>>hHeightVSSample(256, 0, 256, 200, 0, 1000)",
"",
"colz")
555 hHeightVSSample = gROOT.FindObject(
"hHeightVSSample")
556 hHeightVSSample.SetStats(
False)
557 hHeightVSSample.GetXaxis().SetTitle(
"hit sample [sample]")
558 hHeightVSSample.GetYaxis().SetTitle(
"hit amplitude [ADC] ")
559 hHeightVSSample.SetTitle(
"amplitude VS hit time (incl calpulse).")
564 gPad.SetFrameFillStyle(0)
566 tr.Draw(
"sample>>hHitTime(400, -50, 350)")
567 hHitTime = gROOT.FindObject(
"hHitTime")
568 hHitTime.SetStats(
False)
569 hHitTime.GetXaxis().SetTitle(
"hit sample [sample]")
570 hHitTime.GetYaxis().SetTitle(
"entries / 1 sample ")
571 hHitTime.SetTitle(
"hit sample (incl calpulse).")
575 gPad.SetFrameFillStyle(0)
577 tr.Draw(
"Sum$(!isCalCh)>>hHitEff(200, 0, 200)",
"rawTdc-refTdc > -160 && rawTdc-refTdc < -130")
578 hHitEff = gROOT.FindObject(
"hHitEff")
579 hHitEff.GetXaxis().SetTitle(
"# of hits candidates per event")
580 hHitEff.SetTitle(
"# of laser hit candidates for each event in -160 < time < -130")
581 print(
"mean nHit value : " + str(hHitEff.GetMean()))
583 pave = hHitEff.FindObject(
"stats")
589 canvas.Print(pdf_output)
591 root_plot_out = TFile(root_out,
"recreate")
592 hTimeVSSample.Write()
594 hHeightVSSample.Write()
599 root_plot_out.Close()
603 if __name__ ==
'__main__':
607 plotInterimFEDataNtupleSummary(args[1])
611 print(args[0] +
" (output of plotInterimFEData)")