CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/DataFormats/EgammaCandidates/interface/GsfElectron.h

Go to the documentation of this file.
00001  #ifndef GsfElectron_h
00002 #define GsfElectron_h
00003 
00004 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00005 #include "DataFormats/EgammaCandidates/interface/GsfElectronCore.h"
00006 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00007 #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
00008 //#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00009 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00010 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00011 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00012 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
00013 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
00014 //#include "DataFormats/Math/interface/LorentzVector.h"
00015 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00016 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 #include <vector>
00019 #include <limits>
00020 
00021 namespace reco
00022  {
00023 
00024 
00025 /****************************************************************************
00026  * \class reco::GsfElectron
00027  *
00028  * An Electron with a GsfTrack seeded from an ElectronSeed.
00029  * Renamed from PixelMatchGsfElectron.
00030  * Originally adapted from the TRecElectron class in ORCA.
00031  *
00032  * \author Claude Charlot - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3
00033  * \author David Chamont  - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3
00034  *
00035  ****************************************************************************/
00036 
00037 class GsfElectron : public RecoCandidate
00038  {
00039 
00040   //=======================================================
00041   // Constructors
00042   //
00043   // The clone() method with arguments, and the copy
00044   // constructor with edm references is designed for
00045   // someone which want to duplicates all
00046   // collections.
00047   //=======================================================
00048 
00049   public :
00050 
00051     // some nested structures defined later on
00052     struct ChargeInfo ;
00053     struct TrackClusterMatching ;
00054     struct TrackExtrapolations ;
00055     struct ClosestCtfTrack ;
00056     struct FiducialFlags ;
00057     struct ShowerShape ;
00058     struct IsolationVariables ;
00059     struct ConversionRejection ;
00060     struct ClassificationVariables ;
00061 
00062     GsfElectron() ;
00063     GsfElectron( const GsfElectronCoreRef & ) ;
00064     GsfElectron
00065      (
00066       const GsfElectron &,
00067       const GsfElectronCoreRef &
00068      ) ;
00069     GsfElectron
00070      (
00071       const GsfElectron & electron,
00072       const GsfElectronCoreRef & core,
00073       const CaloClusterPtr & electronCluster,
00074       const TrackRef & closestCtfTrack,
00075       const TrackBaseRef & conversionPartner,
00076       const GsfTrackRefVector & ambiguousTracks
00077      ) ;
00078     GsfElectron
00079      (
00080       int charge,
00081       const ChargeInfo &,
00082       const GsfElectronCoreRef &,
00083       const TrackClusterMatching &,
00084       const TrackExtrapolations &,
00085       const ClosestCtfTrack &,
00086       const FiducialFlags &,
00087       const ShowerShape &,
00088       const ConversionRejection &
00089      ) ;
00090     GsfElectron * clone() const ;
00091     GsfElectron * clone
00092      (
00093       const GsfElectronCoreRef & core,
00094       const CaloClusterPtr & electronCluster,
00095       const TrackRef & closestCtfTrack,
00096       const TrackBaseRef & conversionPartner,
00097       const GsfTrackRefVector & ambiguousTracks
00098      ) const ;
00099     virtual ~GsfElectron() {} ;
00100 
00101   private:
00102 
00103     void init() ;
00104 
00105 
00106   //=======================================================
00107   // Candidate methods and complementary information
00108   //
00109   // The gsf electron producer has tried to best evaluate
00110   // the four momentum and charge and given those values to
00111   // the GsfElectron constructor, which forwarded them to
00112   // the Candidate constructor. Those values can be retreived
00113   // with getters inherited from Candidate : p4() and charge().
00114   //=======================================================
00115 
00116   public:
00117 
00118     // Inherited from Candidate
00119     // const LorentzVector & charge() const ;
00120     // const LorentzVector & p4() const ;
00121 
00122     // Complementary struct
00123     struct ChargeInfo
00124      {
00125       int scPixCharge ;
00126       bool isGsfCtfScPixConsistent ;
00127       bool isGsfScPixConsistent ;
00128       bool isGsfCtfConsistent ;
00129       ChargeInfo()
00130         : scPixCharge(0), isGsfCtfScPixConsistent(false),
00131           isGsfScPixConsistent(false), isGsfCtfConsistent(false)
00132         {}
00133      } ;
00134 
00135     // Charge info accessors
00136     // to get gsf track charge: gsfTrack()->charge()
00137     // to get ctf track charge, if closestCtfTrackRef().isNonnull(): closestCtfTrackRef()->charge()
00138     int scPixCharge() const { return chargeInfo_.scPixCharge ; }
00139     bool isGsfCtfScPixChargeConsistent() const { return chargeInfo_.isGsfCtfScPixConsistent ; }
00140     bool isGsfScPixChargeConsistent() const { return chargeInfo_.isGsfScPixConsistent ; }
00141     bool isGsfCtfChargeConsistent() const { return chargeInfo_.isGsfCtfConsistent ; }
00142     const ChargeInfo & chargeInfo() const { return chargeInfo_ ; }
00143 
00144     // Candidate redefined methods
00145     virtual bool isElectron() const { return true ; }
00146     virtual bool overlap( const Candidate & ) const ;
00147 
00148   private:
00149 
00150     // Complementary attributes
00151     ChargeInfo chargeInfo_ ;
00152 
00153 
00154   //=======================================================
00155   // Core Attributes
00156   //
00157   // They all have been computed before, when building the
00158   // collection of GsfElectronCore instances. Each GsfElectron
00159   // has a reference toward a GsfElectronCore.
00160   //=======================================================
00161 
00162   public:
00163 
00164     // accessors
00165     virtual GsfElectronCoreRef core() const ;
00166 
00167     // forward core methods
00168     virtual SuperClusterRef superCluster() const { return core()->superCluster() ; }
00169     virtual GsfTrackRef gsfTrack() const { return core()->gsfTrack() ; }
00170     virtual TrackRef closestTrack() const { return core()->ctfTrack() ; }
00171     float ctfGsfOverlap() const { return core()->ctfGsfOverlap() ; }
00172     bool ecalDrivenSeed() const { return core()->ecalDrivenSeed() ; }
00173     bool trackerDrivenSeed() const { return core()->trackerDrivenSeed() ; }
00174     SuperClusterRef pflowSuperCluster() const { return core()->pflowSuperCluster() ; }
00175 
00176     // backward compatibility
00177     struct ClosestCtfTrack
00178      {
00179       TrackRef ctfTrack ; // best matching ctf track
00180       float shFracInnerHits ; // fraction of common hits between the ctf and gsf tracks
00181       ClosestCtfTrack() : shFracInnerHits(0.) {}
00182       ClosestCtfTrack( TrackRef track, float sh ) : ctfTrack(track), shFracInnerHits(sh) {}
00183      } ;
00184     float shFracInnerHits() const { return core()->ctfGsfOverlap() ; }
00185     TrackRef closestCtfTrackRef() const { return core()->ctfTrack() ; }
00186     ClosestCtfTrack closestCtfTrack() const { return ClosestCtfTrack(core()->ctfTrack(),core()->ctfGsfOverlap()) ; }
00187 
00188   private:
00189 
00190     // attributes
00191     GsfElectronCoreRef core_ ;
00192 
00193 
00194   //=======================================================
00195   // Track-Cluster Matching Attributes
00196   //=======================================================
00197 
00198   public:
00199 
00200     struct TrackClusterMatching
00201      {
00202       CaloClusterPtr electronCluster ;  // basic cluster best matching gsf track
00203       float eSuperClusterOverP ;        // the supercluster energy / track momentum at the PCA to the beam spot
00204       float eSeedClusterOverP ;         // the seed cluster energy / track momentum at the PCA to the beam spot
00205       float eSeedClusterOverPout ;      // the seed cluster energy / track momentum at calo extrapolated from the outermost track state
00206       float eEleClusterOverPout ;       // the electron cluster energy / track momentum at calo extrapolated from the outermost track state
00207       float deltaEtaSuperClusterAtVtx ; // the supercluster eta - track eta position at calo extrapolated from innermost track state
00208       float deltaEtaSeedClusterAtCalo ; // the seed cluster eta - track eta position at calo extrapolated from the outermost track state
00209       float deltaEtaEleClusterAtCalo ;  // the electron cluster eta - track eta position at calo extrapolated from the outermost state
00210       float deltaPhiEleClusterAtCalo ;  // the electron cluster phi - track phi position at calo extrapolated from the outermost track state
00211       float deltaPhiSuperClusterAtVtx ; // the supercluster phi - track phi position at calo extrapolated from the innermost track state
00212       float deltaPhiSeedClusterAtCalo ; // the seed cluster phi - track phi position at calo extrapolated from the outermost track state
00213       TrackClusterMatching()
00214        : eSuperClusterOverP(0.),
00215          eSeedClusterOverP(0.),
00216          eSeedClusterOverPout(0.),
00217          eEleClusterOverPout(0.),
00218          deltaEtaSuperClusterAtVtx(std::numeric_limits<float>::infinity()),
00219          deltaEtaSeedClusterAtCalo(std::numeric_limits<float>::infinity()),
00220          deltaEtaEleClusterAtCalo(std::numeric_limits<float>::infinity()),
00221          deltaPhiEleClusterAtCalo(std::numeric_limits<float>::infinity()),
00222          deltaPhiSuperClusterAtVtx(std::numeric_limits<float>::infinity()),
00223          deltaPhiSeedClusterAtCalo(std::numeric_limits<float>::infinity())
00224         {}
00225      } ;
00226 
00227     // accessors
00228     CaloClusterPtr electronCluster() const { return trackClusterMatching_.electronCluster ; }
00229     float eSuperClusterOverP() const { return trackClusterMatching_.eSuperClusterOverP ; }
00230     float eSeedClusterOverP() const { return trackClusterMatching_.eSeedClusterOverP ; }
00231     float eSeedClusterOverPout() const { return trackClusterMatching_.eSeedClusterOverPout ; }
00232     float eEleClusterOverPout() const { return trackClusterMatching_.eEleClusterOverPout ; }
00233     float deltaEtaSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaEtaSuperClusterAtVtx ; }
00234     float deltaEtaSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaSeedClusterAtCalo ; }
00235     float deltaEtaEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaEleClusterAtCalo ; }
00236     float deltaPhiSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaPhiSuperClusterAtVtx ; }
00237     float deltaPhiSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiSeedClusterAtCalo ; }
00238     float deltaPhiEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiEleClusterAtCalo ; }
00239     const TrackClusterMatching & trackClusterMatching() const { return trackClusterMatching_ ; }
00240 
00241     // for backward compatibility, usefull ?
00242     void setDeltaEtaSuperClusterAtVtx( float de ) { trackClusterMatching_.deltaEtaSuperClusterAtVtx = de ; }
00243     void setDeltaPhiSuperClusterAtVtx( float dphi ) { trackClusterMatching_.deltaPhiSuperClusterAtVtx = dphi ; }
00244 
00245 
00246   private:
00247 
00248     // attributes
00249     TrackClusterMatching trackClusterMatching_ ;
00250 
00251 
00252   //=======================================================
00253   // Track extrapolations
00254   //=======================================================
00255 
00256   public :
00257 
00258     struct TrackExtrapolations
00259      {
00260       math::XYZPointF  positionAtVtx ;     // the track PCA to the beam spot
00261       math::XYZPointF  positionAtCalo ;    // the track PCA to the supercluster position
00262       math::XYZVectorF momentumAtVtx ;     // the track momentum at the PCA to the beam spot
00263       math::XYZVectorF momentumAtCalo ;    // the track momentum extrapolated at the supercluster position from the innermost track state
00264       math::XYZVectorF momentumOut ;       // the track momentum extrapolated at the seed cluster position from the outermost track state
00265       math::XYZVectorF momentumAtEleClus ; // the track momentum extrapolated at the ele cluster position from the outermost track state
00266       math::XYZVectorF momentumAtVtxWithConstraint ;     // the track momentum at the PCA to the beam spot using bs constraint
00267      } ;
00268 
00269     // accessors
00270     math::XYZPointF trackPositionAtVtx() const { return trackExtrapolations_.positionAtVtx ; }
00271     math::XYZPointF trackPositionAtCalo() const { return trackExtrapolations_.positionAtCalo ; }
00272     math::XYZVectorF trackMomentumAtVtx() const { return trackExtrapolations_.momentumAtVtx ; }
00273     math::XYZVectorF trackMomentumAtCalo() const { return trackExtrapolations_.momentumAtCalo ; }
00274     math::XYZVectorF trackMomentumOut() const { return trackExtrapolations_.momentumOut ; }
00275     math::XYZVectorF trackMomentumAtEleClus() const { return trackExtrapolations_.momentumAtEleClus ; }
00276     math::XYZVectorF trackMomentumAtVtxWithConstraint() const { return trackExtrapolations_.momentumAtVtxWithConstraint ; }
00277     const TrackExtrapolations & trackExtrapolations() const { return trackExtrapolations_ ; }
00278 
00279     // for backward compatibility
00280     math::XYZPointF TrackPositionAtVtx() const { return trackPositionAtVtx() ; }
00281     math::XYZPointF TrackPositionAtCalo() const { return trackPositionAtCalo() ; }
00282 
00283 
00284   private:
00285 
00286     // attributes
00287     TrackExtrapolations trackExtrapolations_ ;
00288 
00289 
00290   //=======================================================
00291   // SuperCluster direct access
00292   //=======================================================
00293 
00294   public :
00295 
00296     // direct accessors
00297     math::XYZPoint superClusterPosition() const { return superCluster()->position() ; } // the super cluster position
00298     int basicClustersSize() const { return superCluster()->clustersSize() ; } // number of basic clusters inside the supercluster
00299     CaloCluster_iterator basicClustersBegin() const { return superCluster()->clustersBegin() ; }
00300     CaloCluster_iterator basicClustersEnd() const { return superCluster()->clustersEnd() ; }
00301 
00302     // for backward compatibility
00303     math::XYZPoint caloPosition() const { return superCluster()->position() ; }
00304 
00305 
00306 
00307   //=======================================================
00308   // Fiducial Flags
00309   //=======================================================
00310 
00311   public :
00312 
00313     struct FiducialFlags
00314      {
00315       bool isEB ;        // true if particle is in ECAL Barrel
00316       bool isEE ;        // true if particle is in ECAL Endcaps
00317       bool isEBEEGap ;   // true if particle is in the crack between EB and EE
00318       bool isEBEtaGap ;  // true if particle is in EB, and inside the eta gaps between modules
00319       bool isEBPhiGap ;  // true if particle is in EB, and inside the phi gaps between modules
00320       bool isEEDeeGap ;  // true if particle is in EE, and inside the gaps between dees
00321       bool isEERingGap ; // true if particle is in EE, and inside the gaps between rings
00322       FiducialFlags()
00323        : isEB(false), isEE(false), isEBEEGap(false),
00324          isEBEtaGap(false), isEBPhiGap(false),
00325              isEEDeeGap(false), isEERingGap(false)
00326            {}
00327      } ;
00328 
00329     // accessors
00330     bool isEB() const { return fiducialFlags_.isEB ; }
00331     bool isEE() const { return fiducialFlags_.isEE ; }
00332     bool isGap() const { return ((isEBEEGap())||(isEBGap())||(isEEGap())) ; }
00333     bool isEBEEGap() const { return fiducialFlags_.isEBEEGap ; }
00334     bool isEBGap() const { return (isEBEtaGap()||isEBPhiGap()) ; }
00335     bool isEBEtaGap() const { return fiducialFlags_.isEBEtaGap ; }
00336     bool isEBPhiGap() const { return fiducialFlags_.isEBPhiGap ; }
00337     bool isEEGap() const { return (isEEDeeGap()||isEERingGap()) ; }
00338     bool isEEDeeGap() const { return fiducialFlags_.isEEDeeGap ; }
00339     bool isEERingGap() const { return fiducialFlags_.isEERingGap ; }
00340     const FiducialFlags & fiducialFlags() const { return fiducialFlags_ ; }
00341 
00342 
00343   private:
00344 
00345     // attributes
00346     FiducialFlags fiducialFlags_ ;
00347 
00348 
00349   //=======================================================
00350   // Shower Shape Variables
00351   //=======================================================
00352 
00353   public :
00354 
00355     struct ShowerShape
00356      {
00357       float sigmaEtaEta ;        // weighted cluster rms along eta and inside 5x5 (absolute eta)
00358       float sigmaIetaIeta ;      // weighted cluster rms along eta and inside 5x5 (new, Xtal eta)
00359       float e1x5 ;               // energy inside 1x5 in etaxphi around the seed Xtal
00360       float e2x5Max ;            // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums)
00361       float e5x5 ;               // energy inside 5x5 in etaxphi around the seed Xtal
00362       float hcalDepth1OverEcal ; // hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers within a cone)
00363       float hcalDepth2OverEcal ; // hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers within a cone)
00364       std::vector<CaloTowerDetId> hcalTowersBehindClusters ; //
00365       float hcalDepth1OverEcalBc ; // hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers behind clusters)
00366       float hcalDepth2OverEcalBc ; // hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers behind clusters)
00367       ShowerShape()
00368        : sigmaEtaEta(std::numeric_limits<float>::infinity()),
00369              sigmaIetaIeta(std::numeric_limits<float>::infinity()),
00370              e1x5(0.), e2x5Max(0.), e5x5(0.),
00371        hcalDepth1OverEcal(0.), hcalDepth2OverEcal(0.),
00372        hcalDepth1OverEcalBc(0.), hcalDepth2OverEcalBc(0.)
00373        {}
00374      } ;
00375 
00376     // accessors
00377     float sigmaEtaEta() const { return showerShape_.sigmaEtaEta ; }
00378     float sigmaIetaIeta() const { return showerShape_.sigmaIetaIeta ; }
00379     float e1x5() const { return showerShape_.e1x5 ; }
00380     float e2x5Max() const { return showerShape_.e2x5Max ; }
00381     float e5x5() const { return showerShape_.e5x5 ; }
00382     float hcalDepth1OverEcal() const { return showerShape_.hcalDepth1OverEcal ; }
00383     float hcalDepth2OverEcal() const { return showerShape_.hcalDepth2OverEcal ; }
00384     float hcalOverEcal() const { return hcalDepth1OverEcal() + hcalDepth2OverEcal() ; }
00385     const std::vector<CaloTowerDetId> & hcalTowersBehindClusters() const { return showerShape_.hcalTowersBehindClusters ; }
00386     float hcalDepth1OverEcalBc() const { return showerShape_.hcalDepth1OverEcalBc ; }
00387     float hcalDepth2OverEcalBc() const { return showerShape_.hcalDepth2OverEcalBc ; }
00388     float hcalOverEcalBc() const { return hcalDepth1OverEcalBc() + hcalDepth2OverEcalBc() ; }
00389     const ShowerShape & showerShape() const { return showerShape_ ; }
00390 
00391     // for backward compatibility
00392     float scSigmaEtaEta() const { return sigmaEtaEta() ; }
00393     float scSigmaIEtaIEta() const { return sigmaIetaIeta() ; }
00394     float scE1x5() const { return e1x5() ; }
00395     float scE2x5Max() const { return e2x5Max() ; }
00396     float scE5x5() const { return e5x5() ; }
00397     float hadronicOverEm() const {return hcalOverEcal();}
00398     float hadronicOverEm1() const {return hcalDepth1OverEcal();}
00399     float hadronicOverEm2() const {return hcalDepth2OverEcal();}
00400 
00401 
00402   private:
00403 
00404     // attributes
00405     ShowerShape showerShape_ ;
00406 
00407 
00408   //=======================================================
00409   // Isolation Variables
00410   //=======================================================
00411 
00412   public :
00413 
00414     struct IsolationVariables
00415      {
00416       float tkSumPt ;                // track iso deposit with electron footprint removed
00417       float ecalRecHitSumEt ;        // ecal iso deposit with electron footprint removed
00418       float hcalDepth1TowerSumEt ;   // hcal depht 1 iso deposit with electron footprint removed
00419       float hcalDepth2TowerSumEt ;   // hcal depht 2 iso deposit with electron footprint removed
00420       float hcalDepth1TowerSumEtBc ; // hcal depht 1 iso deposit without towers behind clusters
00421       float hcalDepth2TowerSumEtBc ; // hcal depht 2 iso deposit without towers behind clusters
00422       IsolationVariables()
00423        : tkSumPt(0.), ecalRecHitSumEt(0.),
00424          hcalDepth1TowerSumEt(0.), hcalDepth2TowerSumEt(0.),
00425          hcalDepth1TowerSumEtBc(0.), hcalDepth2TowerSumEtBc(0.)
00426        {}
00427      } ;
00428 
00429     // 03 accessors
00430     float dr03TkSumPt() const { return dr03_.tkSumPt ; }
00431     float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt ; }
00432     float dr03HcalDepth1TowerSumEt() const { return dr03_.hcalDepth1TowerSumEt ; }
00433     float dr03HcalDepth2TowerSumEt() const { return dr03_.hcalDepth2TowerSumEt ; }
00434     float dr03HcalTowerSumEt() const { return dr03HcalDepth1TowerSumEt()+dr03HcalDepth2TowerSumEt() ; }
00435     float dr03HcalDepth1TowerSumEtBc() const { return dr03_.hcalDepth1TowerSumEtBc ; }
00436     float dr03HcalDepth2TowerSumEtBc() const { return dr03_.hcalDepth2TowerSumEtBc ; }
00437     float dr03HcalTowerSumEtBc() const { return dr03HcalDepth1TowerSumEtBc()+dr03HcalDepth2TowerSumEtBc() ; }
00438     const IsolationVariables & dr03IsolationVariables() const { return dr03_ ; }
00439 
00440     // 04 accessors
00441     float dr04TkSumPt() const { return dr04_.tkSumPt ; }
00442     float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt ; }
00443     float dr04HcalDepth1TowerSumEt() const { return dr04_.hcalDepth1TowerSumEt ; }
00444     float dr04HcalDepth2TowerSumEt() const { return dr04_.hcalDepth2TowerSumEt ; }
00445     float dr04HcalTowerSumEt() const { return dr04HcalDepth1TowerSumEt()+dr04HcalDepth2TowerSumEt() ; }
00446     float dr04HcalDepth1TowerSumEtBc() const { return dr04_.hcalDepth1TowerSumEtBc ; }
00447     float dr04HcalDepth2TowerSumEtBc() const { return dr04_.hcalDepth2TowerSumEtBc ; }
00448     float dr04HcalTowerSumEtBc() const { return dr04HcalDepth1TowerSumEtBc()+dr04HcalDepth2TowerSumEtBc() ; }
00449     const IsolationVariables & dr04IsolationVariables() const { return dr04_ ; }
00450 
00451     // setters ?!?
00452     void setDr03Isolation( const IsolationVariables & dr03 ) { dr03_ = dr03 ; }
00453     void setDr04Isolation( const IsolationVariables & dr04 ) { dr04_ = dr04 ; }
00454 
00455     // for backward compatibility
00456     void setIsolation03( const IsolationVariables & dr03 ) { dr03_ = dr03 ; }
00457     void setIsolation04( const IsolationVariables & dr04 ) { dr04_ = dr04 ; }
00458     const IsolationVariables & isolationVariables03() const { return dr03_ ; }
00459     const IsolationVariables & isolationVariables04() const { return dr04_ ; }
00460 
00461   private:
00462 
00463     // attributes
00464     IsolationVariables dr03_ ;
00465     IsolationVariables dr04_ ;
00466 
00467 
00468   //=======================================================
00469   // Conversion Rejection Information
00470   //=======================================================
00471 
00472   public :
00473 
00474     struct ConversionRejection
00475      {
00476       int flags ;  // -infinity:not-computed, other: as computed by Puneeth conversion code
00477       TrackBaseRef partner ; // conversion partner
00478       float dist ; // distance to the conversion partner
00479       float dcot ; // difference of cot(angle) with the conversion partner track
00480       float radius ; // signed conversion radius
00481       ConversionRejection()
00482        : flags(-std::numeric_limits<float>::infinity()),
00483          dist(std::numeric_limits<float>::infinity()),
00484          dcot(std::numeric_limits<float>::infinity()),
00485          radius(std::numeric_limits<float>::infinity())
00486        {}
00487      } ;
00488 
00489     // accessors
00490     int convFlags() const { return conversionRejection_.flags ; }
00491     TrackBaseRef convPartner() const { return conversionRejection_.partner ; }
00492     float convDist() const { return conversionRejection_.dist ; }
00493     float convDcot() const { return conversionRejection_.dcot ; }
00494     float convRadius() const { return conversionRejection_.radius ; }
00495     const ConversionRejection & conversionRejectionVariables() const { return conversionRejection_ ; }
00496 
00497   private:
00498 
00499     // attributes
00500     ConversionRejection conversionRejection_ ;
00501 
00502 
00503   //=======================================================
00504   // Pflow Information
00505   //=======================================================
00506 
00507   public:
00508 
00509     struct PflowIsolationVariables
00510       {
00511        float chargedHadronIso ;
00512        float neutralHadronIso ;
00513        float photonIso ;
00514        PflowIsolationVariables()
00515         : chargedHadronIso(0.), neutralHadronIso(0.), photonIso(0.)
00516         {}
00517       } ;
00518 
00519     struct MvaInput
00520      {
00521       int earlyBrem ; // Early Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true)
00522       int lateBrem ; // Late Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true)
00523       float sigmaEtaEta ; // Sigma-eta-eta with the PF cluster
00524       float hadEnergy ; // Associated PF Had Cluster energy
00525       float deltaEta ; // PF-cluster GSF track delta-eta
00526       int nClusterOutsideMustache ; // -2 => unknown, -1 =>could not be evaluated, 0 and more => number of clusters
00527       float etOutsideMustache ;
00528       MvaInput()
00529        : earlyBrem(-2), lateBrem(-2),
00530          sigmaEtaEta(std::numeric_limits<float>::infinity()),
00531          hadEnergy(0.),
00532          deltaEta(std::numeric_limits<float>::infinity()),
00533          nClusterOutsideMustache(-2),
00534          etOutsideMustache(-std::numeric_limits<float>::infinity())
00535        {}
00536      } ;
00537 
00538     struct MvaOutput
00539      {
00540       int status ; // see PFCandidateElectronExtra::StatusFlag
00541       float mva ;
00542       MvaOutput()
00543        : status(-1), mva(-999999999.)
00544        {}
00545      } ;
00546 
00547     // accessors
00548     const ShowerShape & pfShowerShape() const { return pfShowerShape_ ; }
00549     const PflowIsolationVariables & pfIsolationVariables() const { return pfIso_ ; }
00550     const MvaInput & mvaInput() const { return mvaInput_ ; }
00551     const MvaOutput & mvaOutput() const { return mvaOutput_ ; }
00552 
00553     // setters
00554     void setPfShowerShape( const ShowerShape & shape ) { pfShowerShape_ = shape ; }
00555     void setPfIsolationVariables( const PflowIsolationVariables & iso ) { pfIso_ = iso ; }
00556     void setMvaInput( const MvaInput & mi ) { mvaInput_ = mi ; }
00557     void setMvaOutput( const MvaOutput & mo ) { mvaOutput_ = mo ; }
00558 
00559     // for backward compatibility
00560     float mva() const { return mvaOutput_.mva ; }
00561 
00562   private:
00563 
00564     ShowerShape pfShowerShape_ ;
00565     PflowIsolationVariables pfIso_ ;
00566     MvaInput mvaInput_ ;
00567     MvaOutput mvaOutput_ ;
00568 
00569 
00570   //=======================================================
00571   // Preselection and Ambiguity
00572   //=======================================================
00573 
00574   public :
00575 
00576     // accessors
00577     bool ecalDriven() const ; // return true if ecalDrivenSeed() and passingCutBasedPreselection()
00578     bool passingCutBasedPreselection() const { return passCutBasedPreselection_ ; }
00579     bool passingMvaPreselection() const { return passMvaPreslection_ ; }
00580     bool ambiguous() const { return ambiguous_ ; }
00581     GsfTrackRefVector::size_type ambiguousGsfTracksSize() const { return ambiguousGsfTracks_.size() ; }
00582     GsfTrackRefVector::const_iterator ambiguousGsfTracksBegin() const { return ambiguousGsfTracks_.begin() ; }
00583     GsfTrackRefVector::const_iterator ambiguousGsfTracksEnd() const { return ambiguousGsfTracks_.end() ; }
00584 
00585     // setters
00586     void setPassCutBasedPreselection( bool flag ) { passCutBasedPreselection_ = flag ; }
00587     void setPassMvaPreselection( bool flag ) { passMvaPreslection_ = flag ; }
00588     void setAmbiguous( bool flag ) { ambiguous_ = flag ; }
00589     void clearAmbiguousGsfTracks() { ambiguousGsfTracks_.clear() ; }
00590     void addAmbiguousGsfTrack( const reco::GsfTrackRef & t ) { ambiguousGsfTracks_.push_back(t) ; }
00591 
00592   private:
00593 
00594     // attributes
00595     bool passCutBasedPreselection_ ;
00596     bool passMvaPreslection_ ;
00597     bool ambiguous_ ;
00598     GsfTrackRefVector ambiguousGsfTracks_ ; // ambiguous gsf tracks
00599 
00600 
00601   //=======================================================
00602   // Brem Fractions and Classification
00603   //=======================================================
00604 
00605   public :
00606 
00607     struct ClassificationVariables
00608       {
00609        float trackFbrem  ;       // the brem fraction from gsf fit: (track momentum in - track momentum out) / track momentum in
00610        float superClusterFbrem ; // the brem fraction from supercluster: (supercluster energy - electron cluster energy) / supercluster energy
00611        float pfSuperClusterFbrem ; // the brem fraction from pflow supercluster
00612        ClassificationVariables()
00613         : trackFbrem(-1.e30), superClusterFbrem(-1.e30), pfSuperClusterFbrem(-1.e30)
00614         {}
00615       } ;
00616     enum Classification { UNKNOWN=-1, GOLDEN=0, BIGBREM=1, BADTRACK=2, SHOWERING=3, GAP=4 } ;
00617 
00618     // accessors
00619     float trackFbrem() const { return classVariables_.trackFbrem ; }
00620     float superClusterFbrem() const { return classVariables_.superClusterFbrem ; }
00621     float pfSuperClusterFbrem() const { return classVariables_.pfSuperClusterFbrem ; }
00622     const ClassificationVariables & classificationVariables() const { return classVariables_ ; }
00623     Classification classification() const { return class_ ; }
00624 
00625     // utilities
00626     int numberOfBrems() const { return basicClustersSize()-1 ; }
00627     float fbrem() const { return trackFbrem() ; }
00628 
00629     // setters
00630     void setTrackFbrem( float fbrem ) { classVariables_.trackFbrem = fbrem ; }
00631     void setSuperClusterFbrem( float fbrem ) { classVariables_.superClusterFbrem = fbrem ; }
00632     void setPfSuperClusterFbrem( float fbrem ) { classVariables_.pfSuperClusterFbrem = fbrem ; }
00633     void setClassificationVariables( const ClassificationVariables & cv ) { classVariables_ = cv ; }
00634     void setClassification( Classification myclass ) { class_ = myclass ; }
00635 
00636   private:
00637 
00638     // attributes
00639     ClassificationVariables classVariables_ ;
00640     Classification class_ ; // fbrem and number of clusters based electron classification
00641 
00642 
00643   //=======================================================
00644   // Corrections
00645   //
00646   // The only methods, with classification, which modify
00647   // the electrons after they have been constructed.
00648   // They change a given characteristic, such as the super-cluster
00649   // energy, and propagate the change consistently
00650   // to all the depending attributes.
00651   // We expect the methods to be called in a given order
00652   // and so to store specific kind of corrections
00653   // 1) classify()
00654   // 2) correctEcalEnergy() : depending on classification and eta
00655   // 3) correctMomemtum() : depending on classification and ecal energy and tracker momentum errors
00656   //
00657   // Beware that correctEcalEnergy() is modifying few attributes which
00658   // were potentially used for preselection, whose value used in
00659   // preselection will not be available any more :
00660   // hcalDepth1OverEcal, hcalDepth2OverEcal, eSuperClusterOverP,
00661   // eSeedClusterOverP, eEleClusterOverPout.
00662   //=======================================================
00663 
00664   public :
00665 
00666     enum P4Kind { P4_UNKNOWN=-1, P4_FROM_SUPER_CLUSTER=0, P4_COMBINATION=1, P4_PFLOW_COMBINATION=2 } ;
00667 
00668     struct Corrections
00669      {
00670       bool  isEcalEnergyCorrected ;    // true if ecal energy has been corrected
00671       float correctedEcalEnergy ;      // corrected energy (if !isEcalEnergyCorrected this value is identical to the supercluster energy)
00672       float correctedEcalEnergyError ; // error on energy
00673       //bool isMomentumCorrected ;     // DEPRECATED
00674       float trackMomentumError ;       // track momentum error from gsf fit
00675       //
00676       LorentzVector fromSuperClusterP4 ; // for P4_FROM_SUPER_CLUSTER
00677       float fromSuperClusterP4Error ;    // for P4_FROM_SUPER_CLUSTER
00678       LorentzVector combinedP4 ;    // for P4_COMBINATION
00679       float combinedP4Error ;       // for P4_COMBINATION
00680       LorentzVector pflowP4 ;       // for P4_PFLOW_COMBINATION
00681       float pflowP4Error ;          // for P4_PFLOW_COMBINATION
00682       P4Kind candidateP4Kind ;  // say which momentum has been stored in reco::Candidate
00683       //
00684       Corrections()
00685        : isEcalEnergyCorrected(false), correctedEcalEnergy(0.), correctedEcalEnergyError(999.),
00686              /*isMomentumCorrected(false),*/ trackMomentumError(999.),
00687              fromSuperClusterP4Error(999.), combinedP4Error(999.), pflowP4Error(999.),
00688              candidateP4Kind(P4_UNKNOWN)
00689        {}
00690      } ;
00691 
00692     // setters
00693     void setCorrectedEcalEnergyError( float newEnergyError ) ;
00694     void setCorrectedEcalEnergy( float newEnergy ) ;
00695     void setTrackMomentumError( float trackMomentumError ) ;
00696     void setP4( P4Kind kind, const LorentzVector & p4, float p4Error, bool setCandidate ) ;
00697     using RecoCandidate::setP4 ;
00698 
00699     // accessors
00700     bool isEcalEnergyCorrected() const { return corrections_.isEcalEnergyCorrected ; }
00701     float correctedEcalEnergy() const { return corrections_.correctedEcalEnergy ; }
00702     float correctedEcalEnergyError() const { return corrections_.correctedEcalEnergyError ; }
00703     float trackMomentumError() const { return corrections_.trackMomentumError ; }
00704     const LorentzVector & p4( P4Kind kind ) const ;
00705     using RecoCandidate::p4 ;
00706     float p4Error( P4Kind kind ) const ;
00707     P4Kind candidateP4Kind() const { return corrections_.candidateP4Kind ; }
00708     const Corrections & corrections() const { return corrections_ ; }
00709 
00710     // for backward compatibility
00711     void setEcalEnergyError( float energyError ) { setCorrectedEcalEnergyError(energyError) ; }
00712     float ecalEnergy() const { return correctedEcalEnergy() ; }
00713     float ecalEnergyError() const { return correctedEcalEnergyError() ; }
00714     //bool isMomentumCorrected() const { return corrections_.isMomentumCorrected ; }
00715     float caloEnergy() const { return correctedEcalEnergy() ; }
00716     bool isEnergyScaleCorrected() const { return isEcalEnergyCorrected() ; }
00717     void correctEcalEnergy( float newEnergy, float newEnergyError )
00718      {
00719       setCorrectedEcalEnergy(newEnergy) ;
00720       setEcalEnergyError(newEnergyError) ;
00721      }
00722     void correctMomentum( const LorentzVector & p4, float trackMomentumError, float p4Error )
00723      { setTrackMomentumError(trackMomentumError) ; setP4(P4_COMBINATION,p4,p4Error,true) ; }
00724 
00725 
00726   private:
00727 
00728     // attributes
00729     Corrections corrections_ ;
00730 
00731  } ;
00732 
00733  } // namespace reco
00734 
00735 #endif