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