9 |
|
extern vector<bool> PFnoPUflag; |
10 |
|
|
11 |
|
//-------------------------------------------------------------------------------------------------- |
12 |
+ |
double betaCorrectedIso(ControlFlags & ctrl, |
13 |
+ |
const mithep::PFCandidate * photon, |
14 |
+ |
const mithep::Array<mithep::PFCandidate> * fPFCandidates ) |
15 |
+ |
//-------------------------------------------------------------------------------------------------- |
16 |
+ |
{ |
17 |
+ |
|
18 |
+ |
// |
19 |
+ |
// final iso |
20 |
+ |
// |
21 |
+ |
Double_t fChargedIso = 0.0; |
22 |
+ |
Double_t fGammaIso = 0.0; |
23 |
+ |
Double_t fNeutralHadronIso = 0.0; |
24 |
+ |
|
25 |
+ |
// |
26 |
+ |
// Loop over PF Candidates |
27 |
+ |
// |
28 |
+ |
for(int k=0; k<fPFCandidates->GetEntries(); ++k) { |
29 |
+ |
|
30 |
+ |
if( !(PFnoPUflag[k]) ) continue; // my PF no PU hack |
31 |
+ |
const mithep::PFCandidate *pf = (mithep::PFCandidate*)((*fPFCandidates)[k]); |
32 |
+ |
|
33 |
+ |
Double_t deta = (photon->Eta() - pf->Eta()); |
34 |
+ |
Double_t dphi = mithep::MathUtils::DeltaPhi(Double_t(photon->Phi()),Double_t(pf->Phi())); |
35 |
+ |
Double_t dr = mithep::MathUtils::DeltaR(photon->Phi(),photon->Eta(), pf->Phi(), pf->Eta()); |
36 |
+ |
if (dr > 0.4) continue; |
37 |
+ |
|
38 |
+ |
// skip this photon |
39 |
+ |
if( abs(pf->PFType()) == mithep::PFCandidate::eGamma && |
40 |
+ |
pf->Et() == photon->Et() ) continue; |
41 |
+ |
|
42 |
+ |
if (dr < 1.0) { |
43 |
+ |
|
44 |
+ |
// |
45 |
+ |
// Charged Iso |
46 |
+ |
// |
47 |
+ |
if (pf->Charge() != 0 && (pf->HasTrackerTrk()||pf->HasGsfTrk()) ) { |
48 |
+ |
if( dr < 0.01 ) continue; |
49 |
+ |
// if (abs(pf->PFType()) == mithep::PFCandidate::eElectron || |
50 |
+ |
// abs(pf->PFType()) == mithep::PFCandidate::eMuon) continue; |
51 |
+ |
fChargedIso += pf->Pt(); |
52 |
+ |
} |
53 |
+ |
|
54 |
+ |
// |
55 |
+ |
// Gamma Iso |
56 |
+ |
// |
57 |
+ |
else if (abs(pf->PFType()) == mithep::PFCandidate::eGamma) { |
58 |
+ |
if( pf->Pt() > 0.5 && dr > 0.08) // need the inner veto? |
59 |
+ |
fGammaIso += pf->Pt(); |
60 |
+ |
} |
61 |
+ |
|
62 |
+ |
// |
63 |
+ |
// Other Neutrals |
64 |
+ |
// |
65 |
+ |
else { |
66 |
+ |
// KH, add to sync |
67 |
+ |
if( pf->Pt() > 0.5 ) |
68 |
+ |
fNeutralHadronIso += pf->Pt(); |
69 |
+ |
} |
70 |
+ |
|
71 |
+ |
} |
72 |
+ |
|
73 |
+ |
} |
74 |
+ |
|
75 |
+ |
double pfIso = fChargedIso + fGammaIso + fNeutralHadronIso; |
76 |
+ |
return pfIso; |
77 |
+ |
} |
78 |
+ |
|
79 |
+ |
|
80 |
+ |
|
81 |
+ |
//-------------------------------------------------------------------------------------------------- |
82 |
|
// typeI = PF IDed photons. NB : repurpose PFnoPUflag, flip for recovered photons |
83 |
|
// so that they are skipped in the isolation calculation |
84 |
|
//-------------------------------------------------------------------------------------------------- |
85 |
< |
bool recover_typeI_Photon( mithep::Muon * mu, |
85 |
> |
bool recover_typeI_Photon( ControlFlags & ctrl, |
86 |
> |
mithep::Muon * mu, |
87 |
|
const mithep::Array<mithep::PFCandidate> * pfArr ) |
88 |
|
//-------------------------------------------------------------------------------------------------- |
89 |
|
{ |
100 |
|
if( dR < 0.07 ) photonIndices.push_back(i); |
101 |
|
|
102 |
|
// "need tighter cuts for other photons ..." |
103 |
< |
if( dR < 0.5 && pf->Pt() > 4. ) photonIndices.push_back(i); |
103 |
> |
if( dR < 0.5 && pf->Pt() > 4. && betaCorrectedIso(ctrl, pf, pfArr)/pf->Pt() < 1.0) |
104 |
> |
photonIndices.push_back(i); |
105 |
|
} |
106 |
|
|
107 |
|
int index=-1; |
136 |
|
//-------------------------------------------------------------------------------------------------- |
137 |
|
// typeII = "PFClusters linked to muons" |
138 |
|
//-------------------------------------------------------------------------------------------------- |
139 |
< |
bool recover_typeII_Photon( mithep::Muon * mu, |
139 |
> |
bool recover_typeII_Photon( ControlFlags & ctrl, |
140 |
> |
mithep::Muon * mu, |
141 |
|
const mithep::Array<mithep::PFCandidate> * pfArr ) |
142 |
|
//-------------------------------------------------------------------------------------------------- |
143 |
|
{ |