////////////////////////////////////////////////////////// // This class has been automatically generated on // Wed Mar 4 10:41:18 2009 by ROOT version 5.20/00 // from TTree CollectionTree/CollectionTree // found on file: ntuples/GJ1.root ////////////////////////////////////////////////////////// #ifndef gammaJetAnalysis_h #define gammaJetAnalysis_h #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class gammaJetAnalysis { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain // Declaration of leaf types Int_t RunNumber; Int_t EventNumber; Char_t StreamESD_ref[153]; Char_t Stream1_ref[153]; Char_t Token[153]; Int_t Run; Int_t Event; Int_t Time; Int_t LumiBlock; Int_t BCID; Int_t LVL1ID; Double_t Weight; Int_t IEvent; Int_t StatusElement; Int_t LVL1TriggerType; vector *LVL1TriggerInfo; vector *LVL2TriggerInfo; vector *EventFilterInfo; vector *StreamTagName; vector *StreamTagType; UInt_t NJets; vector *JetEta; vector *JetPt; vector *JetPhi; vector *JetE; vector *JetEMPt; vector *JetMatchTrueEta; vector *JetMatchTruePhi; vector *JetMatchTruePt; vector *JetMatchTrueDR; vector *JetMatchROIEt8; UInt_t NJets_true; vector *JetEta_true; vector *JetPt_true; vector *JetPhi_true; vector *JetE_true; vector *JetMatchRecoEta_true; vector *JetMatchRecoPhi_true; vector *JetMatchRecoPt_true; vector *JetMatchRecoDR_true; UInt_t NJetsC4; vector *JetC4Eta; vector *JetC4Phi; vector *JetC4Pt; vector *JetC4E; vector *JetC4MatchROIEt8; vector *JetC4EMPt; UInt_t NJetC4_true; vector *JetC4Eta_true; vector *JetC4Phi_true; vector *JetC4Pt_true; vector *JetC4E_true; UInt_t L1JetBitmap; UInt_t L2JetBitmap; UInt_t EFJetBitmap; UInt_t EFPhBitmap; UInt_t NJetROI; vector *JetROIEta; vector *JetROIPhi; vector *JetROIEt8; vector *JetROIEt6; vector *JetROIEt4; vector *JetROIThrPat; UInt_t NPhot; vector *PhotEta; vector *PhotPhi; vector *PhotPt; vector *PhotEtcone; vector *PhotIsEM; vector *PhotGood; vector *PhotNTrack; vector *PhotPtTrack; UInt_t NPhot_true; vector *PhotEta_true; vector *PhotPhi_true; vector *PhotPt_true; Double_t Part7Pt; Double_t Part7Eta; Double_t Part7Phi; Double_t Part8Pt; Double_t Part8Eta; Double_t Part8Phi; Double_t Mass; Double_t Mass_true; Double_t Chi; Double_t Chi_true; Double_t EtaBoost; Double_t EtaStar; UInt_t cutBitmap; UInt_t cutBitmap_true; // List of branches TBranch *b_RunNumber; //! TBranch *b_EventNumber; //! TBranch *b_StreamESD_ref; //! TBranch *b_Stream1_ref; //! TBranch *b_Token; //! TBranch *b_Run; //! TBranch *b_Event; //! TBranch *b_Time; //! TBranch *b_LumiBlock; //! TBranch *b_BCID; //! TBranch *b_LVL1ID; //! TBranch *b_Weight; //! TBranch *b_IEvent; //! TBranch *b_StatusElement; //! TBranch *b_LVL1TriggerType; //! TBranch *b_LVL1TriggerInfo; //! TBranch *b_LVL2TriggerInfo; //! TBranch *b_EventFilterInfo; //! TBranch *b_StreamTagName; //! TBranch *b_StreamTagType; //! TBranch *b_NJets; //! TBranch *b_JetEta; //! TBranch *b_JetPt; //! TBranch *b_JetPhi; //! TBranch *b_JetE; //! TBranch *b_JetEMPt; //! TBranch *b_JetMatchTrueEta; //! TBranch *b_JetMatchTruePhi; //! TBranch *b_JetMatchTruePt; //! TBranch *b_JetMatchTrueDR; //! TBranch *b_JetMatchROIEt8; //! TBranch *b_NJets_true; //! TBranch *b_JetEta_true; //! TBranch *b_JetPt_true; //! TBranch *b_JetPhi_true; //! TBranch *b_JetE_true; //! TBranch *b_JetMatchRecoEta_true; //! TBranch *b_JetMatchRecoPhi_true; //! TBranch *b_JetMatchRecoPt_true; //! TBranch *b_JetMatchRecoDR_true; //! TBranch *b_NJetsC4; //! TBranch *b_JetC4Eta; //! TBranch *b_JetC4Phi; //! TBranch *b_JetC4Pt; //! TBranch *b_JetC4E; //! TBranch *b_JetC4MatchROIEt8; //! TBranch *b_JetC4EMPt; //! TBranch *b_NJetsC4_true; //! TBranch *b_JetC4Eta_true; //! TBranch *b_JetC4Phi_true; //! TBranch *b_JetC4Pt_true; //! TBranch *b_JetC4E_true; //! TBranch *b_L1JetBitmap; //! TBranch *b_L2JetBitmap; //! TBranch *b_EFJetBitmap; //! TBranch *b_EFPhBitmap; //! TBranch *b_NJetROI; //! TBranch *b_JetROIEta; //! TBranch *b_JetROIPhi; //! TBranch *b_JetROIEt8; //! TBranch *b_JetROIEt6; //! TBranch *b_JetROIEt4; //! TBranch *b_JetROIThrPat; //! TBranch *b_NPhot; //! TBranch *b_PhotEta; //! TBranch *b_PhotPhi; //! TBranch *b_PhotPt; //! TBranch *b_PhotEtcone; //! TBranch *b_PhotIsEM; //! TBranch *b_PhotGood; //! TBranch *b_PhotNTrack; //! TBranch *b_PhotPtTrack; //! TBranch *b_NPhot_true; //! TBranch *b_PhotEta_true; //! TBranch *b_PhotPhi_true; //! TBranch *b_PhotPt_true; //! TBranch *b_Part7Pt; //! TBranch *b_Part7Eta; //! TBranch *b_Part7Phi; //! TBranch *b_Part8Pt; //! TBranch *b_Part8Eta; //! TBranch *b_Part8Phi; //! TBranch *b_Mass; //! TBranch *b_Mass_true; //! TBranch *b_Chi; //! TBranch *b_Chi_true; //! TBranch *b_EtaBoost; //! TBranch *b_EtaStar; //! TBranch *b_cutBitMap; //! TBranch *b_cutBitmap_true; //! gammaJetAnalysis(TTree *tree=0); virtual ~gammaJetAnalysis(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual void Init(TTree *tree); virtual void Loop(Long64_t eventMax); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); virtual void ToggleBranchesOnOff(string command); virtual void SetWeight(double weight, string outputFilename, bool alsoFilterEvents=false, std::vector events=vector(0)) ; virtual bool PassesEventFilter(); virtual void FilterOutEvents(string outputFilename); virtual double GetWeightOfEvent(); virtual double GetJetRecoPt(int iJet); virtual void FillHistogram(TH1F& hist, const double& value); virtual void FillHistogram(TH2F& hist, const double& valuex, const double& valuey); virtual void SetCuts(const double& etConeCut_, const int& nTracksCut_, const double& ptJ2cut_, const double& phiCut_); virtual void CopyParametersFrom(gammaJetAnalysis* otherAnalysis); virtual TH1F CountTightPhotons(); virtual TH1F GetHistoIsTheLeadingPhotonTheSameAsTheLeadingTightPhoton(); virtual bool PassesEventCuts(); virtual pair GetNearestGJToThisJG(string object, unsigned int iObject, string trueOrReco); virtual TH1F GetHistoPtPhotonOverPtJetWhenTheTwoOverlap(string trueOrReco); virtual bool TrustJetIsReallyJet(unsigned int iJet,string trueOrReco); virtual int GetLeadingTightPhoton(); virtual int GetLeading(string object, string trueOrReco); virtual int GetSubleading(string object, string trueOrReco); virtual int GetMatchingTruePhotonToPhoton(unsigned int recoPhoton); virtual int GetMatchingTrueJetToJet(unsigned int recoJet); virtual TH1F GetHistoSpectrum(string option, string trueOrReco); virtual TH2F GetHistoJetPtVsGammaPt(string trueOrReco="reco"); virtual TH1F GetHistoBalance(); virtual TH2F GetHistoJet2PtVsBalance(); virtual TH2F GetHistoJESvsJetPt(string option="pseudodata"); virtual TH2F GetHistoJESvsJetPt_true(); virtual TH2F GetJetPtVsTruePt(); virtual TH2F GetPhotonPtVsPhotonTruePt(); virtual TH2F GetHistoPhotonPtOverJetPtVsAveragePt(string option="pseudodata"); virtual TH2F GetHistoGRecoOverJTrueVsAveragePt(); virtual void GetBothHistosGoverJandJESVsAverage(TH2F& histJESVsAverage, TH2F& histActualBalance, string option="pseudodata"); //this is a merger of GetHistoPhotonPtOverJetPtVsAveragePt() and GetHistoGRecoOverJTrueVsAveragePt(), to gain speed by looping through events once instead of twice. virtual void GetBothHistosGoverJandJESVsJetPt(TH2F& histJESVsJetPt, TH2F& histActualBalance, string option="pseudodata"); //QCD test functions, used to examine the effects of JES correction to the jet response. virtual TH2F GetHistoResponseToJets(TGraphErrors* graphJESVsJetPt = NULL); //analysis parameters double luminosity; //in pb^{-1}. unsigned int prescale; //how many events to advance at each step for speed bool useEMscaleAsRecoJetPt; //cuts double etConeCut; //maximum fraction of photon's pt to allow as pt around photon within DeltaR of 0.2 int nTracksCut; //maximum tracks to allow around photon double ptJ2cut; //in GeV, the maximum allowed j2 pt double phiCut; //phi needs to be at least as much to consider gamma-jet back to back. private: double pi; //=3.14159.... double GeV; //=1000 TRandom randomEngine; }; #endif #ifdef gammaJetAnalysis_cxx //CONSTRUCTOR gammaJetAnalysis::gammaJetAnalysis(TTree *tree) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. pi = TMath::Pi(); GeV=1000; randomEngine=TRandom(); //defaults prescale=1; luminosity=1; //in pb^{-1}. useEMscaleAsRecoJetPt=false; etConeCut=0.1; nTracksCut=0; ptJ2cut=0; phiCut=pi-0.2; if (tree == 0) { TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("ntuples/GJ1.root"); if (!f) { f = new TFile("ntuples/GJ1.root"); } tree = (TTree*)gDirectory->Get("CollectionTree"); } Init(tree); } gammaJetAnalysis::~gammaJetAnalysis() { if (!fChain) return; delete fChain->GetCurrentFile(); } Int_t gammaJetAnalysis::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Long64_t gammaJetAnalysis::LoadTree(Long64_t entry) { // Set the environment to read one entry if (!fChain) return -5; Long64_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (!fChain->InheritsFrom(TChain::Class())) return centry; TChain *chain = (TChain*)fChain; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); } return centry; } void gammaJetAnalysis::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. // It is normally not necessary to make changes to the generated // code, but the routine can be extended by the user if needed. // Init() will be called many times when running on PROOF // (once per file to be processed). // Set object pointer LVL1TriggerInfo = 0; LVL2TriggerInfo = 0; EventFilterInfo = 0; StreamTagName = 0; StreamTagType = 0; JetEta = 0; JetPt = 0; JetPhi = 0; JetE = 0; JetEMPt = 0; JetMatchTrueEta = 0; JetMatchTruePhi = 0; JetMatchTruePt = 0; JetMatchTrueDR = 0; JetMatchROIEt8 = 0; JetEta_true = 0; JetPt_true = 0; JetPhi_true = 0; JetE_true = 0; JetMatchRecoEta_true = 0; JetMatchRecoPhi_true = 0; JetMatchRecoPt_true = 0; JetMatchRecoDR_true = 0; JetC4Eta = 0; JetC4Phi = 0; JetC4Pt = 0; JetC4E = 0; JetC4MatchROIEt8 = 0; JetC4EMPt = 0; JetC4Eta_true = 0; JetC4Phi_true = 0; JetC4Pt_true = 0; JetC4E_true = 0; JetROIEta = 0; JetROIPhi = 0; JetROIEt8 = 0; JetROIEt6 = 0; JetROIEt4 = 0; JetROIThrPat = 0; PhotEta = 0; PhotPhi = 0; PhotPt = 0; PhotEtcone = 0; PhotIsEM = 0; PhotGood = 0; PhotNTrack = 0; PhotPtTrack = 0; PhotEta_true = 0; PhotPhi_true = 0; PhotPt_true = 0; // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("RunNumber", &RunNumber, &b_RunNumber); fChain->SetBranchAddress("EventNumber", &EventNumber, &b_EventNumber); fChain->SetBranchAddress("StreamESD_ref", StreamESD_ref, &b_StreamESD_ref); fChain->SetBranchAddress("Stream1_ref", Stream1_ref, &b_Stream1_ref); fChain->SetBranchAddress("Token", Token, &b_Token); fChain->SetBranchAddress("Run", &Run, &b_Run); fChain->SetBranchAddress("Event", &Event, &b_Event); fChain->SetBranchAddress("Time", &Time, &b_Time); fChain->SetBranchAddress("LumiBlock", &LumiBlock, &b_LumiBlock); fChain->SetBranchAddress("BCID", &BCID, &b_BCID); fChain->SetBranchAddress("LVL1ID", &LVL1ID, &b_LVL1ID); fChain->SetBranchAddress("Weight", &Weight, &b_Weight); fChain->SetBranchAddress("IEvent", &IEvent, &b_IEvent); fChain->SetBranchAddress("StatusElement", &StatusElement, &b_StatusElement); fChain->SetBranchAddress("LVL1TriggerType", &LVL1TriggerType, &b_LVL1TriggerType); fChain->SetBranchAddress("LVL1TriggerInfo", &LVL1TriggerInfo, &b_LVL1TriggerInfo); fChain->SetBranchAddress("LVL2TriggerInfo", &LVL2TriggerInfo, &b_LVL2TriggerInfo); fChain->SetBranchAddress("EventFilterInfo", &EventFilterInfo, &b_EventFilterInfo); fChain->SetBranchAddress("StreamTagName", &StreamTagName, &b_StreamTagName); fChain->SetBranchAddress("StreamTagType", &StreamTagType, &b_StreamTagType); fChain->SetBranchAddress("NJets", &NJets, &b_NJets); fChain->SetBranchAddress("JetEta", &JetEta, &b_JetEta); fChain->SetBranchAddress("JetPt", &JetPt, &b_JetPt); fChain->SetBranchAddress("JetPhi", &JetPhi, &b_JetPhi); fChain->SetBranchAddress("JetE", &JetE, &b_JetE); fChain->SetBranchAddress("JetEMPt", &JetEMPt, &b_JetEMPt); fChain->SetBranchAddress("JetMatchTrueEta", &JetMatchTrueEta, &b_JetMatchTrueEta); fChain->SetBranchAddress("JetMatchTruePhi", &JetMatchTruePhi, &b_JetMatchTruePhi); fChain->SetBranchAddress("JetMatchTruePt", &JetMatchTruePt, &b_JetMatchTruePt); fChain->SetBranchAddress("JetMatchTrueDR", &JetMatchTrueDR, &b_JetMatchTrueDR); fChain->SetBranchAddress("JetMatchROIEt8", &JetMatchROIEt8, &b_JetMatchROIEt8); fChain->SetBranchAddress("NJets_true", &NJets_true, &b_NJets_true); fChain->SetBranchAddress("JetEta_true", &JetEta_true, &b_JetEta_true); fChain->SetBranchAddress("JetPt_true", &JetPt_true, &b_JetPt_true); fChain->SetBranchAddress("JetPhi_true", &JetPhi_true, &b_JetPhi_true); fChain->SetBranchAddress("JetE_true", &JetE_true, &b_JetE_true); fChain->SetBranchAddress("JetMatchRecoEta_true", &JetMatchRecoEta_true, &b_JetMatchRecoEta_true); fChain->SetBranchAddress("JetMatchRecoPhi_true", &JetMatchRecoPhi_true, &b_JetMatchRecoPhi_true); fChain->SetBranchAddress("JetMatchRecoPt_true", &JetMatchRecoPt_true, &b_JetMatchRecoPt_true); fChain->SetBranchAddress("JetMatchRecoDR_true", &JetMatchRecoDR_true, &b_JetMatchRecoDR_true); fChain->SetBranchAddress("NJetsC4", &NJetsC4, &b_NJetsC4); fChain->SetBranchAddress("JetC4Eta", &JetC4Eta, &b_JetC4Eta); fChain->SetBranchAddress("JetC4Phi", &JetC4Phi, &b_JetC4Phi); fChain->SetBranchAddress("JetC4Pt", &JetC4Pt, &b_JetC4Pt); fChain->SetBranchAddress("JetC4E", &JetC4E, &b_JetC4E); fChain->SetBranchAddress("JetC4MatchROIEt8", &JetC4MatchROIEt8, &b_JetC4MatchROIEt8); fChain->SetBranchAddress("JetC4EMPt", &JetC4EMPt, &b_JetC4EMPt); fChain->SetBranchAddress("NJetC4_true", &NJetC4_true, &b_NJetsC4_true); fChain->SetBranchAddress("JetC4Eta_true", &JetC4Eta_true, &b_JetC4Eta_true); fChain->SetBranchAddress("JetC4Phi_true", &JetC4Phi_true, &b_JetC4Phi_true); fChain->SetBranchAddress("JetC4Pt_true", &JetC4Pt_true, &b_JetC4Pt_true); fChain->SetBranchAddress("JetC4E_true", &JetC4E_true, &b_JetC4E_true); fChain->SetBranchAddress("L1JetBitmap", &L1JetBitmap, &b_L1JetBitmap); fChain->SetBranchAddress("L2JetBitmap", &L2JetBitmap, &b_L2JetBitmap); fChain->SetBranchAddress("EFJetBitmap", &EFJetBitmap, &b_EFJetBitmap); fChain->SetBranchAddress("EFPhBitmap", &EFPhBitmap, &b_EFPhBitmap); fChain->SetBranchAddress("NJetROI", &NJetROI, &b_NJetROI); fChain->SetBranchAddress("JetROIEta", &JetROIEta, &b_JetROIEta); fChain->SetBranchAddress("JetROIPhi", &JetROIPhi, &b_JetROIPhi); fChain->SetBranchAddress("JetROIEt8", &JetROIEt8, &b_JetROIEt8); fChain->SetBranchAddress("JetROIEt6", &JetROIEt6, &b_JetROIEt6); fChain->SetBranchAddress("JetROIEt4", &JetROIEt4, &b_JetROIEt4); fChain->SetBranchAddress("JetROIThrPat", &JetROIThrPat, &b_JetROIThrPat); fChain->SetBranchAddress("NPhot", &NPhot, &b_NPhot); fChain->SetBranchAddress("PhotEta", &PhotEta, &b_PhotEta); fChain->SetBranchAddress("PhotPhi", &PhotPhi, &b_PhotPhi); fChain->SetBranchAddress("PhotPt", &PhotPt, &b_PhotPt); fChain->SetBranchAddress("PhotEtcone", &PhotEtcone, &b_PhotEtcone); fChain->SetBranchAddress("PhotIsEM", &PhotIsEM, &b_PhotIsEM); fChain->SetBranchAddress("PhotGood", &PhotGood, &b_PhotGood); fChain->SetBranchAddress("PhotNTrack", &PhotNTrack, &b_PhotNTrack); fChain->SetBranchAddress("PhotPtTrack", &PhotPtTrack, &b_PhotPtTrack); fChain->SetBranchAddress("NPhot_true", &NPhot_true, &b_NPhot_true); fChain->SetBranchAddress("PhotEta_true", &PhotEta_true, &b_PhotEta_true); fChain->SetBranchAddress("PhotPhi_true", &PhotPhi_true, &b_PhotPhi_true); fChain->SetBranchAddress("PhotPt_true", &PhotPt_true, &b_PhotPt_true); fChain->SetBranchAddress("Part7Pt", &Part7Pt, &b_Part7Pt); fChain->SetBranchAddress("Part7Eta", &Part7Eta, &b_Part7Eta); fChain->SetBranchAddress("Part7Phi", &Part7Phi, &b_Part7Phi); fChain->SetBranchAddress("Part8Pt", &Part8Pt, &b_Part8Pt); fChain->SetBranchAddress("Part8Eta", &Part8Eta, &b_Part8Eta); fChain->SetBranchAddress("Part8Phi", &Part8Phi, &b_Part8Phi); fChain->SetBranchAddress("Mass", &Mass, &b_Mass); fChain->SetBranchAddress("Mass_true", &Mass_true, &b_Mass_true); fChain->SetBranchAddress("Chi", &Chi, &b_Chi); fChain->SetBranchAddress("Chi_true", &Chi_true, &b_Chi_true); fChain->SetBranchAddress("EtaBoost", &EtaBoost, &b_EtaBoost); fChain->SetBranchAddress("EtaStar", &EtaStar, &b_EtaStar); fChain->SetBranchAddress("cutBitmap", &cutBitmap, &b_cutBitMap); fChain->SetBranchAddress("cutBitmap_true", &cutBitmap_true, &b_cutBitmap_true); Notify(); } Bool_t gammaJetAnalysis::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. It is normally not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. return kTRUE; } void gammaJetAnalysis::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t gammaJetAnalysis::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef gammaJetAnalysis_cxx