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