Belle II Software development
DQMHistAnalysisCDCDedx.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <dqm/analysis/modules/DQMHistAnalysisCDCDedx.h>
10#include <vector>
11
12using namespace std;
13using namespace Belle2;
14using boost::format;
15
16REG_MODULE(DQMHistAnalysisCDCDedx);
17
18//-----------------------------------------------------------------
21{
22 B2DEBUG(20, "DQMHistAnalysisCDCDedx: Constructor done.");
23 setDescription("Module to draw and compute values related to dEdx for CDC. ");
24
25 //Parameter definition here
26 addParam("mmode", m_mode, "default monitoring mode is basic", std::string("basic"));
27
28 Double_t stops[m_NRGBs] = { 0.00, 0.00, 0.34, 0.61, 0.84, 1.00 };
29 Double_t red[m_NRGBs] = { 0.00, 0.00, 0.00, 0.87, 1.00, 0.51 };
30 Double_t green[m_NRGBs] = { 0.00, 0.00, 0.81, 1.00, 0.20, 0.00 };
31 Double_t blue[m_NRGBs] = { 0.00, 0.51, 1.00, 0.12, 0.00, 0.00 };
32 m_pal = TColor::CreateGradientColorTable(m_NRGBs, stops, red, green, blue, m_NCont, false);
33 for (auto i = 0; i < m_NCont; i++) m_palarr[i] = m_pal + i;
34}
35
36
37//---------------------------------------------
39{
40
41 gStyle->SetOptStat(0);
42 gROOT->cd();
43
44 B2DEBUG(20, "DQMHistAnalysisCDCDedx: initialized.");
45
46 //intra-run cavnas 1D
47 m_c_ir_dedx = new TCanvas("CDCDedx/m_c_ir_dedx", "", 1400, 500);
48
49 //per run canvas
50 m_c_pr_dedx = new TCanvas("CDCDedx/c_CDCdedxMean", "", 800, 800);
51
52 f_gaus = new TF1("f_gaus", "gaus", 0.0, 2.5);
53 f_gaus->SetLineColor(kRed);
54
55 l_line = new TLine();
56 l_line->SetLineColor(kRed);
57 l_line->SetLineStyle(1);
58 l_line->SetLineWidth(2);
59
60 m_text_dedx = new TPaveText(0.60, 0.60, 0.85, 0.89, "NBNDC");
61 m_text_dedx->SetBorderSize(0);
62
63 m_text_dedx_fit = new TPaveText(0.12, 0.72, 0.37, 0.89, "NBNDC");
64 m_text_dedx_fit->SetBorderSize(0);
65
66 m_text_bandplot = new TPaveText(0.60, 0.72, 0.85, 0.89, "NBNDC");
67 m_text_bandplot->SetBorderSize(0);
68
69 m_text_dedxWire = new TPaveText(0.60, 0.72, 0.85, 0.89, "NBNDC");
70 m_text_dedxWire->SetBorderSize(0);
71
72 m_text_dedx_ir = new TPaveText(0.609, 0.720, 0.942, 0.911, "NBNDC");
73 m_text_dedx_ir->SetBorderSize(0);
74
75 m_text_mean = new TPaveText(0.60, 0.82, 0.85, 0.89, "NBNDC");
76 m_text_mean->SetBorderSize(0);
77
78 m_text_sigma = new TPaveText(0.60, 0.82, 0.85, 0.89, "NBNDC");
79 m_text_sigma->SetBorderSize(0);
80
81 m_lego = new TLegend(0.45, 0.77, 0.60, 0.89);
82 m_legoI = new TLegend(0.40, 0.77, 0.55, 0.89);
83
84 //Monitoring object for run dependency at mirabelle
85 m_monObj = getMonitoringObject("cdcdedx");
88}
89
90
91//-------------------------------------------
93{
94
95 B2DEBUG(20, "DQMHistAnalysisCDCDedx: beginRun called.");
96
97}
98
99
100//----------------------------------------
102{
103
104 B2DEBUG(20, "DQMHistAnalysisCDCDedx: event called.");
105
106 //Plot 0 getmeta those are useful for cosmetics
107 getMetadata();
108
109 m_c_pr_dedx->Clear();
110 if (m_mode != "basic") {
111 m_c_pr_dedx->SetWindowSize(1400, 800);
112 m_c_pr_dedx->Divide(3, 3);
113 } else {
114 m_c_pr_dedx->SetWindowSize(1000, 800);
115 m_c_pr_dedx->Divide(3, 2);
116 }
117
118 //Plot 1 dE/dx per run gain/reso
119 drawDedxPR();
120
121 // Plot 2 dE/dx bands vs p
122 drawBandPlot();
123
124 // Plot 3/4 dE/dx vs phi and costh
126
127 // Plot 5/6 dE/dx mean/reso vs inject time
129
130 m_c_pr_dedx->Modified();
131 m_c_pr_dedx->Update();
132
133 m_c_ir_dedx->Clear();
134 if (m_mode != "basic") {
135 m_c_ir_dedx->SetWindowSize(900, 400);
136 m_c_ir_dedx->Divide(3, 1);
137 } else {
138 m_c_ir_dedx->SetWindowSize(900, 400);
139 m_c_ir_dedx->Divide(2, 1);
140 }
141
142 //Plot 1 dE/dx intra-run gain/reso
143 drawDedxIR();
144
145 m_c_ir_dedx->Modified();
146 m_c_ir_dedx->Update();
147
148 //Plot 7/8 wire status/ injection time
149 if (m_mode != "basic") {
152 }
153}
154
155//-----------------------------------------
157{
158 B2DEBUG(20, "DQMHistAnalysisCDCDedx : endRun called");
159}
160
161//--------------------------------------------
163{
164
165 B2DEBUG(20, "DQMHistAnalysisCDCDedx : terminate called");
166
167 delete m_c_pr_dedx;
168 delete m_c_ir_dedx;
169 delete l_line;
170 delete m_hdEdxIRMean;
171 delete m_hdEdxIRSigma;
172 delete m_hSigmaHer;
173 delete m_hMeanHer;
174 delete m_hMeanLer;
175 delete m_hSigmaLer;
176 delete m_hdEdxIRInd;
177 delete m_lego;
178 delete m_legoI;
179 delete m_text_dedx_fit;
180 delete m_text_dedxWire;
181 delete m_text_bandplot;
182 delete m_text_dedx;
183 delete m_text_dedx_ir;
184 delete m_text_mean;
185 delete m_text_sigma;
186
187}
188
189//-------------------------------------------
191{
192
193 TH1D* h_Meta = (TH1D*)findHist("CDCDedx/hMeta");
194
195 if (h_Meta != nullptr) {
196 m_nallevt = int(h_Meta->GetBinContent(1));
197 m_nbhabhaevt = int(h_Meta->GetBinContent(2));
198 m_nhadevt = int(h_Meta->GetBinContent(3));
199
200 std::string title = h_Meta->GetTitle();
201
202 m_first = title.find("Exp:");
203 m_last = title.find(", Run:");
204 std::string expN = title.substr(m_first + 4, m_last - m_first - 4);
205
206 m_first = title.find(", Run:");
207 m_last = title.find(", RG:");
208 std::string runN = title.substr(m_first + 6, m_last - m_first - 6);
209
210 m_first = title.find(", RG:");
211 m_last = title.find(")");
212 std::string runGain = title.substr(m_first + 5, m_last - m_first - 5);
213
214 m_exp = std::stoi(expN.c_str());
215 m_run = std::stoi(runN.c_str());
216 m_dbrg = std::stof(runGain.c_str());
217 }
218
219}
220
221//-------------------------------------------
223{
224
225 m_mean = 0.0;
226 m_sigma = 0.0;
227
228 TH1* h_dEdx = findHist("CDCDedx/hdEdx");
229 if (h_dEdx != nullptr) {
230
231 double meanerr = 0.0;
232 double sigmaerr = 0.0;
233
234 m_c_pr_dedx->cd(1);
235 l_line->Clear();
236
237 m_status = "LowStats";
238
239 if (h_dEdx->Integral() > 250) {
240 fitHistogram(h_dEdx, m_status);
241 if (m_status == "OK") {
242 m_mean = h_dEdx->GetFunction("f_gaus")->GetParameter(1);
243 m_sigma = h_dEdx->GetFunction("f_gaus")->GetParameter(2);
244 meanerr = h_dEdx->GetFunction("f_gaus")->GetParError(1);
245 sigmaerr = h_dEdx->GetFunction("f_gaus")->GetParError(2);
246 }
247 setHistStyle(h_dEdx);
248 h_dEdx->SetFillColor(kYellow);
249 h_dEdx->SetTitle("CDC-dEdx");
250 h_dEdx->Draw();
251
252 //Draw line for dE/dx mean
253 l_line->DrawLine(m_mean, 0, m_mean, h_dEdx->GetMaximum());
254 }
255
256 m_monObj->setVariable("CDCDedxMean", m_mean);
257 m_monObj->setVariable("CDCDedxReso", m_sigma);
258 m_monObj->setVariable("CDCDedxMeanErr", meanerr);
259 m_monObj->setVariable("CDCDedxResoErr", sigmaerr);
260
261 m_text_dedx_fit->Clear();
262 m_text_dedx->Clear();
263
265 m_text_dedx_fit->AddText(Form("Fit Status: %s", m_status.data()));
266 m_text_dedx_fit->AddText(Form("Fit #mu^{dE/dx}: %0.3f ", m_mean));
267 m_text_dedx_fit->AddText(Form("Fit #sigma^{dE/dx}: %0.3f ", m_sigma));
268 m_text_dedx_fit->SetTextColor(kRed);
269 m_text_dedx_fit->Draw();
270
272 m_text_dedx->AddText(Form("-- Expert info"));
273 m_text_dedx->AddText(Form("-------------"));
275 m_text_dedx->AddText(Form("Prev Gain: %0.03f", m_dbrg));
276 m_text_dedx->Draw();
277
278 m_c_pr_dedx->Draw();
279 m_c_pr_dedx->Modified();
280 m_c_pr_dedx->Update();
281
282 m_status.clear();
283
284 }
285
286 m_text_mean->Clear();
288 m_text_mean->AddText(Form("Avg #mu_{fit}: %0.3f", m_mean));
289
290 m_text_sigma->Clear();
292 m_text_sigma->AddText(Form("Avg #sigma_{fit}: %0.3f", m_sigma));
293}
294
295//--------------------------------------------
297{
298
299 //1. Draw Scattered plot
300 if (m_mode != "basic") {
301
302 m_c_ir_dedx->cd(3);
303
304 TH2D* hdEdxIRScat = (TH2D*)findHist("CDCDedx/hdEdxvsEvt");
305 if (hdEdxIRScat != nullptr) {
306
307 setPadStyle(0.143, 0.045, 0.077, 0.0);
308
309 if (hdEdxIRScat->GetEntries() > 0) {
310 hdEdxIRScat->GetXaxis()->SetRange(hdEdxIRScat->FindFirstBinAbove(0, 1), hdEdxIRScat->FindLastBinAbove(0, 1));
311 }
312
313 setHistStyle(hdEdxIRScat);
314 hdEdxIRScat->SetTitle("CDC-dE/dx Intra-run variation");
315 hdEdxIRScat->Draw("");
316
317 m_text_dedx_ir->Clear();
318
320 m_text_dedx_ir->AddText("CDC-dE/dx Intra-run");
322 m_text_dedx_ir->Draw("same");
323 }
324
325 }
326
327 //Intra rungain/reso variation
328 TH2D* hdEdxIRScatC = (TH2D*)findHist("CDCDedx/hdEdxvsEvt");
329
330 if (hdEdxIRScatC != nullptr) {
331
332 m_c_ir_dedx->cd(1);
333 gPad->SetGridy(1);
334
335 int fbin = hdEdxIRScatC->FindFirstBinAbove(0, 1);
336 int lbin = hdEdxIRScatC->FindLastBinAbove(0, 1);
337 int nbin = lbin - fbin + 1;
338
339 if (nbin <= 0) nbin = 1;
340
341 delete m_hdEdxIRMean;
342 m_hdEdxIRMean = new TH1F("m_hdEdxIRMean", "", nbin, 0.5, nbin + 0.5);
343 m_hdEdxIRMean->SetTitle("CDC-dE/dx gain(#mu): intra-run variation;Events(M);dE/dx (#mu_{fit})");
344
345 delete m_hdEdxIRSigma;
346 m_hdEdxIRSigma = new TH1F("m_hdEdxIRSigma", "", nbin, 0.5, nbin + 0.5);
347 m_hdEdxIRSigma->SetTitle("CDC-dE/dx reso.(#sigma): intra-run variation;Events(M);dE/dx (#sigma_{fit})");
348
349 setHistPars(hdEdxIRScatC, m_hdEdxIRMean, m_hdEdxIRSigma, nbin);
350
351 //2 intra-gain trend
352 setPadStyle(0.143, 0.045, 0.077, 0.0);
353 m_hdEdxIRMean->SetMarkerColor(kBlue);
354 m_hdEdxIRMean->GetYaxis()->SetRangeUser(m_mean - 0.10, m_mean + 0.10);
355 m_hdEdxIRMean->Draw("");
356
357 l_line->DrawLine(0.5, m_mean, m_hdEdxIRMean->GetXaxis()->GetBinUpEdge(nbin), m_mean);
358
359 m_text_mean->Draw("same");
360
361
362 //3 intra-resolution trend
363 m_c_ir_dedx->cd(2);
364 gPad->SetGridy(1);
365
366 setPadStyle(0.143, 0.045, 0.077, 0.0);
367 m_hdEdxIRSigma->SetMarkerColor(kBlue);
368 m_hdEdxIRSigma->GetYaxis()->SetRangeUser(m_sigma - 0.04, m_sigma + 0.04);
369 m_hdEdxIRSigma->Draw("");
370
371 l_line->DrawLine(0.5, m_sigma, m_hdEdxIRSigma->GetXaxis()->GetBinUpEdge(nbin), m_sigma);
372
373 m_text_sigma->Draw("same");
374 }
375
376}
377
378//-----------------------------------------------
380{
381 //Draw Scattered plot
382 TH2D* hdEdxVsP = (TH2D*)findHist("CDCDedx/hdEdxVsP");
383 if (hdEdxVsP != nullptr) {
384
385 m_c_pr_dedx->cd(2);
386 gPad->SetLogx();
387 gPad->SetLogy();
388
389 setPlotStyle();
390 setHistStyle(hdEdxVsP);
391 hdEdxVsP->SetTitle("CDC-dEdx band plot");
392 hdEdxVsP->SetMinimum(0.10);
393 hdEdxVsP->Draw("col");
394
395 m_text_bandplot->Clear();
396
398 m_text_bandplot->AddText(Form("IP tracks (hadron)"));
399 m_text_bandplot->AddText(Form("Exp/Run: %d/%d", m_exp, m_run));
400 if (m_nhadevt > 1e5)
401 m_text_bandplot->AddText(Form("Events: %0.02fM", double(m_nhadevt / 1e6)));
402 if (m_nhadevt > 1e3)
403 m_text_bandplot->AddText(Form("Events: %0.02fK", double(m_nhadevt / 1e3)));
404 else
405 m_text_bandplot->AddText(Form("Events: %d", m_nhadevt));
406 m_text_bandplot->Draw("same");
407 }
408}
409
410
411//---------------------------------------------
413{
414
415 TH2D* hdEdxvsPhi = (TH2D*)findHist("CDCDedx/hdEdxvsPhi");
416 if (hdEdxvsPhi != nullptr) {
417
418 m_c_pr_dedx->cd(3);
419
420 setHistStyle(hdEdxvsPhi);
421 hdEdxvsPhi->SetTitle("CDC-dEdx vs Phi");
422 hdEdxvsPhi->Draw("col");
423
424 l_line->DrawLine(-3.20, m_mean, 3.20, m_mean);
425
426 }
427
428 //plot # 2
429 TH2D* hdEdxvsCosth = (TH2D*)findHist("CDCDedx/hdEdxvsCosth");
430 if (hdEdxvsCosth != nullptr) {
431
432 m_c_pr_dedx->cd(4);
433
434 setHistStyle(hdEdxvsCosth);
435 hdEdxvsCosth->SetTitle("CDC-dEdx vs Costh");
436 hdEdxvsCosth->Draw("col");
437
438 l_line->DrawLine(-1.0, m_mean, 1.0, m_mean);
439 }
440}
441
442//-----------------------------------------------
444{
445
446 TH2D* hinjtimeHer = (TH2D*)findHist("CDCDedx/hinjtimeHer");
447 TH2D* hinjtimeLer = (TH2D*)findHist("CDCDedx/hinjtimeLer");
448
449 if (hinjtimeHer != nullptr && hinjtimeLer != nullptr) {
450
451 m_c_pr_dedx->cd(7);
452
453 setPlotStyle();
454 setHistStyle(hinjtimeHer);
455 hinjtimeHer->SetFillColor(kBlue);
456 hinjtimeHer->SetTitle("Time since m_last injection (HER)");
457 hinjtimeHer->Draw("box");
458
459 setHistStyle(hinjtimeLer);
460 hinjtimeLer->SetFillColor(kRed);
461 hinjtimeLer->Draw("same box");
462
463 l_line->DrawLine(0, m_mean, 80e3, m_mean);
464
465 m_lego->Clear();
466 m_lego->AddEntry(hinjtimeHer, "HER", "f");
467 m_lego->AddEntry(hinjtimeLer, "LER", "f");
468 m_lego->Draw("same");
469
470 }
471}
472
473//---------------------------------------------
475{
476
477 //Injection time variation
478 TH2D* hdEdxITHer = (TH2D*)findHist("CDCDedx/hinjtimeHer");
479 TH2D* hdEdxITLer = (TH2D*)findHist("CDCDedx/hinjtimeLer");
480
481 if (hdEdxITHer != nullptr && hdEdxITLer != nullptr) {
482
483 m_c_pr_dedx->cd(5);
484
485 int fbin = hdEdxITHer->FindFirstBinAbove(0, 1);
486 int lbin = hdEdxITHer->FindLastBinAbove(0, 1);
487 int nbin = (lbin - fbin + 1) / 2;
488 if (nbin <= 0)nbin = 1;
489
490 delete m_hSigmaHer;
491 delete m_hMeanHer;
492 delete m_hMeanLer;
493 delete m_hSigmaLer;
494 m_hMeanHer = new TH1F("m_hMeanHer", "CDC-dE/dx gain(#mu);Injection time (ms);dE/dx (#mu_{fit})", nbin, 0.5, nbin + 0.5);
495 m_hSigmaHer = new TH1F("m_hSigmaHer", "CDC-dE/dx reso.(#sigma);Injection time (ms);dE/dx (#sigma_{fit})", nbin, 0.5, nbin + 0.5);
496
497 m_hMeanLer = new TH1F("m_hMeanLer", "CDC-dE/dx gain(#mu);Injection time (ms);dE/dx (#mu_{fit})", nbin, 0.5, nbin + 0.5);
498 m_hSigmaLer = new TH1F("m_hSigmaLer", "CDC-dE/dx reso.(#sigma);Injection time (ms);dE/dx (#sigma_{fit})", nbin, 0.5, nbin + 0.5);
499
500 setHistPars(hdEdxITHer, m_hMeanHer, m_hSigmaHer, nbin);
501 setHistPars(hdEdxITLer, m_hMeanLer, m_hSigmaLer, nbin);
502
503 // dE/dx mean vs injection time
504 gPad->SetGridy(1);
505 setPadStyle(0.143, 0.045, 0.077, 0.0);
506 m_hMeanHer->SetMarkerColor(kBlue);
507 m_hMeanHer->GetYaxis()->SetRangeUser(m_mean - 0.40, m_mean + 0.40);
508 m_hMeanHer->Draw("");
509
510 l_line->DrawLine(0.5, m_mean, m_hMeanHer->GetXaxis()->GetBinUpEdge(nbin), m_mean);
511
512 m_hMeanLer->SetMarkerColor(kRed);
513 m_hMeanLer->Draw("same");
514 m_text_mean->Draw("same");
515
516 m_legoI->Clear();
517
518 m_legoI->AddEntry(m_hMeanHer, "HER", "p");
519 m_legoI->AddEntry(m_hMeanLer, "LER", "p");
520 m_legoI->Draw("same");
521
522 // dE/dx sigma vs injection time
523
524 m_c_pr_dedx->cd(6);
525 gPad->SetGridy(1);
526
527 setPadStyle(0.143, 0.045, 0.077, 0.0);
528 m_hSigmaHer->SetMarkerColor(kBlue);
529 m_hSigmaHer->GetYaxis()->SetRangeUser(m_sigma - 0.15, m_sigma + 0.15);
530 m_hSigmaHer->Draw("");
531
532 l_line->DrawLine(0.5, m_sigma, m_hSigmaHer->GetXaxis()->GetBinUpEdge(nbin), m_sigma);
533
534 m_hSigmaLer->SetMarkerColor(kRed);
535 m_hSigmaLer->Draw("same");
536
537 m_text_sigma->Draw("same");
538
539 m_legoI->Draw("same");
540 }
541}
542
543//------------------------------------------------
545{
546
547 //Draw Scattered plot
548 TH2D* hWires = (TH2D*)findHist("CDCDedx/hWires");
549 TH2D* hWireStatus = (TH2D*)findHist("CDCDedx/hWireStatus");
550 if (hWires != nullptr && hWireStatus != nullptr) {
551
552 m_c_pr_dedx->cd(8);
553 setHistStyle(hWires);
554 hWires->SetMarkerColor(kGray);
555 hWires->Draw("");
556
557 std::string s_ndead = hWireStatus->GetTitle();
558 int m_ndead = atof(s_ndead.c_str());
559 m_monObj->setVariable("CDCDedxDeadWires", m_ndead);
560
561 setHistStyle(hWireStatus);
562 hWireStatus->SetMarkerColor(kRed);
563 hWireStatus->SetMarkerStyle(7);
564 hWireStatus->Draw("same");
565
566 m_text_dedxWire->Clear();
567
569 m_text_dedxWire->AddText(Form("CDC Wire Status"));
570 m_text_dedxWire->AddText(Form("Exp/Run: %d/%d", m_exp, m_run));
571 m_text_dedxWire->AddText(Form("Dead: %d (%0.02f%%)", m_ndead, (100.0 * m_ndead / c_nSenseWires)));
572 if (m_nallevt > 1e5)
573 m_text_dedxWire->AddText(Form("Events: %0.02fM", double(m_nallevt / 1e6)));
574 if (m_nallevt > 1e3)
575 m_text_dedxWire->AddText(Form("Events: %0.02fK", double(m_nallevt / 1e3)));
576 else
577 m_text_dedxWire->AddText(Form("Events: %d", m_nallevt));
578 m_text_dedxWire->Draw("same");
579 }
580}
581
582//-----------------------------------------------
583void DQMHistAnalysisCDCDedxModule::setHistPars(TH2D*& hdEdx, TH1F*& hmean, TH1F*& hsigma, int nbin)
584{
585
586 int fbin = hdEdx->FindFirstBinAbove(0, 1);
587
588 for (int ibin = 0; ibin < nbin; ibin++) {
589 int localbin = ibin + fbin;
590 delete m_hdEdxIRInd;
591 m_hdEdxIRInd = (TH1*)hdEdx->ProjectionY(Form("htemp_%d", localbin), localbin, localbin);
592
593 double mean = 0.0, meanerr = 0.0;
594 double sigma = 0.0, sigmaerr = 0.0;
595
597
598 if (m_status == "OK") {
599 mean = m_hdEdxIRInd->GetFunction("f_gaus")->GetParameter(1);
600 meanerr = m_hdEdxIRInd->GetFunction("f_gaus")->GetParError(1);
601 sigma = m_hdEdxIRInd->GetFunction("f_gaus")->GetParameter(2);
602 sigmaerr = m_hdEdxIRInd->GetFunction("f_gaus")->GetParError(2);
603 }
604
605 hmean->SetBinContent(ibin + 1, mean);
606 hmean->SetBinError(ibin + 1, meanerr);
607 hsigma->SetBinContent(ibin + 1, sigma);
608 hsigma->SetBinError(ibin + 1, sigmaerr);
609 }
610 hmean->SetMarkerStyle(20);
611 hmean->SetMarkerSize(1.10);
612 hsigma->SetMarkerStyle(20);
613 hsigma->SetMarkerSize(1.10);
614}
615
616//-----------------------------------------------
618{
619
620 pt->AddText("CDC dE/dx (e^{+}e^{-})");
621 pt->AddText(Form("Exp/Run: %d/%d", m_exp, m_run));
622 if (m_nbhabhaevt > 1e5)
623 pt->AddText(Form("Events: %0.02fM", double(m_nbhabhaevt / 1e6)));
624 if (m_nbhabhaevt > 1e3)
625 pt->AddText(Form("Events: %0.02fK", double(m_nbhabhaevt / 1e3)));
626 else
627 pt->AddText(Form("Events: %d", m_nbhabhaevt));
628}
629
630//----------------------------------------------------------------------------------------
631void DQMHistAnalysisCDCDedxModule::fitHistogram(TH1*& temphist, std::string& status)
632{
633
634 if (temphist != nullptr) {
635 temphist->GetXaxis()->SetRange(temphist->FindFirstBinAbove(0, 1), temphist->FindLastBinAbove(0, 1));
636 int fs = temphist->Fit(f_gaus, "QR");
637 if (fs != 0) {
638 status = "Failed";
639 } else {
640 double mean = temphist->GetFunction("f_gaus")->GetParameter(1);
641 double width = temphist->GetFunction("f_gaus")->GetParameter(2);
642 temphist->GetXaxis()->SetRangeUser(mean - 5.0 * width, mean + 5.0 * width);
643 fs = temphist->Fit(f_gaus, "QR", "", mean - 3.0 * width, mean + 3.0 * width);
644 if (fs != 0)status = "Failed";
645 else {
646 temphist->GetXaxis()->SetRangeUser(mean - 5.0 * width, mean + 5.0 * width);
647 status = "OK";
648 }
649 }
650 }
651
652}
653
654//------------------------------------------------
656{
657 gStyle->SetNumberContours(m_NCont);
658 TColor::SetPalette(m_pal, m_palarr);
659}
660
661
662//------------------------------------------------------------------
664{
665
666 obj->SetFillColor(TColor::GetColor("#FFFF99")); // Light yellow background for visibility
667 obj->SetFillStyle(1001); // Solid fill
668 obj->SetLineColor(TColor::GetColor("#000000"));
669 obj->SetLineWidth(1); // Add a border for visibility
670 obj->SetTextAlign(12);
671 obj->SetTextColor(kBlack); // Set text color to black for better contrast
672 obj->SetTextFont(82);
673 obj->SetTextSize(0.03157895);
674
675}
676
677//------------------------------------------------------------------
679{
680
681 obj->SetStats(0);
682 obj->SetTitle("");
683
684 obj->SetTitleOffset(1.15, "x");
685 obj->SetTitleSize(.040, "x");
686 obj->SetTitleOffset(1.15, "y");
687 obj->SetTitleSize(.040, "y");
688
689 obj->SetLabelOffset(0.015, "x");
690 obj->SetLabelSize(.040, "x");
691 obj->SetLabelOffset(0.015, "y");
692 obj->SetLabelSize(.040, "y");
693
694 obj->SetTickLength(0.03, "x");
695 obj->SetTickLength(0.02, "y");
696
697}
698
699//-------------------------------------------------------------------------------------
700void DQMHistAnalysisCDCDedxModule::setPadStyle(double l, double r, double t, double b)
701{
702
703 if (l != 0)gPad->SetLeftMargin(l);
704 if (r != 0)gPad->SetRightMargin(r);
705 if (t != 0)gPad->SetTopMargin(t);
706 if (b != 0)gPad->SetBottomMargin(b);
707 gPad->SetTickx(1);
708 gPad->SetTicky(1);
709
710}
void drawDedxInjTime()
function to draw the dEdx vs injection time
void drawDedxCosPhi()
function to draw dEdx vs costh and phi
void initialize() override final
init function for default values
void drawBandPlot()
function to dedx bands P
void setTextStyle(TPaveText *obj)
function to add text style
void drawWireStatus()
function to draw ADC-based dead wire status of CDC
TH1F * m_hdEdxIRMean
histogram for dE/dx mean vs events per run
TPaveText * m_text_dedx_fit
add dE/dx fit information
void setHistStyle(TH1 *obj)
function to set the style of histogram
TPaveText * m_text_mean
add dE/dx mean information
TH1 * m_hdEdxIRInd
histogram to calculate dE/dx mean and sigma in bins
TLegend * m_legoI
legends for LER/HER for mean and sigma
MonitoringObject * m_monObj
MonitoringObject for mirabelle.
TH1F * m_hSigmaHer
histogram for dE/dx sigma vs injection time (HER)
void terminate() override final
terminating at the end of last run
void drawDedxInjTimeBin()
function to draw the mean/reso of dedx vs injection time
void event() override final
event by event function
TPaveText * m_text_sigma
add dE/dx sigma information
TCanvas * m_c_ir_dedx
intra-run dedx status
void setHistPars(TH2D *&hist, TH1F *&hmean, TH1F *&hsigma, int nbin)
function to set the mean and sigma histograms
static const Int_t m_NCont
Total number of colors in the table.
TPaveText * m_text_dedxWire
add Wire information
void endRun() override final
end of each run
TH1F * m_hSigmaLer
histogram for dE/dx sigma vs injection time (LER)
void setPadStyle(double l, double r, double t, double b)
function to reset pad margins
Int_t m_palarr[m_NCont]
array of colors
void getMetadata()
function to get metadata from histogram
void setBEvtInfo(TPaveText *pt)
function to set the bhabha event info
void fitHistogram(TH1 *&temphist, std::string &status)
function to fit gaussian dist.
unsigned m_first
substring start value
void beginRun() override final
begin each run
TPaveText * m_text_dedx_ir
add dE/dx intra run information
void drawDedxPR()
function to draw dEdx+Fit
TPaveText * m_text_bandplot
add hadron event information
void drawDedxIR()
function to draw dEdx+Fit for run variation
TPaveText * m_text_dedx
add dE/dx bhabha event information
TH1F * m_hdEdxIRSigma
histogram for dE/dx sigma vs events per run
static const Int_t m_NRGBs
Number of end point colors that will form the gradients.
TH1F * m_hMeanLer
histogram for dE/dx mean vs injection time (LER)
TH1F * m_hMeanHer
histogram for dE/dx mean vs injection time (HER)
std::string m_mode
monitoring mode all/basic
void setPlotStyle()
function to add plot style
The base class for the histogram analysis module.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setVariable(const std::string &var, float val, float upErr=-1., float dwErr=-1)
set value to float variable (new variable is made if not yet existing)
void addCanvas(TCanvas *canv)
Add Canvas to monitoring object.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:649
Abstract base class for different kinds of events.
STL namespace.