|
@ -40,13 +40,76 @@ const Double_t MASS_HIST_FIT_MIN = 5100.; |
|
|
const Double_t MASS_HIST_FIT_MAX = 6000.; |
|
|
const Double_t MASS_HIST_FIT_MAX = 6000.; |
|
|
|
|
|
|
|
|
const Double_t K_MASS = 493.677; |
|
|
const Double_t K_MASS = 493.677; |
|
|
|
|
|
const Double_t PSI2S_MASS = 3686.093; |
|
|
|
|
|
const Double_t JPSI_MASS = 3096.900; |
|
|
|
|
|
const Double_t KSTAR_MASS = 891.760; |
|
|
|
|
|
|
|
|
void CreateRooFitAndDraw(TH1D *hist, int fitting_entries); |
|
|
|
|
|
|
|
|
void CreateRooFitAndDraw(TH1D *hist, const char *name); |
|
|
|
|
|
|
|
|
const char *TITLE = "SpruceRD_BuToHpMuMu (#pi^{+} #rightarrow K^{+}, w/o excl Hlt2 decision cut)"; |
|
|
const char *TITLE = "SpruceRD_BuToHpMuMu (#pi^{+} #rightarrow K^{+}, w/o excl Hlt2 decision cut)"; |
|
|
const char *FILE_NAME = "SpruceRD_BuToHpMuMu_Pip2Kp_wohlt2cut"; |
|
|
const char *FILE_NAME = "SpruceRD_BuToHpMuMu_Pip2Kp_wohlt2cut"; |
|
|
const char *MASS_LITERAL = "m(#pi^{+}_{(#rightarrow K^{+})}#mu^{+}#mu^{-})"; |
|
|
const char *MASS_LITERAL = "m(#pi^{+}_{(#rightarrow K^{+})}#mu^{+}#mu^{-})"; |
|
|
|
|
|
|
|
|
|
|
|
struct Hlt1Decision |
|
|
|
|
|
{ |
|
|
|
|
|
std::string name; |
|
|
|
|
|
int index; |
|
|
|
|
|
int flag; |
|
|
|
|
|
Bool_t value; |
|
|
|
|
|
|
|
|
|
|
|
std::string GetName() const |
|
|
|
|
|
{ |
|
|
|
|
|
return TString::Format("Hlt1%sDecision", name.c_str()).Data(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Bool_t *GetValuePointer() |
|
|
|
|
|
{ |
|
|
|
|
|
return &value; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const int FLAG_TrackMVA = 0b0000100000000000; |
|
|
|
|
|
const int FLAG_TwoTrackMVA = 0b0001000000000000; |
|
|
|
|
|
std::vector<Hlt1Decision> Hlt1Decisions{ |
|
|
|
|
|
Hlt1Decision{"DiMuonHighMass", 1, 0b0000000000000001}, // 0001
|
|
|
|
|
|
Hlt1Decision{"DiMuonLowMass", 2, 0b0000000000000010}, // 0002
|
|
|
|
|
|
Hlt1Decision{"DiMuonNoIP", 3, 0b0000000000000100}, // 0004
|
|
|
|
|
|
Hlt1Decision{"DiMuonSoft", 4, 0b0000000000001000}, // 0008
|
|
|
|
|
|
Hlt1Decision{"DisplacedLeptons", 5, 0b0000000000010000}, // 0016
|
|
|
|
|
|
Hlt1Decision{"LowPtDiMuon", 6, 0b0000000000100000}, // 0032
|
|
|
|
|
|
Hlt1Decision{"LowPtMuon", 7, 0b0000000001000000}, // 0064
|
|
|
|
|
|
Hlt1Decision{"OneMuonTrackLine", 8, 0b0000000010000000}, // 0128
|
|
|
|
|
|
Hlt1Decision{"SingleHighEt", 9, 0b0000000100000000}, // 0256
|
|
|
|
|
|
Hlt1Decision{"SingleHighPtMuon", 10, 0b0000001000000000}, // 0512
|
|
|
|
|
|
Hlt1Decision{"TrackMVA", 11, FLAG_TrackMVA}, // 1024
|
|
|
|
|
|
Hlt1Decision{"TrackMuonMVA", 12, 0b0000100000000000}, // 2048
|
|
|
|
|
|
Hlt1Decision{"TwoTrackMVA", 13, FLAG_TwoTrackMVA}, // 4096
|
|
|
|
|
|
}; |
|
|
|
|
|
// 0b0001000000000000
|
|
|
|
|
|
// 0b0001000000110111
|
|
|
|
|
|
|
|
|
|
|
|
void ConnectHlt1Decisions(TChain *chain) |
|
|
|
|
|
{ |
|
|
|
|
|
for (auto &var : Hlt1Decisions) |
|
|
|
|
|
{ |
|
|
|
|
|
chain->SetBranchAddress(var.GetName().c_str(), var.GetValuePointer()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int CombineHlt1DecisionFlags() |
|
|
|
|
|
{ |
|
|
|
|
|
int result = 0; |
|
|
|
|
|
for (const auto &var : Hlt1Decisions) |
|
|
|
|
|
{ |
|
|
|
|
|
if (var.value) |
|
|
|
|
|
{ |
|
|
|
|
|
result = result | var.flag; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int analysis_fullstream_bu2hpmumu() |
|
|
int analysis_fullstream_bu2hpmumu() |
|
|
{ |
|
|
{ |
|
|
TChain *data_chain = new TChain("BuToHpMuMu/DecayTree"); |
|
|
TChain *data_chain = new TChain("BuToHpMuMu/DecayTree"); |
|
@ -113,8 +176,8 @@ int analysis_fullstream_bu2hpmumu() |
|
|
data_chain->SetBranchAddress("Hlt2_InclDetDiMuon_4BodyDecision", &Hlt2_InclDetDiMuon_4BodyDecision); |
|
|
data_chain->SetBranchAddress("Hlt2_InclDetDiMuon_4BodyDecision", &Hlt2_InclDetDiMuon_4BodyDecision); |
|
|
data_chain->SetBranchAddress("Hlt2_InclDetDiMuon_3BodyDecision", &Hlt2_InclDetDiMuon_3BodyDecision); |
|
|
data_chain->SetBranchAddress("Hlt2_InclDetDiMuon_3BodyDecision", &Hlt2_InclDetDiMuon_3BodyDecision); |
|
|
data_chain->SetBranchAddress("Hlt2_InclDetDiMuonDecision", &Hlt2_InclDetDiMuonDecision); |
|
|
data_chain->SetBranchAddress("Hlt2_InclDetDiMuonDecision", &Hlt2_InclDetDiMuonDecision); |
|
|
data_chain->SetBranchAddress("Hlt1TrackMVADecision", &Hlt1TrackMVADecision); |
|
|
|
|
|
data_chain->SetBranchAddress("Hlt1TwoTrackMVADecision", &Hlt1TwoTrackMVADecision); |
|
|
|
|
|
|
|
|
// data_chain->SetBranchAddress("Hlt1TrackMVADecision", &Hlt1TrackMVADecision);
|
|
|
|
|
|
// data_chain->SetBranchAddress("Hlt1TwoTrackMVADecision", &Hlt1TwoTrackMVADecision);
|
|
|
|
|
|
|
|
|
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; |
|
|
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; |
|
|
data_chain->SetBranchAddress("L1_PX", &L1_PX); |
|
|
data_chain->SetBranchAddress("L1_PX", &L1_PX); |
|
@ -130,7 +193,17 @@ int analysis_fullstream_bu2hpmumu() |
|
|
data_chain->SetBranchAddress("Hp_PZ", &Hp_PZ); |
|
|
data_chain->SetBranchAddress("Hp_PZ", &Hp_PZ); |
|
|
data_chain->SetBranchAddress("Hp_ENERGY", &Hp_ENERGY); |
|
|
data_chain->SetBranchAddress("Hp_ENERGY", &Hp_ENERGY); |
|
|
|
|
|
|
|
|
TH1D *h1_B_M = new TH1D("h1_B_M", "B Mass", nBins, MASS_HIST_MIN, MASS_HIST_MAX); |
|
|
|
|
|
|
|
|
ConnectHlt1Decisions(data_chain); |
|
|
|
|
|
|
|
|
|
|
|
TH1D *h1_B_M_jpsi = new TH1D("h1_B_M_jpsi", "B Mass, J/#psi Mode", nBins, MASS_HIST_MIN, MASS_HIST_MAX); |
|
|
|
|
|
TH1D *h1_B_M_psi2s = new TH1D("h1_B_M_psi2s", "B Mass, #psi(2S) Mode", nBins, MASS_HIST_MIN, MASS_HIST_MAX); |
|
|
|
|
|
TH2D *h2_Hlt1_flags_B_Mass = new TH2D("h2_Hlt1_flags_B_Mass", "Hlt1 Decision vs B Mass", 50, 5100, 5400, 13, 1., 14.); |
|
|
|
|
|
h2_Hlt1_flags_B_Mass->SetCanExtend(TH1::kYaxis); |
|
|
|
|
|
|
|
|
|
|
|
for (const auto &var : Hlt1Decisions) |
|
|
|
|
|
{ |
|
|
|
|
|
h2_Hlt1_flags_B_Mass->Fill(0., var.name.c_str(), 0.); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
unsigned int entries = data_chain->GetEntries(); |
|
|
unsigned int entries = data_chain->GetEntries(); |
|
|
unsigned int fitting_entries = 0; |
|
|
unsigned int fitting_entries = 0; |
|
@ -145,51 +218,97 @@ int analysis_fullstream_bu2hpmumu() |
|
|
TLorentzVector l2_4v(L2_PX, L2_PY, L2_PZ, L2_ENERGY); |
|
|
TLorentzVector l2_4v(L2_PX, L2_PY, L2_PZ, L2_ENERGY); |
|
|
Double_t reconstructed_B_Mass = (K_4v + l1_4v + l2_4v).M(); |
|
|
Double_t reconstructed_B_Mass = (K_4v + l1_4v + l2_4v).M(); |
|
|
|
|
|
|
|
|
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))))) |
|
|
|
|
|
|
|
|
int combinedFlags = CombineHlt1DecisionFlags(); |
|
|
|
|
|
bool trackMVADec = (((combinedFlags & FLAG_TrackMVA) == FLAG_TrackMVA) | ((combinedFlags & FLAG_TwoTrackMVA) == FLAG_TwoTrackMVA)); |
|
|
|
|
|
if (TMath::Abs(Jpsi_M - JPSI_MASS) < 100 && trackMVADec) |
|
|
{ |
|
|
{ |
|
|
if ((TMath::Abs(Jpsi_M - 3096.9) < 100) & ((Hlt1TrackMVADecision == 1) | (Hlt1TwoTrackMVADecision == 1))) |
|
|
|
|
|
|
|
|
for (const auto &var : Hlt1Decisions) |
|
|
{ |
|
|
{ |
|
|
h1_B_M->Fill(reconstructed_B_Mass); |
|
|
|
|
|
|
|
|
|
|
|
if (MASS_HIST_FIT_MIN <= reconstructed_B_Mass && reconstructed_B_Mass <= MASS_HIST_FIT_MAX) |
|
|
|
|
|
|
|
|
if (var.value) |
|
|
{ |
|
|
{ |
|
|
fitting_entries++; |
|
|
|
|
|
|
|
|
h2_Hlt1_flags_B_Mass->Fill(reconstructed_B_Mass, var.name.c_str(), 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// std::cout << "HLT1 Decision Flags: " << combinedFlags << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
if (trackMVADec) |
|
|
|
|
|
{ |
|
|
|
|
|
if (TMath::Abs(Jpsi_M - JPSI_MASS) < 100) |
|
|
|
|
|
{ |
|
|
|
|
|
h1_B_M_jpsi->Fill(reconstructed_B_Mass); |
|
|
|
|
|
} |
|
|
|
|
|
else if (TMath::Abs(Jpsi_M - PSI2S_MASS) < 100) |
|
|
|
|
|
{ |
|
|
|
|
|
h1_B_M_psi2s->Fill(reconstructed_B_Mass); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 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 ((TMath::Abs(Jpsi_M - 3096.9) < 100) & ((Hlt1TrackMVADecision == 1) | (Hlt1TwoTrackMVADecision == 1)))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// h1_B_M->Fill(reconstructed_B_Mass);
|
|
|
|
|
|
|
|
|
if (i % 10000 == 0) |
|
|
|
|
|
|
|
|
// if (MASS_HIST_FIT_MIN <= reconstructed_B_Mass && reconstructed_B_Mass <= MASS_HIST_FIT_MAX)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// fitting_entries++;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if ((i + 1) % 10000 == 0 || i + 1 == entries) |
|
|
{ |
|
|
{ |
|
|
std::cout << "[" |
|
|
std::cout << "[" |
|
|
<< FILE_NAME |
|
|
<< FILE_NAME |
|
|
<< "] Processed event: " << i << " (" << TString::Format("%.2f", ((double)i / (double)entries) * 100.) << "%)" << std::endl; |
|
|
|
|
|
|
|
|
<< "] Processed event: " << i + 1 << " (" << TString::Format("%.2f", ((double)(i + 1) / (double)entries) * 100.) << "%)" << std::endl; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 800, 600); |
|
|
TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 800, 600); |
|
|
h1_B_M->Draw(); |
|
|
|
|
|
|
|
|
h1_B_M_jpsi->Draw(); |
|
|
c1->Draw(); |
|
|
c1->Draw(); |
|
|
c1->SaveAs(TString::Format("images/root_hist_%s_bmass.pdf", FILE_NAME).Data()); |
|
|
|
|
|
|
|
|
c1->SaveAs(TString::Format("images/root_hist_%s_%s_bmass.pdf", FILE_NAME, "jpsi").Data()); |
|
|
|
|
|
|
|
|
|
|
|
TCanvas *c2 = new TCanvas("c2", "c2", 0, 0, 800, 600); |
|
|
|
|
|
h1_B_M_psi2s->Draw(); |
|
|
|
|
|
c2->Draw(); |
|
|
|
|
|
c2->SaveAs(TString::Format("images/root_hist_%s_%s_bmass.pdf", FILE_NAME, "psi2s").Data()); |
|
|
|
|
|
|
|
|
|
|
|
TCanvas *c3 = new TCanvas("c3", "c3", 0, 0, 800, 600); |
|
|
|
|
|
c3->SetLeftMargin(0.20); |
|
|
|
|
|
h2_Hlt1_flags_B_Mass->SetStats(0); |
|
|
|
|
|
h2_Hlt1_flags_B_Mass->Draw("COLZ"); |
|
|
|
|
|
c3->Draw(); |
|
|
|
|
|
|
|
|
CreateRooFitAndDraw(h1_B_M, fitting_entries); |
|
|
|
|
|
|
|
|
// CreateRooFitAndDraw(h1_B_M_jpsi, "jpsi");
|
|
|
|
|
|
// CreateRooFitAndDraw(h1_B_M_psi2s, "psi2s");
|
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) |
|
|
|
|
|
|
|
|
void CreateRooFitAndDraw(TH1D *hist, const char *name) |
|
|
{ |
|
|
{ |
|
|
RooRealVar roo_var_mass("var_mass", "B Mass Variable", MASS_HIST_FIT_MIN, MASS_HIST_FIT_MAX); |
|
|
|
|
|
|
|
|
auto suffix = [name](const char *text) |
|
|
|
|
|
{ |
|
|
|
|
|
return TString::Format("%s_%s", text, name); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
std::cout << " ###### " << suffix("AABB") << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
RooRealVar roo_var_mass(suffix("var_mass"), "B Mass Variable", MASS_HIST_FIT_MIN, MASS_HIST_FIT_MAX); |
|
|
roo_var_mass.setRange("fitting_range", MASS_HIST_FIT_MIN, MASS_HIST_FIT_MAX); |
|
|
roo_var_mass.setRange("fitting_range", MASS_HIST_FIT_MIN, MASS_HIST_FIT_MAX); |
|
|
|
|
|
|
|
|
RooDataHist roohist_B_M("roohist_B_M", "B Mass Histogram", roo_var_mass, RooFit::Import(*hist)); |
|
|
|
|
|
|
|
|
TString hist_name = suffix("roohist_B_M"); |
|
|
|
|
|
RooDataHist roohist_B_M(hist_name, "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(TITLE)); |
|
|
roohist_B_M.plotOn(roo_frame_mass, RooFit::Binning(nBins), RooFit::Name("B Mass Distribution")); |
|
|
|
|
|
|
|
|
roohist_B_M.plotOn(roo_frame_mass, RooFit::Binning(nBins), RooFit::Name(hist_name)); |
|
|
roo_frame_mass->GetXaxis()->SetTitle(MASS_LITERAL); |
|
|
roo_frame_mass->GetXaxis()->SetTitle(MASS_LITERAL); |
|
|
|
|
|
|
|
|
// Crystal Ball for Signal
|
|
|
// 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.); |
|
|
|
|
|
|
|
|
RooRealVar var_mass_x0(suffix("var_mass_x0"), "#mu", 5278., 5170., 5500.); |
|
|
|
|
|
RooRealVar var_mass_sigmaLR(suffix("var_mass_sigmaLR"), "#sigma_{LR}", 16., 5., 40.); |
|
|
|
|
|
|
|
|
// Same Variables for Left and Right Tail
|
|
|
// Same Variables for Left and Right Tail
|
|
|
// RooRealVar var_mass_alphaL("var_mass_alphaL", "#alpha_{L}", 2., 0., 4.);
|
|
|
// RooRealVar var_mass_alphaL("var_mass_alphaL", "#alpha_{L}", 2., 0., 4.);
|
|
@ -203,34 +322,48 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) |
|
|
auto var_mass_alphaR = RooRealConstant::value(2.446); |
|
|
auto var_mass_alphaR = RooRealConstant::value(2.446); |
|
|
auto var_mass_nR = RooRealConstant::value(1.146); |
|
|
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); |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
// Exponential for Background
|
|
|
// Exponential for Background
|
|
|
RooRealVar var_mass_bkg_c("var_mass_bkg_c", "#lambda", -0.0014, -0.004, -0.000); |
|
|
|
|
|
RooExponential bkg_exp("bkg_exp", "Exp Background", roo_var_mass, var_mass_bkg_c); |
|
|
|
|
|
|
|
|
RooRealVar var_mass_bkg_c(suffix("var_mass_bkg_c"), "#lambda", -0.0014, -0.004, -0.000); |
|
|
|
|
|
RooExponential bkg_exp(suffix("bkg_exp"), "Exp Background", roo_var_mass, var_mass_bkg_c); |
|
|
|
|
|
|
|
|
RooRealVar var_mass_nsig("nsig", "Mass N Signal", 0., hist->GetEntries()); |
|
|
|
|
|
RooRealVar var_mass_nbkg("nbkg", "Mass N Background", 0., hist->GetEntries()); |
|
|
|
|
|
|
|
|
RooRealVar var_mass_nsig(suffix("nsig"), "Mass N Signal", 0., hist->GetEntries()); |
|
|
|
|
|
RooRealVar var_mass_nbkg(suffix("nbkg"), "Mass N Background", 0., hist->GetEntries()); |
|
|
|
|
|
|
|
|
// TString pdf_name = TString::Format("%s_sigplusbkg", var_id.c_str());
|
|
|
|
|
|
RooAddPdf sigplusbkg("sigplusbkg", "Sig and Bkg PDF", RooArgList(sig_cb, bkg_exp), RooArgList(var_mass_nsig, var_mass_nbkg)); |
|
|
|
|
|
|
|
|
TString pdf_name = suffix("sigplusbkg"); |
|
|
|
|
|
RooAddPdf sigplusbkg(pdf_name, "Sig and Bkg PDF", RooArgList(sig_cb, bkg_exp), RooArgList(var_mass_nsig, var_mass_nbkg)); |
|
|
|
|
|
|
|
|
RooFitResult *fitres = sigplusbkg.fitTo(roohist_B_M, RooFit::Save(), RooFit::PrintLevel(1), RooFit::Range("fitting_range")); |
|
|
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::LineColor(kRed), RooFit::LineStyle(kSolid), RooFit::Range("fitting_range"), RooFit::Name(pdf_name)); |
|
|
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(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(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); |
|
|
|
|
|
|
|
|
RooPlot *roo_frame_pull = roo_var_mass.frame(RooFit::Title("Pull Distribution")); |
|
|
|
|
|
roo_frame_pull->addPlotable(roo_frame_mass->pullHist(hist_name, pdf_name), "P"); |
|
|
|
|
|
|
|
|
|
|
|
TCanvas *c = new TCanvas(suffix("roofit_c"), "roofit_c", 0, 0, 800, 600); |
|
|
|
|
|
|
|
|
|
|
|
auto *p2 = new TPad(suffix("p2"), "Pull", 0., 0., 1., 0.3); |
|
|
|
|
|
p2->Draw(); |
|
|
|
|
|
p2->SetTopMargin(0.001); |
|
|
|
|
|
p2->SetBottomMargin(0.3); |
|
|
|
|
|
p2->SetGrid(); |
|
|
|
|
|
|
|
|
|
|
|
auto *p1 = new TPad(suffix("p1"), "Fit", 0., 0.32, 1., 1.); |
|
|
|
|
|
p1->Draw(); |
|
|
|
|
|
p1->SetBottomMargin(0.001); |
|
|
|
|
|
p1->cd(); |
|
|
|
|
|
|
|
|
roo_frame_mass->Draw(); |
|
|
roo_frame_mass->Draw(); |
|
|
|
|
|
|
|
|
TLegend *leg1 = new TLegend(0.50, 0.58, 0.87, 0.89); |
|
|
|
|
|
|
|
|
TLegend *leg1 = new TLegend(0.50, 0.50, 0.87, 0.89); |
|
|
leg1->SetFillColor(kWhite); |
|
|
leg1->SetFillColor(kWhite); |
|
|
leg1->SetLineColor(kBlack); |
|
|
leg1->SetLineColor(kBlack); |
|
|
|
|
|
|
|
|
leg1->AddEntry(roo_frame_mass->findObject("sigplusbkg"), "Signal + Background", "LP"); |
|
|
|
|
|
|
|
|
leg1->AddEntry(roo_frame_mass->findObject(pdf_name), "Signal + Background", "LP"); |
|
|
leg1->AddEntry(roo_frame_mass->findObject("sig_cb"), "Signal", "LP"); |
|
|
leg1->AddEntry(roo_frame_mass->findObject("sig_cb"), "Signal", "LP"); |
|
|
leg1->AddEntry(roo_frame_mass->findObject("bkg_exp"), "Background", "LP"); |
|
|
leg1->AddEntry(roo_frame_mass->findObject("bkg_exp"), "Background", "LP"); |
|
|
leg1->AddEntry((TObject *)0, "", ""); |
|
|
leg1->AddEntry((TObject *)0, "", ""); |
|
@ -240,10 +373,14 @@ void CreateRooFitAndDraw(TH1D *hist, int fitting_entries) |
|
|
leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", "S", var_mass_nsig.getVal(), var_mass_nsig.getError()).Data(), ""); |
|
|
leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", "S", var_mass_nsig.getVal(), var_mass_nsig.getError()).Data(), ""); |
|
|
leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", "B", var_mass_nbkg.getVal(), var_mass_nbkg.getError()).Data(), ""); |
|
|
leg1->AddEntry((TObject *)0, TString::Format("%s = %.3f #pm %.3f", "B", var_mass_nbkg.getVal(), var_mass_nbkg.getError()).Data(), ""); |
|
|
|
|
|
|
|
|
leg1->AddEntry((TObject *)0, TString::Format("Entries: %d", fitting_entries), ""); |
|
|
|
|
|
|
|
|
leg1->AddEntry((TObject *)0, TString::Format("Entries: %.1f", var_mass_nsig.getVal() + var_mass_nbkg.getVal()), ""); |
|
|
|
|
|
|
|
|
leg1->Draw(); |
|
|
leg1->Draw(); |
|
|
|
|
|
|
|
|
|
|
|
p2->cd(); |
|
|
|
|
|
|
|
|
|
|
|
roo_frame_pull->Draw(); |
|
|
|
|
|
|
|
|
c->Draw(); |
|
|
c->Draw(); |
|
|
c->SaveAs(TString::Format("images/data/roofit_hist_%s_bmass.pdf", FILE_NAME).Data()); |
|
|
|
|
|
|
|
|
c->SaveAs(TString::Format("images/data/roofit_hist_%s_bmass.pdf", suffix(FILE_NAME).Data()).Data()); |
|
|
} |
|
|
} |