CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DataFormats/EgammaCandidates/interface/Photon.h

Go to the documentation of this file.
00001 #ifndef EgammaCandidates_Photon_h
00002 #define EgammaCandidates_Photon_h
00003 
00013 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00014 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
00015 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
00016 #include "DataFormats/EgammaCandidates/interface/PhotonCore.h"
00017 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
00018 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00019 
00020 
00021 namespace reco {
00022 
00023   class Photon : public RecoCandidate {
00024   public:
00026     struct  FiducialFlags;
00027     struct  IsolationVariables;
00028     struct  ShowerShape;
00029     struct  MIPVariables;  
00030     
00032     Photon() : RecoCandidate() { pixelSeed_=false; }
00033 
00035     Photon ( const Photon&); 
00036 
00038     Photon( const LorentzVector & p4, 
00039             Point caloPos, 
00040             const PhotonCoreRef & core,  
00041             const Point & vtx = Point( 0, 0, 0 ) );
00042 
00044     virtual ~Photon();
00045 
00047     virtual Photon * clone() const;
00048 
00050     reco::PhotonCoreRef photonCore() const { return photonCore_;}
00051     //
00053     //
00054     // retrieve provenance
00055     bool isPFlowPhoton() const {return this->photonCore()->isPFlowPhoton();}
00056     bool isStandardPhoton() const {return this->photonCore()->isStandardPhoton();}
00058     reco::SuperClusterRef superCluster() const;
00060     reco::SuperClusterRef pfSuperCluster() const {return this->photonCore()->pfSuperCluster();}
00062     reco::ConversionRefVector conversions() const {return this->photonCore()->conversions() ;}  
00063     enum ConversionProvenance {egamma=0, 
00064                                pflow=1, 
00065                                both=2};
00066 
00068     reco::ConversionRefVector conversionsOneLeg() const {return this->photonCore()->conversionsOneLeg() ;} 
00070     bool hasConversionTracks() const { if (this->photonCore()->conversions().size() > 0 || this->photonCore()->conversionsOneLeg().size() > 0)  return true; else return false;}
00072     reco::ElectronSeedRefVector electronPixelSeeds() const {return this->photonCore()->electronPixelSeeds();}
00074     bool hasPixelSeed() const { if ((this->photonCore()->electronPixelSeeds()).size() > 0 ) return true; else return false; }
00075     int conversionTrackProvenance(const edm::RefToBase<reco::Track>& convTrack) const;
00076 
00077  
00079     math::XYZPointF caloPosition() const {return caloPosition_;}
00081     void setVertex(const Point & vertex);
00083     bool isPhoton() const { return true ; }
00084 
00085     //=======================================================
00086     // Fiducial Flags
00087     //=======================================================
00088     struct  FiducialFlags
00089     {
00090       
00091       //Fiducial flags
00092       bool isEB;//Photon is in EB
00093       bool isEE;//Photon is in EE
00094       bool isEBEtaGap;//Photon is in supermodule/supercrystal eta gap in EB
00095       bool isEBPhiGap;//Photon is in supermodule/supercrystal phi gap in EB
00096       bool isEERingGap;//Photon is in crystal ring gap in EE
00097       bool isEEDeeGap;//Photon is in crystal dee gap in EE
00098       bool isEBEEGap;//Photon is in border between EB and EE.
00099       
00100       FiducialFlags():
00101         isEB(false),
00102            isEE(false),
00103            isEBEtaGap(false),
00104            isEBPhiGap(false),
00105            isEERingGap(false),
00106            isEEDeeGap(false),
00107            isEBEEGap(false)
00108            
00109       {}
00110       
00111       
00112     };
00113 
00115     void setFiducialVolumeFlags  ( const FiducialFlags&  a )  { fiducialFlagBlock_= a ;}
00118     bool isEB() const{return  fiducialFlagBlock_.isEB;}
00119     // true if photon is in ECAL endcap
00120     bool isEE() const{return fiducialFlagBlock_.isEE;}
00122     bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); }
00123     bool isEBEtaGap() const{return fiducialFlagBlock_.isEBEtaGap;}
00124     bool isEBPhiGap() const{return fiducialFlagBlock_.isEBPhiGap;}
00126     bool isEEGap() const { return (isEERingGap() || isEEDeeGap()); }
00127     bool isEERingGap() const{return fiducialFlagBlock_.isEERingGap;}
00128     bool isEEDeeGap() const{return fiducialFlagBlock_.isEEDeeGap;}
00130     bool isEBEEGap() const{return fiducialFlagBlock_.isEBEEGap;}
00131 
00132     //=======================================================
00133     // Shower Shape Variables
00134     //=======================================================
00135 
00136     struct ShowerShape
00137     {
00138       float sigmaEtaEta ;
00139       float sigmaIetaIeta ;
00140       float e1x5 ;
00141       float e2x5 ;
00142       float e3x3 ;
00143       float e5x5 ;
00144       float maxEnergyXtal ; 
00145       float hcalDepth1OverEcal ; // hcal over ecal energy using first hcal depth
00146       float hcalDepth2OverEcal ; // hcal over ecal energy using 2nd hcal depth
00147       float hcalDepth1OverEcalBc;
00148       float hcalDepth2OverEcalBc;
00149       std::vector<CaloTowerDetId> hcalTowersBehindClusters;
00150       ShowerShape()
00151         : sigmaEtaEta(std::numeric_limits<float>::infinity()),
00152            sigmaIetaIeta(std::numeric_limits<float>::infinity()),
00153            e1x5(0), 
00154            e2x5(0), 
00155            e3x3(0), 
00156            e5x5(0), 
00157            maxEnergyXtal(0),
00158           hcalDepth1OverEcal(0),
00159           hcalDepth2OverEcal(0),
00160           hcalDepth1OverEcalBc(0),
00161           hcalDepth2OverEcalBc(0)
00162            
00163       {}
00164     } ;
00165     void setShowerShapeVariables ( const ShowerShape& a )     { showerShapeBlock_ = a ;}
00167     float hadronicOverEm() const {return   showerShapeBlock_.hcalDepth1OverEcal + showerShapeBlock_.hcalDepth2OverEcal  ;}
00169     float hadronicDepth1OverEm() const {return  showerShapeBlock_.hcalDepth1OverEcal  ;}
00171     float hadronicDepth2OverEm() const {return  showerShapeBlock_.hcalDepth2OverEcal  ;}
00172 
00174     float hadTowOverEm() const {return   showerShapeBlock_.hcalDepth1OverEcalBc + showerShapeBlock_.hcalDepth2OverEcalBc  ;}
00176     float hadTowDepth1OverEm() const {return  showerShapeBlock_.hcalDepth1OverEcalBc  ;}
00178     float hadTowDepth2OverEm() const {return  showerShapeBlock_.hcalDepth2OverEcalBc  ;}
00179     const std::vector<CaloTowerDetId> & hcalTowersBehindClusters() const { return showerShapeBlock_.hcalTowersBehindClusters ; }
00180 
00182     float e1x5()            const {return showerShapeBlock_.e1x5;}
00183     float e2x5()            const {return showerShapeBlock_.e2x5;}
00184     float e3x3()            const {return showerShapeBlock_.e3x3;}
00185     float e5x5()            const {return showerShapeBlock_.e5x5;}
00186     float maxEnergyXtal()   const {return showerShapeBlock_.maxEnergyXtal;}
00187     float sigmaEtaEta()     const {return showerShapeBlock_.sigmaEtaEta;}
00188     float sigmaIetaIeta()   const {return showerShapeBlock_.sigmaIetaIeta;}
00189     float r1x5 ()           const {return showerShapeBlock_.e1x5/showerShapeBlock_.e5x5;}
00190     float r2x5 ()           const {return showerShapeBlock_.e2x5/showerShapeBlock_.e5x5;}
00191     float r9 ()             const {return showerShapeBlock_.e3x3/this->superCluster()->rawEnergy();}  
00192 
00193     //=======================================================
00194     // Energy Determinations
00195     //=======================================================
00196     enum P4type { undefined=-1, ecal_standard=0, ecal_photons=1, regression1=2, regression2= 3 } ;
00197 
00198     struct EnergyCorrections {
00199       float scEcalEnergy;
00200       float scEcalEnergyError;
00201       LorentzVector scEcalP4;
00202       float phoEcalEnergy;
00203       float phoEcalEnergyError;
00204       LorentzVector phoEcalP4;
00205       float regression1Energy;
00206       float regression1EnergyError;
00207       LorentzVector regression1P4;
00208       float regression2Energy;
00209       float regression2EnergyError;
00210       LorentzVector regression2P4;
00211       P4type candidateP4type;
00212       EnergyCorrections() : 
00213         scEcalEnergy(0.), 
00214         scEcalEnergyError(999.),
00215         scEcalP4(0., 0., 0., 0.),
00216         phoEcalEnergy(0.), 
00217         phoEcalEnergyError(999.),
00218         phoEcalP4(0., 0., 0., 0.),
00219         regression1Energy(0.), 
00220         regression1EnergyError(999.),
00221         regression1P4(0.,0.,0.,0.),  
00222         regression2Energy(0.), 
00223         regression2EnergyError(999.),
00224         regression2P4(0.,0.,0.,0.),
00225         candidateP4type(undefined) 
00226       {}
00227     };
00228 
00229     using RecoCandidate::setP4 ;
00230     using RecoCandidate::p4 ;
00231 
00232     //sets both energy and its uncertainty
00233     void setCorrectedEnergy( P4type type, float E, float dE, bool toCand=true );        
00234     void setP4( P4type type, const LorentzVector & p4, float p4Error, bool setToRecoCandidate ) ;
00235     void setEnergyCorrections ( const EnergyCorrections& e) { eCorrections_=e;}
00236     void setCandidateP4type(const  P4type type) { eCorrections_.candidateP4type = type; }
00237 
00238     float getCorrectedEnergy( P4type type) const;
00239     float getCorrectedEnergyError( P4type type) const ;
00240     P4type getCandidateP4type() const {return eCorrections_.candidateP4type;}
00241     const LorentzVector& p4( P4type type ) const ;
00242     const EnergyCorrections & energyCorrections() const { return eCorrections_ ; }
00243 
00244     //=======================================================
00245     // MIP Variables
00246     //=======================================================
00247     
00248     struct MIPVariables
00249     {       
00250       float mipChi2;
00251       float mipTotEnergy;
00252       float mipSlope;
00253       float mipIntercept;
00254       int   mipNhitCone;
00255       bool  mipIsHalo;
00256       
00257       MIPVariables():
00258         
00259         mipChi2(0), 
00260         mipTotEnergy(0), 
00261         mipSlope(0), 
00262         mipIntercept(0), 
00263         mipNhitCone(0),
00264         mipIsHalo(false)        
00265       {}    
00266       
00267     } ;  
00268     
00270     float mipChi2()         const {return mipVariableBlock_.mipChi2;}
00271     float mipTotEnergy()    const {return mipVariableBlock_.mipTotEnergy;}
00272     float mipSlope()        const {return mipVariableBlock_.mipSlope;}
00273     float mipIntercept()    const {return mipVariableBlock_.mipIntercept;}
00274     int mipNhitCone()     const {return mipVariableBlock_.mipNhitCone;}
00275     bool  mipIsHalo()       const {return mipVariableBlock_.mipIsHalo;}
00276             
00278     void setMIPVariables ( const MIPVariables& mipVar) {mipVariableBlock_= mipVar;} 
00279     
00280     
00281 
00282     //=======================================================
00283     // Isolation Variables
00284     //=======================================================
00285 
00286     struct IsolationVariables
00287     {
00288       //These are analysis quantities calculated in the PhotonIDAlgo class
00289       
00290       //EcalRecHit isolation
00291       float ecalRecHitSumEt;
00292       //HcalTower isolation
00293       float hcalTowerSumEt;
00294       //HcalDepth1Tower isolation
00295       float hcalDepth1TowerSumEt;
00296       //HcalDepth2Tower isolation
00297       float hcalDepth2TowerSumEt;
00298       //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC
00299       float hcalTowerSumEtBc; 
00300       //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC
00301       float hcalDepth1TowerSumEtBc;
00302       //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC
00303       float hcalDepth2TowerSumEtBc;
00304       //Sum of track pT in a cone of dR
00305       float trkSumPtSolidCone;
00306       //Sum of track pT in a hollow cone of outer radius, inner radius
00307       float trkSumPtHollowCone;
00308       //Number of tracks in a cone of dR
00309       int nTrkSolidCone;
00310       //Number of tracks in a hollow cone of outer radius, inner radius
00311       int nTrkHollowCone;
00312       
00313       IsolationVariables():
00314         
00315         ecalRecHitSumEt(0),
00316         hcalTowerSumEt(0),
00317         hcalDepth1TowerSumEt(0),
00318         hcalDepth2TowerSumEt(0),
00319         hcalTowerSumEtBc(0),
00320         hcalDepth1TowerSumEtBc(0),
00321         hcalDepth2TowerSumEtBc(0),
00322         trkSumPtSolidCone(0),
00323         trkSumPtHollowCone(0),
00324         nTrkSolidCone(0),
00325         nTrkHollowCone(0)
00326            
00327       {}
00328       
00329       
00330     };
00331 
00332     
00334     void setIsolationVariables ( const IsolationVariables& isolInDr04, const IsolationVariables& isolInDr03) {  isolationR04_ = isolInDr04 ; isolationR03_ = isolInDr03 ;} 
00335 
00338     float ecalRecHitSumEtConeDR04()      const{return  isolationR04_.ecalRecHitSumEt;}
00340     float hcalTowerSumEtConeDR04()      const{return  isolationR04_.hcalTowerSumEt ;}
00342     float hcalDepth1TowerSumEtConeDR04()      const{return  isolationR04_.hcalDepth1TowerSumEt;}
00344     float hcalDepth2TowerSumEtConeDR04()      const{return  isolationR04_.hcalDepth2TowerSumEt;}
00346     float hcalTowerSumEtBcConeDR04()      const{return  isolationR04_.hcalTowerSumEtBc ;}
00348     float hcalDepth1TowerSumEtBcConeDR04()      const{return  isolationR04_.hcalDepth1TowerSumEtBc;}
00350     float hcalDepth2TowerSumEtBcConeDR04()      const{return  isolationR04_.hcalDepth2TowerSumEtBc;}
00351     //  Track pT sum 
00352     float trkSumPtSolidConeDR04()    const{return   isolationR04_.trkSumPtSolidCone;}
00353     //As above, excluding the core at the center of the cone
00354     float trkSumPtHollowConeDR04()   const{return   isolationR04_.trkSumPtHollowCone;}
00355     //Returns number of tracks in a cone of dR
00356     int nTrkSolidConeDR04()              const{return   isolationR04_.nTrkSolidCone;}
00357     //As above, excluding the core at the center of the cone
00358     int nTrkHollowConeDR04()            const{return   isolationR04_.nTrkHollowCone;}
00359     //
00361     float ecalRecHitSumEtConeDR03()      const{return  isolationR03_.ecalRecHitSumEt;}
00363     float hcalTowerSumEtConeDR03()      const{return isolationR03_.hcalTowerSumEt;}
00365     float hcalDepth1TowerSumEtConeDR03()      const{return isolationR03_.hcalDepth1TowerSumEt;}
00367     float hcalDepth2TowerSumEtConeDR03()      const{return isolationR03_.hcalDepth2TowerSumEt;}
00369     float hcalTowerSumEtBcConeDR03()      const{return  isolationR03_.hcalTowerSumEtBc ;}
00371     float hcalDepth1TowerSumEtBcConeDR03()      const{return  isolationR03_.hcalDepth1TowerSumEtBc;}
00373     float hcalDepth2TowerSumEtBcConeDR03()      const{return  isolationR03_.hcalDepth2TowerSumEtBc;}
00374     //  Track pT sum c
00375     float trkSumPtSolidConeDR03()    const{return  isolationR03_.trkSumPtSolidCone;}
00376     //As above, excluding the core at the center of the cone
00377     float trkSumPtHollowConeDR03()   const{return  isolationR03_.trkSumPtHollowCone;}
00378     //Returns number of tracks in a cone of dR
00379     int nTrkSolidConeDR03()              const{return  isolationR03_.nTrkSolidCone;}
00380     //As above, excluding the core at the center of the cone
00381     int nTrkHollowConeDR03()             const{return  isolationR03_.nTrkHollowCone;}
00382 
00383 
00384     //=======================================================
00385     // PFlow based Isolation Variables
00386     //=======================================================
00387 
00388     struct PflowIsolationVariables
00389     {
00390 
00391       float chargedHadronIso;
00392       float neutralHadronIso;
00393       float photonIso ;
00394       float modFrixione ;      
00395       
00396       PflowIsolationVariables():
00397         
00398         chargedHadronIso(0),
00399         neutralHadronIso(0),
00400         photonIso(0),
00401         modFrixione(0)
00402                    
00403       {}
00404       
00405       
00406     };
00407 
00409     float chargedHadronIso() const {return  pfIsolation_.chargedHadronIso;}
00410     float neutralHadronIso() const {return  pfIsolation_.neutralHadronIso;}
00411     float photonIso() const {return  pfIsolation_.photonIso;}
00412 
00414     void setPflowIsolationVariables ( const PflowIsolationVariables& pfisol ) {  pfIsolation_ = pfisol;} 
00415 
00416     struct PflowIDVariables
00417     {
00418 
00419       int nClusterOutsideMustache;
00420       float etOutsideMustache;
00421       float mva;
00422 
00423       PflowIDVariables():
00424 
00425         nClusterOutsideMustache(-1),
00426         etOutsideMustache(-999999999.),
00427         mva(-999999999.)
00428                    
00429       {}
00430     };
00431     
00432     // getters
00433     int nClusterOutsideMustache() const {return pfID_.nClusterOutsideMustache;}
00434     float etOutsideMustache() const {return pfID_.etOutsideMustache;}
00435     float pfMVA() const {return pfID_.mva;}
00436     // setters
00437     void setPflowIDVariables ( const PflowIDVariables& pfid ) {  pfID_ = pfid;}     
00438 
00439 
00440   private:
00442     virtual bool overlap( const Candidate & ) const;
00444     math::XYZPointF caloPosition_;
00446     reco::PhotonCoreRef photonCore_;
00447     //
00448     bool pixelSeed_;
00449     //
00450     FiducialFlags fiducialFlagBlock_;
00451     IsolationVariables isolationR04_;
00452     IsolationVariables isolationR03_;
00453     ShowerShape        showerShapeBlock_;
00454     EnergyCorrections eCorrections_; 
00455     MIPVariables        mipVariableBlock_; 
00456     PflowIsolationVariables pfIsolation_;
00457     PflowIDVariables pfID_;
00458 
00459 
00460   };
00461   
00462 }
00463 
00464 #endif