Belle II Software  release-06-00-14
DQMHistAnalysisMiraBelle.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 // Own include
10 #include <dqm/analysis/modules/DQMHistAnalysisMiraBelle.h>
11 
12 //DQM
13 #include <dqm/analysis/modules/DQMHistAnalysis.h>
14 
15 #include <TFile.h>
16 #include <TF1.h>
17 #include <TH1F.h>
18 #include <TH2F.h>
19 #include <TCanvas.h>
20 #include <TLine.h>
21 #include <TClass.h>
22 #include <TROOT.h>
23 
24 #include <fstream>
25 #include <vector>
26 #include <algorithm>
27 
28 using namespace std;
29 using namespace Belle2;
30 
31 //-----------------------------------------------------------------
32 // Register module
33 //-----------------------------------------------------------------
34 
35 REG_MODULE(DQMHistAnalysisMiraBelle);
36 
37 DQMHistAnalysisMiraBelleModule::DQMHistAnalysisMiraBelleModule()
39 {
40  // set module description (e.g. insert text)
41  setDescription("Modify and analyze the data quality histograms of MiraBelle");
43  addParam("debug", m_debug, "debug mode", false);
44  addParam("alert", m_enableAlert, "Enable color alert", true);
45  addParam("scale_dst", m_scale_dst, "Scale factor signal/sideband", 0.09375);
46 }
47 
49 {
50 }
51 
53 {
54  gROOT->cd();
55 
56  //mon_mumu = new Belle2::MonitoringObject("mumu");
57  mon_mumu = getMonitoringObject("mumu");
59 
60  // make cavases to be added to MonitoringObject
61  mumu_main = new TCanvas("mumu_main", "mumu_main", 0, 0, 800, 600);
62  mumu_resolution = new TCanvas("mumu_resolution", "mumu_resolution", 0, 0, 800, 600);
63  mumu_muon_val = new TCanvas("mumu_muon_val", "mumu_muon_val", 0, 0, 400, 400);
64  dst_mass = new TCanvas("dst_mass", "dst_mass", 0, 0, 1200, 400);
65  dst_pi_val = new TCanvas("dst_pi_val", "dst_pi_val", 0, 0, 800, 400);
66  dst_k_val = new TCanvas("dst_k_val", "dst_k_val", 0, 0, 800, 400);
67 
68  // add canvases to MonitoringObject
75 
76  B2DEBUG(20, "DQMHistAnalysisMiraBelle: initialized.");
77 }
78 
80 {
81  B2DEBUG(20, "DQMHistAnalysisMiraBelle: beginRun called.");
82 }
83 
85 {
86  B2DEBUG(20, "DQMHistAnalysisOutputMiraBelle: event called.");
87 }
88 
90 {
91  // ========== mumutight
92  // get existing histograms produced by DQM modules
93  TH1* hist_npxd = findHist("PhysicsObjectsMiraBelle/hist_npxd");
94  TH1* hist_nsvd = findHist("PhysicsObjectsMiraBelle/hist_nsvd");
95  TH1* hist_ncdc = findHist("PhysicsObjectsMiraBelle/hist_ncdc");
96  TH1* hist_topdig = findHist("PhysicsObjectsMiraBelle/hist_topdig");
97  TH1* hist_DetPhotonARICH = findHist("PhysicsObjectsMiraBelle/hist_DetPhotonARICH");
98  TH1* hist_klmTotalHits = findHist("PhysicsObjectsMiraBelle/hist_klmTotalHits");
99  TH1* hist_klmClusterLayers = findHist("PhysicsObjectsMiraBelle/hist_klmClusterLayers");
100  TH1* hist_dD0 = findHist("PhysicsObjectsMiraBelle/hist_dD0");
101  TH1* hist_dZ0 = findHist("PhysicsObjectsMiraBelle/hist_dZ0");
102  TH1* hist_dPtcms = findHist("PhysicsObjectsMiraBelle/hist_dPtcms");
103  TH1* hist_Pval = findHist("PhysicsObjectsMiraBelle/hist_Pval");
104  TH1* hist_nExtraCDCHits = findHist("PhysicsObjectsMiraBelle/hist_nExtraCDCHits");
105  TH1* hist_nECLClusters = findHist("PhysicsObjectsMiraBelle/hist_nECLClusters");
106  TH1* hist_muid = findHist("PhysicsObjectsMiraBelle/hist_muid");
107  TH1* hist_inv_p = findHist("PhysicsObjectsMiraBelle/hist_inv_p");
108  TH1* hist_ndf = findHist("PhysicsObjectsMiraBelle/hist_ndf");
109  TH1* hist_D0 = findHist("PhysicsObjectsMiraBelle/hist_D0");
110  TH1* hist_Z0 = findHist("PhysicsObjectsMiraBelle/hist_Z0");
111  TH1* hist_theta = findHist("PhysicsObjectsMiraBelle/hist_theta");
112  TH1* hist_Phi0 = findHist("PhysicsObjectsMiraBelle/hist_Phi0");
113  TH1* hist_Pt = findHist("PhysicsObjectsMiraBelle/hist_Pt");
114  TH1* hist_Mom = findHist("PhysicsObjectsMiraBelle/hist_Mom");
115  TH1* hist_klmTotalBarrelHits = findHist("PhysicsObjectsMiraBelle/hist_klmTotalBarrelHits");
116  TH1* hist_klmTotalEndcapHits = findHist("PhysicsObjectsMiraBelle/hist_klmTotalEndcapHits");
117  TH1* hist_dPhicms = findHist("PhysicsObjectsMiraBelle/hist_dPhicms");
118 
119  // Make TCanvases
120  // --- Mumu_Main
121  mumu_main->Divide(4, 3);
122  mumu_main->cd(1); hist_theta->Draw();
123  mumu_main->cd(2); hist_Phi0->Draw();
124  mumu_main->cd(3); hist_Mom->Draw();
125  mumu_main->cd(4); hist_Pt->Draw();
126  mumu_main->cd(5); hist_npxd->Draw();
127  mumu_main->cd(6); hist_nsvd->Draw();
128  mumu_main->cd(7); hist_ncdc->Draw();
129  mumu_main->cd(8); hist_topdig->Draw();
130  mumu_main->cd(9); hist_DetPhotonARICH->Draw();
131  mumu_main->cd(10); hist_klmClusterLayers->Draw();
132  mumu_main->cd(11); hist_nExtraCDCHits->Draw();
133  mumu_main->cd(12); hist_nECLClusters->Draw();
134  // --- Mumu_Resolution
135  mumu_resolution->Divide(3, 3);
136  mumu_resolution->cd(1); hist_inv_p->Draw();
137  mumu_resolution->cd(2); hist_dD0->Draw();
138  mumu_resolution->cd(3); hist_dZ0->Draw();
139  mumu_resolution->cd(4); hist_dPtcms->Draw();
140  mumu_resolution->cd(5); hist_dPhicms->Draw();
141  mumu_resolution->cd(6); hist_nECLClusters->Draw();
142  mumu_resolution->cd(7); hist_nExtraCDCHits->Draw();
143  mumu_resolution->cd(8); hist_ndf->Draw();
144  mumu_muon_val->Divide(2, 2);
145  // --- Muon variables
146  mumu_muon_val->cd(1); hist_muid->Draw();
147  mumu_muon_val->cd(2); hist_Pval->Draw();
148  mumu_muon_val->cd(3); hist_theta->Draw();
149  mumu_muon_val->cd(4); hist_Phi0->Draw();
150 
151  // calculate the values of monitoring variables
152  float mean_npxd = hist_npxd->GetMean();
153  float mean_nsvd = hist_nsvd->GetMean();
154  float mean_ncdc = hist_ncdc->GetMean();
155  float mean_nklmlayer = hist_klmClusterLayers->GetMean();
156  float mean_nklm = hist_klmTotalHits->GetMean();
157  float mean_nbklm = hist_klmTotalBarrelHits->GetMean();
158  float mean_neklm = hist_klmTotalEndcapHits->GetMean();
159  float mean_topdig = hist_topdig->GetMean();
160  float mean_parich = hist_DetPhotonARICH->GetMean();
161  float mean_ncdc_ex = hist_nExtraCDCHits->GetMean();
162  float mean_necl = hist_nECLClusters->GetMean();
163  float mean_muid = hist_muid->GetMean();
164  float mean_d0 = hist_D0->GetMean();
165  float mean_z0 = hist_Z0->GetMean();
166  float mean_pval = hist_Pval->GetMean();
167  float mean_ndf = hist_ndf->GetMean();
168  float dif_ndf_ncdc = mean_ndf - mean_ncdc;
169  float mean_dd0 = hist_dD0->GetMean();
170  float mean_dz0 = hist_dZ0->GetMean();
171  float mean_dpt = hist_dPtcms->GetMean();
172  float rms_dd0 = hist_dD0->GetRMS();
173  float rms_dz0 = hist_dZ0->GetRMS();
174  float rms_dpt = hist_dPtcms->GetRMS();
175  int ntot = hist_nsvd->GetEntries();
176  float neve_mumu = ntot;
177  float goodmu_frac = hist_muid->GetBinContent(20) / (float)ntot;
178  float goodmu_o_badmu = hist_muid->GetBinContent(20) / (float)hist_muid->GetBinContent(1);
179  float pval_more95 = 0;
180  float pval_less05 = 0;
181  for (int i = 95; i < 100; i++) pval_more95 += hist_Pval->GetBinContent(i + 1);
182  for (int i = 0; i < 5; i++) pval_less05 += hist_Pval->GetBinContent(i + 1);
183  float pval_frac_0 = pval_less05 / (float)ntot;
184  float pval_frac_1 = pval_more95 / (float)ntot;
185  float nocdc_frac = hist_ncdc->GetBinContent(1) / (float)ntot;
186  float notop_frac = hist_topdig->GetBinContent(1) / (float)ntot;
187  float noarich_frac = hist_DetPhotonARICH->GetBinContent(1) / (float)ntot;
188  //Calculate M(mumu)
189  float peak_mumu = hist_inv_p->GetXaxis()->GetBinCenter(hist_inv_p->GetMaximumBin());
190  TF1* f_mumuInvM = new TF1("f_mumuInvM", "gaus", peak_mumu - 0.04, peak_mumu + 0.04);
191  f_mumuInvM->SetParameters(hist_inv_p->GetMaximum(), peak_mumu, 0.045);
192  f_mumuInvM->SetParLimits(1, peak_mumu - 0.04, peak_mumu + 0.04);
193  f_mumuInvM->SetParLimits(2, 0.01, 0.06);
194  hist_inv_p->Fit(f_mumuInvM, "R");
195  float fit_mumumass = f_mumuInvM->GetParameter(1);
196  if (fit_mumumass < 9) fit_mumumass = 9;
197  if (fit_mumumass > 12) fit_mumumass = 12;
198 
199  // set values
200  mon_mumu->setVariable("mean_npxd", mean_npxd);
201  mon_mumu->setVariable("mean_nsvd", mean_nsvd);
202  mon_mumu->setVariable("mean_ncdc", mean_ncdc);
203  mon_mumu->setVariable("mean_nklmlayer", mean_nklmlayer);
204  mon_mumu->setVariable("mean_nklm", mean_nklm);
205  mon_mumu->setVariable("mean_nbklm", mean_nbklm);
206  mon_mumu->setVariable("mean_neklm", mean_neklm);
207  mon_mumu->setVariable("mean_topdig", mean_topdig);
208  mon_mumu->setVariable("mean_parich", mean_parich);
209  mon_mumu->setVariable("mean_ncdc_ex", mean_ncdc_ex);
210  mon_mumu->setVariable("mean_necl", mean_necl);
211  mon_mumu->setVariable("mean_muid", mean_muid);
212  mon_mumu->setVariable("mean_d0", mean_d0);
213  mon_mumu->setVariable("mean_z0", mean_z0);
214  mon_mumu->setVariable("mean_pval", mean_pval);
215  mon_mumu->setVariable("mean_ndf", mean_ndf);
216  mon_mumu->setVariable("dif_ndf_ncdc", dif_ndf_ncdc);
217  mon_mumu->setVariable("mean_dd0", mean_dd0);
218  mon_mumu->setVariable("mean_dz0", mean_dz0);
219  mon_mumu->setVariable("mean_dpt", mean_dpt);
220  mon_mumu->setVariable("rms_dd0", rms_dd0);
221  mon_mumu->setVariable("rms_dz0", rms_dz0);
222  mon_mumu->setVariable("rms_dpt", rms_dpt);
223  mon_mumu->setVariable("neve_mumu", neve_mumu);
224  mon_mumu->setVariable("goodmu_frac", goodmu_frac);
225  mon_mumu->setVariable("goodmu_o_badmu", goodmu_o_badmu);
226  mon_mumu->setVariable("pval_frac_0", pval_frac_0);
227  mon_mumu->setVariable("pval_frac_1", pval_frac_1);
228  mon_mumu->setVariable("nocdc_frac", nocdc_frac);
229  mon_mumu->setVariable("notop_frac", notop_frac);
230  mon_mumu->setVariable("noarich_frac", noarich_frac);
231  mon_mumu->setVariable("fit_mumumass", fit_mumumass);
232 
233  // ========== D*
234  // get existing histograms produced by DQM modules
235  TH1* hist_D0_InvM = findHist("PhysicsObjectsMiraBelleDst/hist_D0_InvM");
236  TH1* hist_delta_m = findHist("PhysicsObjectsMiraBelleDst/hist_delta_m");
237  TH1* hist_D0_softpi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_ALL_pion");
238  TH1* hist_D0_softpi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_SVD_pion");
239  TH1* hist_D0_softpi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_CDC_pion");
240  TH1* hist_D0_softpi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_TOP_pion");
241  TH1* hist_D0_softpi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_ARICH_pion");
242  TH1* hist_D0_softpi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_ECL_pion");
243  TH1* hist_D0_softpi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_KLM_pion");
244  TH1* hist_D0_pi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_ALL_pion");
245  TH1* hist_D0_pi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_SVD_pion");
246  TH1* hist_D0_pi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_CDC_pion");
247  TH1* hist_D0_pi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_TOP_pion");
248  TH1* hist_D0_pi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_ARICH_pion");
249  TH1* hist_D0_pi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_ECL_pion");
250  TH1* hist_D0_pi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_KLM_pion");
251  TH1* hist_D0_K_PID_ALL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_ALL_kaon");
252  TH1* hist_D0_K_PID_SVD_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_SVD_kaon");
253  TH1* hist_D0_K_PID_CDC_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_CDC_kaon");
254  TH1* hist_D0_K_PID_TOP_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_TOP_kaon");
255  TH1* hist_D0_K_PID_ARICH_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_ARICH_kaon");
256  TH1* hist_D0_K_PID_ECL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_ECL_kaon");
257  TH1* hist_D0_K_PID_KLM_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_KLM_kaon");
258  TH1* hist_sideband_D0_softpi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_ALL_pion");
259  TH1* hist_sideband_D0_softpi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_SVD_pion");
260  TH1* hist_sideband_D0_softpi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_CDC_pion");
261  TH1* hist_sideband_D0_softpi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_TOP_pion");
262  TH1* hist_sideband_D0_softpi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_ARICH_pion");
263  TH1* hist_sideband_D0_softpi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_ECL_pion");
264  TH1* hist_sideband_D0_softpi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_KLM_pion");
265  TH1* hist_sideband_D0_pi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_ALL_pion");
266  TH1* hist_sideband_D0_pi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_SVD_pion");
267  TH1* hist_sideband_D0_pi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_CDC_pion");
268  TH1* hist_sideband_D0_pi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_TOP_pion");
269  TH1* hist_sideband_D0_pi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_ARICH_pion");
270  TH1* hist_sideband_D0_pi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_ECL_pion");
271  TH1* hist_sideband_D0_pi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_KLM_pion");
272  TH1* hist_sideband_D0_K_PID_ALL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_ALL_kaon");
273  TH1* hist_sideband_D0_K_PID_SVD_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_SVD_kaon");
274  TH1* hist_sideband_D0_K_PID_CDC_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_CDC_kaon");
275  TH1* hist_sideband_D0_K_PID_TOP_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_TOP_kaon");
276  TH1* hist_sideband_D0_K_PID_ARICH_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_ARICH_kaon");
277  TH1* hist_sideband_D0_K_PID_ECL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_ECL_kaon");
278  TH1* hist_sideband_D0_K_PID_KLM_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_KLM_kaon");
279  TH1* hist_D0_pi0_InvM = findHist("PhysicsObjectsMiraBelleDst2/hist_D0_pi0_InvM");
280 
281  // Fit mass distributions for scale factor
282  TF1* f_InvM = new TF1("f_InvM", "[0]*TMath::Gaus(x,[1],[2])+[3]*pow(x-[4],2)+[5]", 1.81, 1.95);
283  f_InvM->SetParNames("Height", "#mu", "#sigma", "a", "b", "c");
284  f_InvM->SetParameters(hist_D0_InvM->GetMaximum(), 1.86, 5e-3, 0., 1.86, 0.);
285  hist_D0_InvM->Fit(f_InvM, "", "", 1.81, 1.95);
286  f_InvM->SetLineColor(kRed);
287 
288  TF1* f_delta_m = new TF1("f_delta_m", "[0]*TMath::Gaus(x,[1],[2])+[3]*pow(x-[4],2)+[5]", 0.14, 0.16);
289  f_delta_m->SetParNames("Height", "#mu", "#sigma", "a", "b", "c");
290  f_delta_m->SetParameters(hist_delta_m->GetMaximum(), 0.145, 5e-4, 0., 0.145, 0.);
291  hist_delta_m->Fit(f_delta_m, "", "", 0.14, 0.16);
292  f_delta_m->SetLineColor(kRed);
293 
294  TF1* f_pi0_InvM = new TF1("f_pi0_InvM", "[0]*TMath::Gaus(x,[1],[2])+[3]*pow(x-[4],2)+[5]", 0.09, 0.17);
295  f_pi0_InvM->SetParNames("Height", "#mu", "#sigma", "a", "b", "c");
296  f_pi0_InvM->SetParameters(hist_D0_pi0_InvM->GetMaximum(), 0.13, 5e-3, 0., 0.13, 0.);
297  hist_D0_pi0_InvM->Fit(f_pi0_InvM, "", "", 0.09, 0.17);
298  f_pi0_InvM->SetLineColor(kRed);
299 
300  // D->KPi and D->KPiPi0 yields
301  TF1* f_gaus_InvM = new TF1("f_gaus_InvM", "gaus", 1.81, 1.95);
302  f_gaus_InvM->SetParameters(f_InvM->GetParameter(0), f_InvM->GetParameter(1), f_InvM->GetParameter(2));
303  float InvM_bin_width = hist_D0_InvM->GetXaxis()->GetBinWidth(1);
304  float neve_dst = f_gaus_InvM->Integral(1.81, 1.95) / InvM_bin_width;
305 
306  TF1* f_gaus_pi0_InvM = new TF1("f_gaus_pi0_InvM", "gaus", 0.09, 0.17);
307  f_gaus_pi0_InvM->SetParameters(f_pi0_InvM->GetParameter(0), f_pi0_InvM->GetParameter(1), f_pi0_InvM->GetParameter(2));
308  float pi0_InvM_bin_width = hist_D0_pi0_InvM->GetXaxis()->GetBinWidth(1);
309  float neve_pi0 = f_gaus_pi0_InvM->Integral(0.09, 0.17) / pi0_InvM_bin_width;
310 
311  // Sumw2
312  hist_D0_softpi_PID_ALL_pion->Sumw2();
313  hist_D0_softpi_PID_SVD_pion->Sumw2();
314  hist_D0_softpi_PID_CDC_pion->Sumw2();
315  hist_D0_softpi_PID_TOP_pion->Sumw2();
316  hist_D0_softpi_PID_ARICH_pion->Sumw2();
317  hist_D0_softpi_PID_ECL_pion->Sumw2();
318  hist_D0_softpi_PID_KLM_pion->Sumw2();
319  hist_D0_pi_PID_ALL_pion->Sumw2();
320  hist_D0_pi_PID_SVD_pion->Sumw2();
321  hist_D0_pi_PID_CDC_pion->Sumw2();
322  hist_D0_pi_PID_TOP_pion->Sumw2();
323  hist_D0_pi_PID_ARICH_pion->Sumw2();
324  hist_D0_pi_PID_ECL_pion->Sumw2();
325  hist_D0_pi_PID_KLM_pion->Sumw2();
326  hist_D0_K_PID_ALL_kaon->Sumw2();
327  hist_D0_K_PID_SVD_kaon->Sumw2();
328  hist_D0_K_PID_CDC_kaon->Sumw2();
329  hist_D0_K_PID_TOP_kaon->Sumw2();
330  hist_D0_K_PID_ARICH_kaon->Sumw2();
331  hist_D0_K_PID_ECL_kaon->Sumw2();
332  hist_D0_K_PID_KLM_kaon->Sumw2();
333  hist_sideband_D0_softpi_PID_ALL_pion->Sumw2();
334  hist_sideband_D0_softpi_PID_SVD_pion->Sumw2();
335  hist_sideband_D0_softpi_PID_CDC_pion->Sumw2();
336  hist_sideband_D0_softpi_PID_TOP_pion->Sumw2();
337  hist_sideband_D0_softpi_PID_ARICH_pion->Sumw2();
338  hist_sideband_D0_softpi_PID_ECL_pion->Sumw2();
339  hist_sideband_D0_softpi_PID_KLM_pion->Sumw2();
340  hist_sideband_D0_pi_PID_ALL_pion->Sumw2();
341  hist_sideband_D0_pi_PID_SVD_pion->Sumw2();
342  hist_sideband_D0_pi_PID_CDC_pion->Sumw2();
343  hist_sideband_D0_pi_PID_TOP_pion->Sumw2();
344  hist_sideband_D0_pi_PID_ARICH_pion->Sumw2();
345  hist_sideband_D0_pi_PID_ECL_pion->Sumw2();
346  hist_sideband_D0_pi_PID_KLM_pion->Sumw2();
347  hist_sideband_D0_K_PID_ALL_kaon->Sumw2();
348  hist_sideband_D0_K_PID_SVD_kaon->Sumw2();
349  hist_sideband_D0_K_PID_CDC_kaon->Sumw2();
350  hist_sideband_D0_K_PID_TOP_kaon->Sumw2();
351  hist_sideband_D0_K_PID_ARICH_kaon->Sumw2();
352  hist_sideband_D0_K_PID_ECL_kaon->Sumw2();
353  hist_sideband_D0_K_PID_KLM_kaon->Sumw2();
354 
355  // Scale the distributions in sideband
356  hist_sideband_D0_softpi_PID_ALL_pion->Scale(m_scale_dst);
357  hist_sideband_D0_softpi_PID_SVD_pion->Scale(m_scale_dst);
358  hist_sideband_D0_softpi_PID_CDC_pion->Scale(m_scale_dst);
359  hist_sideband_D0_softpi_PID_TOP_pion->Scale(m_scale_dst);
360  hist_sideband_D0_softpi_PID_ARICH_pion->Scale(m_scale_dst);
361  hist_sideband_D0_softpi_PID_ECL_pion->Scale(m_scale_dst);
362  hist_sideband_D0_softpi_PID_KLM_pion->Scale(m_scale_dst);
363  hist_sideband_D0_pi_PID_ALL_pion->Scale(m_scale_dst);
364  hist_sideband_D0_pi_PID_SVD_pion->Scale(m_scale_dst);
365  hist_sideband_D0_pi_PID_CDC_pion->Scale(m_scale_dst);
366  hist_sideband_D0_pi_PID_TOP_pion->Scale(m_scale_dst);
367  hist_sideband_D0_pi_PID_ARICH_pion->Scale(m_scale_dst);
368  hist_sideband_D0_pi_PID_ECL_pion->Scale(m_scale_dst);
369  hist_sideband_D0_pi_PID_KLM_pion->Scale(m_scale_dst);
370  hist_sideband_D0_K_PID_ALL_kaon->Scale(m_scale_dst);
371  hist_sideband_D0_K_PID_SVD_kaon->Scale(m_scale_dst);
372  hist_sideband_D0_K_PID_CDC_kaon->Scale(m_scale_dst);
373  hist_sideband_D0_K_PID_TOP_kaon->Scale(m_scale_dst);
374  hist_sideband_D0_K_PID_ARICH_kaon->Scale(m_scale_dst);
375  hist_sideband_D0_K_PID_ECL_kaon->Scale(m_scale_dst);
376  hist_sideband_D0_K_PID_KLM_kaon->Scale(m_scale_dst);
377 
378  // BG subtraction
379  hist_D0_softpi_PID_ALL_pion->Add(hist_sideband_D0_softpi_PID_ALL_pion, -1);
380  hist_D0_softpi_PID_SVD_pion->Add(hist_sideband_D0_softpi_PID_SVD_pion, -1);
381  hist_D0_softpi_PID_CDC_pion->Add(hist_sideband_D0_softpi_PID_CDC_pion, -1);
382  hist_D0_softpi_PID_TOP_pion->Add(hist_sideband_D0_softpi_PID_TOP_pion, -1);
383  hist_D0_softpi_PID_ARICH_pion->Add(hist_sideband_D0_softpi_PID_ARICH_pion, -1);
384  hist_D0_softpi_PID_ECL_pion->Add(hist_sideband_D0_softpi_PID_ECL_pion, -1);
385  hist_D0_softpi_PID_KLM_pion->Add(hist_sideband_D0_softpi_PID_KLM_pion, -1);
386  hist_D0_pi_PID_ALL_pion->Add(hist_sideband_D0_pi_PID_ALL_pion, -1);
387  hist_D0_pi_PID_SVD_pion->Add(hist_sideband_D0_pi_PID_SVD_pion, -1);
388  hist_D0_pi_PID_CDC_pion->Add(hist_sideband_D0_pi_PID_CDC_pion, -1);
389  hist_D0_pi_PID_TOP_pion->Add(hist_sideband_D0_pi_PID_TOP_pion, -1);
390  hist_D0_pi_PID_ARICH_pion->Add(hist_sideband_D0_pi_PID_ARICH_pion, -1);
391  hist_D0_pi_PID_ECL_pion->Add(hist_sideband_D0_pi_PID_ECL_pion, -1);
392  hist_D0_pi_PID_KLM_pion->Add(hist_sideband_D0_pi_PID_KLM_pion, -1);
393  hist_D0_K_PID_ALL_kaon->Add(hist_sideband_D0_K_PID_ALL_kaon, -1);
394  hist_D0_K_PID_SVD_kaon->Add(hist_sideband_D0_K_PID_SVD_kaon, -1);
395  hist_D0_K_PID_CDC_kaon->Add(hist_sideband_D0_K_PID_CDC_kaon, -1);
396  hist_D0_K_PID_TOP_kaon->Add(hist_sideband_D0_K_PID_TOP_kaon, -1);
397  hist_D0_K_PID_ARICH_kaon->Add(hist_sideband_D0_K_PID_ARICH_kaon, -1);
398  hist_D0_K_PID_ECL_kaon->Add(hist_sideband_D0_K_PID_ECL_kaon, -1);
399  hist_D0_K_PID_KLM_kaon->Add(hist_sideband_D0_K_PID_KLM_kaon, -1);
400 
401  // Make TCanvases
402  // --- D* -> D0pi mass resolution
403  dst_mass->Divide(3, 1);
404  dst_mass->cd(1);
405  hist_D0_InvM->Draw();
406  f_InvM->Draw("SAME");
407  dst_mass->cd(2);
408  hist_delta_m->Draw();
409  f_delta_m->Draw("SAME");
410  dst_mass->cd(3);
411  hist_D0_pi0_InvM->Draw();
412  f_pi0_InvM->Draw("SAME");
413  // --- pi variables for D0 -> K pi
414  dst_pi_val->Divide(4, 2);
415  dst_pi_val->cd(1); hist_D0_pi_PID_ALL_pion->Draw();
416  dst_pi_val->cd(2); hist_D0_pi_PID_SVD_pion->Draw();
417  dst_pi_val->cd(3); hist_D0_pi_PID_CDC_pion->Draw();
418  dst_pi_val->cd(4); hist_D0_pi_PID_TOP_pion->Draw();
419  dst_pi_val->cd(5); hist_D0_pi_PID_ARICH_pion->Draw();
420  dst_pi_val->cd(6); hist_D0_pi_PID_ECL_pion->Draw();
421  dst_pi_val->cd(7); hist_D0_pi_PID_KLM_pion->Draw();
422  // --- K variables for D0 -> K pi
423  dst_k_val->Divide(4, 2);
424  dst_k_val->cd(1); hist_D0_K_PID_ALL_kaon->Draw();
425  dst_k_val->cd(2); hist_D0_K_PID_SVD_kaon->Draw();
426  dst_k_val->cd(3); hist_D0_K_PID_CDC_kaon->Draw();
427  dst_k_val->cd(4); hist_D0_K_PID_TOP_kaon->Draw();
428  dst_k_val->cd(5); hist_D0_K_PID_ARICH_kaon->Draw();
429  dst_k_val->cd(6); hist_D0_K_PID_ECL_kaon->Draw();
430  dst_k_val->cd(7); hist_D0_K_PID_KLM_kaon->Draw();
431 
432  // calculate the values of monitoring variables
433  float mean_D0_InvM = f_InvM->GetParameter(1);
434  float width_D0_InvM = f_InvM->GetParameter(2);
435  float mean_delta_m = f_delta_m->GetParameter(1);
436  float width_delta_m = f_delta_m->GetParameter(2);
437  float mean_pi0_InvM = f_pi0_InvM->GetParameter(1);
438  float width_pi0_InvM = f_pi0_InvM->GetParameter(2);
439  float mean_D0_softpi_PID_ALL_pion = hist_D0_softpi_PID_ALL_pion->GetMean();
440  float mean_D0_softpi_PID_SVD_pion = hist_D0_softpi_PID_SVD_pion->GetMean();
441  float mean_D0_softpi_PID_CDC_pion = hist_D0_softpi_PID_CDC_pion->GetMean();
442  float mean_D0_softpi_PID_TOP_pion = hist_D0_softpi_PID_TOP_pion->GetMean();
443  float mean_D0_softpi_PID_ARICH_pion = hist_D0_softpi_PID_ARICH_pion->GetMean();
444  float mean_D0_softpi_PID_ECL_pion = hist_D0_softpi_PID_ECL_pion->GetMean();
445  float mean_D0_softpi_PID_KLM_pion = hist_D0_softpi_PID_KLM_pion->GetMean();
446  float mean_D0_pi_PID_ALL_pion = hist_D0_pi_PID_ALL_pion->GetMean();
447  float mean_D0_pi_PID_SVD_pion = hist_D0_pi_PID_SVD_pion->GetMean();
448  float mean_D0_pi_PID_CDC_pion = hist_D0_pi_PID_CDC_pion->GetMean();
449  float mean_D0_pi_PID_TOP_pion = hist_D0_pi_PID_TOP_pion->GetMean();
450  float mean_D0_pi_PID_ARICH_pion = hist_D0_pi_PID_ARICH_pion->GetMean();
451  float mean_D0_pi_PID_ECL_pion = hist_D0_pi_PID_ECL_pion->GetMean();
452  float mean_D0_pi_PID_KLM_pion = hist_D0_pi_PID_KLM_pion->GetMean();
453  float mean_D0_K_PID_ALL_kaon = hist_D0_K_PID_ALL_kaon->GetMean();
454  float mean_D0_K_PID_SVD_kaon = hist_D0_K_PID_SVD_kaon->GetMean();
455  float mean_D0_K_PID_CDC_kaon = hist_D0_K_PID_CDC_kaon->GetMean();
456  float mean_D0_K_PID_TOP_kaon = hist_D0_K_PID_TOP_kaon->GetMean();
457  float mean_D0_K_PID_ARICH_kaon = hist_D0_K_PID_ARICH_kaon->GetMean();
458  float mean_D0_K_PID_ECL_kaon = hist_D0_K_PID_ECL_kaon->GetMean();
459  float mean_D0_K_PID_KLM_kaon = hist_D0_K_PID_KLM_kaon->GetMean();
460 
461  // set values
462  mon_dst->setVariable("neve_dst", neve_dst);
463  mon_dst->setVariable("neve_pi0", neve_pi0);
464  mon_dst->setVariable("mean_D0_InvM", mean_D0_InvM);
465  mon_dst->setVariable("width_D0_InvM", width_D0_InvM);
466  mon_dst->setVariable("mean_delta_m", mean_delta_m);
467  mon_dst->setVariable("width_delta_m", width_delta_m);
468  mon_dst->setVariable("mean_pi0_InvM", mean_pi0_InvM);
469  mon_dst->setVariable("width_pi0_InvM", width_pi0_InvM);
470  mon_dst->setVariable("mean_D0_softpi_PID_ALL_pion", mean_D0_softpi_PID_ALL_pion);
471  mon_dst->setVariable("mean_D0_softpi_PID_SVD_pion", mean_D0_softpi_PID_SVD_pion);
472  mon_dst->setVariable("mean_D0_softpi_PID_CDC_pion", mean_D0_softpi_PID_CDC_pion);
473  mon_dst->setVariable("mean_D0_softpi_PID_TOP_pion", mean_D0_softpi_PID_TOP_pion);
474  mon_dst->setVariable("mean_D0_softpi_PID_ARICH_pion", mean_D0_softpi_PID_ARICH_pion);
475  mon_dst->setVariable("mean_D0_softpi_PID_ECL_pion", mean_D0_softpi_PID_ECL_pion);
476  mon_dst->setVariable("mean_D0_softpi_PID_KLM_pion", mean_D0_softpi_PID_KLM_pion);
477  mon_dst->setVariable("mean_D0_pi_PID_ALL_pion", mean_D0_pi_PID_ALL_pion);
478  mon_dst->setVariable("mean_D0_pi_PID_SVD_pion", mean_D0_pi_PID_SVD_pion);
479  mon_dst->setVariable("mean_D0_pi_PID_CDC_pion", mean_D0_pi_PID_CDC_pion);
480  mon_dst->setVariable("mean_D0_pi_PID_TOP_pion", mean_D0_pi_PID_TOP_pion);
481  mon_dst->setVariable("mean_D0_pi_PID_ARICH_pion", mean_D0_pi_PID_ARICH_pion);
482  mon_dst->setVariable("mean_D0_pi_PID_ECL_pion", mean_D0_pi_PID_ECL_pion);
483  mon_dst->setVariable("mean_D0_pi_PID_KLM_pion", mean_D0_pi_PID_KLM_pion);
484  mon_dst->setVariable("mean_D0_K_PID_ALL_kaon", mean_D0_K_PID_ALL_kaon);
485  mon_dst->setVariable("mean_D0_K_PID_SVD_kaon", mean_D0_K_PID_SVD_kaon);
486  mon_dst->setVariable("mean_D0_K_PID_CDC_kaon", mean_D0_K_PID_CDC_kaon);
487  mon_dst->setVariable("mean_D0_K_PID_TOP_kaon", mean_D0_K_PID_TOP_kaon);
488  mon_dst->setVariable("mean_D0_K_PID_ARICH_kaon", mean_D0_K_PID_ARICH_kaon);
489  mon_dst->setVariable("mean_D0_K_PID_ECL_kaon", mean_D0_K_PID_ECL_kaon);
490  mon_dst->setVariable("mean_D0_K_PID_KLM_kaon", mean_D0_K_PID_KLM_kaon);
491 
492 
493  B2DEBUG(20, "DQMHistAnalysisMiraBelle : endRun called");
494 }
495 
497 {
498 
499  B2DEBUG(20, "terminate called");
500 }
TCanvas * dst_k_val
TCanvas object for PID distributions of K.
virtual void initialize() override
Initialize the Module.
bool m_enableAlert
Enable alert by base color of canvases.
virtual void event() override
Event processor.
virtual void endRun() override
End-of-run action.
virtual void terminate() override
Termination action.
TCanvas * mumu_resolution
TCanvas object for resolution display.
TCanvas * dst_pi_val
TCanvas object for PID distributions of pi.
Belle2::MonitoringObject * mon_dst
MonitoringObject for mumu events.
virtual void beginRun() override
Called when entering a new run.
TCanvas * mumu_main
TCanvas object for main display.
TCanvas * mumu_muon_val
TCanvas object for mumu values display.
Belle2::MonitoringObject * mon_mumu
MonitoringObject for mumu events.
TCanvas * dst_mass
TCanvas object for D0 mass, delta mass, and pi0 mass.
double m_scale_dst
Scale factor "signal region" / "sideband", assuming uniform events.
The base class for the histogram analysis module.
static TH1 * findHist(const std::string &histname)
Find histogram.
static MonitoringObject * getMonitoringObject(const std::string &histname)
Get MonitoringObject with given name (new object is created if non-existing)
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
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:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.