3 #include <onlmon/OnlMonClient.h>
8 #include <TGraphErrors.h>
44 std::cout <<
"HcalMonDraw::HcalMonDraw() ERROR: name does not start with O or I " <<
ThisName << std::endl;
52 hcalStyle =
new TStyle(
"hcalStyle",
"hcalStyle");
64 gROOT->SetStyle(
"hcalStyle");
75 if (name ==
"HcalMon1")
78 TC[0] =
new TCanvas(name.c_str(),
"Hcal Towers", xsize / 3, 0, xsize / 3, ysize * 0.9);
83 gSystem->ProcessEvents();
84 Pad[0] =
new TPad(
"hist",
"On the top", 0., 0.2, 1., 1.);
88 transparent[0] =
new TPad(
"transparent0",
"this does not show", 0, 0, 1, 1);
93 warning[0] =
new TPad(
"warning0",
"this does not show", 0, 0, 0.9, 0.2);
97 TC[0]->SetEditable(0);
99 else if (name ==
"HcalMon2")
102 TC[1] =
new TCanvas(name.c_str(),
"Hcal Sector Running Mean", xsize / 3, 0, xsize / 3, ysize * 0.9);
103 gSystem->ProcessEvents();
104 Pad[2] =
new TPad(
"hcalpad3",
"who needs this?", 0.0, 0.0, 1, 0.92, 0);
109 transparent[1] =
new TPad(
"transparent1",
"this does not show", 0, 0, 1, 1);
112 TC[1]->SetEditable(0);
114 else if (name ==
"HcalMon3")
116 TC[3] =
new TCanvas(name.c_str(),
"HcalMon3 Waveform Info", xsize / 3, 0, xsize / 3, ysize * 0.9);
117 gSystem->ProcessEvents();
118 Pad[6] =
new TPad(
"hcalpad6",
"who needs this?", 0.0, 0.6, 1.0, 0.95, 0);
119 Pad[7] =
new TPad(
"hcalpad7",
"who needs this?", 0.0, 0.3, 1.0, 0.6, 0);
120 Pad[8] =
new TPad(
"hcalpad8",
"who needs this?", 0.0, 0.0, 1.0, 0.3, 0);
125 transparent[3] =
new TPad(
"transparent3",
"this does not show", 0, 0, 1, 1);
128 TC[3]->SetEditable(0);
130 else if (name ==
"HcalMon4")
133 TC[5] =
new TCanvas(name.c_str(),
"HCAL Packet Information", 2 * xsize / 3, 0, 2 * xsize / 3, ysize * 0.9);
134 gSystem->ProcessEvents();
135 Pad[10] =
new TPad(
"pad10",
"packet event check", 0.0, 0.6, 1.0 / 2, 0.95, 0);
136 Pad[11] =
new TPad(
"pad11",
"packet size", 0.0, 0.3, 1.0 / 2, 0.6, 0);
137 Pad[12] =
new TPad(
"pad12",
"packet channels", 0.0, 0.0, 1.0 / 2, 0.3, 0);
138 Pad[13] =
new TPad(
"pad13",
"event number offset", 0.5, 0.6, 1.0, 0.95, 0);
140 Pad[14] =
new TPad(
"pad14",
"correlation0", 0.5, 0.3, 0.75, 0.6, 0);
141 Pad[15] =
new TPad(
"pad15",
"correlation1", 0.75, 0.3, 1.0, 0.6, 0);
150 transparent[5] =
new TPad(
"transparent1",
"this does not show", 0, 0, 1., 1);
155 warning[1] =
new TPad(
"warning1",
"packet warnings", 0.5, 0, 1, 0.2);
156 warning[1]->SetFillStyle(4000);
158 TC[5]->SetEditable(0);
160 else if (name ==
"HcalMon5")
162 TC[6] =
new TCanvas(name.c_str(),
"HcalMon5 Trigger Info", xsize / 2, 0, xsize / 2, ysize * 0.9);
163 gSystem->ProcessEvents();
164 Pad[16] =
new TPad(
"hcalpad16",
"who needs this?", 0.0, 0.3, 0.5, 0.95, 0);
165 Pad[17] =
new TPad(
"hcalpad17",
"who needs this?", 0.5, 0.3, 1.0, 0.90, 0);
166 Pad[18] =
new TPad(
"hcalpad18",
"who needs this?", 0.0, 0.0, 1.0, 0.3, 0);
171 transparent[6] =
new TPad(
"transparent6",
"this does not show", 0, 0, 1, 1);
174 TC[6]->SetEditable(0);
176 else if (name ==
"HcalPopUp")
178 TC[4] =
new TCanvas(name.c_str(),
"!!!DO NOT CLOSE!!! OR THE CODE WILL CRASH!!!!", 2 * xsize / 3, 0.05, xsize / 2, 2 * ysize / 3);
179 gSystem->ProcessEvents();
180 Pad[9] =
new TPad(
"hcalpad9",
"for single tower running mean", 0.0, 0.0, 1, 0.92, 0);
182 transparent[4] =
new TPad(
"transparent4",
"this does not show", 0, 0, 1, 1);
185 TC[4]->SetEditable(0);
194 if (what ==
"ALL" || what ==
"FIRST")
199 if (what ==
"ALL" || what ==
"SECOND")
204 if (what ==
"ALL" || what ==
"THIRD")
209 if (what ==
"ALL" || what ==
"FOURTH")
214 if (what ==
"ALL" || what ==
"FIFTH")
221 std::cout << __PRETTY_FUNCTION__ <<
" Unimplemented Drawing option: " << what << std::endl;
232 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
234 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
236 TH2D* hist1 = (TH2D*) cl->
getHisto(HCALMON_0,
"h2_hcal_rm");
237 TH2F* h2_hcal_mean = (TH2F*) cl->
getHisto(HCALMON_0,
"h2_hcal_mean");
238 TH1F* h_event = (TH1F*) cl->
getHisto(HCALMON_0,
"h_event");
239 TH2F* h2_hcal_hits = (TH2F*) cl->
getHisto(HCALMON_0,
"h2_hcal_hits");
240 TH2F* hist1_1 = (TH2F*) cl->
getHisto(HCALMON_1,
"h2_hcal_rm");
241 TH2F* h2_hcal_mean_1 = (TH2F*) cl->
getHisto(HCALMON_1,
"h2_hcal_mean");
242 TH1D* h_event_1 = (TH1D*) cl->
getHisto(HCALMON_1,
"h_event");
243 TH2F* h2_hcal_hits_1 = (TH2F*) cl->
getHisto(HCALMON_1,
"h2_hcal_hits");
245 if (!gROOT->FindObject(
"HcalMon1"))
252 TC[0]->SetEditable(0);
256 h2_hcal_mean->Scale(1. / h_event->GetEntries());
257 h2_hcal_hits->Scale(1. / h_event->GetEntries());
258 hist1->Divide(h2_hcal_mean);
260 h2_hcal_mean_1->Scale(1. / h_event_1->GetEntries());
261 h2_hcal_hits_1->Scale(1. / h_event_1->GetEntries());
262 hist1_1->Divide(h2_hcal_mean_1);
265 h2_hcal_mean->Add(h2_hcal_mean_1);
266 h2_hcal_hits->Add(h2_hcal_hits_1);
272 TC[0]->SetEditable(1);
276 hist1->GetXaxis()->SetTitle(
"eta index");
277 hist1->GetYaxis()->SetTitle(
"phi index");
278 hist1->GetXaxis()->CenterTitle();
279 hist1->GetYaxis()->CenterTitle();
280 hist1->GetXaxis()->SetNdivisions(24);
281 hist1->GetYaxis()->SetNdivisions(232);
284 hist1->GetXaxis()->SetLabelSize(tsize);
285 hist1->GetYaxis()->SetLabelSize(tsize);
286 hist1->GetZaxis()->SetLabelSize(tsize);
287 hist1->GetXaxis()->SetTitleSize(tsize);
288 hist1->GetYaxis()->SetTitleSize(tsize);
289 hist1->GetXaxis()->SetTickLength(0.02);
291 hist1->GetZaxis()->SetRangeUser(0, 2);
293 TLine* line_sector[32];
294 for (
int i_line = 0; i_line < 32; i_line++)
296 line_sector[i_line] =
new TLine(0, (i_line + 1) * 2, 24, (i_line + 1) * 2);
297 line_sector[i_line]->SetLineColor(1);
298 line_sector[i_line]->SetLineWidth(4);
299 line_sector[i_line]->SetLineStyle(1);
301 TLine* line_board1 =
new TLine(8, 0, 8, 64);
302 line_board1->SetLineColor(1);
303 line_board1->SetLineWidth(4);
304 line_board1->SetLineStyle(1);
305 TLine* line_board2 =
new TLine(16, 0, 16, 64);
306 line_board2->SetLineColor(1);
307 line_board2->SetLineWidth(4);
308 line_board2->SetLineStyle(1);
310 TLine* line_iphi[64];
311 for (
int i_line = 0; i_line < 64; i_line++)
313 line_iphi[i_line] =
new TLine(0, (i_line + 1), 24, (i_line + 1));
314 line_iphi[i_line]->SetLineColor(1);
315 line_iphi[i_line]->SetLineWidth(1);
316 line_iphi[i_line]->SetLineStyle(1);
318 TLine* line_ieta[64];
319 for (
int i_line = 0; i_line < 24; i_line++)
321 line_ieta[i_line] =
new TLine((i_line + 1), 0, (i_line + 1), 64);
322 line_ieta[i_line]->SetLineColor(1);
323 line_ieta[i_line]->SetLineWidth(1);
324 line_ieta[i_line]->SetLineStyle(1);
327 gPad->SetTopMargin(0.08);
328 gPad->SetBottomMargin(0.07);
329 gPad->SetLeftMargin(0.08);
330 gPad->SetRightMargin(0.11);
333 for (
int i_line = 0; i_line < 32; i_line++)
335 line_sector[i_line]->Draw();
340 for (
int i_line = 0; i_line < 64; i_line++)
342 line_iphi[i_line]->Draw();
344 for (
int i_line = 0; i_line < 24; i_line++)
346 line_ieta[i_line]->Draw();
349 Int_t palette[3] = {1, 8, 2};
351 gROOT->SetStyle(
"hcalStyle");
353 gStyle->SetPalette(3, palette);
354 double_t
levels[4] = {0, 0.9, 1.1, 2};
355 hist1->SetContour(4, levels);
359 PrintRun.SetTextFont(62);
360 PrintRun.SetTextSize(0.03);
362 PrintRun.SetTextAlign(23);
363 std::ostringstream runnostream;
364 std::ostringstream runnostream2;
368 runnostream <<
ThisName <<
": tower running mean divided by template";
369 runnostream2 <<
"Run" << cl->
RunNumber() <<
", Time: " << ctime(&evttime);
371 runstring = runnostream.str();
372 PrintRun.DrawText(0.5, 0.99, runstring.c_str());
373 runstring = runnostream2.str();
374 PrintRun.DrawText(0.5, 0.966, runstring.c_str());
376 TButton* but1 =
new TButton(
"Draw Template",
"", 0.01, 0.01, 0.5, 0.05);
377 but1->SetName(
"avgenergy");
380 TButton* but2 =
new TButton(
"Draw Multiplicity",
"", 0.51, 0.01, 0.99, 0.05);
381 but2->SetName(
"hitmap");
386 TC[0]->Connect(
"ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"HcalMonDraw",
this,
387 "HandleEvent(int,int,int,TObject*)");
392 TC[0]->SetEditable(0);
401 const int Nsector = 32;
405 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
407 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
409 TH1F* h_sectorAvg_total = (TH1F*) cl->
getHisto(HCALMON_0,
"h_sectorAvg_total");
410 TH1F* h_event = (TH1F*) cl->
getHisto(HCALMON_0,
"h_event");
411 TH1F* h_sectorAvg_total_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h_sectorAvg_total");
412 TH1F* h_event_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h_event");
413 TH1F* h_rm_sectorAvg[Nsector];
414 TH1F* h_rm_sectorAvg_1[Nsector];
415 for (
int ih = 0; ih < Nsector; ih++)
417 h_rm_sectorAvg[ih] = (TH1F*) cl->
getHisto(HCALMON_0, Form(
"h_rm_sectorAvg_s%d", ih));
418 h_rm_sectorAvg_1[ih] = (TH1F*) cl->
getHisto(HCALMON_1, Form(
"h_rm_sectorAvg_s%d", ih));
419 h_rm_sectorAvg[ih]->Add(h_rm_sectorAvg_1[ih]);
422 if (!gROOT->FindObject(
"HcalMon2"))
427 TC[1]->SetEditable(1);
430 if (!h_rm_sectorAvg[0] || !h_event || !h_sectorAvg_total)
433 TC[1]->SetEditable(0);
437 h_sectorAvg_total->Scale(1. / h_event->GetEntries());
438 h_sectorAvg_total_1->Scale(1. / h_event_1->GetEntries());
439 h_sectorAvg_total->Add(h_sectorAvg_total_1);
441 for (
int ih = 0; ih < Nsector; ih++)
443 h_rm_sectorAvg[ih]->Scale(1. / h_sectorAvg_total->GetBinContent(ih + 1));
444 for (
int ib = 1;
ib < h_rm_sectorAvg[ih]->GetNbinsX();
ib++)
446 h_rm_sectorAvg[ih]->SetBinContent(
ib, ih + h_rm_sectorAvg[ih]->GetBinContent(
ib));
450 gStyle->SetTitleFontSize(0.03);
452 gStyle->SetOptStat(0);
454 TH1F* frame =
new TH1F(
"frame",
"", 100, 0, 100);
456 frame->GetXaxis()->SetTitle(
"time");
457 frame->GetYaxis()->SetTitle(
"sector running mean / template + sector #");
458 frame->GetXaxis()->CenterTitle();
459 frame->GetYaxis()->CenterTitle();
463 frame->GetXaxis()->SetLabelSize(tsize);
464 frame->GetYaxis()->SetLabelSize(tsize);
465 frame->GetXaxis()->SetTitleSize(tsize);
466 frame->GetYaxis()->SetTitleSize(tsize);
468 frame->GetXaxis()->SetRangeUser(0, 100);
469 frame->GetYaxis()->SetRangeUser(0, 32.75);
473 gPad->SetTopMargin(0.01);
475 for (
int ih = 0; ih < Nsector; ih++)
477 h_rm_sectorAvg[ih]->Draw(
"same hist ][");
481 PrintRun.SetTextFont(62);
482 PrintRun.SetTextSize(0.03);
484 PrintRun.SetTextAlign(23);
485 std::ostringstream runnostream;
490 <<
", Time: " << ctime(&evttime);
491 runstring = runnostream.str();
493 PrintRun.DrawText(0.5, 1., runstring.c_str());
496 TC[1]->SetEditable(0);
505 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
507 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
509 TH1F* h_waveform_time = (TH1F*) cl->
getHisto(HCALMON_0,
"h_waveform_time");
510 TH1F* h_waveform_pedestal = (TH1F*) cl->
getHisto(HCALMON_0,
"h_waveform_pedestal");
511 TH2F* h2_hcal_waveform = (TH2F*) cl->
getHisto(HCALMON_0,
"h2_hcal_waveform");
513 TH1F* hwaveform_time_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h_waveform_time");
514 TH1F* hwaveform_pedestal_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h_waveform_pedestal");
515 TH2F* h2_hcal_waveform_1 = (TH2F*) cl->
getHisto(HCALMON_1,
"h2_hcal_waveform");
517 if (!gROOT->FindObject(
"HcalMon3"))
522 TC[3]->SetEditable(1);
525 if (!h2_hcal_waveform || !h_waveform_time || !h_waveform_pedestal)
528 TC[3]->SetEditable(0);
533 h_waveform_time->Add(hwaveform_time_1);
534 h_waveform_pedestal->Add(hwaveform_pedestal_1);
535 h2_hcal_waveform->Add(h2_hcal_waveform_1);
538 gStyle->SetTitleFontSize(0.03);
539 float ymaxp = h2_hcal_waveform->ProfileX()->GetMaximum();
540 h2_hcal_waveform->GetYaxis()->SetRangeUser(0, ymaxp * 20);
542 h2_hcal_waveform->Draw(
"colz");
545 h2_hcal_waveform->GetXaxis()->SetNdivisions(510, kTRUE);
546 h2_hcal_waveform->GetXaxis()->SetTitle(
"Sample #");
547 h2_hcal_waveform->GetYaxis()->SetTitle(
"Waveform [ADC]");
548 h2_hcal_waveform->GetXaxis()->SetLabelSize(tsize);
549 h2_hcal_waveform->GetYaxis()->SetLabelSize(tsize);
550 h2_hcal_waveform->GetXaxis()->SetTitleSize(tsize);
551 h2_hcal_waveform->GetYaxis()->SetTitleSize(tsize);
552 h2_hcal_waveform->GetXaxis()->SetTitleOffset(1.2);
553 h2_hcal_waveform->GetYaxis()->SetTitleOffset(0.75);
555 gPad->SetBottomMargin(0.16);
556 gPad->SetLeftMargin(0.2);
557 gPad->SetRightMargin(0.05);
558 gPad->SetLeftMargin(0.15);
559 gStyle->SetOptStat(0);
560 gStyle->SetPalette(57);
565 PrintRun.SetTextFont(62);
566 PrintRun.SetTextSize(0.03);
568 PrintRun.SetTextAlign(23);
569 std::ostringstream runnostream;
574 <<
", Time: " << ctime(&evttime);
575 runstring = runnostream.str();
577 PrintRun.DrawText(0.5, 0.99, runstring.c_str());
581 gStyle->SetTitleFontSize(0.06);
584 h_waveform_time->Draw(
"hist");
585 h_waveform_time->GetXaxis()->SetNdivisions(510, kTRUE);
586 h_waveform_time->GetXaxis()->SetTitle(
"Sample #");
587 h_waveform_time->GetYaxis()->SetTitle(
"Towers");
588 h_waveform_time->GetXaxis()->SetLabelSize(tsize2);
589 h_waveform_time->GetYaxis()->SetLabelSize(tsize2);
590 h_waveform_time->GetXaxis()->SetTitleSize(tsize2);
591 h_waveform_time->GetYaxis()->SetTitleSize(tsize2);
592 h_waveform_time->GetXaxis()->SetTitleOffset(1.0);
593 h_waveform_time->GetYaxis()->SetTitleOffset(0.85);
594 gPad->SetTopMargin(0.06);
595 gPad->SetBottomMargin(0.18);
596 gPad->SetRightMargin(0.05);
597 gPad->SetLeftMargin(0.2);
598 gStyle->SetOptStat(0);
604 gStyle->SetTitleFontSize(0.06);
606 h_waveform_pedestal->Draw(
"hist");
607 h_waveform_pedestal->GetXaxis()->SetNdivisions(510, kTRUE);
608 h_waveform_pedestal->GetXaxis()->SetTitle(
"ADC Pedistal");
609 h_waveform_pedestal->GetYaxis()->SetTitle(
"Towers");
610 h_waveform_pedestal->GetXaxis()->SetLabelSize(tsize2);
611 h_waveform_pedestal->GetYaxis()->SetLabelSize(tsize2);
612 h_waveform_pedestal->GetXaxis()->SetTitleSize(tsize2);
613 h_waveform_pedestal->GetYaxis()->SetTitleSize(tsize2);
614 h_waveform_pedestal->GetXaxis()->SetTitleOffset(0.9);
615 h_waveform_pedestal->GetYaxis()->SetTitleOffset(0.85);
616 gPad->SetTopMargin(0.06);
617 gPad->SetBottomMargin(0.18);
618 gPad->SetRightMargin(0.05);
619 gPad->SetLeftMargin(0.2);
620 gStyle->SetOptStat(0);
626 TC[3]->SetEditable(0);
636 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
638 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
639 TH1F* h1_packet_number = (TH1F*) cl->
getHisto(HCALMON_0,
"h1_packet_number");
640 TH1F* h1_packet_length = (TH1F*) cl->
getHisto(HCALMON_0,
"h1_packet_length");
641 TH1F* h1_packet_chans = (TH1F*) cl->
getHisto(HCALMON_0,
"h1_packet_chans");
642 TH1F* h1_packet_event = (TH1F*) cl->
getHisto(HCALMON_0,
"h1_packet_event");
643 TH1F* h_event = (TH1F*) cl->
getHisto(HCALMON_0,
"h_event");
644 TH2F* h2_hcal_correlation = (TH2F*) cl->
getHisto(HCALMON_0,
"h2_hcal_correlation");
646 TH1F* h1_packet_number_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h1_packet_number");
647 TH1F* h1_packet_length_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h1_packet_length");
648 TH1F* h1_packet_chans_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h1_packet_chans");
649 TH1F* h1_packet_event_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h1_packet_event");
650 TH2F* h2_hcal_correlation_1 = (TH2F*) cl->
getHisto(HCALMON_1,
"h2_hcal_correlation");
651 TH1F* h_event_1 = (TH1F*) cl->
getHisto(HCALMON_1,
"h_event");
653 if (!gROOT->FindObject(
"HcalMon4"))
658 TC[5]->SetEditable(1);
661 if (!h1_packet_number || !h1_packet_length || !h1_packet_chans || !h_event || !h1_packet_event || !h2_hcal_correlation)
664 if (!h1_packet_number) std::cout <<
"h1_packet_number not found" << std::endl;
665 if (!h1_packet_length) std::cout <<
"h1_packet_length not found" << std::endl;
666 if (!h1_packet_chans) std::cout <<
"h1_packet_chans not found" << std::endl;
667 if (!h_event) std::cout <<
"h_event not found" << std::endl;
668 if (!h1_packet_event) std::cout <<
"h1_packet_event not found" << std::endl;
669 if (!h2_hcal_correlation) std::cout <<
"h2_hcal_correlation not found" << std::endl;
672 TC[5]->SetEditable(0);
683 h1_packet_number->Add(h1_packet_number_1);
684 h1_packet_length->Add(h1_packet_length_1);
685 h1_packet_chans->Add(h1_packet_chans_1);
688 int maxy = h1_packet_event->GetMaximum();
690 for (
int i = 1;
i <= h1_packet_event->GetNbinsX();
i++)
692 if (h1_packet_event->GetBinContent(
i) != 0)
694 h1_packet_event->SetBinContent(
i, h1_packet_event->GetBinContent(
i) - maxy);
697 int maxy1 = h1_packet_event_1->GetMaximum();
698 for (
int i = 1;
i <= h1_packet_event_1->GetNbinsX();
i++)
700 if (h1_packet_event_1->GetBinContent(
i) != 0)
702 h1_packet_event_1->SetBinContent(
i, h1_packet_event_1->GetBinContent(
i) - maxy1);
732 h1_packet_event->Add(h1_packet_event_1);
735 double xmin = h1_packet_number->GetXaxis()->GetXmin();
736 double xmax = h1_packet_number->GetXaxis()->GetXmax();
738 TLine* one =
new TLine(xmin, 1, xmax, 1);
739 one->SetLineStyle(7);
741 TLine* goodSize =
new TLine(xmin, 5981, xmax, 5981);
742 goodSize->SetLineStyle(7);
744 TLine* goodChans =
new TLine(xmin, 192, xmax, 192);
745 goodChans->SetLineStyle(7);
750 TLegend*
leg =
new TLegend(0.3, 0.16, 0.95, 0.4);
751 leg->SetFillStyle(0);
752 leg->SetBorderSize(0);
754 TLine* warnLineOne =
new TLine(xmin, param * 1, xmax, param * 1);
755 warnLineOne->SetLineStyle(7);
756 warnLineOne->SetLineColor(2);
758 leg->AddEntry(warnLineOne,
"95% Threshold",
"l");
760 TLine* warnLineSize =
new TLine(xmin, param * 5981., xmax, param * 5981.);
761 warnLineSize->SetLineStyle(7);
762 warnLineSize->SetLineColor(2);
764 TLine* warnLineChans =
new TLine(xmin, param * 192., xmax, param * 192.);
765 warnLineChans->SetLineStyle(7);
766 warnLineChans->SetLineColor(2);
770 h1_packet_number->GetYaxis()->SetRangeUser(0.0, 1.3);
771 h1_packet_number->Draw(
"hist");
775 warnLineOne->Draw(
"same");
776 h1_packet_number->GetXaxis()->SetNdivisions(510, kTRUE);
777 h1_packet_number->GetXaxis()->SetTitle(
"Packet #");
778 h1_packet_number->GetYaxis()->SetTitle(
"% Of Events Present");
779 h1_packet_number->GetXaxis()->SetLabelSize(tsize - 0.01);
780 h1_packet_number->GetYaxis()->SetLabelSize(tsize - 0.01);
781 h1_packet_number->GetXaxis()->SetTitleSize(tsize - 0.01);
782 h1_packet_number->GetYaxis()->SetTitleSize(tsize - 0.01);
783 h1_packet_number->GetXaxis()->SetTitleOffset(1);
784 gPad->SetBottomMargin(0.16);
785 gPad->SetLeftMargin(0.16);
786 gPad->SetRightMargin(0.05);
787 gPad->SetLeftMargin(0.15);
788 gStyle->SetOptStat(0);
793 h1_packet_length->Draw(
"hist");
794 h1_packet_length->GetYaxis()->SetRangeUser(0, 6500);
796 goodSize->Draw(
"same");
797 warnLineSize->Draw(
"same");
799 h1_packet_length->GetXaxis()->SetNdivisions(510, kTRUE);
800 h1_packet_length->GetXaxis()->SetTitle(
"Packet #");
801 h1_packet_length->GetYaxis()->SetTitle(
"Average Packet Size");
802 h1_packet_length->GetXaxis()->SetLabelSize(tsize - .01);
803 h1_packet_length->GetYaxis()->SetLabelSize(tsize);
804 h1_packet_length->GetXaxis()->SetTitleSize(tsize - .01);
805 h1_packet_length->GetYaxis()->SetTitleSize(tsize);
806 h1_packet_length->GetXaxis()->SetTitleOffset(1);
807 h1_packet_length->GetYaxis()->SetTitleOffset(0.8);
808 gPad->SetBottomMargin(0.16);
809 gPad->SetLeftMargin(0.16);
810 gPad->SetRightMargin(0.05);
811 gPad->SetLeftMargin(0.15);
812 gStyle->SetOptStat(0);
817 h1_packet_chans->Draw(
"hist");
818 h1_packet_chans->GetYaxis()->SetRangeUser(0, 212);
820 goodChans->Draw(
"same");
821 warnLineChans->Draw(
"same");
822 h1_packet_chans->GetXaxis()->SetNdivisions(510, kTRUE);
823 h1_packet_chans->GetXaxis()->SetTitle(
"Packet #");
824 h1_packet_chans->GetYaxis()->SetTitle(
"Average # of Channels");
825 h1_packet_chans->GetXaxis()->SetLabelSize(tsize - .01);
826 h1_packet_chans->GetYaxis()->SetLabelSize(tsize);
827 h1_packet_chans->GetXaxis()->SetTitleSize(tsize - .01);
828 h1_packet_chans->GetYaxis()->SetTitleSize(tsize);
829 h1_packet_chans->GetXaxis()->SetTitleOffset(0.8);
830 h1_packet_chans->GetYaxis()->SetTitleOffset(0.8);
831 gPad->SetBottomMargin(0.16);
832 gPad->SetLeftMargin(0.16);
833 gPad->SetRightMargin(0.05);
834 gPad->SetLeftMargin(0.15);
835 gStyle->SetOptStat(0);
840 h1_packet_event->Draw(
"hist");
841 double ymax = h1_packet_event->GetMaximum();
842 double ymin = h1_packet_event->GetMinimum();
844 h1_packet_event->GetYaxis()->SetRangeUser(ymin - 0.3 * (ymax - ymin + 30), ymax + 0.3 * (ymax - ymin + 30));
845 h1_packet_event->GetXaxis()->SetTitle(
"Packet #");
846 h1_packet_event->GetYaxis()->SetTitle(
"clock offset");
847 h1_packet_event->GetXaxis()->SetLabelSize(tsize - .01);
848 h1_packet_event->GetYaxis()->SetLabelSize(tsize);
849 h1_packet_event->GetXaxis()->SetTitleSize(tsize - .01);
850 h1_packet_event->GetYaxis()->SetTitleSize(tsize);
851 h1_packet_event->GetXaxis()->SetTitleOffset(0.8);
852 h1_packet_event->GetYaxis()->SetTitleOffset(1.2);
853 gPad->SetBottomMargin(0.16);
854 gPad->SetLeftMargin(0.2);
855 gPad->SetRightMargin(0.05);
856 gPad->SetLeftMargin(0.2);
857 gStyle->SetOptStat(0);
862 h2_hcal_correlation->Draw(
"colz");
863 ymax = h2_hcal_correlation->ProfileX()->GetMaximum();
864 xmax = h2_hcal_correlation->ProfileY()->GetMaximum();
865 h2_hcal_correlation->GetYaxis()->SetRangeUser(0, ymax * 1.2);
866 h2_hcal_correlation->GetXaxis()->SetRangeUser(0, xmax * 1.2);
867 h2_hcal_correlation->GetXaxis()->SetNdivisions(510, kTRUE);
868 h2_hcal_correlation->GetYaxis()->SetNdivisions(510, kTRUE);
869 h2_hcal_correlation->GetXaxis()->SetTitle(
"Total West OHCal Energy[a.u.]");
870 h2_hcal_correlation->GetYaxis()->SetTitle(
"Total West IHCal Energy[a.u.]");
871 h2_hcal_correlation->GetXaxis()->SetLabelSize(0);
872 h2_hcal_correlation->GetYaxis()->SetLabelSize(0);
873 h2_hcal_correlation->GetXaxis()->SetTitleSize(tsize - .02);
874 h2_hcal_correlation->GetYaxis()->SetTitleSize(tsize - .02);
875 h2_hcal_correlation->GetXaxis()->SetTitleOffset(0.8);
876 h2_hcal_correlation->GetYaxis()->SetTitleOffset(0.8);
877 gPad->SetBottomMargin(0.16);
878 gPad->SetLeftMargin(0.2);
879 gPad->SetRightMargin(0.03);
880 gPad->SetLeftMargin(0.2);
881 gStyle->SetOptStat(0);
886 h2_hcal_correlation_1->Draw(
"colz");
887 ymax = h2_hcal_correlation_1->ProfileX()->GetMaximum();
888 xmax = h2_hcal_correlation_1->ProfileY()->GetMaximum();
889 h2_hcal_correlation_1->GetYaxis()->SetRangeUser(0, ymax * 1.2);
890 h2_hcal_correlation_1->GetXaxis()->SetRangeUser(0, xmax * 1.2);
891 h2_hcal_correlation_1->GetXaxis()->SetNdivisions(510, kTRUE);
892 h2_hcal_correlation_1->GetYaxis()->SetNdivisions(510, kTRUE);
893 h2_hcal_correlation_1->GetXaxis()->SetTitle(
"Total East OHCal Energy[a.u.]");
894 h2_hcal_correlation_1->GetYaxis()->SetTitle(
"Total East IHCal Energy[a.u.]");
895 h2_hcal_correlation_1->GetXaxis()->SetLabelSize(0);
896 h2_hcal_correlation_1->GetYaxis()->SetLabelSize(0);
897 h2_hcal_correlation_1->GetXaxis()->SetTitleSize(tsize - .02);
898 h2_hcal_correlation_1->GetYaxis()->SetTitleSize(tsize - .02);
899 h2_hcal_correlation_1->GetXaxis()->SetTitleOffset(0.8);
900 h2_hcal_correlation_1->GetYaxis()->SetTitleOffset(0.8);
901 gPad->SetBottomMargin(0.16);
902 gPad->SetLeftMargin(0.2);
903 gPad->SetRightMargin(0.05);
904 gPad->SetLeftMargin(0.2);
905 gStyle->SetOptStat(0);
912 std::vector<int> badPackets;
913 std::vector<std::string> whatswrong;
914 for (
int i = 1;
i <= 8;
i++)
916 bool missing =
false;
917 bool badnumber =
false;
918 bool badlength =
false;
919 bool badchans =
false;
920 if (h1_packet_number->GetBinContent(
i) == 0)
924 if (h1_packet_number->GetBinContent(
i) < param)
928 if (h1_packet_length->GetBinContent(
i) < param * 5981.)
932 if (h1_packet_chans->GetBinContent(
i) < param * 192.)
936 if (badnumber || badlength || badchans || missing)
938 badPackets.push_back((
int) h1_packet_number->GetBinCenter(
i));
942 reason +=
"packet lost! ";
948 reason +=
"some events are missing, ";
952 reason +=
"too short, ";
956 reason +=
"too few channels, ";
959 reason = reason.substr(0, reason.size() - 2);
962 whatswrong.push_back(reason);
965 bool westmismatch =
false;
966 bool eastmismatch =
false;
967 for (
int i = 1;
i <= h1_packet_event->GetNbinsX();
i++)
969 if (h1_packet_event->GetBinContent(
i) != 0)
983 mismatchWarn.SetTextFont(62);
984 mismatchWarn.SetTextSize(0.06);
985 mismatchWarn.SetTextColor(2);
986 mismatchWarn.SetNDC();
987 mismatchWarn.SetTextAlign(23);
990 mismatchWarn.DrawText(0.5, 0.95,
"West misaligned!");
994 mismatchWarn.DrawText(0.5, 0.9,
"East misaligned!");
996 mismatchWarn.SetTextColor(1);
997 mismatchWarn.SetTextSize(0.05);
998 if (westmismatch || eastmismatch)
1002 TLine*
line =
new TLine(0., 0.8, 1., 0.8);
1003 line->SetLineColor(1);
1004 line->SetLineStyle(1);
1005 line->SetLineWidth(10);
1011 PacketWarn.SetTextFont(62);
1012 PacketWarn.SetTextSize(0.04);
1013 PacketWarn.SetTextColor(1);
1014 PacketWarn.SetNDC();
1015 PacketWarn.SetTextAlign(23);
1016 PacketWarn.DrawText(0.5, 0.75,
"Bad Packets:");
1017 for (
int i = 0;
i < (int) badPackets.size();
i++)
1019 PacketWarn.DrawText(0.5, 0.7 - 0.05 *
i, Form(
"%i: %s", badPackets[
i], whatswrong[i].c_str()));
1021 if ((
int) badPackets.size() > 0 && (h_event->GetEntries() > 1000 || h_event_1->GetEntries() > 1000))
1023 PacketWarn.SetTextSize(0.04);
1024 PacketWarn.DrawText(0.5, 0.7 - 0.05 * (
int) badPackets.size(),
"Check with HCal experts.");
1027 PrintRun.SetTextFont(62);
1028 PrintRun.SetTextSize(0.02);
1030 PrintRun.SetTextAlign(23);
1031 std::ostringstream runnostream;
1033 std::ostringstream runnostream2;
1037 runnostream <<
"Packet Information";
1038 runnostream2 <<
" Run " << cl->
RunNumber() <<
", Time: " << ctime(&evttime);
1041 runstring = runnostream.str();
1042 PrintRun.DrawText(0.5, .99, runstring.c_str());
1044 runstring = runnostream2.str();
1045 PrintRun.DrawText(0.5, .966, runstring.c_str());
1048 TC[5]->SetEditable(0);
1057 int displaylimit = 15;
1059 std::ostringstream hottowerlist;
1060 std::ostringstream deadtowerlist;
1061 float hot_threshold = 1.33;
1062 float dead_threshold = 0.66;
1064 for (
int ieta = 0; ieta < 24; ieta++)
1066 for (
int iphi = 0; iphi < 64; iphi++)
1068 double nhit = hhit->GetBinContent(ieta + 1, iphi + 1);
1070 if (nhit > hot_threshold)
1072 if (nhott <= displaylimit)
1073 hottowerlist <<
" (" << ieta <<
"," << iphi <<
")";
1077 if (nhit < dead_threshold)
1079 if (ndeadt <= displaylimit)
1080 deadtowerlist <<
" (" << ieta <<
"," << iphi <<
")";
1086 if (nhott > displaylimit)
1087 hottowerlist <<
"... " << nhott <<
" total";
1088 if (ndeadt > displaylimit)
1089 deadtowerlist <<
"... " << ndeadt <<
" total";
1094 Warn.SetTextFont(62);
1095 Warn.SetTextSize(0.06);
1096 Warn.SetTextColor(2);
1098 Warn.SetTextAlign(23);
1099 Warn.DrawText(0.5, 1,
"Hot towers:");
1100 Warn.DrawText(0.5, 0.9, hottowerlist.str().c_str());
1102 Warn.SetTextColor(4);
1103 Warn.SetTextAlign(22);
1104 Warn.DrawText(0.5, 0.7,
"Dead towers:");
1105 Warn.DrawText(0.5, 0.6, deadtowerlist.str().c_str());
1107 warningpad->Update();
1231 int iret =
Draw(what);
1237 for (TCanvas *canvas :
TC)
1239 if (canvas ==
nullptr)
1253 int iret =
Draw(what);
1261 for (TCanvas *canvas :
TC)
1263 if (canvas ==
nullptr)
1296 char HCALMON_0[100];
1297 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
1298 char HCALMON_1[100];
1299 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
1301 TH2D* h2_hcal_mean = (TH2D*) cl->
getHisto(HCALMON_0,
"h2_hcal_mean");
1306 if (!gROOT->FindObject(
"HcalPopUp"))
1313 TC[4]->SetEditable(0);
1321 TC[4]->SetEditable(1);
1326 gStyle->SetOptStat(0);
1327 gStyle->SetPalette(57);
1328 h2_hcal_mean->GetXaxis()->SetTitle(
"eta index");
1329 h2_hcal_mean->GetYaxis()->SetTitle(
"phi index");
1330 h2_hcal_mean->SetTitle(
"Tower Average Energy[ADC]");
1331 h2_hcal_mean->Draw(
"COLZ");
1333 TLine* line_sector[32];
1334 for (
int i_line = 0; i_line < 32; i_line++)
1336 line_sector[i_line] =
new TLine(0, (i_line + 1) * 2, 24, (i_line + 1) * 2);
1337 line_sector[i_line]->SetLineColor(1);
1338 line_sector[i_line]->SetLineWidth(4);
1339 line_sector[i_line]->SetLineStyle(1);
1341 TLine* line_board1 =
new TLine(8, 0, 8, 64);
1342 line_board1->SetLineColor(1);
1343 line_board1->SetLineWidth(4);
1344 line_board1->SetLineStyle(1);
1345 TLine* line_board2 =
new TLine(16, 0, 16, 64);
1346 line_board2->SetLineColor(1);
1347 line_board2->SetLineWidth(4);
1348 line_board2->SetLineStyle(1);
1350 for (
int i_line = 0; i_line < 32; i_line++)
1352 line_sector[i_line]->Draw();
1354 line_board1->Draw();
1355 line_board2->Draw();
1359 TC[4]->SetEditable(0);
1366 char HCALMON_0[100];
1367 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
1368 char HCALMON_1[100];
1369 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
1371 TH2D* h2_hcal_hits = (TH2D*) cl->
getHisto(HCALMON_0,
"h2_hcal_hits");
1373 if (!gROOT->FindObject(
"HcalPopUp"))
1380 TC[4]->SetEditable(0);
1384 TC[4]->SetEditable(1);
1388 gStyle->SetOptStat(0);
1389 gStyle->SetPalette(57);
1390 h2_hcal_hits->GetXaxis()->SetTitle(
"eta index");
1391 h2_hcal_hits->GetYaxis()->SetTitle(
"phi index");
1392 h2_hcal_hits->SetTitle(
"Average Multiplicity");
1393 h2_hcal_hits->Draw(
"COLZ");
1395 TLine* line_sector[32];
1396 for (
int i_line = 0; i_line < 32; i_line++)
1398 line_sector[i_line] =
new TLine(0, (i_line + 1) * 2, 24, (i_line + 1) * 2);
1399 line_sector[i_line]->SetLineColor(1);
1400 line_sector[i_line]->SetLineWidth(4);
1401 line_sector[i_line]->SetLineStyle(1);
1403 TLine* line_board1 =
new TLine(8, 0, 8, 64);
1404 line_board1->SetLineColor(1);
1405 line_board1->SetLineWidth(4);
1406 line_board1->SetLineStyle(1);
1407 TLine* line_board2 =
new TLine(16, 0, 16, 64);
1408 line_board2->SetLineColor(1);
1409 line_board2->SetLineWidth(4);
1410 line_board2->SetLineStyle(1);
1412 for (
int i_line = 0; i_line < 32; i_line++)
1414 line_sector[i_line]->Draw();
1416 line_board1->Draw();
1417 line_board2->Draw();
1420 TC[4]->SetEditable(0);
1428 char HCALMON_0[100];
1429 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
1430 char HCALMON_1[100];
1431 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
1436 if (strcmp(selected->GetName(),
"avgenergy") == 0)
1441 if (strcmp(selected->GetName(),
"hitmap") == 0)
1447 double xx =
Pad[0]->AbsPixeltoX(x);
1448 double xhis =
Pad[0]->PadtoX(xx);
1449 int binx = (int) xhis;
1450 double yy =
Pad[0]->AbsPixeltoY(y);
1451 double yhis =
Pad[0]->PadtoY(yy);
1452 int biny = (int) yhis;
1454 if (binx < 0 || binx > 23)
return;
1455 if (biny < 0 || biny > 63)
return;
1459 TH1F* h_rm_tower = (TH1F*) cl->
getHisto(HCALMON_0, Form(
"h_rm_tower_%d_%d", binx, biny));
1460 TH1F* h_rm_tower_1 = (TH1F*) cl->
getHisto(HCALMON_1, Form(
"h_rm_tower_%d_%d", binx, biny));
1461 if (!gROOT->FindObject(
"HcalPopUp"))
1466 if (!h_rm_tower || !h_rm_tower_1)
1469 TC[4]->SetEditable(0);
1472 h_rm_tower->Add(h_rm_tower_1);
1473 h_rm_tower->SetXTitle(
"Time");
1474 h_rm_tower->SetYTitle(
"Running Mean");
1476 TC[4]->SetEditable(1);
1479 gStyle->SetOptStat(0);
1483 TC[4]->SetEditable(0);
1492 char HCALMON_0[100];
1493 sprintf(HCALMON_0,
"%s_%i",
prefix.c_str(), 0);
1494 char HCALMON_1[100];
1495 sprintf(HCALMON_1,
"%s_%i",
prefix.c_str(), 1);
1496 TH2F* h2_hcal_hits_trig = (TH2F*) cl->
getHisto(HCALMON_0,
"h2_hcal_hits_trig");
1497 TH2F* h2_hcal_hits = (TH2F*) cl->
getHisto(HCALMON_0,
"h2_hcal_hits");
1498 TH1F* h_hcal_trig = (TH1F*) cl->
getHisto(HCALMON_0,
"h_hcal_trig");
1499 TH2F* h_caloPack_gl1_clock_diff = (TH2F*) cl->
getHisto(HCALMON_0,
"h_caloPack_gl1_clock_diff");
1502 if (!gROOT->FindObject(
"HcalMon5"))
1507 TC[6]->SetEditable(1);
1510 if (!h2_hcal_hits_trig || !h2_hcal_hits || !h_hcal_trig || !h_caloPack_gl1_clock_diff)
1513 TC[6]->SetEditable(0);
1519 gStyle->SetTitleFontSize(0.03);
1521 h2_hcal_hits->Draw(
"colz");
1524 h2_hcal_hits->GetXaxis()->SetNdivisions(510, kTRUE);
1525 h2_hcal_hits->GetXaxis()->SetTitle(
"No trigger req ieta");
1526 h2_hcal_hits->GetYaxis()->SetTitle(
"iphi");
1527 h2_hcal_hits->GetXaxis()->SetLabelSize(tsize);
1528 h2_hcal_hits->GetYaxis()->SetLabelSize(tsize);
1529 h2_hcal_hits->GetXaxis()->SetTitleSize(tsize);
1530 h2_hcal_hits->GetYaxis()->SetTitleSize(tsize);
1531 h2_hcal_hits->GetXaxis()->SetTitleOffset(1.2);
1532 h2_hcal_hits->GetYaxis()->SetTitleOffset(0.75);
1534 gPad->SetBottomMargin(0.16);
1535 gPad->SetLeftMargin(0.2);
1536 gPad->SetRightMargin(0.05);
1537 gPad->SetLeftMargin(0.15);
1538 gStyle->SetOptStat(0);
1539 gStyle->SetPalette(57);
1544 PrintRun.SetTextFont(62);
1545 PrintRun.SetTextSize(0.03);
1547 PrintRun.SetTextAlign(23);
1548 std::ostringstream runnostream;
1553 <<
", Time: " << ctime(&evttime);
1554 runstring = runnostream.str();
1556 PrintRun.DrawText(0.5, 0.99, runstring.c_str());
1560 gStyle->SetTitleFontSize(0.06);
1562 float tsize2 = 0.08;
1563 h2_hcal_hits_trig->Draw(
"colz");
1564 h2_hcal_hits_trig->GetXaxis()->SetNdivisions(510, kTRUE);
1565 h2_hcal_hits_trig->GetXaxis()->SetTitle(
"trigger req ieta");
1566 h2_hcal_hits_trig->GetYaxis()->SetTitle(
"iphi");
1567 h2_hcal_hits_trig->GetXaxis()->SetLabelSize(tsize2);
1568 h2_hcal_hits_trig->GetYaxis()->SetLabelSize(tsize2);
1569 h2_hcal_hits_trig->GetXaxis()->SetTitleSize(tsize2);
1570 h2_hcal_hits_trig->GetYaxis()->SetTitleSize(tsize2);
1571 h2_hcal_hits_trig->GetXaxis()->SetTitleOffset(1.0);
1572 h2_hcal_hits_trig->GetYaxis()->SetTitleOffset(0.85);
1573 gPad->SetTopMargin(0.06);
1574 gPad->SetBottomMargin(0.18);
1575 gPad->SetRightMargin(0.05);
1576 gPad->SetLeftMargin(0.2);
1577 gStyle->SetOptStat(0);
1583 gStyle->SetTitleFontSize(0.06);
1585 h_hcal_trig->Draw(
"hist");
1586 h_hcal_trig->GetXaxis()->SetNdivisions(510, kTRUE);
1587 h_hcal_trig->GetXaxis()->SetTitle(
"trigger index");
1588 h_hcal_trig->GetYaxis()->SetTitle(
"events");
1589 h_hcal_trig->GetXaxis()->SetLabelSize(tsize2);
1590 h_hcal_trig->GetYaxis()->SetLabelSize(tsize2);
1591 h_hcal_trig->GetXaxis()->SetTitleSize(tsize2);
1592 h_hcal_trig->GetYaxis()->SetTitleSize(tsize2);
1593 h_hcal_trig->GetXaxis()->SetTitleOffset(0.9);
1594 h_hcal_trig->GetYaxis()->SetTitleOffset(0.85);
1595 gPad->SetTopMargin(0.06);
1596 gPad->SetBottomMargin(0.18);
1597 gPad->SetRightMargin(0.05);
1598 gPad->SetLeftMargin(0.2);
1599 gStyle->SetOptStat(0);
1605 TC[6]->SetEditable(0);
1615 time_t currtime = cl->
EventTime(
"CURRENT");