#ifdef __CLING__ R__LOAD_LIBRARY(libDelphes) #include "classes/DelphesClasses.h" #include "external/ExRootAnalysis/ExRootTreeReader.h" #endif //------------------------------------------------------------------------------ void SampleMacro(const char *inputFile0,const char *inputFile1){ gSystem->Load("libDelphes"); TCanvas *c1 = new TCanvas("Photon Contour"); c1->Divide(2,1); const char *name[2] = {"Signal", "Background"}; TH2F *histPhotonD[2]; const char *inputFiles[2] = {inputFile0, inputFile1}; for(int nfile=0; nfile<2; nfile++){ // Create chain of root trees TChain chain("Delphes"); chain.Add(inputFile); // Create object of class ExRootTreeReader ExRootTreeReader *treeReader = new ExRootTreeReader(&chain); Long64_t numberOfEntries = treeReader->GetEntries(); // Get pointers to branches used in this analysis TClonesArray *branchPhoton = treeReader->UseBranch("Photon"); // Book histograms histPhotonD[nfile]= new TH2F(TString::Format("contour_%d", nfile),"", 50,-2.5,2.5,50,-3,3); histPhotonD[nfile]->SetStats(0); histPhotonD[nfile]->SetTitle(name[nfile]); Photon *photon; // Loop over all events for(Int_t entry = 0; entry < numberOfEntries; ++entry) { // Load selected branches with data from specified event treeReader->ReadEntry(entry); // If event contains at least 1 photon if(branchPhoton->GetEntries() > 0) { // Take first photon photon = (Photon*) branchPhoton->At(0); histPhotonD[nfile]->Fill(photon->Eta,photon->Phi); } } }// number loop c1->cd(1); histPhotonD[0]->Draw("CONT4Z"); c1->cd(2); histPhotonD[1]->Draw("CONT4Z"); }