ROOT Analysis for the Inclusive Detachted Dilepton Trigger Lines
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

433 lines
18 KiB

  1. #include "TH1D.h"
  2. #include "TH2D.h"
  3. #include "THStack.h"
  4. #include "TGraph.h"
  5. #include "TTree.h"
  6. #include "TChain.h"
  7. #include "TFile.h"
  8. #include "TCanvas.h"
  9. #include "TROOT.h"
  10. #include "TStyle.h"
  11. #include "TColor.h"
  12. #include "TLorentzVector.h"
  13. #include "TRandom3.h"
  14. #include "TLegend.h"
  15. #include "RooDataHist.h"
  16. #include "RooRealVar.h"
  17. #include "RooPlot.h"
  18. #include "RooGaussian.h"
  19. #include "RooExponential.h"
  20. #include "RooRealConstant.h"
  21. #include "RooAddPdf.h"
  22. #include "RooFitResult.h"
  23. #include "RooProduct.h"
  24. #include "RooCrystalBall.h"
  25. #include "RooBreitWigner.h"
  26. #include "RooArgSet.h"
  27. #include "RooFFTConvPdf.h"
  28. #include "RooNovosibirsk.h"
  29. #include <string>
  30. #include <iostream>
  31. #include <cmath>
  32. const int nBins = 70;
  33. const Double_t MASS_HIST_MIN = 5100.;
  34. const Double_t MASS_HIST_MAX = 6000.;
  35. const Double_t MASS_HIST_FIT_MIN = 5100.;
  36. const Double_t MASS_HIST_FIT_MAX = 6000.;
  37. const Double_t K_MASS = 493.677;
  38. const Double_t PSI2S_MASS = 3686.093;
  39. const Double_t JPSI_MASS = 3096.900;
  40. const Double_t KSTAR_MASS = 891.760;
  41. void CreateRooFitAndDraw(TH1D *hist, const char *name);
  42. const char *TITLE = "SpruceRD_BuToHpMuMu (#pi^{+} #rightarrow K^{+}, Small Cut)";
  43. const char *FILE_NAME = "SpruceRD_BuToHpMuMu_Pip2Kp_smallcut";
  44. const char *MASS_LITERAL = "m(#pi^{+}_{(#rightarrow K^{+})}#mu^{+}#mu^{-})";
  45. struct Hlt1Decision
  46. {
  47. std::string name;
  48. int index;
  49. int flag;
  50. Bool_t value;
  51. std::string GetName() const
  52. {
  53. return TString::Format("Hlt1%sDecision", name.c_str()).Data();
  54. }
  55. Bool_t *GetValuePointer()
  56. {
  57. return &value;
  58. }
  59. };
  60. const int FLAG_TrackMVA = 0b0000100000000000;
  61. const int FLAG_TwoTrackMVA = 0b0001000000000000;
  62. std::vector<Hlt1Decision> Hlt1Decisions{
  63. Hlt1Decision{"DiMuonHighMass", 1, 0b0000000000000001}, // 0001
  64. Hlt1Decision{"DiMuonLowMass", 2, 0b0000000000000010}, // 0002
  65. Hlt1Decision{"DiMuonNoIP", 3, 0b0000000000000100}, // 0004
  66. Hlt1Decision{"DiMuonSoft", 4, 0b0000000000001000}, // 0008
  67. Hlt1Decision{"DisplacedLeptons", 5, 0b0000000000010000}, // 0016
  68. Hlt1Decision{"LowPtDiMuon", 6, 0b0000000000100000}, // 0032
  69. Hlt1Decision{"LowPtMuon", 7, 0b0000000001000000}, // 0064
  70. Hlt1Decision{"OneMuonTrackLine", 8, 0b0000000010000000}, // 0128
  71. Hlt1Decision{"SingleHighEt", 9, 0b0000000100000000}, // 0256
  72. Hlt1Decision{"SingleHighPtMuon", 10, 0b0000001000000000}, // 0512
  73. Hlt1Decision{"TrackMVA", 11, FLAG_TrackMVA}, // 1024
  74. Hlt1Decision{"TrackMuonMVA", 12, 0b0000100000000000}, // 2048
  75. Hlt1Decision{"TwoTrackMVA", 13, FLAG_TwoTrackMVA}, // 4096
  76. };
  77. // 0b0001000000000000
  78. // 0b0001000000110111
  79. void ConnectHlt1Decisions(TChain *chain)
  80. {
  81. for (auto &var : Hlt1Decisions)
  82. {
  83. chain->SetBranchAddress(var.GetName().c_str(), var.GetValuePointer());
  84. }
  85. }
  86. int CombineHlt1DecisionFlags()
  87. {
  88. int result = 0;
  89. for (const auto &var : Hlt1Decisions)
  90. {
  91. if (var.value)
  92. {
  93. result = result | var.flag;
  94. }
  95. }
  96. return result;
  97. }
  98. int analysis_fullstream_bu2hpmumu()
  99. {
  100. TChain *data_chain = new TChain("BuToHpMuMu/DecayTree");
  101. data_chain->Add("/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/spruce_magdown_2023_v0_tuple_90000000_v0r0p6288631.root");
  102. data_chain->Add("/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/spruce_magdown_2023_v0r1_tuple_90000000_2023_v0r0p6288631.root");
  103. Float_t B_BPVFDCHI2,
  104. B_BPVIPCHI2,
  105. L1_BPVIPCHI2,
  106. L2_BPVIPCHI2,
  107. L1_PT,
  108. L2_PT,
  109. Jpsi_BPVFDCHI2,
  110. Hp_PT,
  111. Hp_BPVIPCHI2,
  112. Hp_P;
  113. Double_t L1_PID_MU,
  114. L2_PID_MU,
  115. B_CHI2VXNDOF,
  116. Jpsi_MAXDOCACHI2,
  117. Jpsi_CHI2DOF,
  118. Hp_PID_K,
  119. Jpsi_M,
  120. B_M;
  121. Bool_t L1_ISMUON,
  122. L2_ISMUON,
  123. Hlt2RD_BuToKpMuMuDecision,
  124. Hlt2_InclDetDiMuon_4BodyDecision,
  125. Hlt2_InclDetDiMuon_3BodyDecision,
  126. Hlt2_InclDetDiMuonDecision,
  127. Hlt1TrackMVADecision,
  128. Hlt1TwoTrackMVADecision;
  129. UInt_t runNumber;
  130. ULong64_t eventNumber;
  131. data_chain->SetBranchAddress("RUNNUMBER", &runNumber);
  132. data_chain->SetBranchAddress("EVENTNUMBER", &eventNumber);
  133. data_chain->SetBranchAddress("B_M", &B_M);
  134. data_chain->SetBranchAddress("B_BPVFDCHI2", &B_BPVFDCHI2);
  135. data_chain->SetBranchAddress("B_BPVIPCHI2", &B_BPVIPCHI2);
  136. data_chain->SetBranchAddress("L1_BPVIPCHI2", &L1_BPVIPCHI2);
  137. data_chain->SetBranchAddress("L2_BPVIPCHI2", &L2_BPVIPCHI2);
  138. data_chain->SetBranchAddress("L1_PID_MU", &L1_PID_MU);
  139. data_chain->SetBranchAddress("L2_PID_MU", &L2_PID_MU);
  140. data_chain->SetBranchAddress("L1_ISMUON", &L1_ISMUON);
  141. data_chain->SetBranchAddress("L2_ISMUON", &L2_ISMUON);
  142. data_chain->SetBranchAddress("L1_PT", &L1_PT);
  143. data_chain->SetBranchAddress("L2_PT", &L2_PT);
  144. data_chain->SetBranchAddress("B_CHI2VXNDOF", &B_CHI2VXNDOF);
  145. data_chain->SetBranchAddress("Jpsi_MAXDOCACHI2", &Jpsi_MAXDOCACHI2);
  146. data_chain->SetBranchAddress("Jpsi_CHI2DOF", &Jpsi_CHI2DOF);
  147. data_chain->SetBranchAddress("Hp_PT", &Hp_PT);
  148. data_chain->SetBranchAddress("Hp_BPVIPCHI2", &Hp_BPVIPCHI2);
  149. data_chain->SetBranchAddress("Hp_P", &Hp_P);
  150. data_chain->SetBranchAddress("Hp_PID_K", &Hp_PID_K);
  151. data_chain->SetBranchAddress("Jpsi_BPVFDCHI2", &Jpsi_BPVFDCHI2);
  152. data_chain->SetBranchAddress("Jpsi_M", &Jpsi_M);
  153. data_chain->SetBranchAddress("Hlt2RD_BuToKpMuMuDecision", &Hlt2RD_BuToKpMuMuDecision);
  154. data_chain->SetBranchAddress("Hlt2_InclDetDiMuon_4BodyDecision", &Hlt2_InclDetDiMuon_4BodyDecision);
  155. data_chain->SetBranchAddress("Hlt2_InclDetDiMuon_3BodyDecision", &Hlt2_InclDetDiMuon_3BodyDecision);
  156. data_chain->SetBranchAddress("Hlt2_InclDetDiMuonDecision", &Hlt2_InclDetDiMuonDecision);
  157. data_chain->SetBranchAddress("Hlt1TrackMVADecision", &Hlt1TrackMVADecision);
  158. data_chain->SetBranchAddress("Hlt1TwoTrackMVADecision", &Hlt1TwoTrackMVADecision);
  159. Float_t L1_PX, L1_PY, L1_PZ, L1_ENERGY, L2_PX, L2_PY, L2_PZ, L2_ENERGY, Hp_PX, Hp_PY, Hp_PZ, Hp_ENERGY;
  160. data_chain->SetBranchAddress("L1_PX", &L1_PX);
  161. data_chain->SetBranchAddress("L1_PY", &L1_PY);
  162. data_chain->SetBranchAddress("L1_PZ", &L1_PZ);
  163. data_chain->SetBranchAddress("L1_ENERGY", &L1_ENERGY);
  164. data_chain->SetBranchAddress("L2_PX", &L2_PX);
  165. data_chain->SetBranchAddress("L2_PY", &L2_PY);
  166. data_chain->SetBranchAddress("L2_PZ", &L2_PZ);
  167. data_chain->SetBranchAddress("L2_ENERGY", &L2_ENERGY);
  168. data_chain->SetBranchAddress("Hp_PX", &Hp_PX);
  169. data_chain->SetBranchAddress("Hp_PY", &Hp_PY);
  170. data_chain->SetBranchAddress("Hp_PZ", &Hp_PZ);
  171. data_chain->SetBranchAddress("Hp_ENERGY", &Hp_ENERGY);
  172. // ConnectHlt1Decisions(data_chain);
  173. TH1D *h1_B_M_jpsi = new TH1D("h1_B_M_jpsi", "B Mass, J/#psi Mode", nBins, MASS_HIST_MIN, MASS_HIST_MAX);
  174. TH1D *h1_B_M_psi2s = new TH1D("h1_B_M_psi2s", "B Mass, #psi(2S) Mode", nBins, MASS_HIST_MIN, MASS_HIST_MAX);
  175. TH1D *h1_JPsi_M = new TH1D("h1_JPsi_M", "J/#psi", nBins, JPSI_MASS - 100., PSI2S_MASS + 100.);
  176. // TH2D *h2_Hlt1_flags_B_Mass = new TH2D("h2_Hlt1_flags_B_Mass", "Hlt1 Decision vs B Mass", 50, 5100, 5400, 13, 1., 14.);
  177. // TH2D *h2_Hlt1_flags_excl_B_Mass = new TH2D("h2_Hlt1_flags_excl_B_Mass", "Excl Hlt1 Decision vs B Mass", 50, 5100, 5400, 13, 1., 14.);
  178. // h2_Hlt1_flags_B_Mass->SetCanExtend(TH1::kYaxis);
  179. // for (const auto &var : Hlt1Decisions)
  180. // {
  181. // h2_Hlt1_flags_B_Mass->Fill(0., var.name.c_str(), 0.);
  182. // h2_Hlt1_flags_excl_B_Mass->Fill(0., var.name.c_str(), 0.);
  183. // }
  184. std::map<std::pair<unsigned int, unsigned long>, int> run_event_num_dict;
  185. unsigned int entries = data_chain->GetEntries();
  186. unsigned int selected_entries = 0;
  187. for (unsigned int i = 0; i < entries; i++)
  188. {
  189. data_chain->GetEntry(i);
  190. TVector3 K_momentum(Hp_PX, Hp_PY, Hp_PZ);
  191. double K_energy = TMath::Sqrt(TMath::Sq(K_MASS) + K_momentum.Mag2());
  192. TLorentzVector K_4v(K_momentum, K_energy);
  193. TLorentzVector l1_4v(L1_PX, L1_PY, L1_PZ, L1_ENERGY);
  194. TLorentzVector l2_4v(L2_PX, L2_PY, L2_PZ, L2_ENERGY);
  195. Double_t reconstructed_B_Mass = (K_4v + l1_4v + l2_4v).M();
  196. // int combinedFlags = CombineHlt1DecisionFlags();
  197. // bool trackMVADec = (((combinedFlags & FLAG_TrackMVA) == FLAG_TrackMVA) | ((combinedFlags & FLAG_TwoTrackMVA) == FLAG_TwoTrackMVA));
  198. // if (TMath::Abs(Jpsi_M - JPSI_MASS) < 100 && trackMVADec)
  199. // {
  200. // for (const auto &var : Hlt1Decisions)
  201. // {
  202. // if (var.value)
  203. // {
  204. // h2_Hlt1_flags_B_Mass->Fill(reconstructed_B_Mass, var.name.c_str(), 1);
  205. // }
  206. // }
  207. // for (const auto &var : Hlt1Decisions)
  208. // {
  209. // if (var.value)
  210. // {
  211. // h2_Hlt1_flags_excl_B_Mass->Fill(reconstructed_B_Mass, var.name.c_str(), 1);
  212. // break;
  213. // }
  214. // }
  215. // }
  216. // std::cout << "HLT1 Decision Flags: " << combinedFlags << std::endl;
  217. // if (trackMVADec)
  218. // {
  219. // h1_JPsi_M->Fill(Jpsi_M);
  220. // if (TMath::Abs(Jpsi_M - JPSI_MASS) < 100)
  221. // {
  222. // h1_B_M_jpsi->Fill(reconstructed_B_Mass);
  223. // }
  224. // else if (TMath::Abs(Jpsi_M - PSI2S_MASS) < 100)
  225. // {
  226. // h1_B_M_psi2s->Fill(reconstructed_B_Mass);
  227. // }
  228. // }
  229. // if (
  230. // (((B_BPVFDCHI2 > 36) & (B_CHI2VXNDOF < 16) & (B_BPVIPCHI2 < 25) & (Jpsi_MAXDOCACHI2 < 36) & (L1_BPVIPCHI2 > 9) & (L2_BPVIPCHI2 > 9) & (L1_PID_MU > -3) & (L2_PID_MU > -3) & (L1_ISMUON) & (L2_ISMUON) & (L1_PT > 350) & (L2_PT > 350) & (Jpsi_CHI2DOF < 9) & (Jpsi_BPVFDCHI2 > 16) & (Jpsi_M < 5500) & (Hp_PT > 400) & (Hp_BPVIPCHI2 > 6) & (Hp_PT > 400) & (Hp_BPVIPCHI2 > 6) & (Hp_P > 2000) & (Hp_PID_K > -4)) & (Hlt2RD_BuToKpMuMuDecision) & (((Hlt2_InclDetDiMuon_4BodyDecision) | (Hlt2_InclDetDiMuon_3BodyDecision) | (Hlt2_InclDetDiMuonDecision)))))
  231. // {
  232. if ((TMath::Abs(Jpsi_M - 3096.9) < 100) & ((Hlt1TrackMVADecision) | (Hlt1TwoTrackMVADecision)))
  233. {
  234. // check for unique run/event number
  235. selected_entries++;
  236. auto run_event_pair = std::make_pair((unsigned int)runNumber, (unsigned long)eventNumber);
  237. int &run_event_unique_num = run_event_num_dict[run_event_pair];
  238. if (run_event_unique_num)
  239. {
  240. run_event_unique_num = run_event_unique_num + 1;
  241. std::cout << "R: " << runNumber << " / E: " << eventNumber << " / # " << run_event_unique_num
  242. << ", M = " << reconstructed_B_Mass << " MeV"
  243. << std::endl;
  244. }
  245. else
  246. {
  247. run_event_unique_num = 1;
  248. h1_B_M_jpsi->Fill(reconstructed_B_Mass);
  249. }
  250. }
  251. // }
  252. if ((i + 1) % 10000 == 0 || i + 1 == entries)
  253. {
  254. std::cout << "["
  255. << FILE_NAME
  256. << "] Processed event: " << i + 1 << " (" << TString::Format("%.2f", ((double)(i + 1) / (double)entries) * 100.) << "%)" << std::endl;
  257. }
  258. }
  259. std::cout << "#### " << run_event_num_dict.size() << " out of " << selected_entries << " unique ("
  260. << TString::Format("%.2f", ((double)(run_event_num_dict.size()) / (double)selected_entries) * 100.) << "%)." << std::endl;
  261. TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 1400, 600);
  262. c1->Divide(2, 1);
  263. c1->cd(1);
  264. h1_B_M_jpsi->Draw();
  265. c1->cd(2);
  266. h1_B_M_psi2s->Draw();
  267. c1->Draw();
  268. c1->SaveAs(TString::Format("images/root_hist_%s_%s_bmass.pdf", FILE_NAME, "jpsi_psi2s").Data());
  269. TCanvas *c2 = new TCanvas("c2", "c2", 0, 0, 800, 600);
  270. h1_JPsi_M->SetStats(0);
  271. h1_JPsi_M->Draw();
  272. c2->Draw();
  273. // TCanvas *c3 = new TCanvas("c3", "c3", 0, 0, 1400, 600);
  274. // c3->Divide(2, 1, 0.04);
  275. // c3->cd(1);
  276. // //c3->SetLeftMargin(0.40);
  277. // h2_Hlt1_flags_B_Mass->SetStats(0);
  278. // h2_Hlt1_flags_B_Mass->Draw("COLZ");
  279. // c3->cd(2);
  280. // //c3->SetLeftMargin(0.40);
  281. // h2_Hlt1_flags_excl_B_Mass->SetStats(0);
  282. // h2_Hlt1_flags_excl_B_Mass->Draw("COLZ");
  283. // c3->Draw();
  284. // c3->SaveAs(TString::Format("images/root_hist_%s_hlt1dec.pdf", FILE_NAME).Data());
  285. CreateRooFitAndDraw(h1_B_M_jpsi, "jpsi");
  286. // CreateRooFitAndDraw(h1_B_M_psi2s, "psi2s");
  287. // zweiter Plot, welche exklusiv von *einer* HLT1 Line getriggert werden
  288. // DecProd Cut in Decfile von MonteCarlo Production
  289. // --> Lumi * (B Prod Crosssection für B-Prouktion) * (Branching Frcation B->J/Psi K) * (Brranch Fraction J/Psi->mumu) * Effizienz
  290. return 0;
  291. }
  292. void CreateRooFitAndDraw(TH1D *hist, const char *name)
  293. {
  294. auto suffix = [name](const char *text)
  295. {
  296. return TString::Format("%s%s", text, "");
  297. };
  298. RooRealVar roo_var_mass(suffix("var_mass"), "B Mass Variable", MASS_HIST_FIT_MIN, MASS_HIST_FIT_MAX);
  299. roo_var_mass.setRange("fitting_range", MASS_HIST_FIT_MIN, MASS_HIST_FIT_MAX);
  300. TString hist_name = suffix("roohist_B_M");
  301. RooDataHist roohist_B_M(hist_name, "B Mass Histogram", roo_var_mass, RooFit::Import(*hist));
  302. RooPlot *roo_frame_mass = roo_var_mass.frame(RooFit::Title(TITLE));
  303. roohist_B_M.plotOn(roo_frame_mass, RooFit::Binning(nBins), RooFit::Name(hist_name));
  304. roo_frame_mass->GetXaxis()->SetTitle(MASS_LITERAL);
  305. // Crystal Ball for Signal
  306. RooRealVar var_mass_x0(suffix("var_mass_x0"), "#mu", 5278., 5170., 5500.);
  307. RooRealVar var_mass_sigmaLR(suffix("var_mass_sigmaLR"), "#sigma_{LR}", 16., 5., 40.);
  308. // Same Variables for Left and Right Tail
  309. // RooRealVar var_mass_alphaL("var_mass_alphaL", "#alpha_{L}", 2., 0., 4.);
  310. // RooRealVar var_mass_nL("var_mass_nL", "n_{L}", 5., 0., 15.);
  311. // RooRealVar var_mass_alphaR("var_mass_alphaR", "#alpha_{R}", 2., 0., 4.);
  312. // RooRealVar var_mass_nR("var_mass_nR", "n_{R}", 5., 0., 15.);
  313. auto var_mass_alphaL = RooRealConstant::value(1.894);
  314. auto var_mass_nL = RooRealConstant::value(1.120);
  315. auto var_mass_alphaR = RooRealConstant::value(2.446);
  316. auto var_mass_nR = RooRealConstant::value(1.146);
  317. RooCrystalBall sig_cb(suffix("sig_cb"), "Signal Crystal Ball", roo_var_mass, var_mass_x0, var_mass_sigmaLR, var_mass_alphaL, var_mass_nL, var_mass_alphaR, var_mass_nR);
  318. // Exponential for Background
  319. RooRealVar var_mass_bkg_c(suffix("var_mass_bkg_c"), "#lambda", -0.0014, -0.004, -0.000);
  320. RooExponential bkg_exp(suffix("bkg_exp"), "Exp Background", roo_var_mass, var_mass_bkg_c);
  321. RooRealVar var_mass_nsig(suffix("nsig"), "Mass N Signal", 0., hist->GetEntries());
  322. RooRealVar var_mass_nbkg(suffix("nbkg"), "Mass N Background", 0., hist->GetEntries());
  323. TString pdf_name = suffix("sigplusbkg");
  324. RooAddPdf sigplusbkg(pdf_name, "Sig and Bkg PDF", RooArgList(sig_cb, bkg_exp), RooArgList(var_mass_nsig, var_mass_nbkg));
  325. // RooFitResult *fitres = sigplusbkg.fitTo(roohist_B_M, RooFit::Save(), RooFit::PrintLevel(1), RooFit::Range("fitting_range"));
  326. // sigplusbkg.plotOn(roo_frame_mass, RooFit::VisualizeError(*fitres, 1), RooFit::FillColor(kOrange + 1), RooFit::FillStyle(3144));
  327. // sigplusbkg.plotOn(roo_frame_mass, RooFit::LineColor(kRed), RooFit::LineStyle(kSolid), RooFit::Range("fitting_range"), RooFit::Name(pdf_name));
  328. // sigplusbkg.plotOn(roo_frame_mass, RooFit::Components(RooArgSet(bkg_exp)), RooFit::LineColor(kBlue - 7), RooFit::LineStyle(kDashed), RooFit::Range("fitting_range"), RooFit::Name("bkg_exp"));
  329. // sigplusbkg.plotOn(roo_frame_mass, RooFit::Components(RooArgSet(sig_cb)), RooFit::LineColor(kRed - 7), RooFit::LineStyle(kDashed), RooFit::Range("fitting_range"), RooFit::Name("sig_cb"));
  330. // RooPlot *roo_frame_pull = roo_var_mass.frame(RooFit::Title("Pull Distribution"));
  331. // roo_frame_pull->addPlotable(roo_frame_mass->pullHist(hist_name, pdf_name), "P");
  332. TCanvas *c = new TCanvas(suffix("roofit_c"), "roofit_c", 0, 0, 800, 600);
  333. // auto *p2 = new TPad(suffix("p2"), "Pull", 0., 0., 1., 0.3);
  334. // p2->Draw();
  335. // p2->SetTopMargin(0.001);
  336. // p2->SetBottomMargin(0.3);
  337. // p2->SetGrid();
  338. // auto *p1 = new TPad(suffix("p1"), "Fit", 0., 0.32, 1., 1.);
  339. // p1->Draw();
  340. // p1->SetBottomMargin(0.001);
  341. // p1->cd();
  342. roo_frame_mass->Draw();
  343. TLegend *leg1 = new TLegend(0.50, 0.80, 0.87, 0.89);
  344. leg1->SetFillColor(kWhite);
  345. leg1->SetLineColor(kBlack);
  346. // leg1->AddEntry(roo_frame_mass->findObject(pdf_name), "Signal + Background", "LP");
  347. // leg1->AddEntry(roo_frame_mass->findObject("sig_cb"), "Signal", "LP");
  348. // leg1->AddEntry(roo_frame_mass->findObject("bkg_exp"), "Background", "LP");
  349. // leg1->AddEntry((TObject *)0, "", "");
  350. // leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", var_mass_x0.getTitle().Data(), var_mass_x0.getVal(), var_mass_x0.getError()).Data(), "");
  351. // leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", var_mass_sigmaLR.getTitle().Data(), var_mass_sigmaLR.getVal(), var_mass_sigmaLR.getError()).Data(), "");
  352. // leg1->AddEntry((TObject *)0, TString::Format("%s = %.6f #pm %.6f", var_mass_bkg_c.getTitle().Data(), var_mass_bkg_c.getVal(), var_mass_bkg_c.getError()).Data(), "");
  353. // leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", "S", var_mass_nsig.getVal(), var_mass_nsig.getError()).Data(), "");
  354. // leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", "B", var_mass_nbkg.getVal(), var_mass_nbkg.getError()).Data(), "");
  355. leg1->AddEntry((TObject *)0, TString::Format("Entries: %.0f", roohist_B_M.sumEntries()), "");
  356. leg1->Draw();
  357. // p2->cd();
  358. // roo_frame_pull->Draw();
  359. c->Draw();
  360. c->SaveAs(TString::Format("images/data/roofit_hist_%s_bmass.pdf", suffix(FILE_NAME).Data()).Data());
  361. }