CMS 3D CMS Logo

Photon.h
Go to the documentation of this file.
1 #ifndef EgammaCandidates_Photon_h
2 #define EgammaCandidates_Photon_h
3 
18 
19 
20 namespace reco {
21 
22  class Photon : public RecoCandidate {
23  public:
25  struct FiducialFlags;
26  struct IsolationVariables;
27  struct ShowerShape;
28  struct MIPVariables;
29  struct SaturationInfo;
30 
32  Photon() : RecoCandidate() { pixelSeed_=false; }
33 
35  Photon ( const Photon&);
36 
38  Photon( const LorentzVector & p4,
39  const Point& caloPos,
40  const PhotonCoreRef & core,
41  const Point & vtx = Point( 0, 0, 0 ) );
42 
44  ~Photon() override;
45 
47  Photon * clone() const override;
48 
52 
53  //
55  //
56  // retrieve provenance
57  bool isPFlowPhoton() const {return this->photonCore()->isPFlowPhoton();}
58  bool isStandardPhoton() const {return this->photonCore()->isStandardPhoton();}
60  reco::SuperClusterRef superCluster() const override;
62  reco::SuperClusterRef parentSuperCluster() const {return this->photonCore()->parentSuperCluster();}
64  reco::ConversionRefVector conversions() const {return this->photonCore()->conversions() ;}
66  pflow=1,
67  both=2};
68 
70  reco::ConversionRefVector conversionsOneLeg() const {return this->photonCore()->conversionsOneLeg() ;}
72  bool hasConversionTracks() const { if (!this->photonCore()->conversions().empty() || !this->photonCore()->conversionsOneLeg().empty()) return true; else return false;}
74  reco::ElectronSeedRefVector electronPixelSeeds() const {return this->photonCore()->electronPixelSeeds();}
76  bool hasPixelSeed() const { if (!(this->photonCore()->electronPixelSeeds()).empty() ) return true; else return false; }
77  int conversionTrackProvenance(const edm::RefToBase<reco::Track>& convTrack) const;
78 
79 
83  void setVertex(const Point & vertex) override;
85  bool isPhoton() const override { return true ; }
86 
87 
88  //=======================================================
89  // Fiducial Flags
90  //=======================================================
92  {
93 
94  //Fiducial flags
95  bool isEB;//Photon is in EB
96  bool isEE;//Photon is in EE
97  bool isEBEtaGap;//Photon is in supermodule/supercrystal eta gap in EB
98  bool isEBPhiGap;//Photon is in supermodule/supercrystal phi gap in EB
99  bool isEERingGap;//Photon is in crystal ring gap in EE
100  bool isEEDeeGap;//Photon is in crystal dee gap in EE
101  bool isEBEEGap;//Photon is in border between EB and EE.
102 
104  isEB(false),
105  isEE(false),
106  isEBEtaGap(false),
107  isEBPhiGap(false),
108  isEERingGap(false),
109  isEEDeeGap(false),
110  isEBEEGap(false)
111 
112  {}
113 
114 
115  };
116 
121  bool isEB() const{return fiducialFlagBlock_.isEB;}
122  // true if photon is in ECAL endcap
123  bool isEE() const{return fiducialFlagBlock_.isEE;}
125  bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); }
129  bool isEEGap() const { return (isEERingGap() || isEEDeeGap()); }
133  bool isEBEEGap() const{return fiducialFlagBlock_.isEBEEGap;}
134 
135  //=======================================================
136  // Shower Shape Variables
137  //=======================================================
138 
139  struct ShowerShape
140  {
141  float sigmaEtaEta ;
143  float e1x5 ;
144  float e2x5 ;
145  float e3x3 ;
146  float e5x5 ;
147  float maxEnergyXtal ;
148  float hcalDepth1OverEcal ; // hcal over ecal energy using first hcal depth
149  float hcalDepth2OverEcal ; // hcal over ecal energy using 2nd hcal depth
152  std::vector<CaloTowerDetId> hcalTowersBehindClusters;
153  float effSigmaRR;
156  float e2nd;
157  float eTop;
158  float eLeft;
159  float eRight;
160  float eBottom;
161  float e1x3;
162  float e2x2;
163  float e2x5Max;
164  float e2x5Left;
165  float e2x5Right;
166  float e2x5Top;
167  float e2x5Bottom;
169  : sigmaEtaEta(std::numeric_limits<float>::max()),
170  sigmaIetaIeta(std::numeric_limits<float>::max()),
171  e1x5(0.f),
172  e2x5(0.f),
173  e3x3(0.f),
174  e5x5(0.f),
175  maxEnergyXtal(0.f),
176  hcalDepth1OverEcal(0),
177  hcalDepth2OverEcal(0),
178  hcalDepth1OverEcalBc(0),
179  hcalDepth2OverEcalBc(0),
180  effSigmaRR(std::numeric_limits<float>::max()),
181  sigmaIetaIphi(std::numeric_limits<float>::max()),
182  sigmaIphiIphi(std::numeric_limits<float>::max()),
183  e2nd(0.f),
184  eTop(0.f),
185  eLeft(0.f),
186  eRight(0.f),
187  eBottom(0.f),
188  e1x3(0.f),
189  e2x2(0.f),
190  e2x5Max(0.f),
191  e2x5Left(0.f),
192  e2x5Right(0.f),
193  e2x5Top(0.f),
194  e2x5Bottom(0.f)
195  {}
196  } ;
199 
202 
209 
216  const std::vector<CaloTowerDetId> & hcalTowersBehindClusters() const { return showerShapeBlock_.hcalTowersBehindClusters ; }
217 
219  float e1x5() const {return showerShapeBlock_.e1x5;}
220  float e2x5() const {return showerShapeBlock_.e2x5;}
221  float e3x3() const {return showerShapeBlock_.e3x3;}
222  float e5x5() const {return showerShapeBlock_.e5x5;}
224  float sigmaEtaEta() const {return showerShapeBlock_.sigmaEtaEta;}
228  float r9 () const {return showerShapeBlock_.e3x3/this->superCluster()->rawEnergy();}
229 
240  float full5x5_r9 () const {return full5x5_showerShapeBlock_.e3x3/this->superCluster()->rawEnergy();}
241 
242  //=======================================================
243  // SaturationInfo
244  //=======================================================
245 
246  struct SaturationInfo {
250  : nSaturatedXtals(0), isSeedSaturated(false) {};
251  } ;
252 
253  // accessors
256  const SaturationInfo& saturationInfo() const { return saturationInfo_; }
258 
259  //=======================================================
260  // Energy Determinations
261  //=======================================================
263 
279  scEcalEnergy(0.),
280  scEcalEnergyError(999.),
281  scEcalP4(0., 0., 0., 0.),
282  phoEcalEnergy(0.),
283  phoEcalEnergyError(999.),
284  phoEcalP4(0., 0., 0., 0.),
285  regression1Energy(0.),
286  regression1EnergyError(999.),
287  regression1P4(0.,0.,0.,0.),
288  regression2Energy(0.),
289  regression2EnergyError(999.),
290  regression2P4(0.,0.,0.,0.),
291  candidateP4type(undefined)
292  {}
293  };
294 
295  using RecoCandidate::setP4 ;
296  using RecoCandidate::p4 ;
297 
298  //sets both energy and its uncertainty
299  void setCorrectedEnergy( P4type type, float E, float dE, bool toCand=true );
300  void setP4( P4type type, const LorentzVector & p4, float p4Error, bool setToRecoCandidate ) ;
303 
304  float getCorrectedEnergy( P4type type) const;
305  float getCorrectedEnergyError( P4type type) const ;
307  const LorentzVector& p4( P4type type ) const ;
308  const EnergyCorrections & energyCorrections() const { return eCorrections_ ; }
309 
310  //=======================================================
311  // MIP Variables
312  //=======================================================
313 
315  {
316  float mipChi2;
318  float mipSlope;
321  bool mipIsHalo;
322 
324 
325  mipChi2(0),
326  mipTotEnergy(0),
327  mipSlope(0),
328  mipIntercept(0),
329  mipNhitCone(0),
330  mipIsHalo(false)
331  {}
332 
333  } ;
334 
336  float mipChi2() const {return mipVariableBlock_.mipChi2;}
338  float mipSlope() const {return mipVariableBlock_.mipSlope;}
341  bool mipIsHalo() const {return mipVariableBlock_.mipIsHalo;}
342 
344  void setMIPVariables ( const MIPVariables& mipVar) {mipVariableBlock_= mipVar;}
345 
346 
347 
348  //=======================================================
349  // Isolation Variables
350  //=======================================================
351 
353  {
354  //These are analysis quantities calculated in the PhotonIDAlgo class
355 
356  //EcalRecHit isolation
358  //HcalTower isolation
360  //HcalDepth1Tower isolation
362  //HcalDepth2Tower isolation
364  //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC
366  //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC
368  //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC
370  //Sum of track pT in a cone of dR
372  //Sum of track pT in a hollow cone of outer radius, inner radius
374  //Number of tracks in a cone of dR
376  //Number of tracks in a hollow cone of outer radius, inner radius
378 
380 
381  ecalRecHitSumEt(0),
382  hcalTowerSumEt(0),
383  hcalDepth1TowerSumEt(0),
384  hcalDepth2TowerSumEt(0),
385  hcalTowerSumEtBc(0),
386  hcalDepth1TowerSumEtBc(0),
387  hcalDepth2TowerSumEtBc(0),
388  trkSumPtSolidCone(0),
389  trkSumPtHollowCone(0),
390  nTrkSolidCone(0),
391  nTrkHollowCone(0)
392 
393  {}
394 
395 
396  };
397 
398 
400  void setIsolationVariables ( const IsolationVariables& isolInDr04, const IsolationVariables& isolInDr03) { isolationR04_ = isolInDr04 ; isolationR03_ = isolInDr03 ;}
401 
417  // Track pT sum
419  //As above, excluding the core at the center of the cone
421  //Returns number of tracks in a cone of dR
423  //As above, excluding the core at the center of the cone
425  //
440  // Track pT sum c
442  //As above, excluding the core at the center of the cone
444  //Returns number of tracks in a cone of dR
446  //As above, excluding the core at the center of the cone
448 
449 
450  //=======================================================
451  // PFlow based Isolation Variables
452  //=======================================================
453 
455  {
456 
457  float chargedHadronIso; // equivalent to sumChargedHadronPt in DataFormats/MuonReco/interface/MuonPFIsolation.h
458  float chargedHadronIsoWrongVtx; // equivalent to sumChargedHadronPt in DataFormats/MuonReco/interface/MuonPFIsolation.h
459  float neutralHadronIso; // equivalent to sumNeutralHadronPt in DataFormats/MuonReco/interface/MuonPFIsolation.h
460  float photonIso ; // equivalent to sumPhotonPt in DataFormats/MuonReco/interface/MuonPFIsolation.h
461  float modFrixione ;
465  float sumPUPt;
466 
468 
469  chargedHadronIso(0),
470  chargedHadronIsoWrongVtx(0),
471  neutralHadronIso(0),
472  photonIso(0),
473  modFrixione(0),
474  sumChargedParticlePt(0),
475  sumNeutralHadronEtHighThreshold(0),
476  sumPhotonEtHighThreshold(0),
477  sumPUPt(0)
478  {}
479 
480 
481  };
482 
487  float photonIso() const {return pfIsolation_.photonIso;}
491  float sumPUPt() const {return pfIsolation_.sumPUPt;}
492 
495 
498 
500  {
501 
504  float mva;
505 
507 
508  nClusterOutsideMustache(-1),
509  etOutsideMustache(-999999999.),
510  mva(-999999999.)
511 
512  {}
513  };
514 
515  // getters
517  float etOutsideMustache() const {return pfID_.etOutsideMustache;}
518  float pfMVA() const {return pfID_.mva;}
519  // setters
520  void setPflowIDVariables ( const PflowIDVariables& pfid ) { pfID_ = pfid;}
521 
522  private:
524  bool overlap( const Candidate & ) const override;
529  //
531  //
542  };
543 
544 }
545 
546 #endif
MIPVariables mipVariableBlock_
Definition: Photon.h:539
type
Definition: HCALResponse.h:21
void setPflowIsolationVariables(const PflowIsolationVariables &pfisol)
Set Particle Flow Isolation variables.
Definition: Photon.h:497
float hcalDepth1TowerSumEtBcConeDR03() const
Hcal-Depth1 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC...
Definition: Photon.h:437
float hcalTowerSumEtConeDR04() const
Hcal isolation sum.
Definition: Photon.h:406
SaturationInfo saturationInfo_
Definition: Photon.h:537
void setMIPVariables(const MIPVariables &mipVar)
set mip Variables
Definition: Photon.h:344
float trkSumPtSolidConeDR03() const
Definition: Photon.h:441
float hcalDepth1TowerSumEtConeDR04() const
Hcal-Depth1 isolation sum.
Definition: Photon.h:408
ShowerShape full5x5_showerShapeBlock_
Definition: Photon.h:536
Definition: Photon.py:1
PflowIsolationVariables pfIsolation_
Definition: Photon.h:540
float hcalDepth1TowerSumEtConeDR03() const
Hcal-Depth1 isolation sum.
Definition: Photon.h:431
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: Photon.h:152
bool isEE() const
Definition: Photon.h:123
bool isEEDeeGap() const
Definition: Photon.h:131
void setCandidateP4type(const P4type type)
Definition: Photon.h:302
const EnergyCorrections & energyCorrections() const
Definition: Photon.h:308
float chargedHadronIso() const
Accessors for Particle Flow Isolation variables.
Definition: Photon.h:484
float sumChargedParticlePt
sum-pt of charged Particles(inludes e/mu)
Definition: Photon.h:462
bool isEBGap() const
true if photon is in EB, and inside the boundaries in super crystals/modules
Definition: Photon.h:125
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
float neutralHadronIso() const
Definition: Photon.h:486
float e5x5() const
Definition: Photon.h:222
float full5x5_r2x5() const
Definition: Photon.h:239
float hcalTowerSumEtConeDR03() const
Hcal isolation sum.
Definition: Photon.h:429
float sumPUPt() const
Definition: Photon.h:491
float sumNeutralHadronEtHighThreshold() const
Definition: Photon.h:489
const SaturationInfo & saturationInfo() const
Definition: Photon.h:256
reco::ConversionRefVector conversionsOneLeg() const
vector of references to one leg Conversion&#39;s
Definition: Photon.h:70
float sumNeutralHadronEtHighThreshold
sum pt of neutral hadrons with a higher threshold
Definition: Photon.h:463
float sumPhotonEtHighThreshold
sum pt of PF photons with a higher threshold
Definition: Photon.h:464
float trkSumPtSolidConeDR04() const
Definition: Photon.h:418
Definition: __init__.py:1
int nTrkSolidConeDR03() const
Definition: Photon.h:445
float full5x5_e2x5() const
Definition: Photon.h:232
float e1x5() const
Shower shape variables.
Definition: Photon.h:219
bool overlap(const Candidate &) const override
check overlap with another candidate
bool isEBEEGap() const
true if photon is in boundary between EB and EE
Definition: Photon.h:133
float ecalRecHitSumEtConeDR04() const
Definition: Photon.h:404
Photon * clone() const override
returns a clone of the candidate
void setSaturationInfo(const SaturationInfo &s)
Definition: Photon.h:257
float full5x5_r1x5() const
Definition: Photon.h:238
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
float trkSumPtHollowConeDR03() const
Definition: Photon.h:443
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
float full5x5_maxEnergyXtal() const
Definition: Photon.h:235
float full5x5_sigmaEtaEta() const
Definition: Photon.h:236
bool isPhoton() const override
Implement Candidate method for particle species.
Definition: Photon.h:85
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: Photon.h:465
IsolationVariables isolationR03_
Definition: Photon.h:534
int conversionTrackProvenance(const edm::RefToBase< reco::Track > &convTrack) const
ConversionProvenance
Definition: Photon.h:65
float photonIso() const
Definition: Photon.h:487
Photon()
default constructor
Definition: Photon.h:32
float hadronicDepth2OverEm() const
the hadronic release in depth2 over electromagnetic fraction
Definition: Photon.h:208
void setVertex(const Point &vertex) override
set primary event vertex used to define photon direction
float mipIntercept() const
Definition: Photon.h:339
math::XYZPointF caloPosition_
position of seed BasicCluster for shower depth of unconverted photon
Definition: Photon.h:526
float full5x5_e1x5() const
full5x5 Shower shape variables
Definition: Photon.h:231
float full5x5_e3x3() const
Definition: Photon.h:233
float hadTowDepth1OverEm() const
the ration of hadronic energy in towers depth1 behind the BCs in the SC and the SC energy ...
Definition: Photon.h:213
float full5x5_r9() const
Definition: Photon.h:240
LorentzVector regression2P4
Definition: Photon.h:276
reco::PhotonCoreRef photonCore() const
returns a reference to the core photon object
Definition: Photon.h:50
bool mipIsHalo() const
Definition: Photon.h:341
IsolationVariables isolationR04_
Definition: Photon.h:533
void setPhotonCore(const reco::PhotonCoreRef &photonCore)
Definition: Photon.h:51
float full5x5_sigmaIetaIeta() const
Definition: Photon.h:237
float hcalDepth2TowerSumEtBcConeDR04() const
Hcal-Depth2 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC...
Definition: Photon.h:416
reco::ConversionRefVector conversions() const
vector of references to Conversion&#39;s
Definition: Photon.h:64
float hcalTowerSumEtBcConeDR04() const
Hcal isolation sum subtracting the hadronic energy in towers behind the BCs in the SC...
Definition: Photon.h:412
void setEnergyCorrections(const EnergyCorrections &e)
Definition: Photon.h:301
bool isStandardPhoton() const
Definition: Photon.h:58
bool isEBPhiGap() const
Definition: Photon.h:127
void setPflowIDVariables(const PflowIDVariables &pfid)
Definition: Photon.h:520
float sigmaIetaIeta() const
Definition: Photon.h:225
const Point & vertex() const override
vertex position (overwritten by PF...)
EnergyCorrections eCorrections_
Definition: Photon.h:538
float hadTowDepth2OverEm() const
the ration of hadronic energy in towers depth2 behind the BCs in the SC and the SC energy ...
Definition: Photon.h:215
void setShowerShapeVariables(const ShowerShape &a)
Definition: Photon.h:200
float e2x5() const
Definition: Photon.h:220
double f[11][100]
float sigmaEtaEta() const
Definition: Photon.h:224
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
float sumChargedParticlePt() const
Definition: Photon.h:488
float hadTowOverEm() const
the ration of hadronic energy in towers behind the BCs in the SC and the SC energy ...
Definition: Photon.h:211
int nTrkHollowConeDR04() const
Definition: Photon.h:424
float hcalDepth2TowerSumEtConeDR03() const
Hcal-Depth2 isolation sum.
Definition: Photon.h:433
int nTrkHollowConeDR03() const
Definition: Photon.h:447
bool isPFlowPhoton() const
Retrieve photonCore attributes.
Definition: Photon.h:57
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
Definition: Photon.h:204
~Photon() override
destructor
float mipTotEnergy() const
Definition: Photon.h:337
math::XYZPointF caloPosition() const
position in ECAL: this is th SC position if r9<0.93. If r8>0.93 is position of seed BasicCluster taki...
Definition: Photon.h:81
float r1x5() const
Definition: Photon.h:226
float hcalTowerSumEtBcConeDR03() const
Hcal isolation sum subtracting the hadronic energy in towers behind the BCs in the SC...
Definition: Photon.h:435
FiducialFlags fiducialFlagBlock_
Definition: Photon.h:532
float getCorrectedEnergyError(P4type type) const
P4type getCandidateP4type() const
Definition: Photon.h:306
float etOutsideMustache() const
Definition: Photon.h:517
float hadronicDepth1OverEm() const
the hadronic release in depth1 over electromagnetic fraction
Definition: Photon.h:206
bool hasConversionTracks() const
Bool flagging photons with a vector of refereces to conversions with size >0.
Definition: Photon.h:72
bool pixelSeed_
Definition: Photon.h:530
LorentzVector regression1P4
Definition: Photon.h:273
float hcalDepth2TowerSumEtConeDR04() const
Hcal-Depth2 isolation sum.
Definition: Photon.h:410
bool isEEGap() const
true if photon is in EE, and inside the boundaries in supercrystal/D
Definition: Photon.h:129
float e3x3() const
Definition: Photon.h:221
float chargedHadronIsoWrongVtx() const
Definition: Photon.h:485
bool hasPixelSeed() const
Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds.
Definition: Photon.h:76
float hcalDepth1TowerSumEtBcConeDR04() const
Hcal-Depth1 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC...
Definition: Photon.h:414
void setFiducialVolumeFlags(const FiducialFlags &a)
set flags for photons in the ECAL fiducial volume
Definition: Photon.h:118
float sumPhotonEtHighThreshold() const
Definition: Photon.h:490
int nTrkSolidConeDR04() const
Definition: Photon.h:422
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
bool isEERingGap() const
Definition: Photon.h:130
PflowIDVariables pfID_
Definition: Photon.h:541
float getCorrectedEnergy(P4type type) const
bool isEB() const
Definition: Photon.h:121
float trkSumPtHollowConeDR04() const
Definition: Photon.h:420
float r2x5() const
Definition: Photon.h:227
void full5x5_setShowerShapeVariables(const ShowerShape &a)
Definition: Photon.h:201
float ecalRecHitSumEtConeDR03() const
Isolation variables in cone dR=0.3.
Definition: Photon.h:427
fixed size matrix
const ShowerShape & full5x5_showerShapeVariables() const
Definition: Photon.h:198
double a
Definition: hdecay.h:121
int nClusterOutsideMustache() const
Definition: Photon.h:516
float r9() const
Definition: Photon.h:228
reco::ElectronSeedRefVector electronPixelSeeds() const
reference to electron Pixel seed
Definition: Photon.h:74
float hcalDepth2TowerSumEtBcConeDR03() const
Hcal-Depth2 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC...
Definition: Photon.h:439
const std::vector< CaloTowerDetId > & hcalTowersBehindClusters() const
Definition: Photon.h:216
float mipSlope() const
Definition: Photon.h:338
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
float isSeedSaturated() const
Definition: Photon.h:255
int mipNhitCone() const
Definition: Photon.h:340
reco::SuperClusterRef parentSuperCluster() const
Ref to PFlow SuperCluster.
Definition: Photon.h:62
float pfMVA() const
Definition: Photon.h:518
ShowerShape showerShapeBlock_
Definition: Photon.h:535
const PflowIsolationVariables & getPflowIsolationVariables() const
Get Particle Flow Isolation variables block.
Definition: Photon.h:494
float mipChi2() const
MIP variables.
Definition: Photon.h:336
const ShowerShape & showerShapeVariables() const
Definition: Photon.h:197
reco::PhotonCoreRef photonCore_
reference to the PhotonCore
Definition: Photon.h:528
float full5x5_e5x5() const
Definition: Photon.h:234
void setP4(const LorentzVector &p4) final
set 4-momentum
float nSaturatedXtals() const
Definition: Photon.h:254
void setIsolationVariables(const IsolationVariables &isolInDr04, const IsolationVariables &isolInDr03)
set relevant isolation variables
Definition: Photon.h:400
void setP4(P4type type, const LorentzVector &p4, float p4Error, bool setToRecoCandidate)
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
bool isEBEtaGap() const
Definition: Photon.h:126
float maxEnergyXtal() const
Definition: Photon.h:223