3 #include <onlmon/OnlMonClient.h>
7 #include <TGraphErrors.h>
17 #include <TPaveText.h>
37 std::cout <<
"initializing" << std::endl;
39 cemcStyle =
new TStyle(
"cemcStyle",
"cemcStyle");
52 gROOT->SetStyle(
"cemcStyle");
64 if (name ==
"CemcMon1")
67 TC[0] =
new TCanvas(name.c_str(),
"CemcMon Tower Hits", xsize/3 , 0, xsize/3, ysize*0.9);
72 gSystem->ProcessEvents();
73 Pad[0] =
new TPad(
"cemcpad0",
"hit map",0.,0.2,1.,1.);
76 transparent[0] =
new TPad(
"transparent0",
"this does not show", 0, 0, 1, 1);
81 warning[0] =
new TPad(
"warning0",
"hot tower warnings", 0, 0, 1, 0.2);
84 TC[0]->SetEditable(0);
86 else if (name ==
"CemcMon2")
89 TC[1] =
new TCanvas(name.c_str(),
"CemcMon2 Packet Information", 2*xsize /3, 0,2*xsize / 3, ysize*0.9);
90 gSystem->ProcessEvents();
91 Pad[1] =
new TPad(
"cemcpad1",
"packet event check", 0.0, 0.6, 1.0/2, 0.95, 0);
92 Pad[2] =
new TPad(
"cemcpad2",
"packet size", 0.0, 0.3, 1.0/2, 0.6, 0);
93 Pad[3] =
new TPad(
"cemcpad3",
"packet channels", 0.0, 0.0, 1.0/2, 0.3, 0);
98 transparent[1] =
new TPad(
"transparent1",
"this does not show", 0, 0, 1., 1);
103 warning[1] =
new TPad(
"warning1",
"packet warnings",0.5,0,1,1);
106 TC[1]->SetEditable(0);
108 else if (name ==
"CemcMon3")
110 TC[2] =
new TCanvas(name.c_str(),
"CemcMon Waveform Processing", xsize/3 , 0, xsize/3, ysize*0.9);
111 gSystem->ProcessEvents();
112 Pad[4] =
new TPad(
"cemcpad4",
"who needs this?", 0.0, 0.6, 1.0, 0.95, 0);
113 Pad[5] =
new TPad(
"cemcpad5",
"who needs this?", 0.0, 0.3, 1.0, 0.6, 0);
114 Pad[6] =
new TPad(
"cemcpad6",
"who needs this?", 0.0, 0.0, 1.0, 0.3, 0);
119 transparent[2] =
new TPad(
"transparent3",
"this does not show", 0, 0, 1, 1);
122 TC[2]->SetEditable(0);
124 else if (name ==
"CemcMon4")
126 TC[3] =
new TCanvas(name.c_str(),
"CemcMon Waveform Processing Expert", xsize / 3, 0, xsize / 3, ysize*0.9);
127 gSystem->ProcessEvents();
128 Pad[7] =
new TPad(
"cemcpad7",
"who needs this?", 0.0, 0.6, 1.0, 0.95, 0);
129 Pad[8] =
new TPad(
"cemcpad8",
"who needs this?", 0.0, 0.3, 1.0, 0.6, 0);
130 Pad[9] =
new TPad(
"cemcpad9",
"who needs this?", 0.0, 0.0, 1.0, 0.3, 0);
135 transparent[3] =
new TPad(
"transparent3",
"this does not show", 0, 0, 1, 1);
138 TC[3]->SetEditable(0);
149 if (what ==
"ALL" || what ==
"FIRST")
154 if (what ==
"ALL" || what ==
"SECOND")
159 if (what ==
"ALL" || what ==
"THIRD")
164 if (what ==
"ALL" || what ==
"FOURTH")
171 std::cout << __PRETTY_FUNCTION__ <<
" Unimplemented Drawing option: " << what << std::endl;
185 const int nHists = 4;
190 hist1[
i] = (TH2*)cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h2_cemc_rm");
191 if(hist1[
i] && start[0] == -1) start[0] =
i;
192 if(start[0] > -1 && hist1[
i])
194 hist1[
i] ->
SetName(Form(
"h2_cemc_rm_%d",i));
195 if(i != start[0])hist1[start[0]] -> Add(hist1[i],1);
200 TH2* h2_cemc_mean[
nSEBs];
204 h2_cemc_mean[
i] = (TH2*)cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h2_cemc_mean");
205 if( h2_cemc_mean[
i] && start[1] == -1) start[1] =
i;
206 if(start[1] > -1 && h2_cemc_mean[
i])
208 h2_cemc_mean[
i] ->
SetName(Form(
"h2_cemc_mean_%d",i));
209 if(i != start[1])h2_cemc_mean[start[1]] -> Add(h2_cemc_mean[i],1);
214 TH1* h_eventSource[
nSEBs];
219 h_eventSource[
i] = (TH1*)cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_event");
220 if(h_eventSource[
i] && start[2] == -1) start[2] =
i;
221 if(start[2] > -1 && h_eventSource[
i])
223 h_event[
i] = (TH1*)h_eventSource[i] -> Clone();
225 h_event[
i] ->
SetName(Form(
"h1_event_%d",i));
226 if(h_event[i] -> GetEntries() > maxEvent)
229 maxEvent = h_event[
i] -> GetEntries();
237 TC[0]->SetEditable(0);
243 TH1* adcCount[
nSEBs];
247 adcCount[
i] = (TH1*)cl->
getHisto(Form(
"CEMCMON_%i",
i),
"h1_cemc_adc");
249 if(adcCount[
i] && start[3] == -1) start[3] =
i;
250 if(start[3] > -1 && adcCount[
i])
252 adcCount[
i] ->
SetName(Form(
"h1_cemc_adc_%d",i));
253 if(i != start[3])adcCount[start[3]] -> Add(adcCount[i],1);
257 if (!gROOT->FindObject(
"CemcMon1"))
267 else h2_cemc_mean[start[1]]->Scale(1./maxEvent);
273 if(adcCount[start[3]]->GetMean())h2_cemc_mean[start[1]]->Scale(1./adcCount[start[3]]->GetMean());
275 if(adcCount[start[3]]->GetMean())hist1[start[0]] -> Scale(1./adcCount[start[3]]->GetMean());
282 if(h2_cemc_mean[start[1]]-> GetBinContent(
i+1,
j+1) < 0.75 && hist1[start[0]] -> GetBinContent(
i+1,
j+1) < 0.75) hist1[start[0]]->SetBinContent(
i+1,
j+1, h2_cemc_mean[start[1]] -> GetBinContent(
i+1,
j+1));
283 else hist1[start[0]] ->
SetBinContent(
i+1,
j+1, hist1[start[0]]->GetBinContent(
i+1,
j+1)/h2_cemc_mean[start[1]]->GetBinContent(
i+1,
j+1));
295 else hist1[start[0]]->SetBinContent(
i+1,
j+1, 0);
307 TC[0]->SetEditable(1);
311 hist1[start[0]]->GetXaxis()->SetTitle(
"eta index");
312 hist1[start[0]]->GetYaxis()->SetTitle(
"phi index");
313 hist1[start[0]]->GetZaxis()->SetTitle(
"Tower Running Mean/ Histogram Running Mean");
314 hist1[start[0]]->GetXaxis()->CenterTitle();
315 hist1[start[0]]->GetYaxis()->CenterTitle();
316 hist1[start[0]]->GetZaxis()->CenterTitle();
317 hist1[start[0]]->GetXaxis()->SetNdivisions(12,kFALSE);
318 hist1[start[0]]->GetYaxis()->SetNdivisions(32,kFALSE);
321 hist1[start[0]]->GetXaxis()->SetLabelSize(tsize);
322 hist1[start[0]]->GetYaxis()->SetLabelSize(tsize);
323 hist1[start[0]]->GetYaxis()->SetTitleOffset(1.4);
324 hist1[start[0]]->GetZaxis()->SetLabelSize(tsize);
325 hist1[start[0]]->GetXaxis()->SetTitleSize(tsize);
326 hist1[start[0]]->GetYaxis()->SetTitleSize(tsize);
327 hist1[start[0]]->GetXaxis()->SetTickLength(0.02);
331 TLine *line_sector[32];
332 for(
int i_line=0;i_line<32;i_line++)
334 line_sector[i_line] =
new TLine(0,(i_line+1)*8,96,(i_line+1)*8);
335 line_sector[i_line]->SetLineColor(1);
336 line_sector[i_line]->SetLineWidth(1);
337 line_sector[i_line]->SetLineStyle(1);
341 const int numVertDiv = 12;
342 int dEI = 96/numVertDiv;
343 TLine *l_board[numVertDiv-1];
344 for(
int il=1; il<numVertDiv; il++){
345 l_board[il-1] =
new TLine(dEI*il,0,dEI*il,256);
346 l_board[il-1]->SetLineColor(1);
347 l_board[il-1]->SetLineWidth(1);
348 l_board[il-1]->SetLineStyle(1);
349 if(il==6) l_board[il-1]->SetLineWidth(2);
352 gPad->SetTopMargin(0.08);
353 gPad->SetBottomMargin(0.07);
354 gPad->SetLeftMargin(0.08);
355 gPad->SetRightMargin(0.12);
360 Int_t palette[3] = {kGray+2,8,2};
362 gROOT->SetStyle(
"cemcStyle");
364 gStyle->SetPalette(3,palette);
365 double_t
levels[4] = {0,0.75,1.25,2};
366 hist1[start[0]] ->
GetZaxis() -> SetRangeUser(0,2);
367 hist1[start[0]] ->SetContour(4,levels);
369 hist1[start[0]]->DrawCopy(
"colz");
371 for(
int i_line=0;i_line<32;i_line++) line_sector[i_line]->
Draw();
372 for(
int il=0; il<numVertDiv-1; il++) l_board[il]->
Draw();
376 PrintRun.SetTextFont(62);
377 PrintRun.SetTextSize(0.04);
379 PrintRun.SetTextAlign(23);
380 std::ostringstream runnostream;
381 std::ostringstream runnostream2;
383 time_t evttime = cl->
EventTime(
"CURRENT");
385 runnostream <<
"Running mean of Tower Hits Normalized by All Towers " ;
386 runnostream2 <<
"Run " << cl->
RunNumber() <<
", Time: " << ctime(&evttime);
388 runstring = runnostream.str();
389 PrintRun.DrawText(0.5, 0.99, runstring.c_str());
390 runstring = runnostream2.str();
391 PrintRun.DrawText(0.5, 0.966, runstring.c_str());
395 TC[0]->SetEditable(0);
396 if(
save)
TC[0] -> SaveAs(
"plots/towerHits.pdf");
408 TH1* h_eventSource[
nSEBs];
414 h_eventSource[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_event");
415 if(h_eventSource[
i] && start[0] == -1) start[0] =
i;
416 if(start[0] > -1 && h_eventSource[
i])
418 h_event[
i] = (TH1*)h_eventSource[i] -> Clone();
419 h_event[
i] ->
SetName(Form(
"h1_event_%d",i));
420 if( h_event[i] -> GetEntries() > maxEvent)
423 maxEvent = h_event[
i] -> GetEntries();
428 TH1* h1_packet_number[
nSEBs];
432 h1_packet_number[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_packet_number");
433 if(h1_packet_number[
i] && start[1] == -1) start[1] =
i;
434 if(start[1] > -1 && h1_packet_number[
i])
436 h1_packet_number[
i] ->
SetName(Form(
"h1_papcket_number_%d",i));
437 if(i != start[1])h1_packet_number[start[1]] -> Add(h1_packet_number[i],1);
441 TH1* h1_packet_length[
nSEBs];
445 h1_packet_length[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_packet_length");
446 if(h1_packet_length[
i] && start[2] == -1) start[2] =
i;
447 if(start[2] > -1 && h1_packet_length[
i])
449 h1_packet_length[
i] ->
SetName(Form(
"h1_papcket_length_%d",i));
450 if(i != start[2])h1_packet_length[start[2]] -> Add(h1_packet_length[i],1);
455 TH1* h1_packet_chans[
nSEBs];
459 h1_packet_chans[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_packet_chans");
460 if(h1_packet_chans[
i] && start[3] == -1) start[3] =
i;
461 if(start[3] > -1 && h1_packet_chans[
i])
463 h1_packet_chans[
i] ->
SetName(Form(
"h1_papcket_chans_%d",i));
464 if(i != start[3])h1_packet_chans[start[3]] -> Add(h1_packet_chans[i],1);
468 if (start[0] < 0 || start[1] < 0 || start[2] < 0)
471 TC[1]->SetEditable(0);
482 h1_packet_number[start[1]] -> Scale(1./maxEvent);
483 h1_packet_length[start[2]] -> Scale(1./maxEvent);
484 h1_packet_chans[start[3]] -> Scale(1./maxEvent);
487 if (!gROOT->FindObject(
"CemcMon2"))
492 TC[1]->SetEditable(1);
495 TLine *one =
new TLine(6000.5,1,6128.5,1);
498 TLine *goodSize =
new TLine(6000.5,5981,6128.5,5981);
501 TLine *goodChans =
new TLine(6000.5,192,6128.5,192);
507 TLegend *
leg =
new TLegend(0.3,0.70,0.95,0.90);
511 TLine *warnLineOne =
new TLine(6000.5,param*1,6128.5,param*1);
515 leg ->
AddEntry(warnLineOne,Form(
"%g%% Threshold",param*100),
"l");
517 TLine *warnLineOneS =
new TLine(6000.5,param*1,6128.5,param*1);
521 leg ->
AddEntry(warnLineOneS,Form(
"%g%% Threshold, High Eta, South",100*param),
"l");
523 TLine *warnLineSize =
new TLine(6000.5,param*5981.,6128.5,param*5981.);
527 TLine *warnLineSizeS =
new TLine(6000.5,param*3991.,6128.5,param*3991.);
531 TLine *warnLineChans =
new TLine(6000.5,param*192.,6128.5,param*192.);
535 TLine *warnLineChansS =
new TLine(6000.5,param*128.,6128.5,param*128.);
541 h1_packet_number[start[1]] ->
GetYaxis() -> SetRangeUser(0.0,1.3);
542 std::vector<std::vector<int>> badPackets;
543 badPackets.push_back(
getBadPackets(h1_packet_number[start[1]],0,param));
545 h1_packet_number[start[1]]->GetXaxis()->SetNdivisions(510,kTRUE);
546 h1_packet_number[start[1]]->GetXaxis()->SetTitle(
"packet #");
547 h1_packet_number[start[1]]->GetYaxis()->SetTitle(
"% Of Events Present");
548 h1_packet_number[start[1]]->GetXaxis()->SetLabelSize(tsize-0.01);
549 h1_packet_number[start[1]]->GetYaxis()->SetLabelSize(tsize-0.01);
550 h1_packet_number[start[1]]->GetXaxis()->SetTitleSize(tsize-0.01);
551 h1_packet_number[start[1]]->GetYaxis()->SetTitleSize(tsize-0.01);
552 h1_packet_number[start[1]]->GetXaxis()->SetTitleOffset(1);
553 gPad->SetBottomMargin(0.16);
554 gPad->SetLeftMargin(0.16);
555 gPad->SetRightMargin(0.05);
556 gPad->SetLeftMargin(0.15);
559 h1_packet_number[start[1]] -> DrawCopy(
"hist");
561 warnLineOne ->
Draw(
"same");
564 h1_packet_length[start[2]] ->
GetYaxis() -> SetRangeUser(0,6500);
565 badPackets.push_back(
getBadPackets(h1_packet_length[start[2]],1,param));
567 h1_packet_length[start[2]]->GetXaxis()->SetNdivisions(510,kTRUE);
568 h1_packet_length[start[2]]->GetXaxis()->SetTitle(
"packet #");
569 h1_packet_length[start[2]]->GetYaxis()->SetTitle(
"Average Packet Size");
570 h1_packet_length[start[2]]->GetXaxis()->SetLabelSize(tsize-.01);
571 h1_packet_length[start[2]]->GetYaxis()->SetLabelSize(tsize);
572 h1_packet_length[start[2]]->GetXaxis()->SetTitleSize(tsize-.01);
573 h1_packet_length[start[2]]->GetYaxis()->SetTitleSize(tsize);
574 h1_packet_length[start[2]]->GetXaxis()->SetTitleOffset(1);
575 h1_packet_length[start[2]]->GetYaxis()->SetTitleOffset(0.9);
576 h1_packet_length[start[2]]->GetYaxis()->SetRangeUser(0,10000);
577 gPad->SetBottomMargin(0.16);
578 gPad->SetLeftMargin(0.16);
579 gPad->SetRightMargin(0.05);
580 gPad->SetLeftMargin(0.15);
583 h1_packet_length[start[2]] -> DrawCopy(
"hist");
584 goodSize ->
Draw(
"same");
585 warnLineSize ->
Draw(
"same");
586 warnLineSizeS ->
Draw(
"same");
591 h1_packet_chans[start[3]] ->
GetYaxis() -> SetRangeUser(0,212);
592 badPackets.push_back(
getBadPackets(h1_packet_chans[start[3]],2,param));
593 h1_packet_chans[start[3]]->GetXaxis()->SetNdivisions(510,kTRUE);
594 h1_packet_chans[start[3]]->GetXaxis()->SetTitle(
"packet #");
595 h1_packet_chans[start[3]]->GetYaxis()->SetTitle(
"Average # of Channels");
596 h1_packet_chans[start[3]]->GetXaxis()->SetLabelSize(tsize-.01);
597 h1_packet_chans[start[3]]->GetYaxis()->SetLabelSize(tsize);
598 h1_packet_chans[start[3]]->GetXaxis()->SetTitleSize(tsize-.01);
599 h1_packet_chans[start[3]]->GetYaxis()->SetTitleSize(tsize);
600 h1_packet_chans[start[3]]->GetXaxis()->SetTitleOffset(0.8);
601 h1_packet_chans[start[3]]->GetYaxis()->SetTitleOffset(0.8);
602 gPad->SetBottomMargin(0.16);
603 gPad->SetLeftMargin(0.16);
604 gPad->SetRightMargin(0.05);
605 gPad->SetLeftMargin(0.15);
608 h1_packet_chans[start[3]] -> DrawCopy(
"hist");
609 goodChans ->
Draw(
"same");
610 warnLineChans ->
Draw(
"same");
611 warnLineChansS ->
Draw(
"same");
614 TLegend *badPacks =
new TLegend(0,1/4.,1,0.9);
615 TPaveText *
title =
new TPaveText(0,0.9,1,0.95);
616 title -> AddText(
"Bad Packets");
617 badPacks -> SetNColumns(8);
622 for(
int i = 0;
i < 3;
i++)
624 for(
int j = 0;
j < (int)badPackets[
i].
size();
j++)
628 if(badPackets[
i][
j] == 0)
continue;
632 badPacks ->
AddEntry(
"",Form(
"%d",badPackets[
i][
j]),
"");
639 badPacks ->
AddEntry(
"",Form(
"%d",badPackets[
i].
at(j)),
"");
647 badPacks ->
AddEntry(
"",Form(
"%d",badPackets[
i].
at(j)),
"");
652 badPacks ->
AddEntry(
"",Form(
"%d",badPackets[
i].
at(j)),
"");
661 TPaveText *desc =
new TPaveText(0,0,1,0.25);
662 desc -> AddText(Form(
"Currently %.2g%% of packets are reporting a problem",badboys/128.*100));
663 desc -> AddText(
"Packets will be reported bad as above for the following reasons:" );
664 desc -> AddText(Form(
"A packet appears in less than %g %% of events",param*100));
665 desc -> AddText(Form(
"A packet is less than %g %% of size 5981",param*100));
666 desc -> AddText(Form(
"A packet sees fewer than %g %% of 192 channels",param*100));
669 PrintRun.SetTextFont(62);
670 PrintRun.SetTextSize(0.02);
672 PrintRun.SetTextAlign(23);
673 std::ostringstream runnostream;
675 std::ostringstream runnostream2;
676 time_t evttime = cl->
EventTime(
"CURRENT");
679 runnostream <<
"Packet Information";
680 runnostream2 <<
" Run " << cl->
RunNumber() <<
", Time: " << ctime(&evttime);
683 runstring = runnostream.str();
684 PrintRun.DrawText(0.5,.99, runstring.c_str());
686 runstring = runnostream2.str();
687 PrintRun.DrawText(0.5, .966, runstring.c_str());
690 TC[1]->SetEditable(0);
691 if(
save)
TC[1] -> SaveAs(
"plots/packets.pdf");
701 TH2* h2_waveform_twrAvg[
nSEBs];
707 h2_waveform_twrAvg[
i] = (TH2*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h2_waveform_twrAvg");
708 if(h2_waveform_twrAvg[
i] && start[0] == -1) start[0] =
i;
709 if(start[0] > -1 && h2_waveform_twrAvg[
i])
711 h2_waveform_twrAvg[
i] ->
SetName(Form(
"h2_waveform_twrAvg_%d",i));
712 h2_waveform_twrAvg[start[0]] -> Add(h2_waveform_twrAvg[i],1);
716 TH1* h1_waveform_time[
nSEBs];
720 h1_waveform_time[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_waveform_time");
721 if(h1_waveform_time[
i] && start[1] == -1) start[1] =
i;
722 if(start[1] > -1 && h1_waveform_time[
i])
724 h1_waveform_time[
i] ->
SetName(Form(
"h1_waveform_time_%d",i));
725 h1_waveform_time[start[1]] -> Add(h1_waveform_time[i],1);
729 TH1* h1_waveform_pedestal[
nSEBs];
733 h1_waveform_pedestal[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_waveform_pedestal");
735 if(h1_waveform_pedestal[
i] && start[2] == -1) start[2] =
i;
736 if(start[2] > -1 && h1_waveform_pedestal[
i])
738 h1_waveform_pedestal[
i] ->
SetName(Form(
"h1_waveform_pedestal_%d",i));
739 h1_waveform_pedestal[start[2]] -> Add(h1_waveform_pedestal[i],1);
743 if (!gROOT->FindObject(
"CemcMon3"))
748 TC[2]->SetEditable(1);
751 if (start[0] < 0 || start[1] < 0|| start[2] < 0)
754 TC[2]->SetEditable(0);
758 gStyle->SetTitleFontSize(0.03);
759 float ymaxp = h2_waveform_twrAvg[start[0]]->ProfileX()->GetMaximum();
760 h2_waveform_twrAvg[start[0]] ->
GetYaxis() -> SetRangeUser(0,ymaxp*10);
765 h2_waveform_twrAvg[start[0]]->GetXaxis()->SetNdivisions(16);
766 h2_waveform_twrAvg[start[0]]->GetXaxis()->SetTitle(
"sample #");
767 h2_waveform_twrAvg[start[0]]->GetYaxis()->SetTitle(
"Waveform ADC in latest event [ADC]");
768 h2_waveform_twrAvg[start[0]]->GetXaxis()->SetLabelSize(tsize-.01);
769 h2_waveform_twrAvg[start[0]]->GetYaxis()->SetLabelSize(tsize);
770 h2_waveform_twrAvg[start[0]]->GetXaxis()->SetTitleSize(tsize-.01);
771 h2_waveform_twrAvg[start[0]]->GetYaxis()->SetTitleSize(tsize);
772 h2_waveform_twrAvg[start[0]]->GetXaxis()->SetTitleOffset(1.);
773 h2_waveform_twrAvg[start[0]]->GetYaxis()->SetTitleOffset(1.2);
774 TLine *windowLow1 =
new TLine(4,0,4,ymaxp*10);
775 TLine *windowHigh1 =
new TLine(10,0,10,ymaxp*10);
777 gPad->SetBottomMargin(0.16);
778 gPad->SetLeftMargin(0.16);
779 gPad->SetRightMargin(0.05);
780 gPad->SetLeftMargin(0.15);
783 h2_waveform_twrAvg[start[0]]->DrawCopy(
"colz");
784 windowLow1 ->
Draw(
"same");
785 windowHigh1 ->
Draw(
"same");
786 gStyle -> SetPalette(57);
790 PrintRun.SetTextFont(62);
791 PrintRun.SetTextSize(0.03);
793 PrintRun.SetTextAlign(23);
794 std::ostringstream runnostream;
795 std::ostringstream runnostream2;
797 time_t evttime = cl->
EventTime(
"CURRENT");
799 runnostream <<
"Waveform fitting";
800 runnostream2 <<
"Run " << cl->
RunNumber() <<
", Time: " << ctime(&evttime);
804 runstring = runnostream.str();
805 PrintRun.DrawText(0.5, 0.99, runstring.c_str());
807 runstring = runnostream2.str();
808 PrintRun.DrawText(0.5, 0.966, runstring.c_str());
812 gStyle->SetTitleFontSize(0.06);
814 h1_waveform_time[start[1]]->GetXaxis()->SetNdivisions(16);
815 h1_waveform_time[start[1]]->GetXaxis()->SetTitle(
"waveform peak position [sample #]");
816 h1_waveform_time[start[1]]->GetYaxis()->SetTitle(
"Fraction of Towers");
817 h1_waveform_time[start[1]]->GetXaxis()->SetLabelSize(tsize2);
818 h1_waveform_time[start[1]]->GetYaxis()->SetLabelSize(tsize2);
819 h1_waveform_time[start[1]]->GetXaxis()->SetTitleSize(tsize2);
820 h1_waveform_time[start[1]]->GetYaxis()->SetTitleSize(tsize2);
821 h1_waveform_time[start[1]]->GetXaxis()->SetTitleOffset(1.0);
822 h1_waveform_time[start[1]]->GetYaxis()->SetTitleOffset(.85);
824 if(h1_waveform_time[start[1]]->GetEntries())h1_waveform_time[start[1]] -> Scale(1./h1_waveform_time[start[1]]->GetEntries());
825 TLine *windowLow2 =
new TLine(4,0,4,h1_waveform_time[start[1]]->GetMaximum());
826 TLine *windowHigh2 =
new TLine(10,0,10,h1_waveform_time[start[1]]->GetMaximum());
827 gPad->SetTopMargin(0.06);
828 gPad->SetBottomMargin(0.18);
829 gPad->SetRightMargin(0.05);
831 gPad->SetLeftMargin(0.15);
834 h1_waveform_time[start[1]]->DrawCopy(
"hist");
835 windowLow2 ->
Draw(
"same");
836 windowHigh2 ->
Draw(
"same");
840 gStyle->SetTitleFontSize(0.06);
842 h1_waveform_pedestal[start[2]]->GetXaxis()->SetNdivisions(8);
843 h1_waveform_pedestal[start[2]]->GetXaxis()->SetTitle(
"ADC Pedestal");
844 h1_waveform_pedestal[start[2]]->GetYaxis()->SetTitle(
"Fraction of Towers");
845 h1_waveform_pedestal[start[2]]->GetXaxis()->SetLabelSize(tsize2);
846 h1_waveform_pedestal[start[2]]->GetYaxis()->SetLabelSize(tsize2);
847 h1_waveform_pedestal[start[2]]->GetXaxis()->SetTitleSize(tsize2);
848 h1_waveform_pedestal[start[2]]->GetYaxis()->SetTitleSize(tsize2);
849 h1_waveform_pedestal[start[2]]->GetXaxis()->SetTitleOffset(1);
850 h1_waveform_pedestal[start[2]]->GetYaxis()->SetTitleOffset(0.85);
851 if(h1_waveform_pedestal[start[2]]->GetEntries())h1_waveform_pedestal[start[2]] -> Scale(1./h1_waveform_pedestal[start[2]]->GetEntries());
853 gPad->SetTopMargin(0.06);
854 gPad->SetBottomMargin(0.18);
855 gPad->SetRightMargin(0.05);
857 gPad->SetLeftMargin(0.15);
860 h1_waveform_pedestal[start[2]]->DrawCopy(
"hist");
864 TC[2]->SetEditable(0);
865 if(
save)
TC[2] -> SaveAs(
"plots/waveform.pdf");
874 TH1 *h_waveform_sigDiff[
nSEBs];
879 h_waveform_sigDiff[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_fitting_sigDiff");
880 if(h_waveform_sigDiff[
i] && start[0] == -1) start[0] =
i;
881 if(start[0] > -1 && h_waveform_sigDiff[
i])
883 h_waveform_sigDiff[
i] ->
SetName(Form(
"h_fitting_sigDiff_%d",i));
884 h_waveform_sigDiff[start[0]] -> Add(h_waveform_sigDiff[i],1);
888 TH1 *h_waveform_pedDiff[
nSEBs];
892 h_waveform_pedDiff[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_fitting_pedDiff");
893 if(h_waveform_pedDiff[
i] && start[1] == -1) start[1] =
i;
894 if(start[1] > -1 && h_waveform_pedDiff[
i])
896 h_waveform_pedDiff[
i] ->
SetName(Form(
"h_fitting_pedDiff_%d",i));
897 h_waveform_pedDiff[start[1]] -> Add(h_waveform_pedDiff[i],1);
901 TH1 *h_waveform_timeDiff[
nSEBs];
905 h_waveform_timeDiff[
i] = (TH1*) cl->
getHisto(Form(
"CEMCMON_%d",
i),
"h1_fitting_timeDiff");
906 if(h_waveform_timeDiff[
i] && start[2] == -1) start[2] =
i;
907 if(start[2] > -1 && h_waveform_timeDiff[
i])
909 h_waveform_timeDiff[
i] ->
SetName(Form(
"h_fitting_timeDiff_%d",i));
910 h_waveform_timeDiff[start[2]] -> Add(h_waveform_timeDiff[i],1);
914 if(!gROOT -> FindObject(
"CemcMon4"))
919 TC[3]->SetEditable(1);
921 if(start[0] < 0|| start[1] < 0 || start[2] < 0)
924 TC[3]->SetEditable(0);
928 gStyle->SetTitleFontSize(0.03);
932 PrintRun.SetTextFont(62);
933 PrintRun.SetTextSize(0.03);
935 PrintRun.SetTextAlign(23);
936 std::ostringstream runnostream;
937 std::ostringstream runnostream2;
939 time_t evttime = cl->
EventTime(
"CURRENT");
941 runnostream <<
"Waveform Template vs. Fast Fitting";
942 runnostream2 <<
"Run " << cl->
RunNumber() <<
", Time: " << ctime(&evttime);
946 runstring = runnostream.str();
947 PrintRun.DrawText(0.5, 0.99, runstring.c_str());
950 runstring = runnostream2.str();
951 PrintRun.DrawText(0.5, 0.966, runstring.c_str());
956 gStyle->SetTitleFontSize(0.06);
959 h_waveform_sigDiff[start[0]]->GetXaxis()->SetNdivisions(16);
960 h_waveform_sigDiff[start[0]]->GetXaxis()->SetTitle(
"Fast ADC/Template ADC");
961 h_waveform_sigDiff[start[0]]->GetYaxis()->SetTitle(
"Fraction of Towers");
962 h_waveform_sigDiff[start[0]]->GetXaxis()->SetLabelSize(tsize2-.01);
963 h_waveform_sigDiff[start[0]]->GetYaxis()->SetLabelSize(tsize2-.01);
964 h_waveform_sigDiff[start[0]]->GetXaxis()->SetTitleSize(tsize2-.01);
965 h_waveform_sigDiff[start[0]]->GetYaxis()->SetTitleSize(tsize2-.01);
966 h_waveform_sigDiff[start[0]]->GetXaxis()->SetTitleOffset(.9);
967 h_waveform_sigDiff[start[0]]->GetYaxis()->SetTitleOffset(1.1);
968 if(h_waveform_sigDiff[start[0]] -> GetEntries())h_waveform_sigDiff[start[0]] -> Scale(1./h_waveform_sigDiff[start[0]] -> GetEntries());
969 gPad->SetTopMargin(0.06);
970 gPad->SetBottomMargin(0.18);
971 gPad->SetRightMargin(0.05);
972 gPad->SetLeftMargin(0.15);
973 gStyle->SetOptStat(0);
976 h_waveform_sigDiff[start[0]]->DrawCopy(
"hist");
980 gStyle->SetTitleFontSize(0.06);
982 h_waveform_pedDiff[start[1]]->GetXaxis()->SetNdivisions(16);
983 h_waveform_pedDiff[start[1]]->GetXaxis()->SetTitle(
"Fast Pedestal/Template Pedestal");
984 h_waveform_pedDiff[start[1]]->GetYaxis()->SetTitle(
"Fraction of Towers");
985 h_waveform_pedDiff[start[1]]->GetXaxis()->SetLabelSize(tsize2);
986 h_waveform_pedDiff[start[1]]->GetYaxis()->SetLabelSize(tsize2);
987 h_waveform_pedDiff[start[1]]->GetXaxis()->SetTitleSize(tsize2);
988 h_waveform_pedDiff[start[1]]->GetYaxis()->SetTitleSize(tsize2);
989 h_waveform_pedDiff[start[1]]->GetXaxis()->SetTitleOffset(0.9);
990 h_waveform_pedDiff[start[1]]->GetYaxis()->SetTitleOffset(0.9);
991 if(h_waveform_pedDiff[start[1]] -> GetEntries())h_waveform_pedDiff[start[1]] -> Scale(1./ h_waveform_pedDiff[start[1]] -> GetEntries());
992 gPad->SetTopMargin(0.06);
993 gPad->SetBottomMargin(0.18);
994 gPad->SetRightMargin(0.05);
995 gPad->SetLeftMargin(0.15);
996 gStyle->SetOptStat(0);
999 h_waveform_pedDiff[start[1]]->DrawCopy(
"hist");
1003 h_waveform_timeDiff[start[2]]->GetXaxis()->SetNdivisions(16);
1004 h_waveform_timeDiff[start[2]]->GetXaxis()->SetTitle(
"Fast Peak Time - Template Peak Time");
1005 h_waveform_timeDiff[start[2]]->GetYaxis()->SetTitle(
"Fraction of Towers");
1006 h_waveform_timeDiff[start[2]]->GetXaxis()->SetLabelSize(tsize2);
1007 h_waveform_timeDiff[start[2]]->GetYaxis()->SetLabelSize(tsize2);
1008 h_waveform_timeDiff[start[2]]->GetXaxis()->SetTitleSize(tsize2);
1009 h_waveform_timeDiff[start[2]]->GetYaxis()->SetTitleSize(tsize2);
1010 h_waveform_timeDiff[start[2]]->GetXaxis()->SetTitleOffset(0.9);
1011 h_waveform_timeDiff[start[2]]->GetYaxis()->SetTitleOffset(0.9);
1012 if(h_waveform_timeDiff[start[2]]->GetEntries())h_waveform_timeDiff[start[2]] -> Scale(1./ h_waveform_timeDiff[start[2]]->GetEntries());
1013 gPad->SetTopMargin(0.06);
1014 gPad->SetBottomMargin(0.18);
1015 gPad->SetRightMargin(0.05);
1016 gPad->SetLeftMargin(0.15);
1019 h_waveform_timeDiff[start[2]]->DrawCopy(
"hist");
1024 TC[3]->SetEditable(0);
1025 gStyle->SetOptStat(0);
1026 if(
save)
TC[3] -> SaveAs(
"plots/waveformExpert.pdf");
1034 float hot_threshold = 1.25;
1035 float dead_threshold = 0.75;
1036 float nTowerTotal = 24576.-2048.;
1040 if(ieta < 8)
continue;
1041 if(hhit -> GetBinContent(ieta+1, iphi+1) == 0)
continue;
1042 double nhit = hhit->GetBinContent(ieta+1, iphi+1);
1044 if(nhit > hot_threshold) nhott++;
1047 if(nhit < dead_threshold) ndeadt++;
1054 TPaveText *dead =
new TPaveText(0.01,0.7,0.33,1);
1056 dead -> SetTextColor(kWhite);
1057 dead -> AddText(Form(
"Cold towers: %.3g%%",100*ndeadt/nTowerTotal));
1062 TPaveText *good =
new TPaveText(0.33,0.7,0.66,1);
1064 good -> AddText(Form(
"Good towers: %.3g%%",100*(nTowerTotal-ndeadt-nhott)/nTowerTotal));
1065 TPaveText *hot =
new TPaveText(0.66,0.7,1,1);
1067 hot -> AddText(Form(
"Hot towers: %.3g%%",100*nhott/nTowerTotal));
1072 TPaveText *warn =
new TPaveText(0.01,0.1,1,0.7);
1074 warn -> AddText(
"Helpful Numbers: 1 Box = Interface Board (IB)");
1075 warn -> AddText(
"3 Boxes (horiz) = 1 Packet; 6 Boxes (horiz) = 1 Sector");
1078 warn -> AddText(
"For now, watch for entire IB's or sectors going dead");
1084 warningpad->Update();
1093 int iret =
Draw(what);
1099 for (TCanvas *canvas :
TC)
1101 if (canvas ==
nullptr)
1115 int iret =
Draw(what);
1124 for (TCanvas *canvas :
TC)
1126 if (canvas ==
nullptr)
1157 float params[3] = {1., 5981., 192.};
1158 float params2[3] = {1., 3991., 128.};
1160 std::vector<int> badpacks = {0};
1162 for(
int i = 1;
i < hist -> GetNbinsX();
i++)
1164 if((hist -> GetBinContent(
i) < params[what]*cutoff || hist -> GetBinContent(
i) > params[what]) && !(((6000 +
i - 2.)/4.) == floor(((6000 +
i - 2)/4))) ) badpacks.push_back(
i+6000);
1166 else if((hist -> GetBinContent(
i) < params2[what]*cutoff || hist -> GetBinContent(
i) > params2[what]) && (((6000 +
i - 2.)/4.) == floor(((6000 +
i - 2)/4))) ) badpacks.push_back(
i+6000);
1175 time_t currtime = cl->
EventTime(
"CURRENT");