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