#include "TVector3.h" #include "TLorentzVector.h" #include #include "TFile.h" #include "TTree.h" #include "TH2.h" #include "TF1.h" #include "TCanvas.h" void delphes_alanysis() { // Open file TFile *file = TFile::Open("/home/kanhaiya/Madgraph/MG5_aMC_v2_5_5/new_gghaa/Events/run_02/tag_1_delphes_events.root"); if(file==NULL){ // Check if file exist printf("File missing!"); return; } TTree* t = (TTree*)file->Get("Delphes"); // Get the Tree with name t->SetMakeClass(1); //<===== important // Declaration of leaf types Int_t Photon_; Float_t PT[10000]; Float_t Eta[10000]; Float_t Phi[10000]; // List of branches // TBranch *bpx = t4->GetBranch("fTracks.fPx"); TBranch *bnphot = t->GetBranch("Photon"); TBranch *bphot_pt = t->GetBranch("Photon.PT"); TBranch *bphot_eta = t->GetBranch("Photon.Eta"); TBranch *bphot_phi = t->GetBranch("Photon.Phi"); bnphot->SetAddress(&Photon_); bphot_pt->SetAddress(PT); bphot_eta->SetAddress(Eta); bphot_phi->SetAddress(Phi); // Defining the histograms TH1D *new_hist = new TH1D("new_hist","Histogram", 100, 0. ,200.); for (Long64_t event=0;eventGetEntries();event++) { new_hist->Fill(PT[event]); } new_hist->Draw(); }