#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 #include #include const int nBins = 70; const Double_t MASS_HIST_MIN = 4000.; const Double_t MASS_HIST_MAX = 8500.; const Double_t J_PSI_MASS = 3096.916; const Double_t K_MASS = 493.677; std::vector CreateRooFit(TH1D *hist); bool inRange(double value, double center, double low_intvl, double up_intvl) { return center - low_intvl < value && value < center + up_intvl; } bool inRange(double value, double center, double intvl) { return inRange(value, center, intvl, intvl); } int subs_mass() { // files to load std::vector data_filenames = { "/auto/data/pfeiffer/inclusive_detached_dilepton/data_samples/spruce_magdown_2023_v0r1_tuple_90000000_2023_v0r0p6288631.root"}; TChain *data_chain = new TChain("BuToHpMuMu/DecayTree"); for (unsigned int i = 0; i < data_filenames.size(); i++) { data_chain->Add(data_filenames.at(i).c_str()); } Double_t Jpsi_M, L1_M, L2_M, Hp_M; 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("Jpsi_M", &Jpsi_M); data_chain->SetBranchAddress("L1_M", &L1_M); data_chain->SetBranchAddress("L2_M", &L2_M); data_chain->SetBranchAddress("Hp_M", &Hp_M); data_chain->SetBranchAddress("L1_PX", &L1_PX); data_chain->SetBranchAddress("L1_PY", &L1_PY); data_chain->SetBranchAddress("L1_PZ", &L1_PZ); data_chain->SetBranchAddress("L1_ENERGY", &L1_ENERGY); data_chain->SetBranchAddress("L2_PX", &L2_PX); data_chain->SetBranchAddress("L2_PY", &L2_PY); data_chain->SetBranchAddress("L2_PZ", &L2_PZ); data_chain->SetBranchAddress("L2_ENERGY", &L2_ENERGY); data_chain->SetBranchAddress("Hp_PX", &Hp_PX); data_chain->SetBranchAddress("Hp_PY", &Hp_PY); data_chain->SetBranchAddress("Hp_PZ", &Hp_PZ); data_chain->SetBranchAddress("Hp_ENERGY", &Hp_ENERGY); unsigned int entries = data_chain->GetEntries(); TH1D *h1_B_M = new TH1D("h1_B_M", "m(#pi_{K} #mu^{+} #mu^{-})", nBins, MASS_HIST_MIN, MASS_HIST_MAX); for (unsigned int i = 0; i < entries; i++) { data_chain->GetEntry(i); TVector3 K_momentum(Hp_PX, Hp_PY, Hp_PZ); double K_energy = TMath::Sqrt(TMath::Sq(K_MASS) + K_momentum.Mag2()); TLorentzVector K_4v(K_momentum, K_energy); TLorentzVector l1_4v(L1_PX, L1_PY, L1_PZ, L1_ENERGY); TLorentzVector l2_4v(L2_PX, L2_PY, L2_PZ, L2_ENERGY); Double_t reconstructed_B_Mass = (K_4v + l1_4v + l2_4v).M(); h1_B_M->Fill(reconstructed_B_Mass); } TCanvas* c1 = new TCanvas("c1", "c1", 0, 0, 900, 850); h1_B_M->Draw(); c1->Draw(); c1->SaveAs("BuToKpMuMu_incl_ap_B_M_uncut_subid.jpg"); return 0; }