///////////////////////////////////////////////////////////////////////////////// ////////////////////////////// ExampleMacro.C /////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// //// Creates histograms from a flat ntuple (the output of the analysis script. //// This allows for faster remaking of histograms compared to creating them in the anlysis script. //// Run in interpreter mode, e.g. root -l -q -b ExampleMacro.C //// Please add other skeleton examples as you find them useful. #include "TCanvas.h" #include "TFile.h" #include "TROOT.h" #include "TH1F.h" #include "TRandom.h" #include "TGraphErrors.h" #include "AnalysisClass.h" using namespace std; float label_x; float label_y; //const bool ATLASLabel = true; void ExampleMacroSimple(){ TFile f_ex("test-hist.root"); TTree *tree = (TTree*)f_ex.Get("recoTree"); AnalysisClass* myClass = new AnalysisClass(); myClass->Init(tree); TH1F *h_dielectronMass = new TH1F("h_diEMass", "DiElectron Mass", 50, 66, 116); int nEntries = tree->GetEntries(); cout << nEntries << endl; for(int i = 0; i < nEntries; i++){ myClass->GetEntry(i); TLorentzVector e1; e1.SetPtEtaPhiE(myClass->DiLeptonFinder_leadingElectron_pT, myClass->DiLeptonFinder_leadingElectron_eta, myClass->DiLeptonFinder_leadingElectron_phi, myClass->DiLeptonFinder_leadingElectron_E); TLorentzVector e2; e2.SetPtEtaPhiE(myClass->DiLeptonFinder_secondLeadingElectron_pT, myClass->DiLeptonFinder_secondLeadingElectron_eta, myClass->DiLeptonFinder_secondLeadingElectron_phi, myClass->DiLeptonFinder_secondLeadingElectron_E); if( myClass->DiLeptonFinder_n_electron_candidates == 2 ){ h_dielectronMass->Fill( (e1+e2).M(), myClass->eventWeight ); }//end if }//end for : loop over all events f_ex.Close(); }//end ExampleMacroSimple