1 |
bendavid |
1.33 |
// $Id: PhotonTools.cc,v 1.32 2012/07/24 11:41:21 fabstoec Exp $
|
2 |
bendavid |
1.1 |
|
3 |
|
|
#include "MitPhysics/Utils/interface/PhotonTools.h"
|
4 |
|
|
#include "MitPhysics/Utils/interface/ElectronTools.h"
|
5 |
fabstoec |
1.5 |
#include "MitPhysics/Utils/interface/IsolationTools.h"
|
6 |
bendavid |
1.1 |
#include "MitAna/DataTree/interface/StableData.h"
|
7 |
|
|
#include <TFile.h>
|
8 |
fabstoec |
1.8 |
#include <TRandom3.h>
|
9 |
bendavid |
1.1 |
|
10 |
|
|
ClassImp(mithep::PhotonTools)
|
11 |
|
|
|
12 |
|
|
using namespace mithep;
|
13 |
|
|
|
14 |
|
|
//--------------------------------------------------------------------------------------------------
|
15 |
|
|
PhotonTools::PhotonTools()
|
16 |
|
|
{
|
17 |
|
|
// Constructor.
|
18 |
|
|
}
|
19 |
|
|
|
20 |
bendavid |
1.16 |
//--------------------------------------------------------------------------------------------------
|
21 |
|
|
PhotonTools::eScaleCats PhotonTools::EScaleCat(const Photon *p)
|
22 |
|
|
{
|
23 |
|
|
if (p->SCluster()->AbsEta()<1.0) {
|
24 |
bendavid |
1.19 |
if (p->R9()>0.94) {
|
25 |
|
|
Int_t ieta = p->SCluster()->Seed()->IEta();
|
26 |
|
|
Int_t iphi = p->SCluster()->Seed()->IPhi();
|
27 |
|
|
Bool_t central = ( ((std::abs(ieta)-1)/5+1 >= 2 && (std::abs(ieta)-1)/5+1 < 5) || ((std::abs(ieta)-1)/5+1 >= 7 && (std::abs(ieta)-1)/5+1 < 9 ) || ((std::abs(ieta)-1)/5+1 >= 11 && (std::abs(ieta)-1)/5+1 < 13) || ((std::abs(ieta)-1)/5+1 >= 15 && (std::abs(ieta)-1)/5+1 < 17) ) && (iphi %20) > 5 && (iphi%20) <16;
|
28 |
|
|
|
29 |
|
|
if (central) return kEBlowEtaGoldCenter;
|
30 |
|
|
else return kEBlowEtaGoldGap;
|
31 |
|
|
}
|
32 |
bendavid |
1.16 |
else return kEBlowEtaBad;
|
33 |
|
|
}
|
34 |
|
|
else if (p->SCluster()->AbsEta()<1.5) {
|
35 |
|
|
if (p->R9()>0.94) return kEBhighEtaGold;
|
36 |
|
|
else return kEBhighEtaBad;
|
37 |
|
|
}
|
38 |
|
|
else if (p->SCluster()->AbsEta()<2.0) {
|
39 |
|
|
if (p->R9()>0.94) return kEElowEtaGold;
|
40 |
|
|
else return kEElowEtaBad;
|
41 |
|
|
}
|
42 |
|
|
else {
|
43 |
|
|
if (p->R9()>0.94) return kEEhighEtaGold;
|
44 |
|
|
else return kEEhighEtaBad;
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
}
|
48 |
fabstoec |
1.8 |
|
49 |
|
|
void PhotonTools::ScalePhoton(Photon* p, Double_t scale) {
|
50 |
|
|
if( !p ) return;
|
51 |
|
|
FourVectorM mom = p->Mom();
|
52 |
|
|
p->SetMom(scale*mom.X(), scale*mom.Y(), scale*mom.Z(), scale*mom.E());
|
53 |
|
|
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
void PhotonTools::SmearPhoton(Photon* p, TRandom3* rng, Double_t width, UInt_t iSeed) {
|
57 |
|
|
|
58 |
|
|
if( !p ) return;
|
59 |
|
|
if( !rng) return;
|
60 |
|
|
if( width < 0.) return;
|
61 |
|
|
|
62 |
fabstoec |
1.10 |
rng->SetSeed(iSeed);
|
63 |
fabstoec |
1.8 |
FourVectorM mom = p->Mom();
|
64 |
|
|
Double_t scale = rng->Gaus(1.,width);
|
65 |
fabstoec |
1.10 |
|
66 |
fabstoec |
1.8 |
if( scale > 0)
|
67 |
|
|
p->SetMom(scale*mom.X(), scale*mom.Y(), scale*mom.Z(), scale*mom.E());
|
68 |
bendavid |
1.13 |
|
69 |
|
|
return;
|
70 |
|
|
}
|
71 |
fabstoec |
1.8 |
|
72 |
bendavid |
1.13 |
void PhotonTools::SmearPhotonError(Photon* p, Double_t width) {
|
73 |
|
|
|
74 |
|
|
if( !p ) return;
|
75 |
|
|
if( width < 0.) return;
|
76 |
|
|
|
77 |
bendavid |
1.14 |
|
78 |
|
|
Double_t smear = p->EnergySmearing();
|
79 |
|
|
p->SetEnergySmearing(TMath::Sqrt(smear*smear+width*width*p->E()*p->E()));
|
80 |
|
|
|
81 |
bendavid |
1.13 |
Double_t err = p->EnergyErrSmeared();
|
82 |
|
|
if (err>=0.0) {
|
83 |
|
|
p->SetEnergyErrSmeared(TMath::Sqrt(err*err + width*width*p->E()*p->E()));
|
84 |
|
|
}
|
85 |
|
|
|
86 |
fabstoec |
1.8 |
}
|
87 |
|
|
|
88 |
bendavid |
1.16 |
void PhotonTools::ScalePhotonR9(Photon* p, Double_t scale) {
|
89 |
|
|
p->SetR9(scale*p->R9());
|
90 |
|
|
}
|
91 |
|
|
|
92 |
bendavid |
1.23 |
|
93 |
bendavid |
1.16 |
void PhotonTools::ScalePhotonError(Photon* p, Double_t scale) {
|
94 |
|
|
p->SetEnergyErrSmeared(scale*p->EnergyErrSmeared());
|
95 |
|
|
}
|
96 |
|
|
|
97 |
bendavid |
1.1 |
//--------------------------------------------------------------------------------------------------
|
98 |
|
|
Bool_t PhotonTools::PassConversionId(const Photon *p, const DecayParticle *c) {
|
99 |
|
|
|
100 |
|
|
if (!c) return kTRUE;
|
101 |
|
|
|
102 |
|
|
ThreeVector dirconvsc = ThreeVector(p->SCluster()->Point()) - c->Position();
|
103 |
|
|
Double_t deta = c->Eta()-dirconvsc.Eta();
|
104 |
|
|
Double_t dphi = MathUtils::DeltaPhi(c->Phi(),dirconvsc.Phi());
|
105 |
|
|
Double_t eoverp = p->SCluster()->Energy()/c->P();
|
106 |
|
|
|
107 |
|
|
if (p->IsEB() && eoverp>2.0) return kFALSE;
|
108 |
|
|
if (p->IsEE() && eoverp>3.0) return kFALSE;
|
109 |
|
|
|
110 |
|
|
if (p->IsEE() && TMath::Abs(deta)>0.01) return kFALSE;
|
111 |
|
|
if (p->IsEE() && TMath::Abs(dphi)>0.01) return kFALSE;
|
112 |
|
|
|
113 |
|
|
return kTRUE;
|
114 |
|
|
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
//--------------------------------------------------------------------------------------------------
|
118 |
|
|
Bool_t PhotonTools::PassElectronVeto(const Photon *p, const ElectronCol *els) {
|
119 |
|
|
|
120 |
|
|
Bool_t pass = kTRUE;
|
121 |
|
|
for (UInt_t i=0; i<els->GetEntries(); ++i) {
|
122 |
|
|
const Electron *e = els->At(i);
|
123 |
|
|
if (e->SCluster()==p->SCluster() && e->GsfTrk()->NExpectedHitsInner()==0) {
|
124 |
|
|
pass = kFALSE;
|
125 |
|
|
}
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
return pass;
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
//--------------------------------------------------------------------------------------------------
|
132 |
bendavid |
1.13 |
const Electron *PhotonTools::MatchedElectron(const Photon *p, const ElectronCol *els) {
|
133 |
|
|
|
134 |
|
|
for (UInt_t i=0; i<els->GetEntries(); ++i) {
|
135 |
|
|
const Electron *e = els->At(i);
|
136 |
|
|
if ( e->SCluster()==p->SCluster() ) {
|
137 |
|
|
return e;
|
138 |
|
|
}
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
return 0;
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
//--------------------------------------------------------------------------------------------------
|
145 |
|
|
const Photon *PhotonTools::MatchedPhoton(const Electron *e, const PhotonCol *phs) {
|
146 |
|
|
|
147 |
|
|
for (UInt_t i=0; i<phs->GetEntries(); ++i) {
|
148 |
|
|
const Photon *p = phs->At(i);
|
149 |
|
|
if ( p->SCluster()==e->SCluster() ) {
|
150 |
|
|
return p;
|
151 |
|
|
}
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
return 0;
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
//--------------------------------------------------------------------------------------------------
|
158 |
|
|
const SuperCluster *PhotonTools::MatchedSC(const SuperCluster *psc, const SuperClusterCol *scs, Double_t drMin) {
|
159 |
|
|
|
160 |
|
|
Double_t drsmallest = 999.;
|
161 |
|
|
const SuperCluster *match = 0;
|
162 |
|
|
for (UInt_t i=0; i<scs->GetEntries(); ++i) {
|
163 |
|
|
const SuperCluster *sc = scs->At(i);
|
164 |
|
|
Double_t dr = MathUtils::DeltaR(*sc,*psc);
|
165 |
|
|
if ( dr<drsmallest && dr<drMin ) {
|
166 |
|
|
drsmallest = dr;
|
167 |
|
|
match = sc;
|
168 |
|
|
}
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
return match;
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
//--------------------------------------------------------------------------------------------------
|
175 |
bendavid |
1.25 |
const SuperCluster *PhotonTools::MatchedPFSC(const SuperCluster *psc, const PhotonCol *pfphos, const ElectronCol *eles, Double_t drMin) {
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
if (pfphos) {
|
179 |
|
|
for (UInt_t i=0; i<pfphos->GetEntries(); ++i) {
|
180 |
|
|
const Photon *pfpho = pfphos->At(i);
|
181 |
|
|
if (psc == pfpho->SCluster() && pfpho->PFSCluster()) return pfpho->PFSCluster();
|
182 |
|
|
}
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
for (UInt_t i=0; i<eles->GetEntries(); ++i) {
|
186 |
|
|
const Electron *ele = eles->At(i);
|
187 |
|
|
if (psc == ele->SCluster() && ele->PFSCluster()) return ele->PFSCluster();
|
188 |
|
|
}
|
189 |
|
|
|
190 |
|
|
Double_t drsmallest = 999.;
|
191 |
|
|
const SuperCluster *match = 0;
|
192 |
|
|
for (UInt_t i=0; i<eles->GetEntries(); ++i) {
|
193 |
|
|
const Electron *ele = eles->At(i);
|
194 |
|
|
//if (psc == ele->SCluster() && ele->HasPFSCluster()) return ele->PFSCluster();
|
195 |
|
|
if (!ele->PFSCluster()) continue;
|
196 |
|
|
|
197 |
|
|
Double_t dr = MathUtils::DeltaR(*ele->PFSCluster(),*psc);
|
198 |
|
|
if ( dr<drsmallest && dr<drMin ) {
|
199 |
|
|
drsmallest = dr;
|
200 |
|
|
match = ele->PFSCluster();
|
201 |
|
|
}
|
202 |
|
|
}
|
203 |
|
|
|
204 |
|
|
return match;
|
205 |
|
|
}
|
206 |
|
|
|
207 |
|
|
//--------------------------------------------------------------------------------------------------
|
208 |
fabstoec |
1.4 |
Double_t PhotonTools::ElectronVetoCiC(const Photon *p, const ElectronCol *els) {
|
209 |
|
|
|
210 |
|
|
for (UInt_t i=0; i<els->GetEntries(); ++i) {
|
211 |
|
|
const Electron *e = els->At(i);
|
212 |
fabstoec |
1.5 |
if (e->SCluster()==p->SCluster() ) {
|
213 |
|
|
//if( e->GsfTrk()->NExpectedHitsInner()==0 && e->GsfTrk()->Pt() > 2.5 ) {
|
214 |
|
|
if( e->GsfTrk()->NExpectedHitsInner()==0 ) {
|
215 |
|
|
double dEta = e->DeltaEtaSuperClusterTrackAtVtx();
|
216 |
|
|
double dPhi = e->DeltaPhiSuperClusterTrackAtVtx();
|
217 |
|
|
double dR = TMath::Sqrt(dEta*dEta+dPhi*dPhi);
|
218 |
|
|
return dR;
|
219 |
|
|
}
|
220 |
|
|
}
|
221 |
|
|
}
|
222 |
|
|
return 99.;
|
223 |
fabstoec |
1.4 |
}
|
224 |
|
|
|
225 |
|
|
//--------------------------------------------------------------------------------------------------
|
226 |
bendavid |
1.1 |
Bool_t PhotonTools::PassElectronVetoConvRecovery(const Photon *p, const ElectronCol *els, const DecayParticleCol *conversions, const BaseVertex *v) {
|
227 |
|
|
|
228 |
|
|
Bool_t pass = kTRUE;
|
229 |
|
|
for (UInt_t i=0; i<els->GetEntries(); ++i) {
|
230 |
|
|
const Electron *e = els->At(i);
|
231 |
|
|
if (e->SCluster()==p->SCluster() && e->GsfTrk()->NExpectedHitsInner()==0 && ElectronTools::PassConversionFilter(e, conversions,
|
232 |
fabstoec |
1.31 |
v, 0, 0., 1e-6, kTRUE, kFALSE) ) {
|
233 |
|
|
// v, 0, 1e-6, 2.0, kFALSE, kFALSE) ) {
|
234 |
bendavid |
1.1 |
pass = kFALSE;
|
235 |
|
|
}
|
236 |
|
|
}
|
237 |
|
|
|
238 |
|
|
return pass;
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
//--------------------------------------------------------------------------------------------------
|
242 |
|
|
Bool_t PhotonTools::PassTriggerMatching(const Photon *p, const TriggerObjectCol *trigobjs)
|
243 |
|
|
{
|
244 |
|
|
|
245 |
|
|
for (UInt_t i=0; i<trigobjs->GetEntries(); ++i) {
|
246 |
|
|
const TriggerObject *trigobj = trigobjs->At(i);
|
247 |
|
|
if (trigobj->TriggerType()==TriggerObject::TriggerCluster || trigobj->TriggerType()==TriggerObject::TriggerElectron || trigobj->TriggerType()==TriggerObject::TriggerPhoton) {
|
248 |
|
|
if (MathUtils::DeltaR(p->SCluster(),trigobj)<0.3) {
|
249 |
|
|
return kTRUE;
|
250 |
|
|
}
|
251 |
|
|
}
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
return kFALSE;
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
}
|
258 |
|
|
|
259 |
|
|
//--------------------------------------------------------------------------------------------------
|
260 |
|
|
const DecayParticle *PhotonTools::MatchedConversion(const Photon *p, const DecayParticleCol *conversions,
|
261 |
|
|
const BaseVertex *vtx, Int_t nWrongHitsMax, Double_t probMin,
|
262 |
|
|
Double_t lxyMin, Double_t dRMin) {
|
263 |
|
|
|
264 |
bendavid |
1.13 |
return MatchedConversion(p->SCluster(), conversions, vtx, nWrongHitsMax, probMin, lxyMin, dRMin);
|
265 |
|
|
|
266 |
|
|
}
|
267 |
|
|
|
268 |
|
|
//--------------------------------------------------------------------------------------------------
|
269 |
|
|
const DecayParticle *PhotonTools::MatchedConversion(const SuperCluster *sc, const DecayParticleCol *conversions,
|
270 |
|
|
const BaseVertex *vtx, Int_t nWrongHitsMax, Double_t probMin,
|
271 |
|
|
Double_t lxyMin, Double_t dRMin) {
|
272 |
|
|
|
273 |
bendavid |
1.1 |
const DecayParticle *match = 0;
|
274 |
bendavid |
1.3 |
Double_t rhosmallest = 999.;
|
275 |
bendavid |
1.1 |
for (UInt_t i=0; i<conversions->GetEntries(); ++i) {
|
276 |
|
|
const DecayParticle *c = conversions->At(i);
|
277 |
bendavid |
1.13 |
ThreeVector dirconvsc = ThreeVector(sc->Point()) - c->Position();
|
278 |
bendavid |
1.1 |
Double_t dr = MathUtils::DeltaR(*c,dirconvsc);
|
279 |
bendavid |
1.3 |
Double_t rho = c->Position().Rho();
|
280 |
|
|
if (dr<dRMin && rho<rhosmallest && c->Prob()>probMin && c->LxyCorrected(vtx)>lxyMin) {
|
281 |
bendavid |
1.1 |
Int_t nhb1 = dynamic_cast<const StableData*>(c->DaughterDat(0))->NHitsBeforeVtx();
|
282 |
|
|
Int_t nhb2 = dynamic_cast<const StableData*>(c->DaughterDat(1))->NHitsBeforeVtx();
|
283 |
|
|
if (TMath::Max(nhb1,nhb2)<=nWrongHitsMax) {
|
284 |
bendavid |
1.3 |
rhosmallest = rho;
|
285 |
bendavid |
1.1 |
match = c;
|
286 |
|
|
}
|
287 |
|
|
}
|
288 |
|
|
|
289 |
|
|
}
|
290 |
|
|
|
291 |
|
|
return match;
|
292 |
|
|
|
293 |
|
|
}
|
294 |
|
|
|
295 |
bendavid |
1.2 |
//--------------------------------------------------------------------------------------------------
|
296 |
|
|
const DecayParticle *PhotonTools::MatchedConversion(const Track *t, const DecayParticleCol *conversions,
|
297 |
|
|
const BaseVertex *vtx, Int_t nWrongHitsMax, Double_t probMin,
|
298 |
|
|
Double_t lxyMin) {
|
299 |
|
|
|
300 |
|
|
for (UInt_t i=0; i<conversions->GetEntries(); ++i) {
|
301 |
|
|
const DecayParticle *c = conversions->At(i);
|
302 |
|
|
if (c->Prob()>probMin && c->LxyCorrected(vtx)>lxyMin) {
|
303 |
|
|
Int_t nhb1 = dynamic_cast<const StableData*>(c->DaughterDat(0))->NHitsBeforeVtx();
|
304 |
|
|
Int_t nhb2 = dynamic_cast<const StableData*>(c->DaughterDat(1))->NHitsBeforeVtx();
|
305 |
|
|
if (TMath::Max(nhb1,nhb2)<=nWrongHitsMax) {
|
306 |
|
|
const Track *ct1 = dynamic_cast<const ChargedParticle*>(c->Daughter(0))->Trk();
|
307 |
|
|
const Track *ct2 = dynamic_cast<const ChargedParticle*>(c->Daughter(1))->Trk();
|
308 |
|
|
if (t==ct1 || t==ct2) return c;
|
309 |
|
|
}
|
310 |
|
|
}
|
311 |
|
|
|
312 |
|
|
}
|
313 |
|
|
|
314 |
|
|
return 0;
|
315 |
|
|
|
316 |
|
|
}
|
317 |
|
|
|
318 |
bendavid |
1.1 |
PhotonTools::DiphotonR9EtaCats PhotonTools::DiphotonR9EtaCat(const Photon *p1, const Photon *p2) {
|
319 |
|
|
|
320 |
|
|
if (p1->IsEB() && p2->IsEB()) {
|
321 |
|
|
if (p1->R9()>0.93 && p2->R9()>0.93) return kCat1;
|
322 |
|
|
else return kCat2;
|
323 |
|
|
|
324 |
|
|
}
|
325 |
|
|
else {
|
326 |
|
|
if (p1->R9()>0.93 && p2->R9()>0.93) return kCat3;
|
327 |
|
|
else return kCat4;
|
328 |
|
|
}
|
329 |
|
|
|
330 |
|
|
}
|
331 |
|
|
|
332 |
|
|
PhotonTools::DiphotonR9EtaConversionCats PhotonTools::DiphotonR9EtaConversionCat(const Photon *p1, const Photon *p2, const DecayParticleCol *conversions, const BaseVertex *v) {
|
333 |
|
|
|
334 |
|
|
const DecayParticle *conv1 = MatchedConversion(p1, conversions, v);
|
335 |
|
|
const DecayParticle *conv2 = MatchedConversion(p2, conversions, v);
|
336 |
|
|
|
337 |
|
|
if (p1->IsEB() && p2->IsEB()) {
|
338 |
|
|
if (p1->R9()>0.93 && p2->R9()>0.93) return kNewCat1;
|
339 |
|
|
else if (conv1||conv2) return kNewCat2;
|
340 |
|
|
else return kNewCat3;
|
341 |
|
|
|
342 |
|
|
}
|
343 |
|
|
else {
|
344 |
|
|
if (p1->R9()>0.93 && p2->R9()>0.93) return kNewCat4;
|
345 |
|
|
else if (conv1||conv2) return kNewCat5;
|
346 |
|
|
else return kNewCat6;
|
347 |
|
|
}
|
348 |
|
|
|
349 |
fabstoec |
1.4 |
}
|
350 |
|
|
|
351 |
|
|
PhotonTools::CiCBaseLineCats PhotonTools::CiCBaseLineCat(const Photon *p) {
|
352 |
bendavid |
1.12 |
if( p->SCluster()->AbsEta()<1.5 ) {
|
353 |
fabstoec |
1.4 |
if ( p->R9() > 0.94 ) return kCiCCat1;
|
354 |
|
|
else return kCiCCat2;
|
355 |
|
|
} else {
|
356 |
|
|
if ( p->R9() > 0.94 ) return kCiCCat3;
|
357 |
|
|
else return kCiCCat4;
|
358 |
|
|
}
|
359 |
fabstoec |
1.8 |
|
360 |
|
|
// shoud NEVER happen, but you never know...
|
361 |
|
|
return kCiCNoCat;
|
362 |
fabstoec |
1.4 |
}
|
363 |
fabstoec |
1.5 |
|
364 |
|
|
//--------------------------------------------------------------------------------------------------
|
365 |
|
|
const DecayParticle *PhotonTools::MatchedCiCConversion(const Photon *p, const DecayParticleCol *conversions,
|
366 |
|
|
Double_t dPhiMin,
|
367 |
fabstoec |
1.7 |
Double_t dEtaMin,
|
368 |
|
|
Double_t dRMin,
|
369 |
|
|
bool print) {
|
370 |
fabstoec |
1.5 |
|
371 |
fabstoec |
1.8 |
// if there are no conversons, return
|
372 |
|
|
if ( !p || !conversions) return NULL;
|
373 |
|
|
|
374 |
fabstoec |
1.6 |
const DecayParticle *match = NULL;
|
375 |
|
|
|
376 |
|
|
double minDeta = 999.;
|
377 |
|
|
double minDphi = 999.;
|
378 |
fabstoec |
1.7 |
double minDR = 999.;
|
379 |
fabstoec |
1.6 |
|
380 |
|
|
double phPhi = p->SCluster()->Phi();
|
381 |
|
|
double phEta = p->SCluster()->Eta();
|
382 |
fabstoec |
1.7 |
|
383 |
|
|
if(print)
|
384 |
|
|
std::cout<<" --- conv match photon eta = "<<phEta<<" phi = "<<phPhi<<std::endl;
|
385 |
|
|
|
386 |
|
|
|
387 |
fabstoec |
1.5 |
for (UInt_t i=0; i<conversions->GetEntries(); ++i) {
|
388 |
|
|
const DecayParticle *c = conversions->At(i);
|
389 |
fabstoec |
1.6 |
|
390 |
fabstoec |
1.7 |
if(print)
|
391 |
|
|
std::cout<< " c "<<i+1<<" pt = "<<c->Pt()<<std::endl;
|
392 |
|
|
|
393 |
fabstoec |
1.6 |
if(c->Pt() < 1. ) continue; // is this refittedPirMomentum?
|
394 |
|
|
|
395 |
bendavid |
1.29 |
if (c->NDaughters()==2 && c->Prob() < 1e-6) continue;
|
396 |
bendavid |
1.24 |
|
397 |
fabstoec |
1.6 |
//ThreeVector dirconvsc = ThreeVector(p->SCluster()->Point()) - c->Position();
|
398 |
|
|
//ThreeVector dirconvsc = p->CaloPos() - c->Position();
|
399 |
|
|
|
400 |
|
|
double convPhi = c->Phi();
|
401 |
|
|
double convEta = c->Eta();
|
402 |
fabstoec |
1.7 |
|
403 |
fabstoec |
1.6 |
const ThreeVector wrong(0,0,0);
|
404 |
|
|
double Zvertex = c->DzCorrected(wrong);
|
405 |
|
|
// ------------------ FROM GLOBE ----------------------
|
406 |
|
|
//---Definitions for ECAL
|
407 |
|
|
const float R_ECAL = 136.5;
|
408 |
|
|
const float Z_Endcap = 328.0;
|
409 |
|
|
const float etaBarrelEndcap = 1.479;
|
410 |
fabstoec |
1.7 |
|
411 |
fabstoec |
1.6 |
//---ETA correction
|
412 |
|
|
float Theta = 0.0 ;
|
413 |
|
|
float ZEcal = R_ECAL*sinh(convEta)+Zvertex;
|
414 |
fabstoec |
1.7 |
|
415 |
fabstoec |
1.6 |
if(ZEcal != 0.0) Theta = TMath::ATan(R_ECAL/ZEcal);
|
416 |
|
|
if(Theta<0.0) Theta = Theta+M_PI;
|
417 |
|
|
double fEta = - TMath::Log(TMath::Tan(0.5*Theta));
|
418 |
fabstoec |
1.5 |
|
419 |
fabstoec |
1.6 |
if( fabs(fEta) > etaBarrelEndcap ) {
|
420 |
|
|
float Zend = Z_Endcap ;
|
421 |
|
|
if(convEta<0.0 ) Zend = -Zend ;
|
422 |
|
|
float Zlen = Zend - Zvertex ;
|
423 |
|
|
float RR = Zlen/TMath::SinH(convEta);
|
424 |
|
|
Theta = TMath::ATan(RR/Zend);
|
425 |
|
|
if(Theta<0.0) Theta = Theta+M_PI;
|
426 |
|
|
fEta = -TMath::Log(TMath::Tan(0.5*Theta));
|
427 |
|
|
}
|
428 |
|
|
// ---------------------------------------------------
|
429 |
|
|
|
430 |
fabstoec |
1.7 |
if(print) {
|
431 |
|
|
std::cout<<" eta bare = "<<convEta<<std::endl;
|
432 |
|
|
std::cout<<" eta new = "<<fEta<<std::endl;
|
433 |
|
|
std::cout<<" phi = "<<convPhi<<std::endl;
|
434 |
|
|
}
|
435 |
|
|
|
436 |
|
|
convEta = fEta;
|
437 |
|
|
|
438 |
fabstoec |
1.6 |
Double_t dphi = TMath::Abs(phPhi - convPhi);
|
439 |
|
|
if(dphi > M_PI) dphi = 2.*M_PI-dphi;
|
440 |
|
|
//Double_t deta = c->Eta()-dirconvsc.Eta();
|
441 |
|
|
Double_t deta = TMath::Abs(convEta-phEta);
|
442 |
fabstoec |
1.7 |
Double_t dR = TMath::Sqrt(dphi*dphi+deta*deta);
|
443 |
|
|
//if(dphi < minDphi && TMath::Abs(deta)<minDeta) {
|
444 |
|
|
if(dR < minDR) {
|
445 |
|
|
minDR = dR;
|
446 |
|
|
minDphi = dphi;
|
447 |
|
|
minDeta = TMath::Abs(deta);
|
448 |
|
|
match = c;
|
449 |
|
|
|
450 |
|
|
if(print)
|
451 |
|
|
std::cout<<" conv "<<i+1<<" matches with dPhi = "<<minDphi<<" dEta = "<<minDeta<<std::endl;
|
452 |
|
|
|
453 |
fabstoec |
1.6 |
}
|
454 |
fabstoec |
1.5 |
}
|
455 |
|
|
|
456 |
fabstoec |
1.7 |
//if(minDphi < dPhiMin && minDeta < dEtaMin)
|
457 |
|
|
if(minDR < dRMin)
|
458 |
|
|
return match;
|
459 |
|
|
else
|
460 |
|
|
return NULL;
|
461 |
fabstoec |
1.5 |
}
|
462 |
|
|
|
463 |
fabstoec |
1.9 |
bool PhotonTools::PassCiCSelection(const Photon* ph, const Vertex* vtx,
|
464 |
|
|
const TrackCol* trackCol,
|
465 |
|
|
const ElectronCol* eleCol,
|
466 |
|
|
const VertexCol* vtxCol,
|
467 |
fabstoec |
1.5 |
double rho, double ptmin,
|
468 |
fabstoec |
1.9 |
bool applyEleVeto,
|
469 |
fabstoec |
1.5 |
bool print, float* kin) {
|
470 |
fabstoec |
1.9 |
|
471 |
fabstoec |
1.5 |
|
472 |
|
|
// these values are taken from the H2GGlobe code... (actually from Marco/s mail)
|
473 |
|
|
float cic4_allcuts_temp_sublead[] = {
|
474 |
|
|
3.8, 2.2, 1.77, 1.29,
|
475 |
|
|
11.7, 3.4, 3.9, 1.84,
|
476 |
|
|
3.5, 2.2, 2.3, 1.45,
|
477 |
|
|
0.0106, 0.0097, 0.028, 0.027,
|
478 |
|
|
0.082, 0.062, 0.065, 0.048,
|
479 |
|
|
0.94, 0.36, 0.94, 0.32,
|
480 |
|
|
1., 0.062, 0.97, 0.97,
|
481 |
|
|
1.5, 1.5, 1.5, 1.5 }; // the last line is PixelmatchVeto and un-used
|
482 |
|
|
|
483 |
|
|
// cut on Et instead of Pt???
|
484 |
|
|
Bool_t isbarrel = ph->SCluster()->AbsEta()<1.5;
|
485 |
|
|
|
486 |
|
|
// compute all relevant observables first
|
487 |
|
|
double ecalIso3 = ph->EcalRecHitIsoDr03();
|
488 |
|
|
double ecalIso4 = ph->EcalRecHitIsoDr04();
|
489 |
|
|
double hcalIso4 = ph->HcalTowerSumEtDr04();
|
490 |
|
|
|
491 |
|
|
unsigned int wVtxInd = 0;
|
492 |
|
|
|
493 |
|
|
double trackIso1 = IsolationTools::CiCTrackIsolation(ph, vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol);
|
494 |
|
|
|
495 |
|
|
// track iso only
|
496 |
|
|
double trackIso3 = IsolationTools::CiCTrackIsolation(ph, vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol);
|
497 |
|
|
|
498 |
|
|
// track iso worst vtx
|
499 |
|
|
double trackIso2 = IsolationTools::CiCTrackIsolation(ph, vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd, vtxCol);
|
500 |
|
|
|
501 |
|
|
double combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*rho;
|
502 |
|
|
double combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*rho;
|
503 |
|
|
|
504 |
|
|
double tIso1 = (combIso1) *50./ph->Et();
|
505 |
|
|
double tIso2 = (combIso2) *50./(ph->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt());
|
506 |
|
|
//double tIso2 = (combIso2) *50./ph->Et();
|
507 |
|
|
double tIso3 = (trackIso3)*50./ph->Et();
|
508 |
|
|
|
509 |
|
|
double covIEtaIEta =ph->CoviEtaiEta();
|
510 |
|
|
double HoE = ph->HadOverEm();
|
511 |
|
|
|
512 |
|
|
double R9 = ph->R9();
|
513 |
|
|
|
514 |
|
|
double dRTrack = PhotonTools::ElectronVetoCiC(ph, eleCol);
|
515 |
|
|
|
516 |
|
|
// check which category it is ...
|
517 |
|
|
int _tCat = 1;
|
518 |
|
|
if ( !isbarrel ) _tCat = 3;
|
519 |
|
|
if ( R9 < 0.94 ) _tCat++;
|
520 |
|
|
|
521 |
|
|
if(print) {
|
522 |
|
|
std::cout<<" -------------------------- "<<std::endl;
|
523 |
fabstoec |
1.15 |
|
524 |
|
|
std::cout<<" trackIso1 = "<<trackIso1<<std::endl;
|
525 |
|
|
std::cout<<" trackIso2 = "<<trackIso2<<std::endl;
|
526 |
|
|
std::cout<<" trackIso3 = "<<trackIso3<<std::endl;
|
527 |
|
|
std::cout<<" ecalIso3 = "<<ecalIso3<<std::endl;
|
528 |
|
|
std::cout<<" ecalIso4 = "<<ecalIso4<<std::endl;
|
529 |
|
|
std::cout<<" hcalIso4 = "<<hcalIso4<<std::endl;
|
530 |
|
|
|
531 |
fabstoec |
1.5 |
std::cout<<" photon Et = "<<ph->Et()<<std::endl;
|
532 |
fabstoec |
1.30 |
std::cout<<" Eta = "<<ph->SCluster()->Eta()<<std::endl;
|
533 |
fabstoec |
1.15 |
std::cout<<" HoE = "<<HoE<<" ("<<cic4_allcuts_temp_sublead[_tCat-1+4*4]<<")"<<std::endl;
|
534 |
|
|
std::cout<<" R9 = "<<R9<<" ("<<cic4_allcuts_temp_sublead[_tCat-1+5*4]<<")"<<std::endl;
|
535 |
|
|
std::cout<<" dR = "<<dRTrack<<" ("<<cic4_allcuts_temp_sublead[_tCat-1+6*4]<<")"<<std::endl;
|
536 |
|
|
std::cout<<" iso1 = "<<tIso1<<" ("<<cic4_allcuts_temp_sublead[_tCat-1+0*4]<<")"<<std::endl;
|
537 |
|
|
std::cout<<" iso2 = "<<tIso2<<" ("<<cic4_allcuts_temp_sublead[_tCat-1+1*4]<<")"<<std::endl;
|
538 |
|
|
std::cout<<" iso3 = "<<tIso3<<" ("<<cic4_allcuts_temp_sublead[_tCat-1+2*4]<<")"<<std::endl;
|
539 |
fabstoec |
1.5 |
}
|
540 |
|
|
|
541 |
|
|
if(kin) {
|
542 |
|
|
kin[0] = tIso1;
|
543 |
|
|
kin[1] = tIso2;
|
544 |
|
|
kin[2] = tIso3;
|
545 |
|
|
kin[3] = covIEtaIEta;
|
546 |
|
|
kin[4] = HoE;
|
547 |
|
|
kin[5] = R9;
|
548 |
|
|
kin[6] = dRTrack;
|
549 |
|
|
kin[7] = (float) ph->Pt();
|
550 |
|
|
kin[8] = (float) ph->Eta();
|
551 |
|
|
kin[9] = (float) ph->Phi();
|
552 |
|
|
|
553 |
|
|
// iso quantities separate
|
554 |
|
|
kin[10] = ecalIso3;
|
555 |
|
|
kin[11] = ecalIso4;
|
556 |
|
|
kin[12] = hcalIso4;
|
557 |
|
|
kin[13] = trackIso1;
|
558 |
|
|
kin[14] = trackIso2;
|
559 |
|
|
kin[15] = trackIso3;
|
560 |
|
|
|
561 |
|
|
kin[16] = (float) ph->Et();
|
562 |
|
|
kin[17] = (float) ph->E();
|
563 |
|
|
|
564 |
bendavid |
1.11 |
kin[18] = (float) ph->SCluster()->Eta();
|
565 |
|
|
kin[19] = (float) ph->SCluster()->Phi();
|
566 |
fabstoec |
1.5 |
}
|
567 |
|
|
|
568 |
|
|
float passCuts = 1.;
|
569 |
|
|
|
570 |
|
|
if ( ph->Pt() <= ptmin ) passCuts = -1.;
|
571 |
|
|
|
572 |
|
|
// not needed anymore, do in pre-selection...
|
573 |
|
|
//if ( ph->SCluster()->AbsEta()>=2.5 || (ph->SCluster()->AbsEta()>=1.4442 && ph->SCluster()->AbsEta()<=1.566)) passCuts = -1.;
|
574 |
|
|
|
575 |
|
|
if( ! ( tIso1 < cic4_allcuts_temp_sublead[_tCat-1+0*4]
|
576 |
|
|
&& tIso2 < cic4_allcuts_temp_sublead[_tCat-1+1*4]
|
577 |
|
|
&& tIso3 < cic4_allcuts_temp_sublead[_tCat-1+2*4]
|
578 |
|
|
&& covIEtaIEta < cic4_allcuts_temp_sublead[_tCat-1+3*4]
|
579 |
|
|
&& HoE < cic4_allcuts_temp_sublead[_tCat-1+4*4]
|
580 |
|
|
&& R9 > cic4_allcuts_temp_sublead[_tCat-1+5*4]
|
581 |
fabstoec |
1.9 |
&& ( dRTrack > cic4_allcuts_temp_sublead[_tCat-1+6*4] || !applyEleVeto ) ) ) passCuts = -1.;
|
582 |
fabstoec |
1.5 |
|
583 |
fabstoec |
1.15 |
if(print) std::cout<<" ---> "<<passCuts<<std::endl;
|
584 |
|
|
|
585 |
fabstoec |
1.5 |
if(kin) {
|
586 |
bendavid |
1.11 |
kin[20] = passCuts;
|
587 |
|
|
kin[21] = (float) _tCat;
|
588 |
fabstoec |
1.5 |
}
|
589 |
|
|
|
590 |
|
|
if(passCuts > 0.) return true;
|
591 |
|
|
return false;
|
592 |
|
|
}
|
593 |
bendavid |
1.11 |
|
594 |
bendavid |
1.27 |
bool PhotonTools::PassCiCPFIsoSelection(const Photon* ph,
|
595 |
fabstoec |
1.30 |
const Vertex* vtx,
|
596 |
|
|
const PFCandidateCol* pfCol,
|
597 |
|
|
const VertexCol* vtxCol,
|
598 |
|
|
double rho, double ptmin,
|
599 |
|
|
std::vector<double>* kin // store variables for debugging...
|
600 |
|
|
) {
|
601 |
bendavid |
1.27 |
|
602 |
|
|
// these values are taken from the H2GGlobe code... (actually from Marco/s mail)
|
603 |
|
|
float cic4_allcuts_temp_sublead[] = {
|
604 |
|
|
6.0, 4.7, 5.6, 3.6,
|
605 |
|
|
10.0, 6.5, 5.6, 4.4,
|
606 |
|
|
3.8, 2.5, 3.1, 2.2,
|
607 |
|
|
0.0108, 0.0102, 0.028, 0.028,
|
608 |
|
|
0.124, 0.092, 0.142, 0.063,
|
609 |
fabstoec |
1.30 |
0.94, 0.28, 0.94, 0.24 };
|
610 |
bendavid |
1.27 |
|
611 |
|
|
// cut on Et instead of Pt???
|
612 |
|
|
Bool_t isbarrel = ph->SCluster()->AbsEta()<1.5;
|
613 |
|
|
|
614 |
|
|
|
615 |
|
|
|
616 |
|
|
// compute all relevant observables first
|
617 |
|
|
double ecalIso3 = IsolationTools::PFGammaIsolation(ph, 0.3, 0.0, pfCol);
|
618 |
|
|
double ecalIso4 = IsolationTools::PFGammaIsolation(ph, 0.4, 0.0, pfCol);
|
619 |
|
|
|
620 |
|
|
unsigned int wVtxInd = 0;
|
621 |
|
|
|
622 |
|
|
double trackIsoSel03 = IsolationTools::PFChargedIsolation(ph, vtx, 0.3, 0.0, pfCol);
|
623 |
|
|
|
624 |
|
|
// track iso worst vtx
|
625 |
|
|
double trackIsoWorst04 = IsolationTools::PFChargedIsolation(ph, vtx, 0.4, 0.00, pfCol, &wVtxInd, vtxCol);
|
626 |
|
|
|
627 |
fabstoec |
1.30 |
double combIso1 = ecalIso3+trackIsoSel03 + 2.5 - 0.09*rho;
|
628 |
|
|
double combIso2 = ecalIso4+trackIsoWorst04 + 2.5 - 0.23*rho;
|
629 |
bendavid |
1.27 |
|
630 |
|
|
double tIso1 = (combIso1) *50./ph->Et();
|
631 |
|
|
double tIso2 = (combIso2) *50./(ph->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt());
|
632 |
|
|
//double tIso2 = (combIso2) *50./ph->Et();
|
633 |
|
|
double tIso3 = (trackIsoSel03)*50./ph->Et();
|
634 |
|
|
|
635 |
|
|
double covIEtaIEta =ph->CoviEtaiEta();
|
636 |
|
|
double HoE = ph->HadOverEm();
|
637 |
|
|
|
638 |
|
|
double R9 = ph->R9();
|
639 |
|
|
|
640 |
|
|
// check which category it is ...
|
641 |
|
|
int _tCat = 1;
|
642 |
|
|
if ( !isbarrel ) _tCat = 3;
|
643 |
|
|
if ( R9 < 0.94 ) _tCat++;
|
644 |
|
|
|
645 |
|
|
float passCuts = 1.;
|
646 |
|
|
|
647 |
fabstoec |
1.30 |
if( kin ) {
|
648 |
|
|
kin->resize(0);
|
649 |
|
|
|
650 |
|
|
kin->push_back(tIso1);
|
651 |
|
|
kin->push_back(tIso2);
|
652 |
|
|
kin->push_back(tIso3);
|
653 |
|
|
kin->push_back(covIEtaIEta);
|
654 |
|
|
kin->push_back(HoE);
|
655 |
|
|
kin->push_back(R9);
|
656 |
|
|
|
657 |
|
|
kin->push_back( (double) wVtxInd );
|
658 |
|
|
kin->push_back( ecalIso3 );
|
659 |
|
|
kin->push_back( ecalIso4 );
|
660 |
|
|
|
661 |
|
|
kin->push_back( trackIsoSel03 );
|
662 |
|
|
kin->push_back( trackIsoWorst04 );
|
663 |
|
|
|
664 |
|
|
kin->push_back( combIso1 );
|
665 |
|
|
kin->push_back( combIso2 );
|
666 |
|
|
}
|
667 |
|
|
|
668 |
|
|
|
669 |
bendavid |
1.27 |
if ( ph->Pt() <= ptmin ) passCuts = -1.;
|
670 |
|
|
|
671 |
|
|
// not needed anymore, do in pre-selection...
|
672 |
|
|
//if ( ph->SCluster()->AbsEta()>=2.5 || (ph->SCluster()->AbsEta()>=1.4442 && ph->SCluster()->AbsEta()<=1.566)) passCuts = -1.;
|
673 |
|
|
|
674 |
|
|
if( ! ( tIso1 < cic4_allcuts_temp_sublead[_tCat-1+0*4]
|
675 |
|
|
&& tIso2 < cic4_allcuts_temp_sublead[_tCat-1+1*4]
|
676 |
|
|
&& tIso3 < cic4_allcuts_temp_sublead[_tCat-1+2*4]
|
677 |
|
|
&& covIEtaIEta < cic4_allcuts_temp_sublead[_tCat-1+3*4]
|
678 |
|
|
&& HoE < cic4_allcuts_temp_sublead[_tCat-1+4*4]
|
679 |
|
|
&& R9 > cic4_allcuts_temp_sublead[_tCat-1+5*4] ) ) passCuts = -1.;
|
680 |
|
|
|
681 |
|
|
|
682 |
|
|
if(passCuts > 0.) return true;
|
683 |
|
|
return false;
|
684 |
|
|
}
|
685 |
|
|
|
686 |
|
|
|
687 |
|
|
|
688 |
|
|
|
689 |
|
|
|
690 |
bendavid |
1.13 |
const MCParticle *PhotonTools::MatchMC(const Particle *ph, const MCParticleCol *c, Bool_t matchElectrons) {
|
691 |
|
|
|
692 |
|
|
// printf("Start loop\n");
|
693 |
bendavid |
1.11 |
for (UInt_t i=0; i<c->GetEntries(); ++i) {
|
694 |
|
|
const MCParticle *p = c->At(i);
|
695 |
bendavid |
1.13 |
// if (p->IsGenerated() && p->AbsPdgId()==11 && (p->DistinctMother()->AbsPdgId()==23|| p->DistinctMother()->AbsPdgId()==24)) {
|
696 |
|
|
// printf("pdgid = %i, status = %i, pt = %5f, mother pdgid = %i\n",p->PdgId(),p->Status(),p->Pt(),p->Mother()->PdgId());
|
697 |
bendavid |
1.12 |
// }
|
698 |
|
|
if (matchElectrons && p->AbsPdgId()==11 && p->IsGenerated() && p->Status()==3 && MathUtils::DeltaR(*ph,*p) < 0.3 && p->Mother() && (p->Mother()->AbsPdgId()==23 || p->Mother()->AbsPdgId()==24 || p->Mother()->AbsPdgId()==22)) {
|
699 |
|
|
return p;
|
700 |
|
|
}
|
701 |
bendavid |
1.11 |
if ( p->AbsPdgId()==22 && p->IsGenerated() && MathUtils::DeltaR(*ph,*p) < 0.3 && p->Mother() && (p->Mother()->AbsPdgId()==25 || p->Mother()->AbsPdgId()<=21) ) {
|
702 |
|
|
return p;
|
703 |
|
|
}
|
704 |
|
|
}
|
705 |
|
|
return 0;
|
706 |
bendavid |
1.12 |
}
|
707 |
|
|
|
708 |
|
|
PhotonTools::DiphotonR9EtaPtCats PhotonTools::DiphotonR9EtaPtCat(const Photon *p1, const Photon *p2) {
|
709 |
|
|
|
710 |
|
|
PhotonTools::CiCBaseLineCats cat1 = CiCBaseLineCat(p1);
|
711 |
|
|
PhotonTools::CiCBaseLineCats cat2 = CiCBaseLineCat(p2);
|
712 |
|
|
|
713 |
|
|
PhotonTools::DiphotonR9EtaPtCats evtcat = PhotonTools::kOctCat0;
|
714 |
|
|
|
715 |
|
|
bool ph1IsEB = (cat1 == PhotonTools::kCiCCat1 || cat1 == PhotonTools::kCiCCat2);
|
716 |
|
|
bool ph2IsEB = (cat2 == PhotonTools::kCiCCat1 || cat2 == PhotonTools::kCiCCat2);
|
717 |
|
|
|
718 |
|
|
bool ph1IsHR9 = (cat1 == PhotonTools::kCiCCat1 || cat1 == PhotonTools::kCiCCat3);
|
719 |
|
|
bool ph2IsHR9 = (cat2 == PhotonTools::kCiCCat1 || cat2 == PhotonTools::kCiCCat3);
|
720 |
|
|
|
721 |
|
|
if( ph1IsEB && ph2IsEB )
|
722 |
|
|
evtcat = ( ph1IsHR9 && ph2IsHR9 ? PhotonTools::kOctCat0 : PhotonTools::kOctCat1);
|
723 |
|
|
else
|
724 |
|
|
evtcat = ( ph1IsHR9 && ph2IsHR9 ? PhotonTools::kOctCat2 : PhotonTools::kOctCat3);
|
725 |
|
|
|
726 |
|
|
float ptgg = (p1->Mom()+p2->Mom()).Pt();
|
727 |
|
|
if (ptgg<40.0) evtcat = PhotonTools::DiphotonR9EtaPtCats(evtcat + 4);
|
728 |
|
|
|
729 |
|
|
|
730 |
|
|
return evtcat;
|
731 |
fabstoec |
1.15 |
}
|
732 |
mingyang |
1.17 |
|
733 |
bendavid |
1.22 |
Bool_t PhotonTools::PassSinglePhotonPresel(const Photon *p,const ElectronCol *els, const DecayParticleCol *conversions, const BaseVertex *bs, const TrackCol* trackCol,const Vertex *vtx, double rho, Bool_t applyElectronVeto, Bool_t invertElectronVeto) {
|
734 |
mingyang |
1.17 |
float ScEta=p->SCluster()->Eta();
|
735 |
|
|
float Et=p->Et();
|
736 |
|
|
float R9=p->R9();
|
737 |
|
|
float HoE=p->HadOverEm();
|
738 |
|
|
float CovIEtaIEta=p->CoviEtaiEta();
|
739 |
|
|
float EcalIsoDr03=p->EcalRecHitIsoDr03();
|
740 |
|
|
float HcalIsoDr03=p->HcalTowerSumEtDr03();
|
741 |
|
|
float TrkIsoHollowDr03=p->HollowConeTrkIsoDr03();
|
742 |
|
|
float NewEcalIso=EcalIsoDr03-0.012*Et;
|
743 |
|
|
float NewHcalIso=HcalIsoDr03-0.005*Et;
|
744 |
|
|
float NewTrkIsoHollowDr03=TrkIsoHollowDr03-0.002*Et;
|
745 |
|
|
Bool_t IsBarrel=kFALSE;
|
746 |
|
|
Bool_t IsEndcap=kFALSE;
|
747 |
bendavid |
1.22 |
Bool_t PassEleVetoRaw = PhotonTools::PassElectronVetoConvRecovery(p, els, conversions, bs);
|
748 |
bendavid |
1.20 |
Bool_t PassEleVeto = (!applyElectronVeto && !invertElectronVeto) || (applyElectronVeto && !invertElectronVeto && PassEleVetoRaw) || (!applyElectronVeto && invertElectronVeto && !PassEleVetoRaw);
|
749 |
bendavid |
1.22 |
float AbsTrackIsoCIC=IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0,trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );
|
750 |
mingyang |
1.18 |
float HcalEcalPUCorr=EcalIsoDr03+HcalIsoDr03-0.17*rho;
|
751 |
|
|
|
752 |
mingyang |
1.17 |
if(fabs(ScEta)<1.4442){IsBarrel=kTRUE;}
|
753 |
|
|
if(fabs(ScEta)>1.566 && fabs(ScEta)<2.5){IsEndcap=kTRUE;}
|
754 |
|
|
if((!IsBarrel) && (!IsEndcap)){
|
755 |
|
|
return kFALSE;
|
756 |
|
|
}
|
757 |
|
|
if(!PassEleVeto){
|
758 |
|
|
return kFALSE;
|
759 |
|
|
}
|
760 |
|
|
if(R9<=0.9){
|
761 |
bendavid |
1.21 |
if(HoE<0.075 && ((IsBarrel && CovIEtaIEta<0.014) || (IsEndcap && CovIEtaIEta<0.034)) && NewEcalIso<4 && NewHcalIso<4 && NewTrkIsoHollowDr03<4 && HcalEcalPUCorr<3 && AbsTrackIsoCIC<2.8 && TrkIsoHollowDr03<4.0) {
|
762 |
mingyang |
1.17 |
return kTRUE;
|
763 |
|
|
}
|
764 |
|
|
}
|
765 |
|
|
if(R9>0.9){
|
766 |
bendavid |
1.21 |
if(((IsBarrel && HoE<0.082 && CovIEtaIEta<0.014) || (IsEndcap && HoE <0.075 && CovIEtaIEta<0.034)) && NewEcalIso<50 && NewHcalIso<50 && NewTrkIsoHollowDr03<50 && HcalEcalPUCorr<3 && AbsTrackIsoCIC<2.8 && TrkIsoHollowDr03<4.0) {
|
767 |
mingyang |
1.17 |
return kTRUE;
|
768 |
|
|
}
|
769 |
|
|
}
|
770 |
|
|
return kFALSE;
|
771 |
|
|
}
|
772 |
mingyang |
1.26 |
|
773 |
|
|
Bool_t PhotonTools::PassSinglePhotonPreselPFISO(const Photon *p,const ElectronCol *els, const DecayParticleCol *conversions, const BaseVertex *bs, const TrackCol* trackCol,const Vertex *vtx, double rho, const PFCandidateCol *fPFCands, Bool_t applyElectronVeto, Bool_t invertElectronVeto) {
|
774 |
|
|
float ScEta=p->SCluster()->Eta();
|
775 |
|
|
float Et=p->Et();
|
776 |
|
|
float R9=p->R9();
|
777 |
|
|
float HoE=p->HadOverEm();
|
778 |
|
|
float CovIEtaIEta=p->CoviEtaiEta();
|
779 |
|
|
float EcalIsoDr03=p->EcalRecHitIsoDr03();
|
780 |
|
|
float HcalIsoDr03=p->HcalTowerSumEtDr03();
|
781 |
|
|
float TrkIsoHollowDr03=p->HollowConeTrkIsoDr03();
|
782 |
|
|
float NewEcalIso=EcalIsoDr03-0.012*Et;
|
783 |
|
|
float NewHcalIso=HcalIsoDr03-0.005*Et;
|
784 |
|
|
float NewTrkIsoHollowDr03=TrkIsoHollowDr03-0.002*Et;
|
785 |
|
|
Bool_t IsBarrel=kFALSE;
|
786 |
|
|
Bool_t IsEndcap=kFALSE;
|
787 |
|
|
Bool_t PassEleVetoRaw = PhotonTools::PassElectronVetoConvRecovery(p, els, conversions, bs);
|
788 |
|
|
Bool_t PassEleVeto = (!applyElectronVeto && !invertElectronVeto) || (applyElectronVeto && !invertElectronVeto && PassEleVetoRaw) || (!applyElectronVeto && invertElectronVeto && !PassEleVetoRaw);
|
789 |
|
|
|
790 |
bendavid |
1.27 |
float ChargedIso_selvtx_DR002To0p02=IsolationTools::PFChargedIsolation(p,vtx, 0.2, 0.,fPFCands);
|
791 |
mingyang |
1.26 |
|
792 |
|
|
if(fabs(ScEta)<1.4442){IsBarrel=kTRUE;}
|
793 |
|
|
if(fabs(ScEta)>1.566 && fabs(ScEta)<2.5){IsEndcap=kTRUE;}
|
794 |
|
|
if((!IsBarrel) && (!IsEndcap)){
|
795 |
|
|
return kFALSE;
|
796 |
|
|
}
|
797 |
|
|
if(!PassEleVeto){
|
798 |
|
|
return kFALSE;
|
799 |
|
|
}
|
800 |
|
|
if(R9<=0.9){
|
801 |
|
|
if(HoE<0.075 && ((IsBarrel && CovIEtaIEta<0.014) || (IsEndcap && CovIEtaIEta<0.034)) && NewEcalIso<4 && NewHcalIso<4 && NewTrkIsoHollowDr03<4 && ChargedIso_selvtx_DR002To0p02<4) {
|
802 |
|
|
return kTRUE;
|
803 |
|
|
}
|
804 |
|
|
}
|
805 |
|
|
if(R9>0.9){
|
806 |
|
|
if(((IsBarrel && HoE<0.082 && CovIEtaIEta<0.014) || (IsEndcap && HoE <0.075 && CovIEtaIEta<0.034)) && NewEcalIso<50 && NewHcalIso<50 && NewTrkIsoHollowDr03<50 && ChargedIso_selvtx_DR002To0p02<4) {
|
807 |
|
|
return kTRUE;
|
808 |
|
|
}
|
809 |
|
|
}
|
810 |
|
|
return kFALSE;
|
811 |
|
|
}
|
812 |
fabstoec |
1.32 |
|
813 |
|
|
|
814 |
|
|
void PhotonTools::ScalePhotonShowerShapes(Photon* p, PhotonTools::ShowerShapeScales scale) {
|
815 |
|
|
|
816 |
|
|
switch(scale) {
|
817 |
|
|
|
818 |
|
|
case kNoShowerShapeScaling:
|
819 |
|
|
break;
|
820 |
|
|
|
821 |
|
|
case k2011ShowerShape:
|
822 |
|
|
//regression sigmaE
|
823 |
|
|
if (p->SCluster()->AbsEta()<1.5)
|
824 |
|
|
PhotonTools::ScalePhotonError(p,1.07);
|
825 |
|
|
else
|
826 |
|
|
PhotonTools::ScalePhotonError(p,1.045);
|
827 |
|
|
|
828 |
|
|
//R9
|
829 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetR9(1.0035*p->R9());
|
830 |
|
|
else p->SetR9(1.0035*p->R9());
|
831 |
|
|
//CoviEtaiEta(SigiEtaiEta)
|
832 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetCoviEtaiEta(0.87*p->CoviEtaiEta()+0.0011);
|
833 |
|
|
else p->SetCoviEtaiEta(0.99*p->CoviEtaiEta());
|
834 |
|
|
//EtaWidth
|
835 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetEtaWidth(0.99*p->EtaWidth());
|
836 |
|
|
else p->SetEtaWidth(0.99*p->EtaWidth());
|
837 |
|
|
//PhiWidth
|
838 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetPhiWidth(0.99*p->PhiWidth());
|
839 |
|
|
else p->SetPhiWidth(0.99*p->PhiWidth());
|
840 |
|
|
break;
|
841 |
|
|
|
842 |
bendavid |
1.33 |
case k2012ShowerShape:
|
843 |
fabstoec |
1.32 |
//R9
|
844 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetR9(1.0045*p->R9()+0.001);
|
845 |
|
|
else p->SetR9(1.0086*p->R9()-0.0007);
|
846 |
|
|
//CoviEtaiEta(SigiEtaiEta)
|
847 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetCoviEtaiEta(0.891832*p->CoviEtaiEta()+0.0009133);
|
848 |
|
|
else p->SetCoviEtaiEta(0.9947*p->CoviEtaiEta()+0.00003);
|
849 |
|
|
//EtaWidth
|
850 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetEtaWidth(1.04302*p->EtaWidth()- 0.000618);
|
851 |
|
|
else p->SetEtaWidth(0.903254*p->EtaWidth()+ 0.001346);
|
852 |
|
|
//PhiWidth
|
853 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetPhiWidth(1.00002*p->PhiWidth()- 0.000371);
|
854 |
|
|
else p->SetPhiWidth(0.99992*p->PhiWidth()+ 4.8e-07);
|
855 |
|
|
//s4Ratio
|
856 |
|
|
if (p->SCluster()->AbsEta()<1.5) p->SetS4Ratio(1.01894*p->S4Ratio()-0.01034);
|
857 |
|
|
else p->SetS4Ratio(1.04969*p->S4Ratio()-0.03642);
|
858 |
|
|
break;
|
859 |
|
|
default:
|
860 |
|
|
break;
|
861 |
|
|
|
862 |
|
|
}
|
863 |
|
|
return;
|
864 |
|
|
}
|
865 |
|
|
|