2024-01-22 16:45:48 +01:00
|
|
|
#include "TH1D.h"
|
|
|
|
#include "TH2D.h"
|
|
|
|
#include "THStack.h"
|
|
|
|
#include "TGraph.h"
|
|
|
|
#include "TTree.h"
|
|
|
|
#include "TChain.h"
|
|
|
|
#include "TFile.h"
|
|
|
|
#include "TCanvas.h"
|
|
|
|
#include "TROOT.h"
|
|
|
|
#include "TStyle.h"
|
|
|
|
#include "TColor.h"
|
|
|
|
#include "TLorentzVector.h"
|
|
|
|
#include "TRandom3.h"
|
|
|
|
#include "TLorentzVector.h"
|
|
|
|
|
|
|
|
#include "RooDataHist.h"
|
|
|
|
#include "RooRealVar.h"
|
|
|
|
#include "RooPlot.h"
|
|
|
|
#include "RooGaussian.h"
|
|
|
|
#include "RooExponential.h"
|
|
|
|
#include "RooRealConstant.h"
|
|
|
|
#include "RooAddPdf.h"
|
|
|
|
#include "RooFitResult.h"
|
|
|
|
#include "RooProduct.h"
|
|
|
|
#include "RooCrystalBall.h"
|
|
|
|
#include "RooBreitWigner.h"
|
|
|
|
#include "RooArgSet.h"
|
|
|
|
#include "RooFFTConvPdf.h"
|
|
|
|
#include "RooNovosibirsk.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
const int nBins = 70;
|
|
|
|
|
|
|
|
const Double_t MASS_HIST_FIT_MIN = 5100.;
|
|
|
|
const Double_t MASS_HIST_FIT_MAX = 6000.;
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
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^{-})";
|
2024-01-22 16:45:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
void CreateRooFitAndDraw(TH1D *hist, int fitting_entries);
|
|
|
|
|
|
|
|
int analysis_turbo()
|
|
|
|
{
|
|
|
|
TChain *data_chain = new TChain(TString::Format("%s/DecayTree", TITLE).Data());
|
2024-01-22 16:45:48 +01:00
|
|
|
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;
|
|
|
|
|
|
|
|
Bool_t Hlt1TrackMVADecision, Hlt1TwoTrackMVADecision;
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
if (TITLE == B0_DECAY)
|
2024-01-22 16:45:48 +01:00
|
|
|
{
|
|
|
|
data_chain->SetBranchAddress("B0_M", &B0_M);
|
|
|
|
data_chain->SetBranchAddress("Jpsi_M", &Jpsi_M);
|
|
|
|
data_chain->SetBranchAddress("Kst0_M", &Kst_M);
|
|
|
|
data_chain->SetBranchAddress("Hlt1TrackMVADecision", &Hlt1TrackMVADecision);
|
|
|
|
data_chain->SetBranchAddress("Hlt1TwoTrackMVADecision", &Hlt1TwoTrackMVADecision);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
data_chain->SetBranchAddress("B_M", &B_M);
|
|
|
|
data_chain->SetBranchAddress("Jpsi_M", &Jpsi_M);
|
|
|
|
data_chain->SetBranchAddress("Hlt1TrackMVADecision", &Hlt1TrackMVADecision);
|
|
|
|
data_chain->SetBranchAddress("Hlt1TwoTrackMVADecision", &Hlt1TwoTrackMVADecision);
|
|
|
|
}
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
TH1D *h1_B_M = new TH1D("h1_B_M", TITLE, nBins, MASS_HIST_FIT_MIN, MASS_HIST_FIT_MAX);
|
|
|
|
h1_B_M->GetXaxis()->SetTitle(X_AXIS);
|
2024-01-22 16:45:48 +01:00
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
int fitting_entries = 0;
|
2024-01-22 16:45:48 +01:00
|
|
|
unsigned int entries = data_chain->GetEntries();
|
|
|
|
for (unsigned int i = 0; i < entries; i++)
|
|
|
|
{
|
|
|
|
data_chain->GetEntry(i);
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
if (TITLE == B0_DECAY)
|
2024-01-22 16:45:48 +01:00
|
|
|
{
|
|
|
|
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);
|
2024-01-23 16:36:19 +01:00
|
|
|
if (MASS_HIST_FIT_MIN <= B0_M && B0_M <= MASS_HIST_FIT_MAX)
|
|
|
|
{
|
|
|
|
fitting_entries++;
|
|
|
|
}
|
2024-01-22 16:45:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((TMath::Abs(Jpsi_M - 3096.9) < 100.) && (B_M > 4500.) && (B_M < 6000.) && ((Hlt1TrackMVADecision) || (Hlt1TwoTrackMVADecision)))
|
|
|
|
{
|
|
|
|
h1_B_M->Fill(B_M);
|
2024-01-23 16:36:19 +01:00
|
|
|
if (MASS_HIST_FIT_MIN <= B_M && B_M <= MASS_HIST_FIT_MAX)
|
|
|
|
{
|
|
|
|
fitting_entries++;
|
|
|
|
}
|
2024-01-22 16:45:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i % 10000 == 0)
|
|
|
|
{
|
|
|
|
std::cout << "["
|
2024-01-23 16:36:19 +01:00
|
|
|
<< TITLE
|
2024-01-22 16:45:48 +01:00
|
|
|
<< "] Processed event: " << i << " (" << TString::Format("%.2f", ((double)i / (double)entries) * 100.) << "%)" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 800, 600);
|
|
|
|
h1_B_M->Draw();
|
|
|
|
c1->Draw();
|
2024-01-23 16:36:19 +01:00
|
|
|
c1->SaveAs(TString::Format("images/root_hist_%s_bmass.pdf", TITLE).Data());
|
2024-01-22 16:45:48 +01:00
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
CreateRooFitAndDraw(h1_B_M, fitting_entries);
|
2024-01-22 16:45:48 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
void CreateRooFitAndDraw(TH1D *hist, int fitting_entries)
|
2024-01-22 16:45:48 +01:00
|
|
|
{
|
|
|
|
RooRealVar roo_var_mass("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);
|
|
|
|
|
|
|
|
RooDataHist roohist_B_M("roohist_B_M", "B Mass Histogram", roo_var_mass, RooFit::Import(*hist));
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
RooPlot *roo_frame_mass = roo_var_mass.frame(RooFit::Title(TITLE));
|
2024-01-22 16:45:48 +01:00
|
|
|
roohist_B_M.plotOn(roo_frame_mass, RooFit::Binning(nBins), RooFit::Name("B Mass Distribution"));
|
2024-01-23 16:36:19 +01:00
|
|
|
roo_frame_mass->GetXaxis()->SetTitle(X_AXIS);
|
2024-01-22 16:45:48 +01:00
|
|
|
|
|
|
|
TCanvas *c = new TCanvas("roofit_c", "roofit_c", 0, 0, 800, 600);
|
|
|
|
|
|
|
|
roo_frame_mass->Draw();
|
|
|
|
|
|
|
|
TLegend *leg1 = new TLegend(0.65, 0.7, 0.87, 0.8);
|
|
|
|
leg1->SetFillColor(kWhite);
|
|
|
|
leg1->SetLineColor(kBlack);
|
|
|
|
|
2024-01-23 16:36:19 +01:00
|
|
|
leg1->AddEntry((TObject *)0, TString::Format("Entries: %d", fitting_entries), "");
|
2024-01-22 16:45:48 +01:00
|
|
|
|
|
|
|
leg1->Draw();
|
|
|
|
|
|
|
|
c->Draw();
|
2024-01-23 16:36:19 +01:00
|
|
|
c->SaveAs(TString::Format("images/roofit_hist_%s_bmass.pdf", TITLE).Data());
|
2024-01-22 16:45:48 +01:00
|
|
|
}
|