Changes in modules/PhotonID.cc [4fd4f01:341014c] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/PhotonID.cc
r4fd4f01 r341014c 17 17 */ 18 18 19 20 19 /** \class PhotonID 21 20 * … … 34 33 #include "classes/DelphesFormula.h" 35 34 35 #include "ExRootAnalysis/ExRootClassifier.h" 36 #include "ExRootAnalysis/ExRootFilter.h" 36 37 #include "ExRootAnalysis/ExRootResult.h" 37 #include "ExRootAnalysis/ExRootFilter.h" 38 #include "ExRootAnalysis/ExRootClassifier.h" 39 38 39 #include "TDatabasePDG.h" 40 #include "TFormula.h" 41 #include "TLorentzVector.h" 40 42 #include "TMath.h" 43 #include "TObjArray.h" 44 #include "TRandom3.h" 41 45 #include "TString.h" 42 #include "TFormula.h" 43 #include "TRandom3.h" 44 #include "TObjArray.h" 45 #include "TDatabasePDG.h" 46 #include "TLorentzVector.h" 47 48 #include <algorithm> 49 #include <stdexcept> 46 47 #include <algorithm> 50 48 #include <iostream> 51 49 #include <sstream> 50 #include <stdexcept> 52 51 53 52 using namespace std; … … 56 55 57 56 PhotonID::PhotonID() : 58 fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), 59 { 60 fPromptFormula= new DelphesFormula;61 fNonPromptFormula= new DelphesFormula;62 fFakeFormula= new DelphesFormula;57 fPromptFormula(0), fNonPromptFormula(0), fFakeFormula(0), fItInputPhotonArray(0), fItInputGenArray(0) 58 { 59 fPromptFormula = new DelphesFormula; 60 fNonPromptFormula = new DelphesFormula; 61 fFakeFormula = new DelphesFormula; 63 62 } 64 63 … … 81 80 fNonPromptFormula->Compile(GetString("NonPromptFormula", "1.0")); 82 81 fFakeFormula->Compile(GetString("FakeFormula", "1.0")); 83 82 84 83 // import input arrays 85 84 fInputPhotonArray = ImportArray(GetString("InputPhotonArray", "PhotonIsolation/photons")); … … 111 110 112 111 void PhotonID::Process() 113 { 112 { 114 113 Candidate *candidate, *mother; 115 114 Double_t pt, eta, phi, e; 116 115 Double_t relIso; 117 116 Bool_t isolated; 118 117 119 118 //cout<< "---- new event ---------"<<endl; 120 119 121 120 fItInputPhotonArray->Reset(); 122 while((candidate = static_cast<Candidate *>(fItInputPhotonArray->Next())))121 while((candidate = static_cast<Candidate *>(fItInputPhotonArray->Next()))) 123 122 { 124 123 125 124 mother = candidate; 126 candidate = static_cast<Candidate *>(candidate->Clone());125 candidate = static_cast<Candidate *>(candidate->Clone()); 127 126 candidate->AddCandidate(mother); 128 127 … … 134 133 e = candidateMomentum.E(); 135 134 136 if 135 if(pt < fPTMin) continue; 137 136 138 137 //cout<< " ---- photon -----: "<<pt<<","<<eta<<","<<phi<<endl; 139 138 140 139 // find out if photon matches does not match photon in gen collection and apply fae efficiency 141 if (isFake(candidate) )140 if(isFake(candidate)) 142 141 { 143 142 //cout<<" Fake!"<<endl; … … 157 156 158 157 // if isolated apply prompt formula 159 if 158 if(isolated) 160 159 { 161 160 //cout<<" isolated!: "<<relIso<<endl; … … 164 163 candidate->Status = 1; 165 164 fOutputArray->Add(candidate); 166 167 165 } 168 166 169 167 // if non-isolated apply non-prompt formula 170 168 else … … 182 180 //------------------------------------------------------------------------------ 183 181 184 Bool_t PhotonID::isFake(const Candidate *obj){ 182 Bool_t PhotonID::isFake(const Candidate *obj) 183 { 185 184 186 185 const TLorentzVector &mom_rec = obj->Momentum; 187 186 188 187 Bool_t matches = false; 189 188 fItInputGenArray->Reset(); 190 189 Candidate *gen; 191 192 while((gen = static_cast<Candidate *>(fItInputGenArray->Next())))190 191 while((gen = static_cast<Candidate *>(fItInputGenArray->Next()))) 193 192 { 194 193 const TLorentzVector &mom_gen = gen->Momentum; 195 194 Int_t status = gen->Status; 196 195 Int_t pdgCode = TMath::Abs(gen->PID); 197 Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) /mom_rec.Pt());196 Float_t dPtOverPt = TMath::Abs((mom_gen.Pt() - mom_rec.Pt()) / mom_rec.Pt()); 198 197 Float_t deltaR = mom_gen.DeltaR(mom_rec); 199 198 200 if 201 if 202 if 203 if 199 if(status != 1) continue; 200 if(pdgCode != 22) continue; 201 if(dPtOverPt > 0.5) continue; 202 if(deltaR > 0.1) continue; 204 203 205 204 matches = true; 206 205 break; 207 208 206 } 209 207
Note:
See TracChangeset
for help on using the changeset viewer.