Browse Source

use mc data in pre_selection_cuts

pull/1/head
Marius Pfeiffer 11 months ago
parent
commit
34f79df68d
  1. 103
      general_cuts.cpp
  2. 176
      pre_selection_cuts.cpp

103
general_cuts.cpp

@ -37,7 +37,10 @@ private:
TVar _min; TVar _min;
TVar _max; TVar _max;
TVar _value = TVar{}; TVar _value = TVar{};
TVar _cutAt = 0;
bool _applyCut = false;
TH1 *_histogram = nullptr; TH1 *_histogram = nullptr;
TH1 *_bkgHistogram = nullptr;
public: public:
DrawVar(std::string identifier, TVar min, TVar max) DrawVar(std::string identifier, TVar min, TVar max)
@ -45,6 +48,13 @@ public:
{ {
} }
DrawVar(std::string identifier, TVar min, TVar max, TVar cutAt)
: DrawVar(identifier, min, max)
{
_cutAt = cutAt;
_applyCut = true;
}
std::string getId() std::string getId()
{ {
return _identifier; return _identifier;
@ -75,14 +85,30 @@ public:
return _value; return _value;
} }
bool cutAccepted()
{
if (!_applyCut)
{
return true;
}
return _value > _cutAt;
}
void initHistograms()
{
_histogram = new TH1D(TString::Format("h1_%s", this->getIdStr()).Data(), this->getIdStr(), nBins, _min, _max);
_bkgHistogram = new TH1D(TString::Format("h1_bkg_%s", this->getIdStr()).Data(), this->getIdStr(), nBins, _min, _max);
_bkgHistogram->SetLineColor(kRed);
}
TH1 *getHist() TH1 *getHist()
{ {
return _histogram; return _histogram;
} }
void setHist(TH1D *hist)
TH1 *getBkgHist()
{ {
_histogram = hist;
return _bkgHistogram;
} }
}; };
@ -107,10 +133,24 @@ int general_cuts()
gStyle->SetOptStat(0); gStyle->SetOptStat(0);
gStyle->SetOptFit(0); gStyle->SetOptFit(0);
// Selectoin
// Pre-Selection Cut-Based
// IP Tochter, PT Tochter, FDCHI2 B, PT B
// PID isMuon, PID K
std::vector<DrawVar<Float_t>> float_vars{ std::vector<DrawVar<Float_t>> float_vars{
DrawVar<Float_t>("B0_PT", 0., 20000.)};
DrawVar<Float_t>("B0_PT", 0., 7000.),
DrawVar<Float_t>("B0_FDCHI2_OWNPV", 0., 500., 15.),
DrawVar<Float_t>("JPsi_PT", 0., 6000.),
DrawVar<Float_t>("JPsi_IP_OWNPV", 0., 2., 0.15),
DrawVar<Float_t>("Kstar0_PT", 0., 3500.),
DrawVar<Float_t>("Kstar0_IP_OWNPV", 0., 3., 0.15),
DrawVar<Float_t>("Kplus_PT", 0., 2000., 400.),
DrawVar<Float_t>("Kplus_IP_OWNPV", 0., 3., 0.15),
DrawVar<Float_t>("piminus_PT", 0., 2000., 200.),
DrawVar<Float_t>("piminus_IP_OWNPV", 0., 3., 0.15)};
std::vector<DrawVar<Double_t>> double_vars{ std::vector<DrawVar<Double_t>> double_vars{
DrawVar<Double_t>("JPsi_M", 400., 5000.)
}; };
// files to load // files to load
@ -127,17 +167,18 @@ int general_cuts()
Double_t B0_M; Double_t B0_M;
chain->SetBranchAddress("B0_M", &B0_M); chain->SetBranchAddress("B0_M", &B0_M);
TH1D *h1_B0_M = new TH1D("h1_B0_M", "B+ Mass", nBins, 4500, 7500); TH1D *h1_B0_M = new TH1D("h1_B0_M", "B+ Mass", nBins, 4500, 7500);
TH1D *h1_bkg_B0_M = new TH1D("h1_bkg_B0_M", "B+ Mass Bkg", nBins, 4500, 7500);
for (size_t i = 0; i < float_vars.size(); i++) for (size_t i = 0; i < float_vars.size(); i++)
{ {
chain->SetBranchAddress(float_vars[i].getIdStr(), float_vars[i].getValuePointer()); chain->SetBranchAddress(float_vars[i].getIdStr(), float_vars[i].getValuePointer());
float_vars[i].setHist(new TH1D(TString::Format("h1_%s", float_vars[i].getIdStr()).Data(), float_vars[i].getIdStr(), nBins, float_vars[i].getMin(), float_vars[i].getMax()));
float_vars[i].initHistograms();
} }
for (size_t i = 0; i < double_vars.size(); i++) for (size_t i = 0; i < double_vars.size(); i++)
{ {
chain->SetBranchAddress(double_vars[i].getIdStr(), double_vars[i].getValuePointer()); chain->SetBranchAddress(double_vars[i].getIdStr(), double_vars[i].getValuePointer());
double_vars[i].setHist(new TH1D(TString::Format("h1_%s", double_vars[i].getIdStr()).Data(), double_vars[i].getIdStr(), nBins, double_vars[i].getMin(), double_vars[i].getMax()));
double_vars[i].initHistograms();
} }
unsigned int entries = chain->GetEntries(); unsigned int entries = chain->GetEntries();
@ -145,8 +186,41 @@ int general_cuts()
for (unsigned int i = 0; i < entries; i++) for (unsigned int i = 0; i < entries; i++)
{ {
chain->GetEntry(i); chain->GetEntry(i);
bool cutAccepted = true;
for (size_t i = 0; i < float_vars.size(); i++)
{
cutAccepted = cutAccepted && float_vars[i].cutAccepted();
}
for (size_t i = 0; i < double_vars.size(); i++)
{
cutAccepted = cutAccepted && double_vars[i].cutAccepted();
}
if (cutAccepted)
{
h1_B0_M->Fill(B0_M); h1_B0_M->Fill(B0_M);
}
else
{
h1_bkg_B0_M->Fill(B0_M);
}
if (B0_M > 5500.)
{
for (size_t i = 0; i < float_vars.size(); i++)
{
float_vars[i].getBkgHist()->Fill(float_vars[i].getValue());
}
for (size_t i = 0; i < double_vars.size(); i++)
{
double_vars[i].getBkgHist()->Fill(double_vars[i].getValue());
}
}
else
{
for (size_t i = 0; i < float_vars.size(); i++) for (size_t i = 0; i < float_vars.size(); i++)
{ {
float_vars[i].getHist()->Fill(float_vars[i].getValue()); float_vars[i].getHist()->Fill(float_vars[i].getValue());
@ -157,22 +231,34 @@ int general_cuts()
double_vars[i].getHist()->Fill(double_vars[i].getValue()); double_vars[i].getHist()->Fill(double_vars[i].getValue());
} }
} }
}
TCanvas *c1 = new TCanvas("c1", "Canvas 1", 0, 0, 800, 600); TCanvas *c1 = new TCanvas("c1", "Canvas 1", 0, 0, 800, 600);
h1_bkg_B0_M->SetLineColor(kRed);
if (h1_bkg_B0_M->GetMaximum() >= h1_B0_M->GetMaximum())
{
h1_bkg_B0_M->Draw();
h1_B0_M->Draw("SAME");
}
else
{
h1_B0_M->Draw(); h1_B0_M->Draw();
h1_bkg_B0_M->Draw("SAME");
}
c1->Draw(); c1->Draw();
if (float_vars.size() > 0) if (float_vars.size() > 0)
{ {
TCanvas *c2 = new TCanvas("c2", "Canvas 2", 0, 0, 1200, 600); TCanvas *c2 = new TCanvas("c2", "Canvas 2", 0, 0, 1200, 600);
c2->Divide(4, 2);
c2->Divide(4, 3);
for (size_t i = 0; i < float_vars.size(); i++) for (size_t i = 0; i < float_vars.size(); i++)
{ {
c2->cd(i + 1); c2->cd(i + 1);
float_vars[i].getHist()->Draw(); float_vars[i].getHist()->Draw();
float_vars[i].getBkgHist()->Draw("SAME");
} }
c2->Draw(); c2->Draw();
@ -181,12 +267,13 @@ int general_cuts()
if (double_vars.size() > 0) if (double_vars.size() > 0)
{ {
TCanvas *c3 = new TCanvas("c3", "Canvas 3", 0, 0, 1200, 600); TCanvas *c3 = new TCanvas("c3", "Canvas 3", 0, 0, 1200, 600);
c3->Divide(4, 2);
c3->Divide(4, 3);
for (size_t i = 0; i < double_vars.size(); i++) for (size_t i = 0; i < double_vars.size(); i++)
{ {
c3->cd(i + 1); c3->cd(i + 1);
double_vars[i].getHist()->Draw(); double_vars[i].getHist()->Draw();
double_vars[i].getBkgHist()->Draw("SAME");
} }
c3->Draw(); c3->Draw();

176
pre_selection_cuts.cpp

@ -53,62 +53,94 @@ int pre_selection_cuts()
gStyle->SetOptFit(0); gStyle->SetOptFit(0);
// files to load // files to load
std::vector<std::string> filenames =
std::vector<std::string> data_filenames =
{ {
"./BuToKpMuMu_Collision23_Beam6800GeV-VeloClosed-MagDown-Excl-UT_RealData_Sprucing23r1_90000000_RD.root"};
"/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/BuToKpMuMu_Collision23_Beam6800GeV-VeloClosed-MagDown-Excl-UT_RealData_Sprucing23r1_90000000_RD.root"};
TChain *chain = new TChain("SpruceRD_BuToKpMuMu/DecayTree");
for (unsigned int i = 0; i < filenames.size(); i++)
TChain *data_chain = new TChain("SpruceRD_BuToKpMuMu/DecayTree");
for (unsigned int i = 0; i < data_filenames.size(); i++)
{ {
chain->Add(filenames.at(i).c_str());
data_chain->Add(data_filenames.at(i).c_str());
}
// files to load
std::vector<std::string> mc_filenames =
{
"/auto/data/pfeiffer/inclusive_detached_dilepton/MC/BuToKpMuMu_rd_btoxll_simulation_12143001_MagDown_v0r0p6316987.root"};
TChain *mc_chain = new TChain("BuToKpMuMu23_noPID/DecayTree");
for (unsigned int i = 0; i < mc_filenames.size(); i++)
{
mc_chain->Add(mc_filenames.at(i).c_str());
} }
Double_t Bplus_M, // 4400 -> 8200 Double_t Bplus_M, // 4400 -> 8200
JPsi_M, // 200 -> 6600
Jpsi_M, // 200 -> 6600
Kplus_M; // 493.6769 -> 493.6779 Kplus_M; // 493.6769 -> 493.6779
Float_t Bplus_PT, // 0 -> 30 * 10^3 Float_t Bplus_PT, // 0 -> 30 * 10^3
Bplus_FDCHI2_OWNPV, // 0 -> 7000
JPsi_IP_OWNPV, // 0 -> 3
JPsi_PT, // 0 -> 26 * 10^3
Kplus_IP_OWNPV, // 0 -> 7
Bplus_BPVFDCHI2, // 0 -> 7000
Jpsi_BPVIPCHI2, // 0 -> 3
Jpsi_PT, // 0 -> 26 * 10^3
Kplus_BPVIPCHI2, // 0 -> 7
Kplus_PT; // 0 -> 11 * 10^3 Kplus_PT; // 0 -> 11 * 10^3
chain->SetBranchAddress("Bplus_M", &Bplus_M);
chain->SetBranchAddress("Bplus_PT", &Bplus_PT);
chain->SetBranchAddress("Bplus_FDCHI2_OWNPV", &Bplus_FDCHI2_OWNPV);
chain->SetBranchAddress("JPsi_M", &JPsi_M);
chain->SetBranchAddress("JPsi_IP_OWNPV", &JPsi_IP_OWNPV);
chain->SetBranchAddress("JPsi_PT", &JPsi_PT);
chain->SetBranchAddress("Kplus_M", &Kplus_M);
chain->SetBranchAddress("Kplus_IP_OWNPV", &Kplus_IP_OWNPV);
chain->SetBranchAddress("Kplus_PT", &Kplus_PT);
Double_t Bplus_M_mc, // 4400 -> 8200
Jpsi_M_mc, // 200 -> 6600
Kplus_M_mc; // 493.6769 -> 493.6779
Float_t Bplus_PT_mc, // 0 -> 30 * 10^3
Bplus_BPVFDCHI2_mc, // 0 -> 7000
Jpsi_BPVIPCHI2_mc, // 0 -> 3
Jpsi_PT_mc, // 0 -> 26 * 10^3
Kplus_BPVIPCHI2_mc, // 0 -> 7
Kplus_PT_mc; // 0 -> 11 * 10^3
data_chain->SetBranchAddress("Bplus_M", &Bplus_M);
data_chain->SetBranchAddress("Bplus_PT", &Bplus_PT);
data_chain->SetBranchAddress("Bplus_BPVFDCHI2", &Bplus_BPVFDCHI2);
data_chain->SetBranchAddress("Jpsi_M", &Jpsi_M);
data_chain->SetBranchAddress("Jpsi_BPVIPCHI2", &Jpsi_BPVIPCHI2);
data_chain->SetBranchAddress("Jpsi_PT", &Jpsi_PT);
data_chain->SetBranchAddress("Kplus_M", &Kplus_M);
data_chain->SetBranchAddress("Kplus_BPVIPCHI2", &Kplus_BPVIPCHI2);
data_chain->SetBranchAddress("Kplus_PT", &Kplus_PT);
mc_chain->SetBranchAddress("B_M", &Bplus_M_mc);
mc_chain->SetBranchAddress("B_PT", &Bplus_PT_mc);
mc_chain->SetBranchAddress("B_BPVFDCHI2", &Bplus_BPVFDCHI2_mc);
mc_chain->SetBranchAddress("Jpsi_M", &Jpsi_M_mc);
mc_chain->SetBranchAddress("Jpsi_BPVIPCHI2", &Jpsi_BPVIPCHI2_mc);
mc_chain->SetBranchAddress("Jpsi_PT", &Jpsi_PT_mc);
mc_chain->SetBranchAddress("K_M", &Kplus_M_mc);
mc_chain->SetBranchAddress("K_BPVIPCHI2", &Kplus_BPVIPCHI2_mc);
mc_chain->SetBranchAddress("K_PT", &Kplus_PT_mc);
TH1D *h1_Bplus_M = new TH1D("h1_Bplus_M", "B+ Mass", nBins, 4500, 7500); TH1D *h1_Bplus_M = new TH1D("h1_Bplus_M", "B+ Mass", nBins, 4500, 7500);
TH1D *h1_Bplus_PT = new TH1D("h1_Bplus_PT", "B+ P_{T}", nBins, 0, 15000); TH1D *h1_Bplus_PT = new TH1D("h1_Bplus_PT", "B+ P_{T}", nBins, 0, 15000);
TH1D *h1_Bplus_FDCHI2_OWNPV = new TH1D("h1_Bplus_FDCHI2_OWNPV", "B+ FD #chi^{2}", nBins, 0, 3000);
TH1D *h1_JPsi_M = new TH1D("h1_JPsi_M", "J/#psi Mass", nBins, 200, 6600);
TH1D *h1_JPsi_IP_OWNPV = new TH1D("h1_JPsi_IP_OWNPV", "J/#psi IP", nBins, 0, 1);
TH1D *h1_JPsi_PT = new TH1D("h1_JPsi_PT", "J/#psi P_{T}", nBins, 0, 15000);
TH1D *h1_Bplus_BPVFDCHI2 = new TH1D("h1_Bplus_BPVFDCHI2", "B+ FD #chi^{2}", nBins, 0, 1500);
TH1D *h1_Jpsi_M = new TH1D("h1_Jpsi_M", "J/#psi Mass", nBins, 200, 6600);
TH1D *h1_Jpsi_BPVIPCHI2 = new TH1D("h1_Jpsi_BPVIPCHI2", "J/#psi IP #chi^{2}", nBins, 0, 100);
TH1D *h1_Jpsi_PT = new TH1D("h1_Jpsi_PT", "J/#psi P_{T}", nBins, 0, 15000);
TH1D *h1_Kplus_M = new TH1D("h1_Kplus_M", "K^{+} Mass", nBins, 493.676999999, 493.677000001); TH1D *h1_Kplus_M = new TH1D("h1_Kplus_M", "K^{+} Mass", nBins, 493.676999999, 493.677000001);
TH1D *h1_Kplus_IP_OWNPV = new TH1D("h1_Kplus_IP_OWNPV", "K^{+} IP", nBins, 0, 3);
TH1D *h1_Kplus_BPVIPCHI2 = new TH1D("h1_Kplus_BPVIPCHI2", "K^{+} IP #chi^{2}", nBins, 0, 100);
TH1D *h1_Kplus_PT = new TH1D("h1_Kplus_PT", "K^{+} P_{T}", nBins, 0, 6500); TH1D *h1_Kplus_PT = new TH1D("h1_Kplus_PT", "K^{+} P_{T}", nBins, 0, 6500);
TH1D *h1_bkg_Bplus_M = new TH1D("h1_bkg_Bplus_M", "B+ Mass", nBins, 4500, 7500); TH1D *h1_bkg_Bplus_M = new TH1D("h1_bkg_Bplus_M", "B+ Mass", nBins, 4500, 7500);
TH1D *h1_bkg_Bplus_PT = new TH1D("h1_bkg_Bplus_PT", "B+ P_{T}", nBins, 0, 15000); TH1D *h1_bkg_Bplus_PT = new TH1D("h1_bkg_Bplus_PT", "B+ P_{T}", nBins, 0, 15000);
TH1D *h1_bkg_Bplus_FDCHI2_OWNPV = new TH1D("h1_bkg_Bplus_FDCHI2_OWNPV", "B+ FD #chi^{2}", nBins, 0, 3000);
TH1D *h1_bkg_JPsi_M = new TH1D("h1_bkg_JPsi_M", "J/#psi Mass", nBins, 200, 6600);
TH1D *h1_bkg_JPsi_IP_OWNPV = new TH1D("h1_bkg_JPsi_IP_OWNPV", "J/#psi IP", nBins, 0, 1);
TH1D *h1_bkg_JPsi_PT = new TH1D("h1_bkg_JPsi_PT", "J/#psi P_{T}", nBins, 0, 15000);
TH1D *h1_bkg_Bplus_BPVFDCHI2 = new TH1D("h1_bkg_Bplus_BPVFDCHI2", "B+ FD #chi^{2}", nBins, 0, 1500);
TH1D *h1_bkg_Jpsi_M = new TH1D("h1_bkg_Jpsi_M", "J/#psi Mass", nBins, 200, 6600);
TH1D *h1_bkg_Jpsi_BPVIPCHI2 = new TH1D("h1_bkg_Jpsi_BPVIPCHI2", "J/#psi IP #chi^{2}", nBins, 0, 100);
TH1D *h1_bkg_Jpsi_PT = new TH1D("h1_bkg_Jpsi_PT", "J/#psi P_{T}", nBins, 0, 15000);
TH1D *h1_bkg_Kplus_M = new TH1D("h1_bkg_Kplus_M", "K^{+} Mass", nBins, 493.676999999, 493.677000001); TH1D *h1_bkg_Kplus_M = new TH1D("h1_bkg_Kplus_M", "K^{+} Mass", nBins, 493.676999999, 493.677000001);
TH1D *h1_bkg_Kplus_IP_OWNPV = new TH1D("h1_bkg_Kplus_IP_OWNPV", "K^{+} IP", nBins, 0, 3);
TH1D *h1_bkg_Kplus_BPVIPCHI2 = new TH1D("h1_bkg_Kplus_BPVIPCHI2", "K^{+} IP #chi^{2}", nBins, 0, 100);
TH1D *h1_bkg_Kplus_PT = new TH1D("h1_bkg_Kplus_PT", "K^{+} P_{T}", nBins, 0, 6500); TH1D *h1_bkg_Kplus_PT = new TH1D("h1_bkg_Kplus_PT", "K^{+} P_{T}", nBins, 0, 6500);
unsigned int entries = chain->GetEntries();
unsigned int entries = data_chain->GetEntries();
// loop over all entries in the tree // loop over all entries in the tree
for (unsigned int i = 0; i < entries; i++) for (unsigned int i = 0; i < entries; i++)
{ {
chain->GetEntry(i);
data_chain->GetEntry(i);
const double JSPI_MASS = 3096.; const double JSPI_MASS = 3096.;
/* /*
@ -118,49 +150,53 @@ int pre_selection_cuts()
J/Psi PT > 1000. J/Psi PT > 1000.
K+ IP > 0.2 K+ IP > 0.2
K+ PT > 650. K+ PT > 650.
eher auf IP CHI2 schneiden, statt IP. da eher signifikanz
*/ */
if (Bplus_PT > 1200. && Bplus_FDCHI2_OWNPV > 90. && JPsi_IP_OWNPV > 0.05 &&
JPsi_PT > 800. && Kplus_IP_OWNPV > 0.17 && Kplus_PT > 500. && (JSPI_MASS - 150. < JPsi_M && JPsi_M < JSPI_MASS + 150.)) {
if (Bplus_PT > 1200. && Bplus_BPVFDCHI2 > 90. && /*Jpsi_IP_OWNPV > 0.05 && */
Jpsi_PT > 800. && Kplus_BPVIPCHI2 > 0.17 && Kplus_PT > 500. && (JSPI_MASS - 150. < Jpsi_M && Jpsi_M < JSPI_MASS + 150.))
{
h1_Bplus_M->Fill(Bplus_M); h1_Bplus_M->Fill(Bplus_M);
} else {
}
else
{
h1_bkg_Bplus_M->Fill(Bplus_M); h1_bkg_Bplus_M->Fill(Bplus_M);
} }
if (Bplus_M > 5700.)
{
h1_bkg_Bplus_PT->Fill(Bplus_PT); h1_bkg_Bplus_PT->Fill(Bplus_PT);
h1_bkg_Bplus_FDCHI2_OWNPV->Fill(Bplus_FDCHI2_OWNPV);
h1_bkg_JPsi_M->Fill(JPsi_M);
h1_bkg_JPsi_IP_OWNPV->Fill(JPsi_IP_OWNPV);
h1_bkg_JPsi_PT->Fill(JPsi_PT);
h1_bkg_Bplus_BPVFDCHI2->Fill(Bplus_BPVFDCHI2);
h1_bkg_Jpsi_M->Fill(Jpsi_M);
h1_bkg_Jpsi_BPVIPCHI2->Fill(Jpsi_BPVIPCHI2);
h1_bkg_Jpsi_PT->Fill(Jpsi_PT);
h1_bkg_Kplus_M->Fill(Kplus_M); h1_bkg_Kplus_M->Fill(Kplus_M);
h1_bkg_Kplus_IP_OWNPV->Fill(Kplus_IP_OWNPV);
h1_bkg_Kplus_BPVIPCHI2->Fill(Kplus_BPVIPCHI2);
h1_bkg_Kplus_PT->Fill(Kplus_PT); h1_bkg_Kplus_PT->Fill(Kplus_PT);
} }
else
unsigned int mc_entries = mc_chain->GetEntries();
for (size_t i = 0; i < mc_entries; i++)
{ {
h1_Bplus_PT->Fill(Bplus_PT);
h1_Bplus_FDCHI2_OWNPV->Fill(Bplus_FDCHI2_OWNPV);
h1_JPsi_M->Fill(JPsi_M);
h1_JPsi_IP_OWNPV->Fill(JPsi_IP_OWNPV);
h1_JPsi_PT->Fill(JPsi_PT);
mc_chain->GetEntry(i);
h1_Bplus_PT->Fill(Bplus_PT_mc);
h1_Bplus_BPVFDCHI2->Fill(Bplus_BPVFDCHI2_mc);
h1_Jpsi_M->Fill(Jpsi_M_mc);
h1_Jpsi_BPVIPCHI2->Fill(Jpsi_BPVIPCHI2_mc);
h1_Jpsi_PT->Fill(Jpsi_PT_mc);
h1_Kplus_M->Fill(Kplus_M); h1_Kplus_M->Fill(Kplus_M);
h1_Kplus_IP_OWNPV->Fill(Kplus_IP_OWNPV);
h1_Kplus_PT->Fill(Kplus_PT);
}
h1_Kplus_BPVIPCHI2->Fill(Kplus_BPVIPCHI2_mc);
h1_Kplus_PT->Fill(Kplus_PT_mc);
} }
TCanvas *c1 = new TCanvas("c1", "Canvas 1", 0, 0, 800, 600); TCanvas *c1 = new TCanvas("c1", "Canvas 1", 0, 0, 800, 600);
//h1_bkg_Bplus_M->SetLineColor(kRed);
//h1_bkg_Bplus_M->Draw();
h1_bkg_Bplus_M->SetLineColor(kRed);
h1_bkg_Bplus_M->Draw();
h1_Bplus_M->Draw(); h1_Bplus_M->Draw();
c1->Draw(); c1->Draw();
std::vector<TH1 *> small_histos{h1_Bplus_PT, h1_Bplus_FDCHI2_OWNPV, h1_JPsi_M, h1_JPsi_IP_OWNPV, h1_JPsi_PT, h1_Kplus_M, h1_Kplus_IP_OWNPV, h1_Kplus_PT};
std::vector<TH1 *> small_bkg_histos{h1_bkg_Bplus_PT, h1_bkg_Bplus_FDCHI2_OWNPV, h1_bkg_JPsi_M, h1_bkg_JPsi_IP_OWNPV, h1_bkg_JPsi_PT, h1_bkg_Kplus_M, h1_bkg_Kplus_IP_OWNPV, h1_bkg_Kplus_PT};
std::vector<TH1 *> small_histos{h1_Bplus_PT, h1_Bplus_BPVFDCHI2, h1_Jpsi_M, h1_Jpsi_BPVIPCHI2, h1_Jpsi_PT, h1_Kplus_M, h1_Kplus_BPVIPCHI2, h1_Kplus_PT};
std::vector<TH1 *> small_bkg_histos{h1_bkg_Bplus_PT, h1_bkg_Bplus_BPVFDCHI2, h1_bkg_Jpsi_M, h1_bkg_Jpsi_BPVIPCHI2, h1_bkg_Jpsi_PT, h1_bkg_Kplus_M, h1_bkg_Kplus_BPVIPCHI2, h1_bkg_Kplus_PT};
TCanvas *c2 = new TCanvas("c2", "Canvas 2", 0, 0, 1200, 600); TCanvas *c2 = new TCanvas("c2", "Canvas 2", 0, 0, 1200, 600);
c2->Divide(4, 2); c2->Divide(4, 2);
@ -169,24 +205,46 @@ int pre_selection_cuts()
{ {
c2->cd(i + 1); c2->cd(i + 1);
small_histos[i]->Draw();
small_bkg_histos[i]->SetLineColor(kRed);
small_bkg_histos[i]->Draw("SAME");
small_histos[i]->SetLineWidth(1);
small_histos[i]->SetMinimum(0);
small_histos[i]->SetLineColor(kRed);
small_histos[i]->SetFillColor(kRed);
small_histos[i]->SetFillStyle(3004);
small_histos[i]->Scale(1. / small_histos[i]->Integral(), "width");
small_bkg_histos[i]->SetLineColor(kBlue);
small_bkg_histos[i]->SetLineWidth(2);
small_bkg_histos[i]->SetMinimum(0);
small_bkg_histos[i]->Scale(1. / small_bkg_histos[i]->Integral(), "width");
if (small_histos[i]->GetMaximum() > small_bkg_histos[i]->GetMaximum())
{
small_histos[i]->Draw("HIST");
small_bkg_histos[i]->Draw("HIST SAME");
}
else
{
small_bkg_histos[i]->Draw("HIST");
small_histos[i]->Draw("HIST SAME");
}
} }
c2->Draw(); c2->Draw();
/*
TCanvas *c3 = new TCanvas("c3", "Canvas 3", 0, 0, 800, 600); TCanvas *c3 = new TCanvas("c3", "Canvas 3", 0, 0, 800, 600);
auto fitFrame = CreateRooFit(h1_Bplus_M); auto fitFrame = CreateRooFit(h1_Bplus_M);
fitFrame->Draw(); fitFrame->Draw();
c3->Draw(); c3->Draw();
*/
return 0; return 0;
} }
RooPlot* CreateRooFit(TH1D* hist) {
RooPlot *CreateRooFit(TH1D *hist)
{
RooRealVar roo_var_mass("roo_var_mass", "B+ Mass Variable", 4500., 7500.); RooRealVar roo_var_mass("roo_var_mass", "B+ Mass Variable", 4500., 7500.);
roo_var_mass.setRange("fitting_range", 4700., 6500.); roo_var_mass.setRange("fitting_range", 4700., 6500.);

Loading…
Cancel
Save