From 10c4c72282e839b03074f7cd51b97d4896253002 Mon Sep 17 00:00:00 2001 From: Marius Pfeiffer Date: Thu, 8 Feb 2024 12:27:22 +0100 Subject: [PATCH] move old files, extend do_all --- do_all.cpp | 533 +++++++++++++----- .../analysis_fullstream_b02hphmmumu.cpp | 6 +- .../analysis_fullstream_bu2hpmumu.cpp | 38 +- .../analysis_fullstream_michele.cpp | 0 .../analysis_turbo.cpp | 57 +- .../general_cuts.cpp | 0 .../inspect_tree.cpp | 0 .../pre_selection_cuts.cpp | 0 .../simulation.cpp | 0 .../simulation_fullstream_B02KpPimMuMu.cpp | 4 +- .../simulation_fullstream_Bu2KpMuMu.cpp | 0 .../status_report_plots.cpp | 0 .../subs_mass.cpp | 0 .../train_bdt.cpp | 0 14 files changed, 456 insertions(+), 182 deletions(-) rename analysis_fullstream_b02hphmmumu.cpp => old_analysis_macros/analysis_fullstream_b02hphmmumu.cpp (98%) rename analysis_fullstream_bu2hpmumu.cpp => old_analysis_macros/analysis_fullstream_bu2hpmumu.cpp (85%) rename analysis_fullstream_michele.cpp => old_analysis_macros/analysis_fullstream_michele.cpp (100%) rename analysis_turbo.cpp => old_analysis_macros/analysis_turbo.cpp (79%) rename general_cuts.cpp => old_analysis_macros/general_cuts.cpp (100%) rename inspect_tree.cpp => old_analysis_macros/inspect_tree.cpp (100%) rename pre_selection_cuts.cpp => old_analysis_macros/pre_selection_cuts.cpp (100%) rename simulation.cpp => old_analysis_macros/simulation.cpp (100%) rename simulation_fullstream_B02KpPimMuMu.cpp => old_analysis_macros/simulation_fullstream_B02KpPimMuMu.cpp (98%) rename simulation_fullstream_Bu2KpMuMu.cpp => old_analysis_macros/simulation_fullstream_Bu2KpMuMu.cpp (100%) rename status_report_plots.cpp => old_analysis_macros/status_report_plots.cpp (100%) rename subs_mass.cpp => old_analysis_macros/subs_mass.cpp (100%) rename train_bdt.cpp => old_analysis_macros/train_bdt.cpp (100%) diff --git a/do_all.cpp b/do_all.cpp index d252209..339e5f4 100644 --- a/do_all.cpp +++ b/do_all.cpp @@ -35,199 +35,462 @@ #include template -class Cut { - public: - virtual bool Check(T y) = 0; - virtual std::string ToString() = 0; +class Cut +{ +public: + virtual bool Check(T y) = 0; + virtual std::string ToString() = 0; }; template -class LT : public Cut { - private: - T value; - - public: - LT(T val) : value{val} { - - } - - bool Check(T y) { - return y < value; - } - - std::string ToString() { - return TString::Format("(x < %s)", std::to_string(value).c_str()).Data(); - } +class LT : public Cut +{ +private: + T value; + +public: + LT(T val) : value{val} + { + } + + bool Check(T y) + { + return y < value; + } + + std::string ToString() + { + return TString::Format("(x < %s)", std::to_string(value).c_str()).Data(); + } }; template -class GT : public Cut { - private: - T value; - - public: - GT(T val) : value{val} {} - - bool Check(T y) { - return y > value; - } - - std::string ToString() { - return TString::Format("(x > %s)", std::to_string(value).c_str()).Data(); - } +class GT : public Cut +{ +private: + T value; + +public: + GT(T val) : value{val} {} + + bool Check(T y) + { + return y > value; + } + + std::string ToString() + { + return TString::Format("(x > %s)", std::to_string(value).c_str()).Data(); + } }; template -class EQ : public Cut { - private: - T value; - - public: - EQ(T val) : value{val} {} - - bool Check(T y) { - return y == value; - } - - std::string ToString() { - return TString::Format("(x == %s)", std::to_string(value).c_str()).Data(); - } +class EQ : public Cut +{ +private: + T value; + +public: + EQ(T val) : value{val} {} + + bool Check(T y) + { + return y == value; + } + + std::string ToString() + { + return TString::Format("(x == %s)", std::to_string(value).c_str()).Data(); + } }; template -class BT : public Cut { - private: - T low; - T up; - - public: - BT(T lower, T upper) : low{lower}, up{upper} {} +class BT : public Cut +{ +private: + T low; + T up; + +public: + BT(T lower, T upper) : low{lower}, up{upper} {} + + bool Check(T y) + { + return low < y && y < up; + } + + std::string ToString() + { + return TString::Format("(x in [%s, %s])", std::to_string(low).c_str(), std::to_string(up).c_str()).Data(); + } +}; - bool Check(T y) { - return low < y && y < up; +template +class Variable +{ +private: + const char *name; + std::vector *> cuts; + + T value; + +public: + Variable() + { + } + + Variable(const char *name, std::vector *> cuts) + { + this->name = name; + this->cuts = cuts; + } + + T *GetValuePtr() + { + return &value; + } + + T GetValue() const + { + return value; + } + + bool CheckCuts() const + { + for (int i = 0; i < cuts.size(); i++) + { + if (!cuts[i]->Check(value)) + { + return false; + } } + return true; + } +}; - std::string ToString() { - return TString::Format("(x in [%s, %s])", std::to_string(low).c_str(), std::to_string(up).c_str()).Data(); +class VariableCollection +{ +private: + std::map> doubles; + std::map> floats; + std::map> ints; + std::map> bools; + std::vector> trigger_cuts; + + TLorentzVector ComputeFourMomentum(const char *name, bool do_mass_sub, double subbed_mass) + { + std::string pxname = TString::Format("%s_PX", name).Data(); + std::string pyname = TString::Format("%s_PY", name).Data(); + std::string pzname = TString::Format("%s_PZ", name).Data(); + std::string ename = TString::Format("%s_ENERGY", name).Data(); + + auto itx = floats.find(pxname); + if (itx == floats.end()) + { + return TLorentzVector{}; } -}; -template -class Variable { - private: - const char* name; - std::vector*> cuts; + auto ity = floats.find(pyname); + if (ity == floats.end()) + { + return TLorentzVector{}; + } - T value; + auto itz = floats.find(pzname); + if (itz == floats.end()) + { + return TLorentzVector{}; + } - public: + TVector3 momentum(itx->second.GetValue(), ity->second.GetValue(), itz->second.GetValue()); + double energy = 0; - Variable() { + if (do_mass_sub) + { + energy = TMath::Sqrt(TMath::Sq(subbed_mass) + momentum.Mag2()); + } + else + { + auto ite = floats.find(ename); + if (ite == floats.end()) + { + return TLorentzVector{}; + } + energy = ite->second.GetValue(); } - Variable(const char* name, std::vector*> cuts) { - this->name = name; - this->cuts = cuts; + return TLorentzVector(momentum, energy); + } + +public: + VariableCollection() + { + doubles = std::map>{}; + floats = std::map>{}; + ints = std::map>{}; + bools = std::map>{}; + trigger_cuts = std::vector>{}; + } + + void Connect(TChain *chain) + { + for (auto &[key, var] : doubles) + { + chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); } - T* GetValuePtr() { - return &value; + for (auto &[key, var] : floats) + { + chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); } - T GetValue() const { - return value; + for (auto &[key, var] : ints) + { + chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); } -}; -class VariableCollection { - private: - std::map> doubles; - std::map> floats; - std::map> ints; - std::map> bools; + for (auto &[key, var] : bools) + { + chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); + } + } + + void AddDouble(const char *name, const std::vector *> &cuts) + { + doubles[name] = Variable(name, cuts); + } + + void AddFloat(const char *name, const std::vector *> &cuts) + { + floats[name] = Variable(name, cuts); + } + + void AddInt(const char *name, const std::vector *> &cuts) + { + ints[name] = Variable(name, cuts); + } + + void AddBool(const char *name, const std::vector *> &cuts) + { + bools[name] = Variable(name, cuts); + } + + void AddTriggerCut(const std::vector &triggers) + { + trigger_cuts.push_back(triggers); + } + + void AddFourMomentumFor(const char *name) + { + std::string pxname = TString::Format("%s_PX", name).Data(); + std::string pyname = TString::Format("%s_PY", name).Data(); + std::string pzname = TString::Format("%s_PZ", name).Data(); + std::string ename = TString::Format("%s_ENERGY", name).Data(); + + floats[pxname] = Variable(pxname.c_str(), {}); + floats[pyname] = Variable(pyname.c_str(), {}); + floats[pzname] = Variable(pzname.c_str(), {}); + floats[ename] = Variable(ename.c_str(), {}); + } + + Double_t GetDouble(const char *name) const + { + auto it = doubles.find(name); + if (it != doubles.end()) + { + return it->second.GetValue(); + } + return 0; + } + + Float_t GetFloat(const char *name) const + { + auto it = floats.find(name); + if (it != floats.end()) + { + return it->second.GetValue(); + } + return 0; + } + + Int_t GetInt(const char *name) const + { + auto it = ints.find(name); + if (it != ints.end()) + { + return it->second.GetValue(); + } + return 0; + } + + Bool_t GetBool(const char *name) const + { + auto it = bools.find(name); + if (it != bools.end()) + { + return it->second.GetValue(); + } + return 0; + } + + TLorentzVector GetFourMomentum(const char *name) + { + return ComputeFourMomentum(name, false, 0.); + } + + TLorentzVector GetFourMomentumWithMassSub(const char *name, double subbed_mass) + { + return ComputeFourMomentum(name, true, subbed_mass); + } + + bool CheckCuts() const + { + for (const auto &[key, var] : doubles) + { + if (!var.CheckCuts()) + { + return false; + } + } - public: - VariableCollection() { - doubles = std::map>{}; - floats = std::map>{}; - ints = std::map>{}; - bools = std::map>{}; + for (const auto &[key, var] : floats) + { + if (!var.CheckCuts()) + { + return false; + } } - void Connect(TChain *chain) { - for (auto& [key, var] : doubles) { - chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); + for (const auto &[key, var] : ints) + { + if (!var.CheckCuts()) + { + return false; } + } - for (auto& [key, var] : floats) { - chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); + for (const auto &[key, var] : bools) + { + if (!var.CheckCuts()) + { + return false; } + } - for (auto& [key, var] : ints) { - chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); + for (const auto &triggers : trigger_cuts) + { + bool cut_okay = false; + for (const auto &trigger : triggers) + { + cut_okay = cut_okay | this->GetBool(trigger.c_str()); } - for (auto& [key, var] : bools) { - chain->SetBranchAddress(key.c_str(), var.GetValuePtr()); + if (!cut_okay) + { + return false; } } - void AddDouble(const char* name, const std::vector*>& cuts) { - doubles[name] = Variable(name, cuts); - } + return true; + } - void AddFloat(const char* name, const std::vector*>& cuts) { - floats[name] = Variable(name, cuts); + void PrintValues() const + { + for (const auto &[key, var] : doubles) + { + std::cout << key << ": " << var.GetValue() << std::endl; } - void AddInt(const char* name, const std::vector*>& cuts) { - ints[name] = Variable(name, cuts); + for (const auto &[key, var] : floats) + { + std::cout << key << ": " << var.GetValue() << std::endl; } - void AddBool(const char* name, const std::vector*>& cuts) { - bools[name] = Variable(name, cuts); + for (const auto &[key, var] : ints) + { + std::cout << key << ": " << var.GetValue() << std::endl; } - void PrintValues() { - for (const auto& [key, var] : doubles) { - std::cout << key << ": " << var.GetValue() << std::endl; - } - - for (const auto& [key, var] : floats) { - std::cout << key << ": " << var.GetValue() << std::endl; - } - - for (const auto& [key, var] : ints) { - std::cout << key << ": " << var.GetValue() << std::endl; - } - - for (const auto& [key, var] : bools) { - std::cout << key << ": " << var.GetValue() << std::endl; - } + for (const auto &[key, var] : bools) + { + std::cout << key << ": " << var.GetValue() << std::endl; } + } }; -int do_all() { +int do_all() +{ - VariableCollection col{}; - col.AddDouble("B_M", {}); - col.AddDouble("Jpsi_M", {}); - col.AddFloat("Kplus_PT", {}); - col.AddBool("muminus_ISMUON", {}); - col.AddInt("muplus_Q", {}); + TChain *data_chain = new TChain("BuToHpMuMu/DecayTree"); + data_chain->Add("/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/spruce_magdown_2023_v0r1_tuple_90000000_2023_v0r0p6288631.root"); + data_chain->Add("/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/spruce_magdown_2023_v0_tuple_90000000_v0r0p6288631.root"); - TChain *data_chain = new TChain(TString::Format("%s/DecayTree", "Hlt2RD_BuToKpMuMu").Data()); - data_chain->Add("/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/Collision23_Beam6800GeV-VeloClosed-MagDown-Excl-UT_RealData_SprucingPass23r1_94000000_RD.root"); + VariableCollection col{}; + col.AddFloat("B_BPVFDCHI2", {new GT(36.)}); + col.AddDouble("B_CHI2VXNDOF", {new LT(16.)}); + col.AddFloat("B_BPVIPCHI2", {new LT(25.)}); + col.AddDouble("Jpsi_MAXDOCACHI2", {new LT(36.)}); + col.AddFloat("L1_BPVIPCHI2", {new GT(9.)}); + col.AddFloat("L2_BPVIPCHI2", {new GT(9.)}); + col.AddDouble("L1_PID_MU", {new GT(-3.)}); + col.AddDouble("L2_PID_MU", {new GT(-3.)}); + col.AddBool("L1_ISMUON", {new EQ(true)}); + col.AddBool("L2_ISMUON", {new EQ(true)}); + col.AddFloat("L1_PT", {new GT(350.)}); + col.AddFloat("L2_PT", {new GT(350.)}); + col.AddDouble("Jpsi_CHI2DOF", {new LT(9.)}); + col.AddFloat("Jpsi_BPVFDCHI2", {new GT(16.)}); + col.AddDouble("Jpsi_M", {new LT(5500.), new BT(3096.9 - 100., 3096.9 + 100.)}); + col.AddFloat("Hp_PT", {new GT(400.)}); + col.AddFloat("Hp_BPVIPCHI2", {new GT(6.)}); + col.AddFloat("Hp_P", {new GT(2000.)}); + col.AddDouble("Hp_PID_K", {new GT(-4.)}); + col.AddBool("Hlt2_InclDetDiMuon_4BodyDecision", {}); + col.AddBool("Hlt2_InclDetDiMuon_3BodyDecision", {}); + col.AddBool("Hlt2_InclDetDiMuonDecision", {}); + col.AddBool("Hlt2RD_BuToKpMuMuDecision", {}); + col.AddBool("Hlt1TrackMVADecision", {}); + col.AddBool("Hlt1TwoTrackMVADecision", {}); + col.AddFourMomentumFor("L1"); + col.AddFourMomentumFor("L2"); + col.AddFourMomentumFor("Hp"); + + col.AddTriggerCut({"Hlt2_InclDetDiMuonDecision", "Hlt2_InclDetDiMuon_3BodyDecision", "Hlt2_InclDetDiMuon_4BodyDecision"}); + col.AddTriggerCut({"Hlt1TrackMVADecision", "Hlt1TwoTrackMVADecision"}); + col.AddTriggerCut({"Hlt2RD_BuToKpMuMuDecision"}); col.Connect(data_chain); - data_chain->GetEntry(1); + const Double_t MASS_HIST_MIN = 5100.; + const Double_t MASS_HIST_MAX = 6000.; + const int N_BINS = 70; + TH1D *h1_B_M = new TH1D("h1_B_M", "B Mass", N_BINS, MASS_HIST_MIN, MASS_HIST_MAX); + + unsigned int entries = data_chain->GetEntries(); + for (unsigned int i = 0; i < entries; i++) + { + data_chain->GetEntry(i); - col.PrintValues(); + if (col.CheckCuts()) + { + auto l1_4v = col.GetFourMomentum("L1"); + auto l2_4v = col.GetFourMomentum("L2"); + auto K_4v = col.GetFourMomentumWithMassSub("Hp", 493.677); - data_chain->GetEntry(2); + h1_B_M->Fill((l1_4v + l2_4v + K_4v).M()); + } + + if ((i + 1) % 10000 == 0 || i + 1 == entries) + { + std::cout << "[" + << "BuToHpMuMu" + << "] Processed event: " << i + 1 << " (" << TString::Format("%.2f", ((double)(i + 1) / (double)entries) * 100.) << "%)" << std::endl; + } + } - col.PrintValues(); + TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 800, 600); + h1_B_M->Draw(); + c1->Draw(); return 0; } \ No newline at end of file diff --git a/analysis_fullstream_b02hphmmumu.cpp b/old_analysis_macros/analysis_fullstream_b02hphmmumu.cpp similarity index 98% rename from analysis_fullstream_b02hphmmumu.cpp rename to old_analysis_macros/analysis_fullstream_b02hphmmumu.cpp index 9ca0418..c269fd8 100644 --- a/analysis_fullstream_b02hphmmumu.cpp +++ b/old_analysis_macros/analysis_fullstream_b02hphmmumu.cpp @@ -40,8 +40,8 @@ const Double_t MASS_HIST_MAX = 5700.; const Double_t MASS_HIST_FIT_MIN = 5100.; const Double_t MASS_HIST_FIT_MAX = 5700.; -const char* TITLE = "SpruceRD_B0ToHpHmMuMu (#pi^{+} #rightarrow K^{+})"; -const char* FILE_NAME = "SpruceRD_B0ToHpHmMuMu_Pip2Kp"; +const char* TITLE = "SpruceRD_B0ToHpHmMuMu (#pi^{+} #rightarrow K^{+}, w/o excl Hlt2 decision cut)"; +const char* FILE_NAME = "SpruceRD_B0ToHpHmMuMu_Pip2Kp_wohlt2cut"; const char* MASS_LITERAL = "m(#pi^{+}_{(#rightarrow K^{+})}#pi^{-}#mu^{+}#mu^{-})"; const Double_t K_MASS = 493.677; @@ -203,7 +203,7 @@ int analysis_fullstream_b02hphmmumu() (Hp_BPVIPCHI2 > 6) & (Hp_PT > 250) & (Hp_P > 2000) & (Hp_PID_K > 0) ) & // - (Hlt2RD_B0ToKpPimMuMuDecision) & ((Hlt2_InclDetDiMuon_4BodyDecision) | (Hlt2_InclDetDiMuon_3BodyDecision) | (Hlt2_InclDetDiMuonDecision))) + /*(Hlt2RD_B0ToKpPimMuMuDecision) &*/ ((Hlt2_InclDetDiMuon_4BodyDecision) | (Hlt2_InclDetDiMuon_3BodyDecision) | (Hlt2_InclDetDiMuonDecision))) { if ((TMath::Abs(Jpsi_M - 3096.9) < 100) & ((Hlt1TrackMVADecision) | (Hlt1TwoTrackMVADecision))) { diff --git a/analysis_fullstream_bu2hpmumu.cpp b/old_analysis_macros/analysis_fullstream_bu2hpmumu.cpp similarity index 85% rename from analysis_fullstream_bu2hpmumu.cpp rename to old_analysis_macros/analysis_fullstream_bu2hpmumu.cpp index e85e4ec..a460fa4 100644 --- a/analysis_fullstream_bu2hpmumu.cpp +++ b/old_analysis_macros/analysis_fullstream_bu2hpmumu.cpp @@ -43,8 +43,8 @@ const Double_t K_MASS = 493.677; void CreateRooFitAndDraw(TH1D *hist, int fitting_entries); -const char *TITLE = "SpruceRD_BuToHpMuMu (#pi^{+} #rightarrow K^{+}, Small Cuts 2)"; -const char *FILE_NAME = "SpruceRD_BuToHpMuMu_Pip2Kp_small2"; +const char *TITLE = "SpruceRD_BuToHpMuMu (#pi^{+} #rightarrow K^{+}, w/o excl Hlt2 decision cut)"; +const char *FILE_NAME = "SpruceRD_BuToHpMuMu_Pip2Kp_wohlt2cut"; const char *MASS_LITERAL = "m(#pi^{+}_{(#rightarrow K^{+})}#mu^{+}#mu^{-})"; int analysis_fullstream_bu2hpmumu() @@ -145,22 +145,19 @@ int analysis_fullstream_bu2hpmumu() TLorentzVector l2_4v(L2_PX, L2_PY, L2_PZ, L2_ENERGY); Double_t reconstructed_B_Mass = (K_4v + l1_4v + l2_4v).M(); - - if ((TMath::Abs(Jpsi_M - 3096.9) < 100) & ((Hlt1TrackMVADecision == 1) | (Hlt1TwoTrackMVADecision == 1))) + if ((((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 == 1) & (L2_ISMUON == 1) & (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 == 1)*/ & (((Hlt2_InclDetDiMuon_4BodyDecision == 1) | (Hlt2_InclDetDiMuon_3BodyDecision == 1) | (Hlt2_InclDetDiMuonDecision == 1))))) { - h1_B_M->Fill(reconstructed_B_Mass); - - if (MASS_HIST_FIT_MIN <= reconstructed_B_Mass && reconstructed_B_Mass <= MASS_HIST_FIT_MAX) + if ((TMath::Abs(Jpsi_M - 3096.9) < 100) & ((Hlt1TrackMVADecision == 1) | (Hlt1TwoTrackMVADecision == 1))) { - fitting_entries++; + h1_B_M->Fill(reconstructed_B_Mass); + + if (MASS_HIST_FIT_MIN <= reconstructed_B_Mass && reconstructed_B_Mass <= MASS_HIST_FIT_MAX) + { + fitting_entries++; + } } } - // if ((((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 == 1) & (L2_ISMUON == 1) & (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 == 1) & (((Hlt2_InclDetDiMuon_4BodyDecision == 1) | (Hlt2_InclDetDiMuon_3BodyDecision == 1) | (Hlt2_InclDetDiMuonDecision == 1))))) - // { - - // } - if (i % 10000 == 0) { std::cout << "[" @@ -190,7 +187,6 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) roohist_B_M.plotOn(roo_frame_mass, RooFit::Binning(nBins), RooFit::Name("B Mass Distribution")); roo_frame_mass->GetXaxis()->SetTitle(MASS_LITERAL); - // Crystal Ball for Signal RooRealVar var_mass_x0("var_mass_x0", "#mu", 5278., 5170., 5500.); RooRealVar var_mass_sigmaLR("var_mass_sigmaLR", "#sigma_{LR}", 16., 5., 40.); @@ -202,10 +198,10 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) // RooRealVar var_mass_alphaR("var_mass_alphaR", "#alpha_{R}", 2., 0., 4.); // RooRealVar var_mass_nR("var_mass_nR", "n_{R}", 5., 0., 15.); - auto var_mass_alphaL = RooRealConstant::value(1.309); - auto var_mass_nL = RooRealConstant::value(0.72); - auto var_mass_alphaR = RooRealConstant::value(1.226); - auto var_mass_nR = RooRealConstant::value(0.992); + auto var_mass_alphaL = RooRealConstant::value(1.894); + auto var_mass_nL = RooRealConstant::value(1.120); + auto var_mass_alphaR = RooRealConstant::value(2.446); + auto var_mass_nR = RooRealConstant::value(1.146); RooCrystalBall sig_cb("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); @@ -221,10 +217,10 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) RooFitResult *fitres = sigplusbkg.fitTo(roohist_B_M, RooFit::Save(), RooFit::PrintLevel(1), RooFit::Range("fitting_range")); - sigplusbkg.plotOn(roo_frame_mass, RooFit::VisualizeError(*fitres, 1), RooFit::FillColor(kOrange + 1), RooFit::FillStyle(3144)); + // sigplusbkg.plotOn(roo_frame_mass, RooFit::VisualizeError(*fitres, 1), RooFit::FillColor(kOrange + 1), RooFit::FillStyle(3144)); sigplusbkg.plotOn(roo_frame_mass, RooFit::LineColor(kRed), RooFit::LineStyle(kSolid), RooFit::Range("fitting_range"), RooFit::Name("sigplusbkg")); - 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")); - 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")); + 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")); + 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")); TCanvas *c = new TCanvas("roofit_c", "roofit_c", 0, 0, 800, 600); diff --git a/analysis_fullstream_michele.cpp b/old_analysis_macros/analysis_fullstream_michele.cpp similarity index 100% rename from analysis_fullstream_michele.cpp rename to old_analysis_macros/analysis_fullstream_michele.cpp diff --git a/analysis_turbo.cpp b/old_analysis_macros/analysis_turbo.cpp similarity index 79% rename from analysis_turbo.cpp rename to old_analysis_macros/analysis_turbo.cpp index 482186d..72179dc 100644 --- a/analysis_turbo.cpp +++ b/old_analysis_macros/analysis_turbo.cpp @@ -34,22 +34,30 @@ const int nBins = 70; -const Double_t MASS_HIST_MIN = 5100.; +const Double_t MASS_HIST_MIN = 5150.; const Double_t MASS_HIST_MAX = 6000.; -const char *B0_DECAY = "Hlt2RD_B0ToKpPimMuMu"; -const char *Bu_DECAY = "Hlt2RD_BuToKpMuMu"; - -const char *TITLE = B0_DECAY; -const char *X_AXIS = "m(K^{+}#pi^{-}#mu^{+}#mu^{-})"; - +const char *B0_DECAY = "Hlt2RD_B0ToKpPimMuMu_woHtl1cut"; +const char *Bu_DECAY = "Hlt2RD_BuToKpMuMu_woHtl1cut"; +const char *TITLE = Bu_DECAY; +const char *HIST_TITLE = "Hlt2RD_BuToKpMuMu w/o Hlt1 Decision Cut"; +const char *X_AXIS = "m(K^{+}#mu^{+}#mu^{-})"; void CreateRooFitAndDraw(TH1D *hist, int fitting_entries); int analysis_turbo() { - TChain *data_chain = new TChain(TString::Format("%s/DecayTree", TITLE).Data()); + std::string tree = ""; + if (TITLE == B0_DECAY) + { + tree = "Hlt2RD_B0ToKpPimMuMu"; + } + else + { + tree = "Hlt2RD_BuToKpMuMu"; + } + TChain *data_chain = new TChain(TString::Format("%s/DecayTree", tree.c_str()).Data()); data_chain->Add("/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/Collision23_Beam6800GeV-VeloClosed-MagDown-Excl-UT_RealData_SprucingPass23r1_94000000_RD.root"); Double_t B_M, Jpsi_M, B0_M, Kst_M; @@ -72,7 +80,7 @@ int analysis_turbo() data_chain->SetBranchAddress("Hlt1TwoTrackMVADecision", &Hlt1TwoTrackMVADecision); } - TH1D *h1_B_M = new TH1D("h1_B_M", TITLE, nBins, MASS_HIST_MIN, MASS_HIST_MAX); + TH1D *h1_B_M = new TH1D("h1_B_M", HIST_TITLE, nBins, MASS_HIST_MIN, MASS_HIST_MAX); h1_B_M->GetXaxis()->SetTitle(X_AXIS); int fitting_entries = 0; @@ -83,7 +91,7 @@ int analysis_turbo() if (TITLE == B0_DECAY) { - if ((TMath::Abs(Jpsi_M - 3096.9) < 100) && (B0_M > 4500) && (B0_M < 6000) && (TMath::Abs(Kst_M - 895.55) < 50) && ((Hlt1TrackMVADecision) || (Hlt1TwoTrackMVADecision))) + if ((TMath::Abs(Jpsi_M - 3096.9) < 100) && (B0_M > 4500) && (B0_M < 6000) && (TMath::Abs(Kst_M - 895.55) < 50) /*&& ((Hlt1TrackMVADecision) || (Hlt1TwoTrackMVADecision))*/) { h1_B_M->Fill(B0_M); if (MASS_HIST_MIN <= B0_M && B0_M <= MASS_HIST_MAX) @@ -94,7 +102,7 @@ int analysis_turbo() } else { - if ((TMath::Abs(Jpsi_M - 3096.9) < 100.) && (B_M > 4500.) && (B_M < 6000.) && ((Hlt1TrackMVADecision) || (Hlt1TwoTrackMVADecision))) + if ((TMath::Abs(Jpsi_M - 3096.9) < 100.) && (B_M > 4500.) && (B_M < 6000.) /*&& ((Hlt1TrackMVADecision) || (Hlt1TwoTrackMVADecision))*/) { h1_B_M->Fill(B_M); if (MASS_HIST_MIN <= B_M && B_M <= MASS_HIST_MAX) @@ -113,8 +121,8 @@ int analysis_turbo() } std::cout << "[" - << TITLE - << "] Processed event: " << entries << " (" << TString::Format("%.2f", 100.) << "%)" << std::endl; + << TITLE + << "] Processed event: " << entries << " (" << TString::Format("%.2f", 100.) << "%)" << std::endl; TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 800, 600); h1_B_M->Draw(); @@ -133,7 +141,7 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) RooDataHist roohist_B_M("roohist_B_M", "B Mass Histogram", roo_var_mass, RooFit::Import(*hist)); - RooPlot *roo_frame_mass = roo_var_mass.frame(RooFit::Title(TITLE)); + RooPlot *roo_frame_mass = roo_var_mass.frame(RooFit::Title(HIST_TITLE)); roohist_B_M.plotOn(roo_frame_mass, RooFit::Binning(nBins), RooFit::Name("B Mass Distribution")); roo_frame_mass->GetXaxis()->SetTitle(X_AXIS); @@ -148,10 +156,17 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) // RooRealVar var_mass_alphaR("var_mass_alphaR", "#alpha_{R}", 2., 0., 4.); // RooRealVar var_mass_nR("var_mass_nR", "n_{R}", 5., 0., 15.); - auto var_mass_alphaL = RooRealConstant::value(1.948); - auto var_mass_nL = RooRealConstant::value(0.618); - auto var_mass_alphaR = RooRealConstant::value(2.320); - auto var_mass_nR = RooRealConstant::value(0.473); + // B+/- + auto var_mass_alphaL = RooRealConstant::value(1.912); + auto var_mass_nL = RooRealConstant::value(1.125); + auto var_mass_alphaR = RooRealConstant::value(2.447); + auto var_mass_nR = RooRealConstant::value(1.491); + + // B0 + // auto var_mass_alphaL = RooRealConstant::value(1.948); + // auto var_mass_nL = RooRealConstant::value(0.618); + // auto var_mass_alphaR = RooRealConstant::value(2.320); + // auto var_mass_nR = RooRealConstant::value(0.473); RooCrystalBall sig_cb("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); @@ -167,10 +182,10 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) RooFitResult *fitres = sigplusbkg.fitTo(roohist_B_M, RooFit::Save(), RooFit::PrintLevel(1), RooFit::Range("fitting_range")); - sigplusbkg.plotOn(roo_frame_mass, RooFit::VisualizeError(*fitres, 1), RooFit::FillColor(kOrange + 1), RooFit::FillStyle(3144)); + sigplusbkg.plotOn(roo_frame_mass, RooFit::VisualizeError(*fitres, 1), RooFit::FillColor(kYellow -7), RooFit::FillStyle(3144)); sigplusbkg.plotOn(roo_frame_mass, RooFit::LineColor(kRed), RooFit::LineStyle(kSolid), RooFit::Range("fitting_range"), RooFit::Name("sigplusbkg")); - 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")); - 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")); + 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")); + 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")); TCanvas *c = new TCanvas("roofit_c", "roofit_c", 0, 0, 800, 600); diff --git a/general_cuts.cpp b/old_analysis_macros/general_cuts.cpp similarity index 100% rename from general_cuts.cpp rename to old_analysis_macros/general_cuts.cpp diff --git a/inspect_tree.cpp b/old_analysis_macros/inspect_tree.cpp similarity index 100% rename from inspect_tree.cpp rename to old_analysis_macros/inspect_tree.cpp diff --git a/pre_selection_cuts.cpp b/old_analysis_macros/pre_selection_cuts.cpp similarity index 100% rename from pre_selection_cuts.cpp rename to old_analysis_macros/pre_selection_cuts.cpp diff --git a/simulation.cpp b/old_analysis_macros/simulation.cpp similarity index 100% rename from simulation.cpp rename to old_analysis_macros/simulation.cpp diff --git a/simulation_fullstream_B02KpPimMuMu.cpp b/old_analysis_macros/simulation_fullstream_B02KpPimMuMu.cpp similarity index 98% rename from simulation_fullstream_B02KpPimMuMu.cpp rename to old_analysis_macros/simulation_fullstream_B02KpPimMuMu.cpp index 8688b38..f47885f 100644 --- a/simulation_fullstream_B02KpPimMuMu.cpp +++ b/old_analysis_macros/simulation_fullstream_B02KpPimMuMu.cpp @@ -44,7 +44,7 @@ const int PID_KAON = 321; const int PID_PION = 211; const int PID_MUON = 13; -const char *NAME = "B0ToHpHmMuMu_Fullstream"; +const char *NAME = "B0ToHpHmMuMu_Fullstream_wobkgcat"; const char *X_AXIS = "m(#pi^{+}_{#rightarrow K^{+}}#pi^{-}#mu^{+}#mu^{-})"; const bool USE_HYP_REPLACE = false; const char *B_NAME = "B0"; @@ -120,7 +120,7 @@ int simulation_fullstream_B02KpPimMuMu() Double_t reconstructed_B_Mass = 0; - if (TMath::Abs(L1_TRUEID) == PID_MUON && L2_TRUEID == -L1_TRUEID) + if (B_BKGCAT == 30 && TMath::Abs(L1_TRUEID) == PID_MUON && L2_TRUEID == -L1_TRUEID) { if (TMath::Abs(Hp_TRUEID) == PID_KAON && TMath::Abs(Hm_TRUEID) == PID_PION) { diff --git a/simulation_fullstream_Bu2KpMuMu.cpp b/old_analysis_macros/simulation_fullstream_Bu2KpMuMu.cpp similarity index 100% rename from simulation_fullstream_Bu2KpMuMu.cpp rename to old_analysis_macros/simulation_fullstream_Bu2KpMuMu.cpp diff --git a/status_report_plots.cpp b/old_analysis_macros/status_report_plots.cpp similarity index 100% rename from status_report_plots.cpp rename to old_analysis_macros/status_report_plots.cpp diff --git a/subs_mass.cpp b/old_analysis_macros/subs_mass.cpp similarity index 100% rename from subs_mass.cpp rename to old_analysis_macros/subs_mass.cpp diff --git a/train_bdt.cpp b/old_analysis_macros/train_bdt.cpp similarity index 100% rename from train_bdt.cpp rename to old_analysis_macros/train_bdt.cpp