ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/PhotonTools.cc
Revision: 1.40
Committed: Tue Jan 8 13:24:01 2013 UTC (12 years, 4 months ago) by fabstoec
Content type: text/plain
Branch: MAIN
Changes since 1.39: +14 -6 lines
Log Message:
added feature to use special smearing on Diphoton MVA input

File Contents

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