Belle II Software development
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 header.
10#include <dqm/analysis/modules/DQMHistAnalysisMiraBelle.h>
11
12#include <TROOT.h>
13#include <TF1.h>
14
15using namespace std;
16using namespace Belle2;
17
18//-----------------------------------------------------------------
19// Register module
20//-----------------------------------------------------------------
21
22REG_MODULE(DQMHistAnalysisMiraBelle);
23
26{
27 // set module description (e.g. insert text)
28 setDescription("Modify and analyze the data quality histograms of MiraBelle");
30 addParam("scale_dst", m_scale_dst, "Scale factor signal/sideband", 0.09375);
31}
32
34{
35}
36
38{
39 gROOT->cd();
40
41 //mon_mumu = new Belle2::MonitoringObject("mumu");
44 //bhabha,hadrons
46 mon_hadron = getMonitoringObject("hadronb2");
47
48 // make cavases to be added to MonitoringObject
49 mumu_main = new TCanvas("mumu_main", "mumu_main", 0, 0, 800, 600);
50 mumu_resolution = new TCanvas("mumu_resolution", "mumu_resolution", 0, 0, 800, 600);
51 mumu_muon_val = new TCanvas("mumu_muon_val", "mumu_muon_val", 0, 0, 400, 400);
52 dst_mass = new TCanvas("dst_mass", "dst_mass", 0, 0, 1200, 400);
53 dst_pi_val = new TCanvas("dst_pi_val", "dst_pi_val", 0, 0, 800, 400);
54 dst_k_val = new TCanvas("dst_k_val", "dst_k_val", 0, 0, 800, 400);
55 //bhabha,hadrons
56 bhabha_main = new TCanvas("bhabha_main", "bhabha_main", 0, 0, 800, 600);
57 bhabha_resolution = new TCanvas("bhabha_resolution", "bhabha_resolution", 0, 0, 800, 600);
58 hadron_main = new TCanvas("hadron_main", "hadron_main", 0, 0, 800, 600);
59
60 // add canvases to MonitoringObject
67 //bhabha,hadrons
71
72 B2DEBUG(20, "DQMHistAnalysisMiraBelle: initialized.");
73
74}
75
77{
78 B2DEBUG(20, "DQMHistAnalysisMiraBelle: beginRun called.");
79}
80
82{
83 B2DEBUG(20, "DQMHistAnalysisOutputMiraBelle: event called.");
84}
85
87{
88 // ========== mumutight
89 // get existing histograms produced by DQM modules
90 auto* hist_npxd = findHist("PhysicsObjectsMiraBelle/hist_npxd");
91 auto* hist_nsvd = findHist("PhysicsObjectsMiraBelle/hist_nsvd");
92 auto* hist_ncdc = findHist("PhysicsObjectsMiraBelle/hist_ncdc");
93 auto* hist_topdig = findHist("PhysicsObjectsMiraBelle/hist_topdig");
94 auto* hist_DetPhotonARICH = findHist("PhysicsObjectsMiraBelle/hist_DetPhotonARICH");
95 auto* hist_klmTotalHits = findHist("PhysicsObjectsMiraBelle/hist_klmTotalHits");
96 auto* hist_klmClusterLayers = findHist("PhysicsObjectsMiraBelle/hist_klmClusterLayers");
97 auto* hist_dD0 = findHist("PhysicsObjectsMiraBelle/hist_dD0");
98 auto* hist_dZ0 = findHist("PhysicsObjectsMiraBelle/hist_dZ0");
99 auto* hist_dPtcms = findHist("PhysicsObjectsMiraBelle/hist_dPtcms");
100 auto* hist_Pval = findHist("PhysicsObjectsMiraBelle/hist_Pval");
101 auto* hist_nExtraCDCHits = findHist("PhysicsObjectsMiraBelle/hist_nExtraCDCHits");
102 auto* hist_nECLClusters = findHist("PhysicsObjectsMiraBelle/hist_nECLClusters");
103 auto* hist_muid = findHist("PhysicsObjectsMiraBelle/hist_muid");
104 auto* hist_inv_p = findHist("PhysicsObjectsMiraBelle/hist_inv_p");
105 auto* hist_ndf = findHist("PhysicsObjectsMiraBelle/hist_ndf");
106 auto* hist_D0 = findHist("PhysicsObjectsMiraBelle/hist_D0");
107 auto* hist_Z0 = findHist("PhysicsObjectsMiraBelle/hist_Z0");
108 auto* hist_theta = findHist("PhysicsObjectsMiraBelle/hist_theta");
109 auto* hist_Phi0 = findHist("PhysicsObjectsMiraBelle/hist_Phi0");
110 auto* hist_Pt = findHist("PhysicsObjectsMiraBelle/hist_Pt");
111 auto* hist_Mom = findHist("PhysicsObjectsMiraBelle/hist_Mom");
112 auto* hist_klmTotalBarrelHits = findHist("PhysicsObjectsMiraBelle/hist_klmTotalBarrelHits");
113 auto* hist_klmTotalEndcapHits = findHist("PhysicsObjectsMiraBelle/hist_klmTotalEndcapHits");
114 auto* hist_dPhicms = findHist("PhysicsObjectsMiraBelle/hist_dPhicms");
115
116 if (hist_npxd == nullptr) {
117 B2ERROR("Can not find the hist_npxd histogram!");
118 return;
119 }
120 if (hist_nsvd == nullptr) {
121 B2ERROR("Can not find the hist_nsvd histogram!");
122 return;
123 }
124 if (hist_ncdc == nullptr) {
125 B2ERROR("Can not find the hist_ncdc histogram!");
126 return;
127 }
128 if (hist_topdig == nullptr) {
129 B2ERROR("Can not find the hist_topdig histogram!");
130 return;
131 }
132 if (hist_DetPhotonARICH == nullptr) {
133 B2ERROR("Can not find the hist_DetPhotonARICH histogram!");
134 return;
135 }
136 if (hist_klmTotalHits == nullptr) {
137 B2ERROR("Can not find the hist_klmTotalHits histogram!");
138 return;
139 }
140 if (hist_klmClusterLayers == nullptr) {
141 B2ERROR("Can not find the hist_klmClusterLayers histogram!");
142 return;
143 }
144 if (hist_dD0 == nullptr) {
145 B2ERROR("Can not find the hist_dD0 histogram!");
146 return;
147 }
148 if (hist_dZ0 == nullptr) {
149 B2ERROR("Can not find the hist_dZ0 histogram!");
150 return;
151 }
152 if (hist_dPtcms == nullptr) {
153 B2ERROR("Can not find the hist_dPtcms histogram!");
154 return;
155 }
156 if (hist_Pval == nullptr) {
157 B2ERROR("Can not find the hist_Pval histogram!");
158 return;
159 }
160 if (hist_nExtraCDCHits == nullptr) {
161 B2ERROR("Can not find the hist_nExtraCDCHits histogram!");
162 return;
163 }
164 if (hist_nECLClusters == nullptr) {
165 B2ERROR("Can not find the hist_nECLClusters histogram!");
166 return;
167 }
168 if (hist_muid == nullptr) {
169 B2ERROR("Can not find the hist_muid histogram!");
170 return;
171 }
172 if (hist_inv_p == nullptr) {
173 B2ERROR("Can not find the hist_inv_p histogram!");
174 return;
175 }
176 if (hist_ndf == nullptr) {
177 B2ERROR("Can not find the hist_ndf histogram!");
178 return;
179 }
180 if (hist_D0 == nullptr) {
181 B2ERROR("Can not find the hist_D0 histogram!");
182 return;
183 }
184 if (hist_Z0 == nullptr) {
185 B2ERROR("Can not find the hist_Z0 histogram!");
186 return;
187 }
188 if (hist_theta == nullptr) {
189 B2ERROR("Can not find the hist_theta histogram!");
190 return;
191 }
192 if (hist_Phi0 == nullptr) {
193 B2ERROR("Can not find the hist_Phi0 histogram!");
194 return;
195 }
196 if (hist_Pt == nullptr) {
197 B2ERROR("Can not find the hist_Pt histogram!");
198 return;
199 }
200 if (hist_Mom == nullptr) {
201 B2ERROR("Can not find the hist_Mom histogram!");
202 return;
203 }
204 if (hist_klmTotalBarrelHits == nullptr) {
205 B2ERROR("Can not find the hist_klmTotalBarrelHits histogram!");
206 return;
207 }
208 if (hist_klmTotalEndcapHits == nullptr) {
209 B2ERROR("Can not find the hist_klmTotalEndcapHits histogram!");
210 return;
211 }
212 if (hist_dPhicms == nullptr) {
213 B2ERROR("Can not find the hist_dPhicms histogram!");
214 return;
215 }
216
217 // Make TCanvases
218 // --- Mumu_Main
219 mumu_main->Divide(4, 3);
220 mumu_main->cd(1); hist_theta->Draw();
221 mumu_main->cd(2); hist_Phi0->Draw();
222 mumu_main->cd(3); hist_Mom->Draw();
223 mumu_main->cd(4); hist_Pt->Draw();
224 mumu_main->cd(5); hist_npxd->Draw();
225 mumu_main->cd(6); hist_nsvd->Draw();
226 mumu_main->cd(7); hist_ncdc->Draw();
227 mumu_main->cd(8); hist_topdig->Draw();
228 mumu_main->cd(9); hist_DetPhotonARICH->Draw();
229 mumu_main->cd(10); hist_klmClusterLayers->Draw();
230 mumu_main->cd(11); hist_nExtraCDCHits->Draw();
231 mumu_main->cd(12); hist_nECLClusters->Draw();
232 // --- Mumu_Resolution
233 mumu_resolution->Divide(3, 3);
234 mumu_resolution->cd(1); hist_inv_p->Draw();
235 mumu_resolution->cd(2); hist_dD0->Draw();
236 mumu_resolution->cd(3); hist_dZ0->Draw();
237 mumu_resolution->cd(4); hist_dPtcms->Draw();
238 mumu_resolution->cd(5); hist_dPhicms->Draw();
239 mumu_resolution->cd(6); hist_nECLClusters->Draw();
240 mumu_resolution->cd(7); hist_nExtraCDCHits->Draw();
241 mumu_resolution->cd(8); hist_ndf->Draw();
242 mumu_muon_val->Divide(2, 2);
243 // --- Muon variables
244 mumu_muon_val->cd(1); hist_muid->Draw();
245 mumu_muon_val->cd(2); hist_Pval->Draw();
246 mumu_muon_val->cd(3); hist_theta->Draw();
247 mumu_muon_val->cd(4); hist_Phi0->Draw();
248
249 // calculate the values of monitoring variables
250 double mean_npxd = hist_npxd->GetMean();
251 double mean_nsvd = hist_nsvd->GetMean();
252 double mean_ncdc = hist_ncdc->GetMean();
253 double mean_nklmlayer = hist_klmClusterLayers->GetMean();
254 double mean_nklm = hist_klmTotalHits->GetMean();
255 double mean_nbklm = hist_klmTotalBarrelHits->GetMean();
256 double mean_neklm = hist_klmTotalEndcapHits->GetMean();
257 double mean_topdig = hist_topdig->GetMean();
258 double mean_parich = hist_DetPhotonARICH->GetMean();
259 double mean_ncdc_ex = hist_nExtraCDCHits->GetMean();
260 double mean_necl = hist_nECLClusters->GetMean();
261 double mean_muid = hist_muid->GetMean();
262 double mean_d0 = hist_D0->GetMean();
263 double mean_z0 = hist_Z0->GetMean();
264 double mean_pval = hist_Pval->GetMean();
265 double mean_ndf = hist_ndf->GetMean();
266 double dif_ndf_ncdc = mean_ndf - mean_ncdc;
267 double mean_dd0 = hist_dD0->GetMean();
268 double mean_dz0 = hist_dZ0->GetMean();
269 double mean_dpt = hist_dPtcms->GetMean();
270 double rms_dd0 = hist_dD0->GetRMS();
271 double rms_dz0 = hist_dZ0->GetRMS();
272 double rms_dpt = hist_dPtcms->GetRMS();
273 double sigma68_dd0 = getSigma68(hist_dD0);
274 double sigma68_dz0 = getSigma68(hist_dZ0);
275 double sigma68_dpt = getSigma68(hist_dPtcms);
276 int ntot = hist_nsvd->GetEntries();
277 double neve_mumu = ntot;
278 double goodmu_frac = -1.;
279 double pval_frac_0 = -1.;
280 double pval_frac_1 = -1.;
281 double nocdc_frac = -1.;
282 double notop_frac = -1.;
283 double noarich_frac = -1.;
284 double muidcontent = hist_muid->GetBinContent(1);
285 double goodmu_o_badmu = -1.;
286 if (muidcontent != 0) {
287 goodmu_o_badmu = hist_muid->GetBinContent(20) / muidcontent;
288 } else {
289 goodmu_o_badmu = 0.0;
290 }
291 double pval_more95 = 0.0;
292 double pval_less05 = 0.0;
293 for (int i = 95; i < 100; i++) pval_more95 += hist_Pval->GetBinContent(i + 1);
294 for (int i = 0; i < 5; i++) pval_less05 += hist_Pval->GetBinContent(i + 1);
295 if (ntot != 0) {
296 goodmu_frac = hist_muid->GetBinContent(20) / neve_mumu;
297 pval_frac_0 = pval_less05 / neve_mumu;
298 pval_frac_1 = pval_more95 / neve_mumu;
299 nocdc_frac = hist_ncdc->GetBinContent(1) / neve_mumu;
300 notop_frac = hist_topdig->GetBinContent(1) / neve_mumu;
301 noarich_frac = hist_DetPhotonARICH->GetBinContent(1) / neve_mumu;
302 } else {
303 goodmu_frac = 0.0;
304 pval_frac_0 = 0.0;
305 pval_frac_1 = 0.0;
306 nocdc_frac = 0.0;
307 notop_frac = 0.0;
308 noarich_frac = 0.0;
309 }
310 //Calculate M(mumu)
311 double peak_mumu = hist_inv_p->GetXaxis()->GetBinCenter(hist_inv_p->GetMaximumBin());
312 TF1* f_mumuInvM = new TF1("f_mumuInvM", "gaus", peak_mumu - 0.05, peak_mumu + 0.05);
313 f_mumuInvM->SetParameters(hist_inv_p->GetMaximum(), peak_mumu, 0.045);
314 f_mumuInvM->SetParLimits(1, peak_mumu - 0.05, peak_mumu + 0.05);
315 f_mumuInvM->SetParLimits(2, 0.01, 0.08);
316 hist_inv_p->Fit(f_mumuInvM, "R");
317 double fit_mumumass = f_mumuInvM->GetParameter(1);
318 if (fit_mumumass < 9.) fit_mumumass = 9.;
319 if (fit_mumumass > 12.) fit_mumumass = 12.;
320 double fit_mumumass_error = f_mumuInvM->GetParError(1);
321 double mumumass_reference = 10.573;
322 double pull_mumumass = (fit_mumumass - mumumass_reference) / fit_mumumass_error;
323 double fit_sigma_mumu = f_mumuInvM->GetParameter(2);
324
325 // set values
326 mon_mumu->setVariable("mean_npxd", mean_npxd);
327 mon_mumu->setVariable("mean_nsvd", mean_nsvd);
328 mon_mumu->setVariable("mean_ncdc", mean_ncdc);
329 mon_mumu->setVariable("mean_nklmlayer", mean_nklmlayer);
330 mon_mumu->setVariable("mean_nklm", mean_nklm);
331 mon_mumu->setVariable("mean_nbklm", mean_nbklm);
332 mon_mumu->setVariable("mean_neklm", mean_neklm);
333 mon_mumu->setVariable("mean_topdig", mean_topdig);
334 mon_mumu->setVariable("mean_parich", mean_parich);
335 mon_mumu->setVariable("mean_ncdc_ex", mean_ncdc_ex);
336 mon_mumu->setVariable("mean_necl", mean_necl);
337 mon_mumu->setVariable("mean_muid", mean_muid);
338 mon_mumu->setVariable("mean_d0", mean_d0);
339 mon_mumu->setVariable("mean_z0", mean_z0);
340 mon_mumu->setVariable("mean_pval", mean_pval);
341 mon_mumu->setVariable("mean_ndf", mean_ndf);
342 mon_mumu->setVariable("dif_ndf_ncdc", dif_ndf_ncdc);
343 mon_mumu->setVariable("mean_dd0", mean_dd0);
344 mon_mumu->setVariable("mean_dz0", mean_dz0);
345 mon_mumu->setVariable("mean_dpt", mean_dpt);
346 mon_mumu->setVariable("rms_dd0", rms_dd0);
347 mon_mumu->setVariable("rms_dz0", rms_dz0);
348 mon_mumu->setVariable("rms_dpt", rms_dpt);
349 mon_mumu->setVariable("sigma68_dd0", sigma68_dd0);
350 mon_mumu->setVariable("sigma68_dz0", sigma68_dz0);
351 mon_mumu->setVariable("sigma68_dpt", sigma68_dpt);
352 mon_mumu->setVariable("neve_mumu", neve_mumu);
353 mon_mumu->setVariable("goodmu_frac", goodmu_frac);
354 mon_mumu->setVariable("goodmu_o_badmu", goodmu_o_badmu);
355 mon_mumu->setVariable("pval_frac_0", pval_frac_0);
356 mon_mumu->setVariable("pval_frac_1", pval_frac_1);
357 mon_mumu->setVariable("nocdc_frac", nocdc_frac);
358 mon_mumu->setVariable("notop_frac", notop_frac);
359 mon_mumu->setVariable("noarich_frac", noarich_frac);
360 mon_mumu->setVariable("fit_mumumass", fit_mumumass);
361 mon_mumu->setVariable("fit_mumumass_error", fit_mumumass_error);
362 mon_mumu->setVariable("pull_mumumass", pull_mumumass);
363 mon_mumu->setVariable("sigma_mumumass", fit_sigma_mumu);
364
365 // ========== D*
366 // get existing histograms produced by DQM modules
367 auto* hist_D0_InvM = findHist("PhysicsObjectsMiraBelleDst/hist_D0_InvM");
368 auto* hist_delta_m = findHist("PhysicsObjectsMiraBelleDst/hist_delta_m");
369 auto* hist_D0_softpi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_ALL_pion");
370 auto* hist_D0_softpi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_SVD_pion");
371 auto* hist_D0_softpi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_CDC_pion");
372 auto* hist_D0_softpi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_TOP_pion");
373 auto* hist_D0_softpi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_ARICH_pion");
374 auto* hist_D0_softpi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_ECL_pion");
375 auto* hist_D0_softpi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_softpi_PID_KLM_pion");
376 auto* hist_D0_pi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_ALL_pion");
377 auto* hist_D0_pi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_SVD_pion");
378 auto* hist_D0_pi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_CDC_pion");
379 auto* hist_D0_pi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_TOP_pion");
380 auto* hist_D0_pi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_ARICH_pion");
381 auto* hist_D0_pi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_ECL_pion");
382 auto* hist_D0_pi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_D0_pi_PID_KLM_pion");
383 auto* hist_D0_K_PID_ALL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_ALL_kaon");
384 auto* hist_D0_K_PID_SVD_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_SVD_kaon");
385 auto* hist_D0_K_PID_CDC_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_CDC_kaon");
386 auto* hist_D0_K_PID_TOP_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_TOP_kaon");
387 auto* hist_D0_K_PID_ARICH_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_ARICH_kaon");
388 auto* hist_D0_K_PID_ECL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_ECL_kaon");
389 auto* hist_D0_K_PID_KLM_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_D0_K_PID_KLM_kaon");
390 auto* hist_sideband_D0_softpi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_ALL_pion");
391 auto* hist_sideband_D0_softpi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_SVD_pion");
392 auto* hist_sideband_D0_softpi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_CDC_pion");
393 auto* hist_sideband_D0_softpi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_TOP_pion");
394 auto* hist_sideband_D0_softpi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_ARICH_pion");
395 auto* hist_sideband_D0_softpi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_ECL_pion");
396 auto* hist_sideband_D0_softpi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_softpi_PID_KLM_pion");
397 auto* hist_sideband_D0_pi_PID_ALL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_ALL_pion");
398 auto* hist_sideband_D0_pi_PID_SVD_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_SVD_pion");
399 auto* hist_sideband_D0_pi_PID_CDC_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_CDC_pion");
400 auto* hist_sideband_D0_pi_PID_TOP_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_TOP_pion");
401 auto* hist_sideband_D0_pi_PID_ARICH_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_ARICH_pion");
402 auto* hist_sideband_D0_pi_PID_ECL_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_ECL_pion");
403 auto* hist_sideband_D0_pi_PID_KLM_pion = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_pi_PID_KLM_pion");
404 auto* hist_sideband_D0_K_PID_ALL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_ALL_kaon");
405 auto* hist_sideband_D0_K_PID_SVD_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_SVD_kaon");
406 auto* hist_sideband_D0_K_PID_CDC_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_CDC_kaon");
407 auto* hist_sideband_D0_K_PID_TOP_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_TOP_kaon");
408 auto* hist_sideband_D0_K_PID_ARICH_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_ARICH_kaon");
409 auto* hist_sideband_D0_K_PID_ECL_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_ECL_kaon");
410 auto* hist_sideband_D0_K_PID_KLM_kaon = findHist("PhysicsObjectsMiraBelleDst/hist_sideband_D0_K_PID_KLM_kaon");
411 auto* hist_D0_pi0_InvM = findHist("PhysicsObjectsMiraBelleDst2/hist_D0_pi0_InvM");
412 if (hist_D0_InvM == nullptr) {
413 B2ERROR("Can not find the hist_D0_InvM histogram!");
414 return;
415 }
416 if (hist_delta_m == nullptr) {
417 B2ERROR("Can not find the hist_delta_m histogram!");
418 return;
419 }
420 if (hist_D0_softpi_PID_ALL_pion == nullptr) {
421 B2ERROR("Can not find the hist_D0_softpi_PID_ALL_pion histogram!");
422 return;
423 }
424 if (hist_D0_softpi_PID_SVD_pion == nullptr) {
425 B2ERROR("Can not find the hist_D0_softpi_PID_SVD_pion histogram!");
426 return;
427 }
428 if (hist_D0_softpi_PID_CDC_pion == nullptr) {
429 B2ERROR("Can not find the hist_D0_softpi_PID_CDC_pion histogram!");
430 return;
431 }
432 if (hist_D0_softpi_PID_TOP_pion == nullptr) {
433 B2ERROR("Can not find the hist_D0_softpi_PID_TOP_pion histogram!");
434 return;
435 }
436 if (hist_D0_softpi_PID_ARICH_pion == nullptr) {
437 B2ERROR("Can not find the hist_D0_softpi_PID_ARICH_pion histogram!");
438 return;
439 }
440 if (hist_D0_softpi_PID_ECL_pion == nullptr) {
441 B2ERROR("Can not find the hist_D0_softpi_PID_ECL_pion histogram!");
442 return;
443 }
444 if (hist_D0_softpi_PID_KLM_pion == nullptr) {
445 B2ERROR("Can not find the hist_D0_softpi_PID_KLM_pion histogram!");
446 return;
447 }
448 if (hist_D0_pi_PID_ALL_pion == nullptr) {
449 B2ERROR("Can not find the hist_D0_pi_PID_ALL_pion histogram!");
450 return;
451 }
452 if (hist_D0_pi_PID_SVD_pion == nullptr) {
453 B2ERROR("Can not find the hist_D0_pi_PID_SVD_pion histogram!");
454 return;
455 }
456 if (hist_D0_pi_PID_CDC_pion == nullptr) {
457 B2ERROR("Can not find the hist_D0_pi_PID_CDC_pion histogram!");
458 return;
459 }
460 if (hist_D0_pi_PID_TOP_pion == nullptr) {
461 B2ERROR("Can not find the hist_D0_pi_PID_TOP_pion histogram!");
462 return;
463 }
464 if (hist_D0_pi_PID_ARICH_pion == nullptr) {
465 B2ERROR("Can not find the hist_D0_pi_PID_ARICH_pion histogram!");
466 return;
467 }
468 if (hist_D0_pi_PID_ECL_pion == nullptr) {
469 B2ERROR("Can not find the hist_D0_pi_PID_ECL_pion histogram!");
470 return;
471 }
472 if (hist_D0_pi_PID_KLM_pion == nullptr) {
473 B2ERROR("Can not find the hist_D0_pi_PID_KLM_pion histogram!");
474 return;
475 }
476 if (hist_D0_K_PID_ALL_kaon == nullptr) {
477 B2ERROR("Can not find the hist_D0_K_PID_ALL_kaon histogram!");
478 return;
479 }
480 if (hist_D0_K_PID_SVD_kaon == nullptr) {
481 B2ERROR("Can not find the hist_D0_K_PID_SVD_kaon histogram!");
482 return;
483 }
484 if (hist_D0_K_PID_CDC_kaon == nullptr) {
485 B2ERROR("Can not find the hist_D0_K_PID_CDC_kaon histogram!");
486 return;
487 }
488 if (hist_D0_K_PID_TOP_kaon == nullptr) {
489 B2ERROR("Can not find the hist_D0_K_PID_TOP_kaon histogram!");
490 return;
491 }
492 if (hist_D0_K_PID_ARICH_kaon == nullptr) {
493 B2ERROR("Can not find the hist_D0_K_PID_ARICH_kaon histogram!");
494 return;
495 }
496 if (hist_D0_K_PID_ECL_kaon == nullptr) {
497 B2ERROR("Can not find the hist_D0_K_PID_ECL_kaon histogram!");
498 return;
499 }
500 if (hist_D0_K_PID_KLM_kaon == nullptr) {
501 B2ERROR("Can not find the hist_D0_K_PID_KLM_kaon histogram!");
502 return;
503 }
504 if (hist_sideband_D0_softpi_PID_ALL_pion == nullptr) {
505 B2ERROR("Can not find the hist_sideband_D0_softpi_PID_ALL_pion histogram!");
506 return;
507 }
508 if (hist_sideband_D0_softpi_PID_SVD_pion == nullptr) {
509 B2ERROR("Can not find the hist_sideband_D0_softpi_PID_SVD_pion histogram!");
510 return;
511 }
512 if (hist_sideband_D0_softpi_PID_CDC_pion == nullptr) {
513 B2ERROR("Can not find the hist_sideband_D0_softpi_PID_CDC_pion histogram!");
514 return;
515 }
516 if (hist_sideband_D0_softpi_PID_TOP_pion == nullptr) {
517 B2ERROR("Can not find the hist_sideband_D0_softpi_PID_TOP_pion histogram!");
518 return;
519 }
520 if (hist_sideband_D0_softpi_PID_ARICH_pion == nullptr) {
521 B2ERROR("Can not find the hist_sideband_D0_softpi_PID_ARICH_pion histogram!");
522 return;
523 }
524 if (hist_sideband_D0_softpi_PID_ECL_pion == nullptr) {
525 B2ERROR("Can not find the hist_sideband_D0_softpi_PID_ECL_pion histogram!");
526 return;
527 }
528 if (hist_sideband_D0_softpi_PID_KLM_pion == nullptr) {
529 B2ERROR("Can not find the hist_sideband_D0_softpi_PID_KLM_pion histogram!");
530 return;
531 }
532 if (hist_sideband_D0_pi_PID_ALL_pion == nullptr) {
533 B2ERROR("Can not find the hist_sideband_D0_pi_PID_ALL_pion histogram!");
534 return;
535 }
536 if (hist_sideband_D0_pi_PID_SVD_pion == nullptr) {
537 B2ERROR("Can not find the hist_sideband_D0_pi_PID_SVD_pion histogram!");
538 return;
539 }
540 if (hist_sideband_D0_pi_PID_CDC_pion == nullptr) {
541 B2ERROR("Can not find the hist_sideband_D0_pi_PID_CDC_pion histogram!");
542 return;
543 }
544 if (hist_sideband_D0_pi_PID_TOP_pion == nullptr) {
545 B2ERROR("Can not find the hist_sideband_D0_pi_PID_TOP_pion histogram!");
546 return;
547 }
548 if (hist_sideband_D0_pi_PID_ARICH_pion == nullptr) {
549 B2ERROR("Can not find the hist_sideband_D0_pi_PID_ARICH_pion histogram!");
550 return;
551 }
552 if (hist_sideband_D0_pi_PID_ECL_pion == nullptr) {
553 B2ERROR("Can not find the hist_sideband_D0_pi_PID_ECL_pion histogram!");
554 return;
555 }
556 if (hist_sideband_D0_pi_PID_KLM_pion == nullptr) {
557 B2ERROR("Can not find the hist_sideband_D0_pi_PID_KLM_pion histogram!");
558 return;
559 }
560 if (hist_sideband_D0_K_PID_ALL_kaon == nullptr) {
561 B2ERROR("Can not find the hist_sideband_D0_K_PID_ALL_kaon histogram!");
562 return;
563 }
564 if (hist_sideband_D0_K_PID_SVD_kaon == nullptr) {
565 B2ERROR("Can not find the hist_sideband_D0_K_PID_SVD_kaon histogram!");
566 return;
567 }
568 if (hist_sideband_D0_K_PID_CDC_kaon == nullptr) {
569 B2ERROR("Can not find the hist_sideband_D0_K_PID_CDC_kaon histogram!");
570 return;
571 }
572 if (hist_sideband_D0_K_PID_TOP_kaon == nullptr) {
573 B2ERROR("Can not find the hist_sideband_D0_K_PID_TOP_kaon histogram!");
574 return;
575 }
576 if (hist_sideband_D0_K_PID_ARICH_kaon == nullptr) {
577 B2ERROR("Can not find the hist_sideband_D0_K_PID_ARICH_kaon histogram!");
578 return;
579 }
580 if (hist_sideband_D0_K_PID_ECL_kaon == nullptr) {
581 B2ERROR("Can not find the hist_sideband_D0_K_PID_ECL_kaon histogram!");
582 return;
583 }
584 if (hist_sideband_D0_K_PID_KLM_kaon == nullptr) {
585 B2ERROR("Can not find the hist_sideband_D0_K_PID_KLM_kaon histogram!");
586 return;
587 }
588 if (hist_D0_pi0_InvM == nullptr) {
589 B2ERROR("Can not find the hist_D0_pi0_InvM histogram!");
590 return;
591 }
592 // Fit mass distributions for scale factor
593 TF1* f_InvM = new TF1("f_InvM", "[0]*TMath::Gaus(x,[1],[2])+[3]*pow(x-[4],2)+[5]", 1.81, 1.95);
594 f_InvM->SetParNames("Height", "#mu", "#sigma", "a", "b", "c");
595 f_InvM->SetParameters(hist_D0_InvM->GetMaximum(), 1.86, 5e-3, 0., 1.86, 0.);
596 hist_D0_InvM->Fit(f_InvM, "", "", 1.81, 1.95);
597 f_InvM->SetLineColor(kRed);
598
599 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);
600 f_delta_m->SetParNames("Height", "#mu", "#sigma", "a", "b", "c");
601 f_delta_m->SetParameters(hist_delta_m->GetMaximum(), 0.145, 5e-4, 0., 0.145, 0.);
602 hist_delta_m->Fit(f_delta_m, "", "", 0.14, 0.16);
603 f_delta_m->SetLineColor(kRed);
604
605 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);
606 f_pi0_InvM->SetParNames("Height", "#mu", "#sigma", "a", "b", "c");
607 f_pi0_InvM->SetParameters(hist_D0_pi0_InvM->GetMaximum(), 0.13, 5e-3, 0., 0.13, 0.);
608 hist_D0_pi0_InvM->Fit(f_pi0_InvM, "", "", 0.09, 0.17);
609 f_pi0_InvM->SetLineColor(kRed);
610
611 // D->KPi and D->KPiPi0 yields
612 TF1* f_gaus_InvM = new TF1("f_gaus_InvM", "gaus", 1.81, 1.95);
613 f_gaus_InvM->SetParameters(f_InvM->GetParameter(0), f_InvM->GetParameter(1), f_InvM->GetParameter(2));
614 double InvM_bin_width = hist_D0_InvM->GetXaxis()->GetBinWidth(1);
615 double neve_dst = f_gaus_InvM->Integral(1.81, 1.95) / InvM_bin_width;
616
617 TF1* f_gaus_pi0_InvM = new TF1("f_gaus_pi0_InvM", "gaus", 0.09, 0.17);
618 f_gaus_pi0_InvM->SetParameters(f_pi0_InvM->GetParameter(0), f_pi0_InvM->GetParameter(1), f_pi0_InvM->GetParameter(2));
619 double pi0_InvM_bin_width = hist_D0_pi0_InvM->GetXaxis()->GetBinWidth(1);
620 double neve_pi0 = f_gaus_pi0_InvM->Integral(0.09, 0.17) / pi0_InvM_bin_width;
621
622 // Sumw2
623 hist_D0_softpi_PID_ALL_pion->Sumw2();
624 hist_D0_softpi_PID_SVD_pion->Sumw2();
625 hist_D0_softpi_PID_CDC_pion->Sumw2();
626 hist_D0_softpi_PID_TOP_pion->Sumw2();
627 hist_D0_softpi_PID_ARICH_pion->Sumw2();
628 hist_D0_softpi_PID_ECL_pion->Sumw2();
629 hist_D0_softpi_PID_KLM_pion->Sumw2();
630 hist_D0_pi_PID_ALL_pion->Sumw2();
631 hist_D0_pi_PID_SVD_pion->Sumw2();
632 hist_D0_pi_PID_CDC_pion->Sumw2();
633 hist_D0_pi_PID_TOP_pion->Sumw2();
634 hist_D0_pi_PID_ARICH_pion->Sumw2();
635 hist_D0_pi_PID_ECL_pion->Sumw2();
636 hist_D0_pi_PID_KLM_pion->Sumw2();
637 hist_D0_K_PID_ALL_kaon->Sumw2();
638 hist_D0_K_PID_SVD_kaon->Sumw2();
639 hist_D0_K_PID_CDC_kaon->Sumw2();
640 hist_D0_K_PID_TOP_kaon->Sumw2();
641 hist_D0_K_PID_ARICH_kaon->Sumw2();
642 hist_D0_K_PID_ECL_kaon->Sumw2();
643 hist_D0_K_PID_KLM_kaon->Sumw2();
644 hist_sideband_D0_softpi_PID_ALL_pion->Sumw2();
645 hist_sideband_D0_softpi_PID_SVD_pion->Sumw2();
646 hist_sideband_D0_softpi_PID_CDC_pion->Sumw2();
647 hist_sideband_D0_softpi_PID_TOP_pion->Sumw2();
648 hist_sideband_D0_softpi_PID_ARICH_pion->Sumw2();
649 hist_sideband_D0_softpi_PID_ECL_pion->Sumw2();
650 hist_sideband_D0_softpi_PID_KLM_pion->Sumw2();
651 hist_sideband_D0_pi_PID_ALL_pion->Sumw2();
652 hist_sideband_D0_pi_PID_SVD_pion->Sumw2();
653 hist_sideband_D0_pi_PID_CDC_pion->Sumw2();
654 hist_sideband_D0_pi_PID_TOP_pion->Sumw2();
655 hist_sideband_D0_pi_PID_ARICH_pion->Sumw2();
656 hist_sideband_D0_pi_PID_ECL_pion->Sumw2();
657 hist_sideband_D0_pi_PID_KLM_pion->Sumw2();
658 hist_sideband_D0_K_PID_ALL_kaon->Sumw2();
659 hist_sideband_D0_K_PID_SVD_kaon->Sumw2();
660 hist_sideband_D0_K_PID_CDC_kaon->Sumw2();
661 hist_sideband_D0_K_PID_TOP_kaon->Sumw2();
662 hist_sideband_D0_K_PID_ARICH_kaon->Sumw2();
663 hist_sideband_D0_K_PID_ECL_kaon->Sumw2();
664 hist_sideband_D0_K_PID_KLM_kaon->Sumw2();
665
666 // Scale the distributions in sideband
667 hist_sideband_D0_softpi_PID_ALL_pion->Scale(m_scale_dst);
668 hist_sideband_D0_softpi_PID_SVD_pion->Scale(m_scale_dst);
669 hist_sideband_D0_softpi_PID_CDC_pion->Scale(m_scale_dst);
670 hist_sideband_D0_softpi_PID_TOP_pion->Scale(m_scale_dst);
671 hist_sideband_D0_softpi_PID_ARICH_pion->Scale(m_scale_dst);
672 hist_sideband_D0_softpi_PID_ECL_pion->Scale(m_scale_dst);
673 hist_sideband_D0_softpi_PID_KLM_pion->Scale(m_scale_dst);
674 hist_sideband_D0_pi_PID_ALL_pion->Scale(m_scale_dst);
675 hist_sideband_D0_pi_PID_SVD_pion->Scale(m_scale_dst);
676 hist_sideband_D0_pi_PID_CDC_pion->Scale(m_scale_dst);
677 hist_sideband_D0_pi_PID_TOP_pion->Scale(m_scale_dst);
678 hist_sideband_D0_pi_PID_ARICH_pion->Scale(m_scale_dst);
679 hist_sideband_D0_pi_PID_ECL_pion->Scale(m_scale_dst);
680 hist_sideband_D0_pi_PID_KLM_pion->Scale(m_scale_dst);
681 hist_sideband_D0_K_PID_ALL_kaon->Scale(m_scale_dst);
682 hist_sideband_D0_K_PID_SVD_kaon->Scale(m_scale_dst);
683 hist_sideband_D0_K_PID_CDC_kaon->Scale(m_scale_dst);
684 hist_sideband_D0_K_PID_TOP_kaon->Scale(m_scale_dst);
685 hist_sideband_D0_K_PID_ARICH_kaon->Scale(m_scale_dst);
686 hist_sideband_D0_K_PID_ECL_kaon->Scale(m_scale_dst);
687 hist_sideband_D0_K_PID_KLM_kaon->Scale(m_scale_dst);
688
689 // BG subtraction
690 hist_D0_softpi_PID_ALL_pion->Add(hist_sideband_D0_softpi_PID_ALL_pion, -1);
691 hist_D0_softpi_PID_SVD_pion->Add(hist_sideband_D0_softpi_PID_SVD_pion, -1);
692 hist_D0_softpi_PID_CDC_pion->Add(hist_sideband_D0_softpi_PID_CDC_pion, -1);
693 hist_D0_softpi_PID_TOP_pion->Add(hist_sideband_D0_softpi_PID_TOP_pion, -1);
694 hist_D0_softpi_PID_ARICH_pion->Add(hist_sideband_D0_softpi_PID_ARICH_pion, -1);
695 hist_D0_softpi_PID_ECL_pion->Add(hist_sideband_D0_softpi_PID_ECL_pion, -1);
696 hist_D0_softpi_PID_KLM_pion->Add(hist_sideband_D0_softpi_PID_KLM_pion, -1);
697 hist_D0_pi_PID_ALL_pion->Add(hist_sideband_D0_pi_PID_ALL_pion, -1);
698 hist_D0_pi_PID_SVD_pion->Add(hist_sideband_D0_pi_PID_SVD_pion, -1);
699 hist_D0_pi_PID_CDC_pion->Add(hist_sideband_D0_pi_PID_CDC_pion, -1);
700 hist_D0_pi_PID_TOP_pion->Add(hist_sideband_D0_pi_PID_TOP_pion, -1);
701 hist_D0_pi_PID_ARICH_pion->Add(hist_sideband_D0_pi_PID_ARICH_pion, -1);
702 hist_D0_pi_PID_ECL_pion->Add(hist_sideband_D0_pi_PID_ECL_pion, -1);
703 hist_D0_pi_PID_KLM_pion->Add(hist_sideband_D0_pi_PID_KLM_pion, -1);
704 hist_D0_K_PID_ALL_kaon->Add(hist_sideband_D0_K_PID_ALL_kaon, -1);
705 hist_D0_K_PID_SVD_kaon->Add(hist_sideband_D0_K_PID_SVD_kaon, -1);
706 hist_D0_K_PID_CDC_kaon->Add(hist_sideband_D0_K_PID_CDC_kaon, -1);
707 hist_D0_K_PID_TOP_kaon->Add(hist_sideband_D0_K_PID_TOP_kaon, -1);
708 hist_D0_K_PID_ARICH_kaon->Add(hist_sideband_D0_K_PID_ARICH_kaon, -1);
709 hist_D0_K_PID_ECL_kaon->Add(hist_sideband_D0_K_PID_ECL_kaon, -1);
710 hist_D0_K_PID_KLM_kaon->Add(hist_sideband_D0_K_PID_KLM_kaon, -1);
711
712 // Make TCanvases
713 // --- D* -> D0pi mass resolution
714 dst_mass->Divide(3, 1);
715 dst_mass->cd(1);
716 hist_D0_InvM->Draw();
717 f_InvM->Draw("SAME");
718 dst_mass->cd(2);
719 hist_delta_m->Draw();
720 f_delta_m->Draw("SAME");
721 dst_mass->cd(3);
722 hist_D0_pi0_InvM->Draw();
723 f_pi0_InvM->Draw("SAME");
724 // --- pi variables for D0 -> K pi
725 dst_pi_val->Divide(4, 2);
726 dst_pi_val->cd(1); hist_D0_pi_PID_ALL_pion->Draw();
727 dst_pi_val->cd(2); hist_D0_pi_PID_SVD_pion->Draw();
728 dst_pi_val->cd(3); hist_D0_pi_PID_CDC_pion->Draw();
729 dst_pi_val->cd(4); hist_D0_pi_PID_TOP_pion->Draw();
730 dst_pi_val->cd(5); hist_D0_pi_PID_ARICH_pion->Draw();
731 dst_pi_val->cd(6); hist_D0_pi_PID_ECL_pion->Draw();
732 dst_pi_val->cd(7); hist_D0_pi_PID_KLM_pion->Draw();
733 // --- K variables for D0 -> K pi
734 dst_k_val->Divide(4, 2);
735 dst_k_val->cd(1); hist_D0_K_PID_ALL_kaon->Draw();
736 dst_k_val->cd(2); hist_D0_K_PID_SVD_kaon->Draw();
737 dst_k_val->cd(3); hist_D0_K_PID_CDC_kaon->Draw();
738 dst_k_val->cd(4); hist_D0_K_PID_TOP_kaon->Draw();
739 dst_k_val->cd(5); hist_D0_K_PID_ARICH_kaon->Draw();
740 dst_k_val->cd(6); hist_D0_K_PID_ECL_kaon->Draw();
741 dst_k_val->cd(7); hist_D0_K_PID_KLM_kaon->Draw();
742
743 // calculate the values of monitoring variables
744 double mean_D0_InvM = f_InvM->GetParameter(1);
745 double width_D0_InvM = f_InvM->GetParameter(2);
746 double mean_delta_m = f_delta_m->GetParameter(1);
747 double width_delta_m = f_delta_m->GetParameter(2);
748 double mean_pi0_InvM = f_pi0_InvM->GetParameter(1);
749 double width_pi0_InvM = f_pi0_InvM->GetParameter(2);
750 double mean_D0_softpi_PID_ALL_pion = hist_D0_softpi_PID_ALL_pion->GetMean();
751 double mean_D0_softpi_PID_SVD_pion = hist_D0_softpi_PID_SVD_pion->GetMean();
752 double mean_D0_softpi_PID_CDC_pion = hist_D0_softpi_PID_CDC_pion->GetMean();
753 double mean_D0_softpi_PID_TOP_pion = hist_D0_softpi_PID_TOP_pion->GetMean();
754 double mean_D0_softpi_PID_ARICH_pion = hist_D0_softpi_PID_ARICH_pion->GetMean();
755 double mean_D0_softpi_PID_ECL_pion = hist_D0_softpi_PID_ECL_pion->GetMean();
756 double mean_D0_softpi_PID_KLM_pion = hist_D0_softpi_PID_KLM_pion->GetMean();
757 double mean_D0_pi_PID_ALL_pion = hist_D0_pi_PID_ALL_pion->GetMean();
758 double mean_D0_pi_PID_SVD_pion = hist_D0_pi_PID_SVD_pion->GetMean();
759 double mean_D0_pi_PID_CDC_pion = hist_D0_pi_PID_CDC_pion->GetMean();
760 double mean_D0_pi_PID_TOP_pion = hist_D0_pi_PID_TOP_pion->GetMean();
761 double mean_D0_pi_PID_ARICH_pion = hist_D0_pi_PID_ARICH_pion->GetMean();
762 double mean_D0_pi_PID_ECL_pion = hist_D0_pi_PID_ECL_pion->GetMean();
763 double mean_D0_pi_PID_KLM_pion = hist_D0_pi_PID_KLM_pion->GetMean();
764 double mean_D0_K_PID_ALL_kaon = hist_D0_K_PID_ALL_kaon->GetMean();
765 double mean_D0_K_PID_SVD_kaon = hist_D0_K_PID_SVD_kaon->GetMean();
766 double mean_D0_K_PID_CDC_kaon = hist_D0_K_PID_CDC_kaon->GetMean();
767 double mean_D0_K_PID_TOP_kaon = hist_D0_K_PID_TOP_kaon->GetMean();
768 double mean_D0_K_PID_ARICH_kaon = hist_D0_K_PID_ARICH_kaon->GetMean();
769 double mean_D0_K_PID_ECL_kaon = hist_D0_K_PID_ECL_kaon->GetMean();
770 double mean_D0_K_PID_KLM_kaon = hist_D0_K_PID_KLM_kaon->GetMean();
771
772 // set values
773 mon_dst->setVariable("neve_dst", neve_dst);
774 mon_dst->setVariable("neve_pi0", neve_pi0);
775 mon_dst->setVariable("mean_D0_InvM", mean_D0_InvM);
776 mon_dst->setVariable("width_D0_InvM", width_D0_InvM);
777 mon_dst->setVariable("mean_delta_m", mean_delta_m);
778 mon_dst->setVariable("width_delta_m", width_delta_m);
779 mon_dst->setVariable("mean_pi0_InvM", mean_pi0_InvM);
780 mon_dst->setVariable("width_pi0_InvM", width_pi0_InvM);
781 mon_dst->setVariable("mean_D0_softpi_PID_ALL_pion", mean_D0_softpi_PID_ALL_pion);
782 mon_dst->setVariable("mean_D0_softpi_PID_SVD_pion", mean_D0_softpi_PID_SVD_pion);
783 mon_dst->setVariable("mean_D0_softpi_PID_CDC_pion", mean_D0_softpi_PID_CDC_pion);
784 mon_dst->setVariable("mean_D0_softpi_PID_TOP_pion", mean_D0_softpi_PID_TOP_pion);
785 mon_dst->setVariable("mean_D0_softpi_PID_ARICH_pion", mean_D0_softpi_PID_ARICH_pion);
786 mon_dst->setVariable("mean_D0_softpi_PID_ECL_pion", mean_D0_softpi_PID_ECL_pion);
787 mon_dst->setVariable("mean_D0_softpi_PID_KLM_pion", mean_D0_softpi_PID_KLM_pion);
788 mon_dst->setVariable("mean_D0_pi_PID_ALL_pion", mean_D0_pi_PID_ALL_pion);
789 mon_dst->setVariable("mean_D0_pi_PID_SVD_pion", mean_D0_pi_PID_SVD_pion);
790 mon_dst->setVariable("mean_D0_pi_PID_CDC_pion", mean_D0_pi_PID_CDC_pion);
791 mon_dst->setVariable("mean_D0_pi_PID_TOP_pion", mean_D0_pi_PID_TOP_pion);
792 mon_dst->setVariable("mean_D0_pi_PID_ARICH_pion", mean_D0_pi_PID_ARICH_pion);
793 mon_dst->setVariable("mean_D0_pi_PID_ECL_pion", mean_D0_pi_PID_ECL_pion);
794 mon_dst->setVariable("mean_D0_pi_PID_KLM_pion", mean_D0_pi_PID_KLM_pion);
795 mon_dst->setVariable("mean_D0_K_PID_ALL_kaon", mean_D0_K_PID_ALL_kaon);
796 mon_dst->setVariable("mean_D0_K_PID_SVD_kaon", mean_D0_K_PID_SVD_kaon);
797 mon_dst->setVariable("mean_D0_K_PID_CDC_kaon", mean_D0_K_PID_CDC_kaon);
798 mon_dst->setVariable("mean_D0_K_PID_TOP_kaon", mean_D0_K_PID_TOP_kaon);
799 mon_dst->setVariable("mean_D0_K_PID_ARICH_kaon", mean_D0_K_PID_ARICH_kaon);
800 mon_dst->setVariable("mean_D0_K_PID_ECL_kaon", mean_D0_K_PID_ECL_kaon);
801 mon_dst->setVariable("mean_D0_K_PID_KLM_kaon", mean_D0_K_PID_KLM_kaon);
802
803 //bhabha,hadrons
804 // ========== bhabha_all
805 // get existing histograms produced by DQM modules
806 auto* histbh_npxd = findHist("PhysicsObjectsMiraBelleBhabha/hist_npxd");
807 auto* histbh_nsvd = findHist("PhysicsObjectsMiraBelleBhabha/hist_nsvd");
808 auto* histbh_ncdc = findHist("PhysicsObjectsMiraBelleBhabha/hist_ncdc");
809 auto* histbh_topdig = findHist("PhysicsObjectsMiraBelleBhabha/hist_topdig");
810 auto* histbh_DetPhotonARICH = findHist("PhysicsObjectsMiraBelleBhabha/hist_DetPhotonARICH");
811 auto* histbh_dD0 = findHist("PhysicsObjectsMiraBelleBhabha/hist_dD0");
812 auto* histbh_dZ0 = findHist("PhysicsObjectsMiraBelleBhabha/hist_dZ0");
813 auto* histbh_dPtcms = findHist("PhysicsObjectsMiraBelleBhabha/hist_dPtcms");
814 auto* histbh_Pval = findHist("PhysicsObjectsMiraBelleBhabha/hist_Pval");
815 auto* histbh_nExtraCDCHits = findHist("PhysicsObjectsMiraBelleBhabha/hist_nExtraCDCHits");
816 auto* histbh_nECLClusters = findHist("PhysicsObjectsMiraBelleBhabha/hist_nECLClusters");
817 auto* histbh_electronid = findHist("PhysicsObjectsMiraBelleBhabha/hist_electronid");
818 auto* histbh_inv_p = findHist("PhysicsObjectsMiraBelleBhabha/hist_inv_p");
819 auto* histbh_ndf = findHist("PhysicsObjectsMiraBelleBhabha/hist_ndf");
820 auto* histbh_D0 = findHist("PhysicsObjectsMiraBelleBhabha/hist_D0");
821 auto* histbh_Z0 = findHist("PhysicsObjectsMiraBelleBhabha/hist_Z0");
822 auto* histbh_theta = findHist("PhysicsObjectsMiraBelleBhabha/hist_theta");
823 auto* histbh_Phi0 = findHist("PhysicsObjectsMiraBelleBhabha/hist_Phi0");
824 auto* histbh_Pt = findHist("PhysicsObjectsMiraBelleBhabha/hist_Pt");
825 auto* histbh_Mom = findHist("PhysicsObjectsMiraBelleBhabha/hist_Mom");
826 auto* histbh_dPhicms = findHist("PhysicsObjectsMiraBelleBhabha/hist_dPhicms");
827
828 if (histbh_npxd == nullptr) {
829 B2ERROR("Can not find the histbh_npxd histogram!");
830 return;
831 }
832 if (histbh_nsvd == nullptr) {
833 B2ERROR("Can not find the histbh_nsvd histogram!");
834 return;
835 }
836 if (histbh_ncdc == nullptr) {
837 B2ERROR("Can not find the histbh_ncdc histogram!");
838 return;
839 }
840 if (histbh_topdig == nullptr) {
841 B2ERROR("Can not find the histbh_topdig histogram!");
842 return;
843 }
844 if (histbh_DetPhotonARICH == nullptr) {
845 B2ERROR("Can not find the histbh_DetPhotonARICH histogram!");
846 return;
847 }
848 if (histbh_dD0 == nullptr) {
849 B2ERROR("Can not find the histbh_dD0 histogram!");
850 return;
851 }
852 if (histbh_dZ0 == nullptr) {
853 B2ERROR("Can not find the histbh_dZ0 histogram!");
854 return;
855 }
856 if (histbh_dPtcms == nullptr) {
857 B2ERROR("Can not find the histbh_dPtcms histogram!");
858 return;
859 }
860 if (histbh_Pval == nullptr) {
861 B2ERROR("Can not find the histbh_Pval histogram!");
862 return;
863 }
864 if (histbh_nExtraCDCHits == nullptr) {
865 B2ERROR("Can not find the histbh_nExtraCDCHits histogram!");
866 return;
867 }
868 if (histbh_nECLClusters == nullptr) {
869 B2ERROR("Can not find the histbh_nECLClusters histogram!");
870 return;
871 }
872 if (histbh_electronid == nullptr) {
873 B2ERROR("Can not find the histbh_electronid histogram!");
874 return;
875 }
876 if (histbh_inv_p == nullptr) {
877 B2ERROR("Can not find the histbh_inv_p histogram!");
878 return;
879 }
880 if (histbh_ndf == nullptr) {
881 B2ERROR("Can not find the histbh_ndf histogram!");
882 return;
883 }
884 if (histbh_D0 == nullptr) {
885 B2ERROR("Can not find the histbh_D0 histogram!");
886 return;
887 }
888 if (histbh_Z0 == nullptr) {
889 B2ERROR("Can not find the histbh_Z0 histogram!");
890 return;
891 }
892 if (histbh_theta == nullptr) {
893 B2ERROR("Can not find the histbh_theta histogram!");
894 return;
895 }
896 if (histbh_Phi0 == nullptr) {
897 B2ERROR("Can not find the histbh_Phi0 histogram!");
898 return;
899 }
900 if (histbh_Pt == nullptr) {
901 B2ERROR("Can not find the histbh_Pt histogram!");
902 return;
903 }
904 if (histbh_Mom == nullptr) {
905 B2ERROR("Can not find the histbh_Mom histogram!");
906 return;
907 }
908 if (histbh_dPhicms == nullptr) {
909 B2ERROR("Can not find the histbh_dPhicms histogram!");
910 return;
911 }
912
913 // Make TCanvases
914 // --- bhabha_Main
915 bhabha_main->Divide(4, 3);
916 bhabha_main->cd(1); histbh_theta->Draw();
917 bhabha_main->cd(2); histbh_Phi0->Draw();
918 bhabha_main->cd(3); histbh_Mom->Draw();
919 bhabha_main->cd(4); histbh_Pt->Draw();
920 bhabha_main->cd(5); histbh_npxd->Draw();
921 bhabha_main->cd(6); histbh_nsvd->Draw();
922 bhabha_main->cd(7); histbh_ncdc->Draw();
923 bhabha_main->cd(8); histbh_topdig->Draw();
924 bhabha_main->cd(9); histbh_DetPhotonARICH->Draw();
925 bhabha_main->cd(10); histbh_nExtraCDCHits->Draw();
926 bhabha_main->cd(11); histbh_nECLClusters->Draw();
927 // --- bhabha_Resolution
928 bhabha_resolution->Divide(3, 3);
929 bhabha_resolution->cd(1); histbh_inv_p->Draw();
930 bhabha_resolution->cd(2); histbh_dD0->Draw();
931 bhabha_resolution->cd(3); histbh_dZ0->Draw();
932 bhabha_resolution->cd(4); histbh_dPtcms->Draw();
933 bhabha_resolution->cd(5); histbh_dPhicms->Draw();
934 bhabha_resolution->cd(6); histbh_nECLClusters->Draw();
935 bhabha_resolution->cd(7); histbh_nExtraCDCHits->Draw();
936 bhabha_resolution->cd(8); histbh_ndf->Draw();
937
938 // calculate the values of monitoring variables
939 double bh_mean_npxd = histbh_npxd->GetMean();
940 double bh_mean_nsvd = histbh_nsvd->GetMean();
941 double bh_mean_ncdc = histbh_ncdc->GetMean();
942 double bh_mean_topdig = histbh_topdig->GetMean();
943 double bh_mean_parich = histbh_DetPhotonARICH->GetMean();
944 double bh_mean_ncdc_ex = histbh_nExtraCDCHits->GetMean();
945 double bh_mean_necl = histbh_nECLClusters->GetMean();
946 double bh_mean_electronid = histbh_electronid->GetMean();
947 double bh_mean_d0 = histbh_D0->GetMean();
948 double bh_mean_z0 = histbh_Z0->GetMean();
949 double bh_mean_pval = histbh_Pval->GetMean();
950 double bh_mean_ndf = histbh_ndf->GetMean();
951 double bh_dif_ndf_ncdc = mean_ndf - mean_ncdc;
952 double bh_mean_dd0 = histbh_dD0->GetMean();
953 double bh_mean_dz0 = histbh_dZ0->GetMean();
954 double bh_mean_dpt = histbh_dPtcms->GetMean();
955 double bh_rms_dd0 = histbh_dD0->GetRMS();
956 double bh_rms_dz0 = histbh_dZ0->GetRMS();
957 double bh_rms_dpt = histbh_dPtcms->GetRMS();
958 double bh_sigma68_dd0 = getSigma68(histbh_dD0);
959 double bh_sigma68_dz0 = getSigma68(histbh_dZ0);
960 double bh_sigma68_dpt = getSigma68(histbh_dPtcms);
961 int bh_ntot = histbh_nECLClusters->GetEntries();
962 double bh_neve_bhabha = bh_ntot;
963 int bh_ntot_sign = histbh_nsvd->GetEntries();
964 double bh_neve_bhabha_sign = bh_ntot_sign;
965 double bh_goode_frac = -1.;
966 double bh_pval_frac_0 = -1.;
967 double bh_pval_frac_1 = -1.;
968 double bh_nocdc_frac = -1.;
969 double bh_notop_frac = -1.;
970 double bh_noarich_frac = -1.;
971 double eidcontent = histbh_electronid->GetBinContent(1);
972 double bh_goode_o_bade;
973 if (eidcontent != 0) {
974 bh_goode_o_bade = histbh_electronid->GetBinContent(20) / eidcontent;
975 } else {
976 bh_goode_o_bade = 0.0;
977 }
978 double bh_pval_more95 = 0.0;
979 double bh_pval_less05 = 0.0;
980 for (int i = 95; i < 100; i++) bh_pval_more95 += histbh_Pval->GetBinContent(i + 1);
981 for (int i = 0; i < 5; i++) bh_pval_less05 += histbh_Pval->GetBinContent(i + 1);
982 if (bh_neve_bhabha_sign != 0) {
983 bh_goode_frac = histbh_electronid->GetBinContent(20) / bh_neve_bhabha_sign;
984 bh_pval_frac_0 = bh_pval_less05 / bh_neve_bhabha_sign;
985 bh_pval_frac_1 = bh_pval_more95 / bh_neve_bhabha_sign;
986 bh_nocdc_frac = histbh_ncdc->GetBinContent(1) / bh_neve_bhabha_sign;
987 bh_notop_frac = histbh_topdig->GetBinContent(1) / bh_neve_bhabha_sign;
988 bh_noarich_frac = histbh_DetPhotonARICH->GetBinContent(1) / bh_neve_bhabha_sign;
989 } else {
990 bh_goode_frac = 0.0;
991 bh_pval_frac_0 = 0.0;
992 bh_pval_frac_1 = 0.0;
993 bh_nocdc_frac = 0.0;
994 bh_notop_frac = 0.0;
995 bh_noarich_frac = 0.0;
996 }
997 // set values
998 mon_bhabha->setVariable("bh_mean_npxd", bh_mean_npxd);
999 mon_bhabha->setVariable("bh_mean_nsvd", bh_mean_nsvd);
1000 mon_bhabha->setVariable("bh_mean_ncdc", bh_mean_ncdc);
1001 mon_bhabha->setVariable("bh_mean_topdig", bh_mean_topdig);
1002 mon_bhabha->setVariable("bh_mean_parich", bh_mean_parich);
1003 mon_bhabha->setVariable("bh_mean_ncdc_ex", bh_mean_ncdc_ex);
1004 mon_bhabha->setVariable("bh_mean_necl", bh_mean_necl);
1005 mon_bhabha->setVariable("bh_mean_electronid", bh_mean_electronid);
1006 mon_bhabha->setVariable("bh_mean_d0", bh_mean_d0);
1007 mon_bhabha->setVariable("bh_mean_z0", bh_mean_z0);
1008 mon_bhabha->setVariable("bh_mean_pval", bh_mean_pval);
1009 mon_bhabha->setVariable("bh_mean_ndf", bh_mean_ndf);
1010 mon_bhabha->setVariable("bh_dif_ndf_ncdc", bh_dif_ndf_ncdc);
1011 mon_bhabha->setVariable("bh_mean_dd0", bh_mean_dd0);
1012 mon_bhabha->setVariable("bh_mean_dz0", bh_mean_dz0);
1013 mon_bhabha->setVariable("bh_mean_dpt", bh_mean_dpt);
1014 mon_bhabha->setVariable("bh_rms_dd0", bh_rms_dd0);
1015 mon_bhabha->setVariable("bh_rms_dz0", bh_rms_dz0);
1016 mon_bhabha->setVariable("bh_rms_dpt", bh_rms_dpt);
1017 mon_bhabha->setVariable("bh_sigma68_dd0", bh_sigma68_dd0);
1018 mon_bhabha->setVariable("bh_sigma68_dz0", bh_sigma68_dz0);
1019 mon_bhabha->setVariable("bh_sigma68_dpt", bh_sigma68_dpt);
1020 mon_bhabha->setVariable("bh_neve_bhabha", bh_neve_bhabha);
1021 mon_bhabha->setVariable("bh_neve_bhabha_sign", bh_neve_bhabha_sign);
1022 mon_bhabha->setVariable("bh_goode_frac", bh_goode_frac);
1023 mon_bhabha->setVariable("bh_goode_o_bade", bh_goode_o_bade);
1024 mon_bhabha->setVariable("bh_pval_frac_0", bh_pval_frac_0);
1025 mon_bhabha->setVariable("bh_pval_frac_1", bh_pval_frac_1);
1026 mon_bhabha->setVariable("bh_nocdc_frac", bh_nocdc_frac);
1027 mon_bhabha->setVariable("bh_notop_frac", bh_notop_frac);
1028 mon_bhabha->setVariable("bh_noarich_frac", bh_noarich_frac);
1029 // ========== hadronb2 + tight
1030 // get existing histograms produced by DQM modules
1031 auto* histhad_nECLClusters = findHist("PhysicsObjectsMiraBelleHadron/hist_nECLClusters");
1032 auto* histhad_visibleEnergyCMSnorm = findHist("PhysicsObjectsMiraBelleHadron/hist_visibleEnergyCMSnorm");
1033 auto* histhad_EsumCMSnorm = findHist("PhysicsObjectsMiraBelleHadron/hist_EsumCMSnorm");
1034 auto* histhad_R2 = findHist("PhysicsObjectsMiraBelleHadron/hist_R2");
1035 auto* histhad_physicsresultsH = findHist("PhysicsObjectsMiraBelleHadron/hist_physicsresultsH");
1036
1037 if (histhad_nECLClusters == nullptr) {
1038 B2ERROR("Can not find the histhad_nECLClusters histogram!");
1039 return;
1040 }
1041 if (histhad_visibleEnergyCMSnorm == nullptr) {
1042 B2ERROR("Can not find the histhad_visibleEnergyCMSnorm histogram!");
1043 return;
1044 }
1045 if (histhad_EsumCMSnorm == nullptr) {
1046 B2ERROR("Can not find the histhad_EsumCMSnorm histogram!");
1047 return;
1048 }
1049 if (histhad_R2 == nullptr) {
1050 B2ERROR("Can not find the histhad_R2 histogram!");
1051 return;
1052 }
1053 if (histhad_physicsresultsH == nullptr) {
1054 B2ERROR("Can not find the histhad_physicsresultsH histogram!");
1055 return;
1056 }
1057
1058 // Make TCanvases
1059 // --- hadron_Main
1060 hadron_main->Divide(2, 2);
1061 hadron_main->cd(1); histhad_nECLClusters->Draw();
1062 hadron_main->cd(2); histhad_visibleEnergyCMSnorm->Draw();
1063 hadron_main->cd(3); histhad_EsumCMSnorm->Draw();
1064 hadron_main->cd(4); histhad_R2->Draw();
1065 // calculate the values of monitoring variables
1066 double had_ntot = histhad_physicsresultsH->GetBinContent(3);
1067 double ratio_hadron_bhabha = 0.;
1068 //pull
1069 double ratio_pull_hadBhabha = -10.;
1070 double error_ratio = -10.;
1071
1072 if (bh_ntot != 0) {
1073 ratio_hadron_bhabha = had_ntot / bh_neve_bhabha;
1074 //pull
1075 double ratio_reference = 0.206;
1076 error_ratio = ratio_hadron_bhabha * sqrt((1 / had_ntot) + (1 / bh_neve_bhabha));
1077 ratio_pull_hadBhabha = (ratio_hadron_bhabha - ratio_reference) / error_ratio;
1078 }
1079 // set values
1080 mon_bhabha->setVariable("had_ntot", had_ntot);
1081 mon_hadron->setVariable("ratio_hadron_bhabha", ratio_hadron_bhabha);
1082 mon_hadron->setVariable("error_ratio", error_ratio);
1083 mon_hadron->setVariable("ratio_pull_hadBhabha", ratio_pull_hadBhabha);
1084
1085 B2DEBUG(20, "DQMHistAnalysisMiraBelle : endRun called");
1086}
1087
1089{
1090
1091 B2DEBUG(20, "terminate called");
1092}
TCanvas * dst_k_val
TCanvas object for PID distributions of K.
void initialize() override final
Initialize the Module.
TCanvas * bhabha_main
TCanvas object for main display.
TCanvas * hadron_main
TCanvas object for main display.
TCanvas * bhabha_resolution
TCanvas object for resolution display.
TCanvas * mumu_resolution
TCanvas object for resolution display.
Belle2::MonitoringObject * mon_bhabha
MonitoringObject for bhabha events.
void terminate() override final
Termination action.
TCanvas * dst_pi_val
TCanvas object for PID distributions of pi.
Belle2::MonitoringObject * mon_dst
MonitoringObject for D* events.
void event() override final
Event processor.
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.
void endRun() override final
End-of-run action.
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.
void beginRun() override final
Called when entering a new run.
Belle2::MonitoringObject * mon_hadron
MonitoringObject for hadronb2 tight events.
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).
double getSigma68(TH1 *h) const
Helper function to compute half of the central interval covering 68% of a distribution.
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
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.
STL namespace.