CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/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 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00020 
00021 
00022 namespace reco {
00023 
00024   class Photon : public RecoCandidate {
00025   public:
00027     struct  FiducialFlags;
00028     struct  IsolationVariables;
00029     struct  ShowerShape;
00030     struct  MIPVariables;  
00031     
00033     Photon() : RecoCandidate() { pixelSeed_=false; }
00034 
00036     Photon ( const Photon&); 
00037 
00039     Photon( const LorentzVector & p4, 
00040             Point caloPos, 
00041             const PhotonCoreRef & core,  
00042             const Point & vtx = Point( 0, 0, 0 ) );
00043 
00045     virtual ~Photon();
00046 
00048     virtual Photon * clone() const;
00049 
00051     reco::PhotonCoreRef photonCore() const { return photonCore_;}
00052     //
00054     //
00055     // retrieve provenance
00056     bool isPFlowPhoton() const {return this->photonCore()->isPFlowPhoton();}
00057     bool isStandardPhoton() const {return this->photonCore()->isStandardPhoton();}
00059     reco::SuperClusterRef superCluster() const;
00061     reco::SuperClusterRef pfSuperCluster() const {return this->photonCore()->pfSuperCluster();}
00063     reco::ConversionRefVector conversions() const {return this->photonCore()->conversions() ;}  
00064     enum ConversionProvenance {egamma=0, 
00065                                pflow=1, 
00066                                both=2};
00067 
00069     reco::ConversionRefVector conversionsOneLeg() const {return this->photonCore()->conversionsOneLeg() ;} 
00071     bool hasConversionTracks() const { if (this->photonCore()->conversions().size() > 0 || this->photonCore()->conversionsOneLeg().size() > 0)  return true; else return false;}
00073     reco::ElectronSeedRefVector electronPixelSeeds() const {return this->photonCore()->electronPixelSeeds();}
00075     bool hasPixelSeed() const { if ((this->photonCore()->electronPixelSeeds()).size() > 0 ) return true; else return false; }
00076     int conversionTrackProvenance(const edm::RefToBase<reco::Track>& convTrack) const;
00077 
00078  
00080     math::XYZPointF caloPosition() const {return caloPosition_;}
00082     void setVertex(const Point & vertex);
00084     bool isPhoton() const { return true ; }
00085 
00086     //=======================================================
00087     // Fiducial Flags
00088     //=======================================================
00089     struct  FiducialFlags
00090     {
00091       
00092       //Fiducial flags
00093       bool isEB;//Photon is in EB
00094       bool isEE;//Photon is in EE
00095       bool isEBEtaGap;//Photon is in supermodule/supercrystal eta gap in EB
00096       bool isEBPhiGap;//Photon is in supermodule/supercrystal phi gap in EB
00097       bool isEERingGap;//Photon is in crystal ring gap in EE
00098       bool isEEDeeGap;//Photon is in crystal dee gap in EE
00099       bool isEBEEGap;//Photon is in border between EB and EE.
00100       
00101       FiducialFlags():
00102         isEB(false),
00103            isEE(false),
00104            isEBEtaGap(false),
00105            isEBPhiGap(false),
00106            isEERingGap(false),
00107            isEEDeeGap(false),
00108            isEBEEGap(false)
00109            
00110       {}
00111       
00112       
00113     };
00114 
00116     void setFiducialVolumeFlags  ( const FiducialFlags&  a )  { fiducialFlagBlock_= a ;}
00119     bool isEB() const{return  fiducialFlagBlock_.isEB;}
00120     // true if photon is in ECAL endcap
00121     bool isEE() const{return fiducialFlagBlock_.isEE;}
00123     bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); }
00124     bool isEBEtaGap() const{return fiducialFlagBlock_.isEBEtaGap;}
00125     bool isEBPhiGap() const{return fiducialFlagBlock_.isEBPhiGap;}
00127     bool isEEGap() const { return (isEERingGap() || isEEDeeGap()); }
00128     bool isEERingGap() const{return fiducialFlagBlock_.isEERingGap;}
00129     bool isEEDeeGap() const{return fiducialFlagBlock_.isEEDeeGap;}
00131     bool isEBEEGap() const{return fiducialFlagBlock_.isEBEEGap;}
00132 
00133     //=======================================================
00134     // Shower Shape Variables
00135     //=======================================================
00136 
00137     struct ShowerShape
00138     {
00139       float sigmaEtaEta ;
00140       float sigmaIetaIeta ;
00141       float e1x5 ;
00142       float e2x5 ;
00143       float e3x3 ;
00144       float e5x5 ;
00145       float maxEnergyXtal ; 
00146       float hcalDepth1OverEcal ; // hcal over ecal energy using first hcal depth
00147       float hcalDepth2OverEcal ; // hcal over ecal energy using 2nd hcal depth
00148       float hcalDepth1OverEcalBc;
00149       float hcalDepth2OverEcalBc;
00150       std::vector<CaloTowerDetId> hcalTowersBehindClusters;
00151       ShowerShape()
00152         : sigmaEtaEta(std::numeric_limits<float>::infinity()),
00153            sigmaIetaIeta(std::numeric_limits<float>::infinity()),
00154            e1x5(0), 
00155            e2x5(0), 
00156            e3x3(0), 
00157            e5x5(0), 
00158            maxEnergyXtal(0),
00159           hcalDepth1OverEcal(0),
00160           hcalDepth2OverEcal(0),
00161           hcalDepth1OverEcalBc(0),
00162           hcalDepth2OverEcalBc(0)
00163            
00164       {}
00165     } ;
00166     void setShowerShapeVariables ( const ShowerShape& a )     { showerShapeBlock_ = a ;}
00168     float hadronicOverEm() const {return   showerShapeBlock_.hcalDepth1OverEcal + showerShapeBlock_.hcalDepth2OverEcal  ;}
00170     float hadronicDepth1OverEm() const {return  showerShapeBlock_.hcalDepth1OverEcal  ;}
00172     float hadronicDepth2OverEm() const {return  showerShapeBlock_.hcalDepth2OverEcal  ;}
00173 
00175     float hadTowOverEm() const {return   showerShapeBlock_.hcalDepth1OverEcalBc + showerShapeBlock_.hcalDepth2OverEcalBc  ;}
00177     float hadTowDepth1OverEm() const {return  showerShapeBlock_.hcalDepth1OverEcalBc  ;}
00179     float hadTowDepth2OverEm() const {return  showerShapeBlock_.hcalDepth2OverEcalBc  ;}
00180     const std::vector<CaloTowerDetId> & hcalTowersBehindClusters() const { return showerShapeBlock_.hcalTowersBehindClusters ; }
00181 
00183     float e1x5()            const {return showerShapeBlock_.e1x5;}
00184     float e2x5()            const {return showerShapeBlock_.e2x5;}
00185     float e3x3()            const {return showerShapeBlock_.e3x3;}
00186     float e5x5()            const {return showerShapeBlock_.e5x5;}
00187     float maxEnergyXtal()   const {return showerShapeBlock_.maxEnergyXtal;}
00188     float sigmaEtaEta()     const {return showerShapeBlock_.sigmaEtaEta;}
00189     float sigmaIetaIeta()   const {return showerShapeBlock_.sigmaIetaIeta;}
00190     float r1x5 ()           const {return showerShapeBlock_.e1x5/showerShapeBlock_.e5x5;}
00191     float r2x5 ()           const {return showerShapeBlock_.e2x5/showerShapeBlock_.e5x5;}
00192     float r9 ()             const {return showerShapeBlock_.e3x3/this->superCluster()->rawEnergy();}  
00193 
00194     //=======================================================
00195     // Energy Determinations
00196     //=======================================================
00197     enum P4type { undefined=-1, ecal_standard=0, ecal_photons=1, regression1=2, regression2= 3 } ;
00198 
00199     struct EnergyCorrections {
00200       float scEcalEnergy;
00201       float scEcalEnergyError;
00202       LorentzVector scEcalP4;
00203       float phoEcalEnergy;
00204       float phoEcalEnergyError;
00205       LorentzVector phoEcalP4;
00206       float regression1Energy;
00207       float regression1EnergyError;
00208       LorentzVector regression1P4;
00209       float regression2Energy;
00210       float regression2EnergyError;
00211       LorentzVector regression2P4;
00212       P4type candidateP4type;
00213       EnergyCorrections() : 
00214         scEcalEnergy(0.), 
00215         scEcalEnergyError(999.),
00216         scEcalP4(0., 0., 0., 0.),
00217         phoEcalEnergy(0.), 
00218         phoEcalEnergyError(999.),
00219         phoEcalP4(0., 0., 0., 0.),
00220         regression1Energy(0.), 
00221         regression1EnergyError(999.),
00222         regression1P4(0.,0.,0.,0.),  
00223         regression2Energy(0.), 
00224         regression2EnergyError(999.),
00225         regression2P4(0.,0.,0.,0.),
00226         candidateP4type(undefined) 
00227       {}
00228     };
00229 
00230     using RecoCandidate::setP4 ;
00231     using RecoCandidate::p4 ;
00232 
00233     //sets both energy and its uncertainty
00234     void setCorrectedEnergy( P4type type, float E, float dE, bool toCand=true );        
00235     void setP4( P4type type, const LorentzVector & p4, float p4Error, bool setToRecoCandidate ) ;
00236     void setEnergyCorrections ( const EnergyCorrections& e) { eCorrections_=e;}
00237     void setCandidateP4type(const  P4type type) { eCorrections_.candidateP4type = type; }
00238 
00239     float getCorrectedEnergy( P4type type) const;
00240     float getCorrectedEnergyError( P4type type) const ;
00241     P4type getCandidateP4type() const {return eCorrections_.candidateP4type;}
00242     const LorentzVector& p4( P4type type ) const ;
00243     const EnergyCorrections & energyCorrections() const { return eCorrections_ ; }
00244 
00245     //=======================================================
00246     // MIP Variables
00247     //=======================================================
00248     
00249     struct MIPVariables
00250     {       
00251       float mipChi2;
00252       float mipTotEnergy;
00253       float mipSlope;
00254       float mipIntercept;
00255       int   mipNhitCone;
00256       bool  mipIsHalo;
00257       
00258       MIPVariables():
00259         
00260         mipChi2(0), 
00261         mipTotEnergy(0), 
00262         mipSlope(0), 
00263         mipIntercept(0), 
00264         mipNhitCone(0),
00265         mipIsHalo(false)        
00266       {}    
00267       
00268     } ;  
00269     
00271     float mipChi2()         const {return mipVariableBlock_.mipChi2;}
00272     float mipTotEnergy()    const {return mipVariableBlock_.mipTotEnergy;}
00273     float mipSlope()        const {return mipVariableBlock_.mipSlope;}
00274     float mipIntercept()    const {return mipVariableBlock_.mipIntercept;}
00275     int mipNhitCone()     const {return mipVariableBlock_.mipNhitCone;}
00276     bool  mipIsHalo()       const {return mipVariableBlock_.mipIsHalo;}
00277             
00279     void setMIPVariables ( const MIPVariables& mipVar) {mipVariableBlock_= mipVar;} 
00280     
00281     
00282 
00283     //=======================================================
00284     // Isolation Variables
00285     //=======================================================
00286 
00287     struct IsolationVariables
00288     {
00289       //These are analysis quantities calculated in the PhotonIDAlgo class
00290       
00291       //EcalRecHit isolation
00292       float ecalRecHitSumEt;
00293       //HcalDepth1Tower isolation
00294       float hcalTowerSumEt;
00295       //HcalDepth1Tower isolation
00296       float hcalDepth1TowerSumEt;
00297       //HcalDepth2Tower isolation
00298       float hcalDepth2TowerSumEt;
00299       //Sum of track pT in a cone of dR
00300       float trkSumPtSolidCone;
00301       //Sum of track pT in a hollow cone of outer radius, inner radius
00302       float trkSumPtHollowCone;
00303       //Number of tracks in a cone of dR
00304       int nTrkSolidCone;
00305       //Number of tracks in a hollow cone of outer radius, inner radius
00306       int nTrkHollowCone;
00307       
00308       IsolationVariables():
00309         
00310         ecalRecHitSumEt(0),
00311            hcalTowerSumEt(0),
00312            hcalDepth1TowerSumEt(0),
00313            hcalDepth2TowerSumEt(0),
00314            trkSumPtSolidCone(0),
00315            trkSumPtHollowCone(0),
00316            nTrkSolidCone(0),
00317            nTrkHollowCone(0)
00318            
00319       {}
00320       
00321       
00322     };
00323 
00324     
00326     void setIsolationVariables ( const IsolationVariables& isolInDr04, const IsolationVariables& isolInDr03) {  isolationR04_ = isolInDr04 ; isolationR03_ = isolInDr03 ;} 
00327 
00330     float ecalRecHitSumEtConeDR04()      const{return  isolationR04_.ecalRecHitSumEt;}
00332     float hcalTowerSumEtConeDR04()      const{return  isolationR04_.hcalTowerSumEt ;}
00334     float hcalDepth1TowerSumEtConeDR04()      const{return  isolationR04_.hcalDepth1TowerSumEt;}
00336     float hcalDepth2TowerSumEtConeDR04()      const{return  isolationR04_.hcalDepth2TowerSumEt;}
00337     //  Track pT sum c
00338     float trkSumPtSolidConeDR04()    const{return   isolationR04_.trkSumPtSolidCone;}
00339     //As above, excluding the core at the center of the cone
00340     float trkSumPtHollowConeDR04()   const{return   isolationR04_.trkSumPtHollowCone;}
00341     //Returns number of tracks in a cone of dR
00342     int nTrkSolidConeDR04()              const{return   isolationR04_.nTrkSolidCone;}
00343     //As above, excluding the core at the center of the cone
00344     int nTrkHollowConeDR04()            const{return   isolationR04_.nTrkHollowCone;}
00345     //
00347     float ecalRecHitSumEtConeDR03()      const{return  isolationR03_.ecalRecHitSumEt;}
00349     float hcalTowerSumEtConeDR03()      const{return isolationR03_.hcalTowerSumEt;}
00351     float hcalDepth1TowerSumEtConeDR03()      const{return isolationR03_.hcalDepth1TowerSumEt;}
00353     float hcalDepth2TowerSumEtConeDR03()      const{return isolationR03_.hcalDepth2TowerSumEt;}
00354     //  Track pT sum c
00355     float trkSumPtSolidConeDR03()    const{return  isolationR03_.trkSumPtSolidCone;}
00356     //As above, excluding the core at the center of the cone
00357     float trkSumPtHollowConeDR03()   const{return  isolationR03_.trkSumPtHollowCone;}
00358     //Returns number of tracks in a cone of dR
00359     int nTrkSolidConeDR03()              const{return  isolationR03_.nTrkSolidCone;}
00360     //As above, excluding the core at the center of the cone
00361     int nTrkHollowConeDR03()             const{return  isolationR03_.nTrkHollowCone;}
00362 
00363 
00364     //=======================================================
00365     // PFlow based Isolation Variables
00366     //=======================================================
00367 
00368     struct PflowIsolationVariables
00369     {
00370 
00371       float chargedHadronIso;
00372       float neutralHadronIso;
00373       float photonIso ;
00374       float modFrixione ;      
00375       
00376       PflowIsolationVariables():
00377         
00378         chargedHadronIso(0),
00379         neutralHadronIso(0),
00380         photonIso(0),
00381         modFrixione(0)
00382                    
00383       {}
00384       
00385       
00386     };
00387 
00389     float chargedHadronIso() const {return  pfIsolation_.chargedHadronIso;}
00390     float neutralHadronIso() const {return  pfIsolation_.neutralHadronIso;}
00391     float photonIso() const {return  pfIsolation_.photonIso;}
00392 
00394     void setPflowIsolationVariables ( const PflowIsolationVariables& pfisol ) {  pfIsolation_ = pfisol;} 
00395 
00396     struct PflowIDVariables
00397     {
00398 
00399       int nClusterOutsideMustache;
00400       float etOutsideMustache;
00401       float mva;
00402 
00403       PflowIDVariables():
00404 
00405         nClusterOutsideMustache(-1),
00406         etOutsideMustache(-999999999.),
00407         mva(-999999999.)
00408                    
00409       {}
00410     };
00411     
00412     // getters
00413     int nClusterOutsideMustache() const {return pfID_.nClusterOutsideMustache;}
00414     float etOutsideMustache() const {return pfID_.etOutsideMustache;}
00415     float pfMVA() const {return pfID_.mva;}
00416     // setters
00417     void setPflowIDVariables ( const PflowIDVariables& pfid ) {  pfID_ = pfid;}     
00418 
00419 
00420   private:
00422     virtual bool overlap( const Candidate & ) const;
00424     math::XYZPointF caloPosition_;
00426     reco::PhotonCoreRef photonCore_;
00427     //
00428     bool pixelSeed_;
00429     //
00430     FiducialFlags fiducialFlagBlock_;
00431     IsolationVariables isolationR04_;
00432     IsolationVariables isolationR03_;
00433     ShowerShape        showerShapeBlock_;
00434     EnergyCorrections eCorrections_; 
00435     MIPVariables        mipVariableBlock_; 
00436     PflowIsolationVariables pfIsolation_;
00437     PflowIDVariables pfID_;
00438 
00439 
00440   };
00441   
00442 }
00443 
00444 #endif