#include #include #include "TFile.h" #include "TTree.h" #include "TH2F.h" #include "TH1F.h" #include "THStack.h" #include "TCanvas.h" #include "TVirtualPad.h" #include "TLorentzVector.h" #include "TMath.h" #include "TPad.h" #include "TStyle.h" #include "TLegend.h" #include "TChain.h" #include "TEfficiency.h" #include #include #include void testtauposgamma() { gStyle->SetOptStat(0); TH1F *control1 = new TH1F("control1","control1",100,-1,100); TH1F *control2 = new TH1F("control2","control2",100,-1,100); TFile *f = new TFile("flat_ntuple.root"); TTree *tree = (TTree*)f->Get("CollectionTree"); float true_gamma_pt; tree->SetBranchAddress("true_gamma_pt", &true_gamma_pt); float true_gamma_eta; tree->SetBranchAddress("true_gamma_eta", &true_gamma_eta); float true_gamma_phi; tree->SetBranchAddress("true_gamma_phi", &true_gamma_phi); float true_taupos_pt; tree->SetBranchAddress("true_taupos_pt", &true_taupos_pt); float true_taupos_eta; tree->SetBranchAddress("true_taupos_eta", &true_taupos_eta); float true_taupos_phi; tree->SetBranchAddress("true_taupos_phi", &true_taupos_phi); float true_tauneg_pt; tree->SetBranchAddress("true_tauneg_pt", &true_tauneg_pt); float true_tauneg_eta; tree->SetBranchAddress("true_tauneg_eta", &true_tauneg_eta); float true_tauneg_phi; tree->SetBranchAddress("true_tauneg_phi", &true_tauneg_phi); for(int i = 0;iGetEntries();i++) { tree->GetEntry(i); TLorentzVector tau1,tau2,gamma; tau1.SetPtEtaPhiM(true_taupos_pt,true_taupos_eta,true_taupos_phi,1.78); tau2.SetPtEtaPhiM(true_tauneg_pt,true_tauneg_eta,true_tauneg_phi,1.78); gamma.SetPtEtaPhiM(true_gamma_pt,true_gamma_eta,true_gamma_phi,0); control1->Fill((tau1+gamma).M()); control2->Fill((tau2+gamma).M()); } control1->SetLineWidth(3); control2->SetLineWidth(3); TCanvas *c5 = new TCanvas("c5","c5",800,800); c5->cd(); control1->GetXaxis()->SetTitle("taupos-gamma inv mass [GeV]"); control1->Draw("hist"); TCanvas *c6 = new TCanvas("c6","c6",800,800); c6->cd(); control2->GetXaxis()->SetTitle("tauneg-gamma inv mass [GeV]"); control2->Draw("hist"); }