CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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/Math/interface/LorentzVector.h"
00014 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00015 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00016 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00017 #include <vector>
00018 #include <limits>
00019 
00020 namespace reco
00021  {
00022 
00023 
00024 /****************************************************************************
00025  * \class reco::GsfElectron
00026  *
00027  * An Electron with a GsfTrack seeded from an ElectronSeed.
00028  * Renamed from PixelMatchGsfElectron.
00029  * Originally adapted from the TRecElectron class in ORCA.
00030  *
00031  * \author Claude Charlot - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3
00032  * \author David Chamont  - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3
00033  * \author Ursula Berthon - Laboratoire Leprince-Ringuet - École polytechnique, CNRS/IN2P3
00034  *
00035  * \version $Id: GsfElectron.h,v 1.44 2011/01/21 17:02:14 chamont Exp $
00036  *
00037  ****************************************************************************/
00038 
00039 class GsfElectron : public RecoCandidate
00040  {
00041 
00042   //=======================================================
00043   // Constructors
00044   //
00045   // The clone() method with arguments, and the copy
00046   // constructor with edm references is designed for
00047   // someone which want to duplicates all
00048   // collections.
00049   //=======================================================
00050 
00051   public :
00052 
00053     // some nested structures defined later on
00054     struct ChargeInfo ;
00055     struct TrackClusterMatching ;
00056     struct TrackExtrapolations ;
00057     struct ClosestCtfTrack ;
00058     struct FiducialFlags ;
00059     struct ShowerShape ;
00060     struct IsolationVariables ;
00061     struct ConversionRejection ;
00062 
00063     GsfElectron() ;
00064     GsfElectron( const GsfElectronCoreRef & ) ;
00065     GsfElectron
00066      (
00067       const GsfElectron &,
00068       const GsfElectronCoreRef &
00069      ) ;
00070     GsfElectron
00071      (
00072       const GsfElectron & electron,
00073       const GsfElectronCoreRef & core,
00074       const CaloClusterPtr & electronCluster,
00075       const TrackRef & closestCtfTrack,
00076       const TrackBaseRef & conversionPartner,
00077       const GsfTrackRefVector & ambiguousTracks
00078      ) ;
00079     GsfElectron
00080      (
00081       const LorentzVector & p4, int charge,
00082       const ChargeInfo &,
00083       const GsfElectronCoreRef &,
00084       const TrackClusterMatching &,
00085       const TrackExtrapolations &,
00086       const ClosestCtfTrack &,
00087       const FiducialFlags &,
00088       const ShowerShape &,
00089       const ConversionRejection &,
00090       float fbrem
00091      ) ;
00092     GsfElectron * clone() const ;
00093     GsfElectron * clone
00094      (
00095       const GsfElectronCoreRef & core,
00096       const CaloClusterPtr & electronCluster,
00097       const TrackRef & closestCtfTrack,
00098       const TrackBaseRef & conversionPartner,
00099       const GsfTrackRefVector & ambiguousTracks
00100      ) const ;
00101     virtual ~GsfElectron() {} ;
00102 
00103 
00104   //=======================================================
00105   // Candidate methods and charge information
00106   //
00107   // The gsf electron producer has tried to best evaluate
00108   // the four momentum and charge and given those values to
00109   // the GsfElectron constructor, which forwarded them to
00110   // the Candidate constructor. Those values can be retreived
00111   // with getters inherited from Candidate : p4() and charge().
00112   //=======================================================
00113 
00114   public:
00115 
00116     // Inherited from Candidate
00117     // const LorentzVector & charge() const ;
00118     // const LorentzVector & p4() const ;
00119 
00120     // Complementary struct
00121     struct ChargeInfo
00122      {
00123       int scPixCharge ;
00124       bool isGsfCtfScPixConsistent ;
00125       bool isGsfScPixConsistent ;
00126       bool isGsfCtfConsistent ;
00127       ChargeInfo()
00128         : scPixCharge(0), isGsfCtfScPixConsistent(false),
00129           isGsfScPixConsistent(false), isGsfCtfConsistent(false)
00130         {}
00131      } ;
00132 
00133     // Charge info accessors
00134     // to get gsf track charge: gsfTrack()->charge()
00135     // to get ctf track charge, if closestCtfTrackRef().isNonnull(): closestCtfTrackRef()->charge()
00136     int scPixCharge() const { return chargeInfo_.scPixCharge ; }
00137     bool isGsfCtfScPixChargeConsistent() const { return chargeInfo_.isGsfCtfScPixConsistent ; }
00138     bool isGsfScPixChargeConsistent() const { return chargeInfo_.isGsfScPixConsistent ; }
00139     bool isGsfCtfChargeConsistent() const { return chargeInfo_.isGsfCtfConsistent ; }
00140     const ChargeInfo & chargeInfo() const { return chargeInfo_ ; }
00141 
00142     // Candidate redefined methods
00143     virtual bool isElectron() const { return true ; }
00144     virtual bool overlap( const Candidate & ) const ;
00145 
00146   private:
00147 
00148     // Complementary attributes
00149     ChargeInfo chargeInfo_ ;
00150 
00151 
00152   //=======================================================
00153   // Core Attributes
00154   //
00155   // They all have been computed before, when building the
00156   // collection of GsfElectronCore instances. Each GsfElectron
00157   // has a reference toward a GsfElectronCore.
00158   //=======================================================
00159 
00160   public:
00161 
00162     // accessors
00163     virtual GsfElectronCoreRef core() const { return core_ ; }
00164 
00165     // forward core methods
00166     SuperClusterRef superCluster() const { return core()->superCluster() ; }
00167     GsfTrackRef gsfTrack() const { return core()->gsfTrack() ; }
00168     bool ecalDrivenSeed() const { return core()->ecalDrivenSeed() ; }
00169     bool trackerDrivenSeed() const { return core()->trackerDrivenSeed() ; }
00170     SuperClusterRef pflowSuperCluster() const { return core()->pflowSuperCluster() ; }
00171 
00172   private:
00173 
00174     // attributes
00175     GsfElectronCoreRef core_ ;
00176 
00177 
00178   //=======================================================
00179   // Track-Cluster Matching Attributes
00180   //=======================================================
00181 
00182   public:
00183 
00184     struct TrackClusterMatching
00185      {
00186       CaloClusterPtr electronCluster ;  // basic cluster best matching gsf track
00187       float eSuperClusterOverP ;        // the supercluster energy / track momentum at the PCA to the beam spot
00188       float eSeedClusterOverP ;         // the seed cluster energy / track momentum at the PCA to the beam spot
00189       float eSeedClusterOverPout ;      // the seed cluster energy / track momentum at calo extrapolated from the outermost track state
00190       float eEleClusterOverPout ;       // the electron cluster energy / track momentum at calo extrapolated from the outermost track state
00191       float deltaEtaSuperClusterAtVtx ; // the supercluster eta - track eta position at calo extrapolated from innermost track state
00192       float deltaEtaSeedClusterAtCalo ; // the seed cluster eta - track eta position at calo extrapolated from the outermost track state
00193       float deltaEtaEleClusterAtCalo ;  // the electron cluster eta - track eta position at calo extrapolated from the outermost state
00194       float deltaPhiEleClusterAtCalo ;  // the electron cluster phi - track phi position at calo extrapolated from the outermost track state
00195       float deltaPhiSuperClusterAtVtx ; // the supercluster phi - track phi position at calo extrapolated from the innermost track state
00196       float deltaPhiSeedClusterAtCalo ; // the seed cluster phi - track phi position at calo extrapolated from the outermost track state
00197      } ;
00198 
00199     // accessors
00200     CaloClusterPtr electronCluster() const { return trackClusterMatching_.electronCluster ; }
00201     float eSuperClusterOverP() const { return trackClusterMatching_.eSuperClusterOverP ; }
00202     float eSeedClusterOverP() const { return trackClusterMatching_.eSeedClusterOverP ; }
00203     float eSeedClusterOverPout() const { return trackClusterMatching_.eSeedClusterOverPout ; }
00204     float eEleClusterOverPout() const { return trackClusterMatching_.eEleClusterOverPout ; }
00205     float deltaEtaSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaEtaSuperClusterAtVtx ; }
00206     float deltaEtaSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaSeedClusterAtCalo ; }
00207     float deltaEtaEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaEleClusterAtCalo ; }
00208     float deltaPhiSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaPhiSuperClusterAtVtx ; }
00209     float deltaPhiSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiSeedClusterAtCalo ; }
00210     float deltaPhiEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiEleClusterAtCalo ; }
00211     const TrackClusterMatching & trackClusterMatching() const { return trackClusterMatching_ ; }
00212 
00213     // for backward compatibility, usefull ?
00214     void setDeltaEtaSuperClusterAtVtx( float de ) { trackClusterMatching_.deltaEtaSuperClusterAtVtx = de ; }
00215     void setDeltaPhiSuperClusterAtVtx( float dphi ) { trackClusterMatching_.deltaPhiSuperClusterAtVtx = dphi ; }
00216 
00217 
00218   private:
00219 
00220     // attributes
00221     TrackClusterMatching trackClusterMatching_ ;
00222 
00223 
00224   //=======================================================
00225   // Track extrapolations
00226   //=======================================================
00227 
00228   public :
00229 
00230     struct TrackExtrapolations
00231      {
00232       math::XYZPoint  positionAtVtx ;     // the track PCA to the beam spot
00233       math::XYZPoint  positionAtCalo ;    // the track PCA to the supercluster position
00234       math::XYZVector momentumAtVtx ;     // the track momentum at the PCA to the beam spot
00235       math::XYZVector momentumAtCalo ;    // the track momentum extrapolated at the supercluster position from the innermost track state
00236       math::XYZVector momentumOut ;       // the track momentum extrapolated at the seed cluster position from the outermost track state
00237       math::XYZVector momentumAtEleClus ; // the track momentum extrapolated at the ele cluster position from the outermost track state
00238       math::XYZVector momentumAtVtxWithConstraint ;     // the track momentum at the PCA to the beam spot using bs constraint
00239      } ;
00240 
00241     // accessors
00242     math::XYZPoint trackPositionAtVtx() const { return trackExtrapolations_.positionAtVtx ; }
00243     math::XYZPoint trackPositionAtCalo() const { return trackExtrapolations_.positionAtCalo ; }
00244     math::XYZVector trackMomentumAtVtx() const { return trackExtrapolations_.momentumAtVtx ; }
00245     math::XYZVector trackMomentumAtCalo() const { return trackExtrapolations_.momentumAtCalo ; }
00246     math::XYZVector trackMomentumOut() const { return trackExtrapolations_.momentumOut ; }
00247     math::XYZVector trackMomentumAtEleClus() const { return trackExtrapolations_.momentumAtEleClus ; }
00248     math::XYZVector trackMomentumAtVtxWithConstraint() const { return trackExtrapolations_.momentumAtVtxWithConstraint ; }
00249     const TrackExtrapolations & trackExtrapolations() const { return trackExtrapolations_ ; }
00250 
00251     // for backward compatibility
00252     math::XYZPoint TrackPositionAtVtx() const { return trackPositionAtVtx() ; }
00253     math::XYZPoint TrackPositionAtCalo() const { return trackPositionAtCalo() ; }
00254 
00255 
00256   private:
00257 
00258     // attributes
00259     TrackExtrapolations trackExtrapolations_ ;
00260 
00261 
00262   //=======================================================
00263   // SuperCluster direct access
00264   //=======================================================
00265 
00266   public :
00267 
00268     // direct accessors
00269     math::XYZPoint superClusterPosition() const { return superCluster()->position() ; } // the super cluster position
00270     int basicClustersSize() const { return superCluster()->clustersSize() ; } // number of basic clusters inside the supercluster
00271     CaloCluster_iterator basicClustersBegin() const { return superCluster()->clustersBegin() ; }
00272     CaloCluster_iterator basicClustersEnd() const { return superCluster()->clustersEnd() ; }
00273 
00274     // for backward compatibility
00275     math::XYZPoint caloPosition() const { return superCluster()->position() ; }
00276 
00277 
00278   //=======================================================
00279   // Other tracks
00280   //=======================================================
00281 
00282   public :
00283 
00284     struct ClosestCtfTrack
00285      {
00286       TrackRef ctfTrack ; // best matching ctf track
00287       float shFracInnerHits ; // fraction of common hits between the ctf and gsf tracks
00288           ClosestCtfTrack() : shFracInnerHits(0.) {}
00289      } ;
00290 
00291     // accessors
00292     TrackRef closestCtfTrackRef() const { return closestCtfTrack_.ctfTrack ; } // get the CTF track best matching the GTF associated to this electron
00293     float shFracInnerHits() const { return closestCtfTrack_.shFracInnerHits ; } // measure the fraction of common hits between the GSF and CTF tracks
00294     const ClosestCtfTrack & closestCtfTrack() const { return closestCtfTrack_ ; }
00295     GsfTrackRefVector::size_type ambiguousGsfTracksSize() const { return ambiguousGsfTracks_.size() ; }
00296     GsfTrackRefVector::const_iterator ambiguousGsfTracksBegin() const { return ambiguousGsfTracks_.begin() ; }
00297     GsfTrackRefVector::const_iterator ambiguousGsfTracksEnd() const { return ambiguousGsfTracks_.end() ; }
00298 
00299     // setters
00300     void clearAmbiguousGsfTracks() { ambiguousGsfTracks_.clear() ; }
00301     void addAmbiguousGsfTrack( const reco::GsfTrackRef & t ) { ambiguousGsfTracks_.push_back(t) ; }
00302 
00303 
00304   private:
00305 
00306     // attributes
00307     ClosestCtfTrack closestCtfTrack_ ;
00308     GsfTrackRefVector ambiguousGsfTracks_ ; // ambiguous gsf tracks
00309 
00310 
00311   //=======================================================
00312   // Fiducial Flags
00313   //=======================================================
00314 
00315   public :
00316 
00317     struct FiducialFlags
00318      {
00319       bool isEB ;        // true if particle is in ECAL Barrel
00320       bool isEE ;        // true if particle is in ECAL Endcaps
00321       bool isEBEEGap ;   // true if particle is in the crack between EB and EE
00322       bool isEBEtaGap ;  // true if particle is in EB, and inside the eta gaps between modules
00323       bool isEBPhiGap ;  // true if particle is in EB, and inside the phi gaps between modules
00324       bool isEEDeeGap ;  // true if particle is in EE, and inside the gaps between dees
00325       bool isEERingGap ; // true if particle is in EE, and inside the gaps between rings
00326       FiducialFlags()
00327        : isEB(false), isEE(false), isEBEEGap(false),
00328          isEBEtaGap(false), isEBPhiGap(false),
00329              isEEDeeGap(false), isEERingGap(false)
00330            {}
00331      } ;
00332 
00333     // accessors
00334     bool isEB() const { return fiducialFlags_.isEB ; }
00335     bool isEE() const { return fiducialFlags_.isEE ; }
00336     bool isGap() const { return ((isEBEEGap())||(isEBGap())||(isEEGap())) ; }
00337     bool isEBEEGap() const { return fiducialFlags_.isEBEEGap ; }
00338     bool isEBGap() const { return (isEBEtaGap()||isEBPhiGap()) ; }
00339     bool isEBEtaGap() const { return fiducialFlags_.isEBEtaGap ; }
00340     bool isEBPhiGap() const { return fiducialFlags_.isEBPhiGap ; }
00341     bool isEEGap() const { return (isEEDeeGap()||isEERingGap()) ; }
00342     bool isEEDeeGap() const { return fiducialFlags_.isEEDeeGap ; }
00343     bool isEERingGap() const { return fiducialFlags_.isEERingGap ; }
00344     const FiducialFlags & fiducialFlags() const { return fiducialFlags_ ; }
00345 
00346 
00347   private:
00348 
00349     // attributes
00350     FiducialFlags fiducialFlags_ ;
00351 
00352 
00353   //=======================================================
00354   // Shower Shape Variables
00355   //=======================================================
00356 
00357   public :
00358 
00359     struct ShowerShape
00360      {
00361       float sigmaEtaEta ;        // weighted cluster rms along eta and inside 5x5 (absolute eta)
00362       float sigmaIetaIeta ;      // weighted cluster rms along eta and inside 5x5 (new, Xtal eta)
00363       float e1x5 ;               // energy inside 1x5 in etaxphi around the seed Xtal
00364       float e2x5Max ;            // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums)
00365       float e5x5 ;               // energy inside 5x5 in etaxphi around the seed Xtal
00366       float hcalDepth1OverEcal ; // hcal over ecal seed cluster energy using first hcal depth (hcal is energy of towers within dR=015)
00367       float hcalDepth2OverEcal ; // hcal over ecal seed cluster energy using 2nd hcal depth (hcal is energy of towers within dR=015)
00368       ShowerShape()
00369        : sigmaEtaEta(std::numeric_limits<float>::infinity()),
00370              sigmaIetaIeta(std::numeric_limits<float>::infinity()),
00371              e1x5(0.), e2x5Max(0.), e5x5(0.),
00372              hcalDepth1OverEcal(0), hcalDepth2OverEcal(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 ShowerShape & showerShape() const { return showerShape_ ; }
00386 
00387     // for backward compatibility
00388     float scSigmaEtaEta() const { return sigmaEtaEta() ; }
00389     float scSigmaIEtaIEta() const { return sigmaIetaIeta() ; }
00390     float scE1x5() const { return e1x5() ; }
00391     float scE2x5Max() const { return e2x5Max() ; }
00392     float scE5x5() const { return e5x5() ; }
00393     float hadronicOverEm() const {return hcalOverEcal();}
00394     float hadronicOverEm1() const {return hcalDepth1OverEcal();}
00395     float hadronicOverEm2() const {return hcalDepth2OverEcal();}
00396 
00397 
00398   private:
00399 
00400     // attributes
00401     ShowerShape showerShape_ ;
00402 
00403 
00404   //=======================================================
00405   // Isolation Variables
00406   //=======================================================
00407 
00408   public :
00409 
00410     struct IsolationVariables
00411      {
00412       float tkSumPt ;                // track iso deposit with electron footprint removed
00413       float ecalRecHitSumEt ;        // ecal iso deposit with electron footprint removed
00414       float hcalDepth1TowerSumEt ;   // hcal depht 1 iso deposit with electron footprint removed
00415       float hcalDepth2TowerSumEt ;   // hcal depht 2 iso deposit with electron footprint removed
00416       IsolationVariables()
00417        : tkSumPt(0.), ecalRecHitSumEt(0.), hcalDepth1TowerSumEt(0.), hcalDepth2TowerSumEt(0.)
00418        {}
00419      } ;
00420 
00421     // 03 accessors
00422     float dr03TkSumPt() const { return dr03_.tkSumPt ; }
00423     float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt ; }
00424     float dr03HcalDepth1TowerSumEt() const { return dr03_.hcalDepth1TowerSumEt ; }
00425     float dr03HcalDepth2TowerSumEt() const { return dr03_.hcalDepth2TowerSumEt ; }
00426     float dr03HcalTowerSumEt() const { return dr03HcalDepth1TowerSumEt()+dr03HcalDepth2TowerSumEt() ; }
00427     const IsolationVariables & dr03IsolationVariables() const { return dr03_ ; }
00428 
00429     // 04 accessors
00430     float dr04TkSumPt() const { return dr04_.tkSumPt ; }
00431     float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt ; }
00432     float dr04HcalDepth1TowerSumEt() const { return dr04_.hcalDepth1TowerSumEt ; }
00433     float dr04HcalDepth2TowerSumEt() const { return dr04_.hcalDepth2TowerSumEt ; }
00434     float dr04HcalTowerSumEt() const { return dr04HcalDepth1TowerSumEt()+dr04HcalDepth2TowerSumEt() ; }
00435     const IsolationVariables & dr04IsolationVariables() const { return dr04_ ; }
00436 
00437     // setters ?!?
00438     void setDr03Isolation( const IsolationVariables & dr03 ) { dr03_ = dr03 ; }
00439     void setDr04Isolation( const IsolationVariables & dr04 ) { dr04_ = dr04 ; }
00440 
00441     // for backward compatibility
00442     void setIsolation03( const IsolationVariables & dr03 ) { dr03_ = dr03 ; }
00443     void setIsolation04( const IsolationVariables & dr04 ) { dr04_ = dr04 ; }
00444     const IsolationVariables & isolationVariables03() const { return dr03_ ; }
00445     const IsolationVariables & isolationVariables04() const { return dr04_ ; }
00446 
00447   private:
00448 
00449     // attributes
00450     IsolationVariables dr03_ ;
00451     IsolationVariables dr04_ ;
00452 
00453 
00454   //=======================================================
00455   // Conversion Rejection Information
00456   //=======================================================
00457 
00458   public :
00459 
00460     struct ConversionRejection
00461      {
00462       int flags ;  // -infinity:not-computed, other: as computed by Puneeth conversion code
00463       TrackBaseRef partner ; // conversion partner
00464       float dist ; // distance to the conversion partner
00465       float dcot ; // difference of cot(angle) with the conversion partner track
00466       float radius ; // signed conversion radius
00467       ConversionRejection()
00468        : flags(-std::numeric_limits<float>::infinity()),
00469          dist(std::numeric_limits<float>::infinity()),
00470          dcot(std::numeric_limits<float>::infinity()),
00471          radius(std::numeric_limits<float>::infinity())
00472        {}
00473      } ;
00474 
00475     // accessors
00476     int convFlags() const { return conversionRejection_.flags ; }
00477     TrackBaseRef convPartner() const { return conversionRejection_.partner ; }
00478     float convDist() const { return conversionRejection_.dist ; }
00479     float convDcot() const { return conversionRejection_.dcot ; }
00480     float convRadius() const { return conversionRejection_.radius ; }
00481     const ConversionRejection & conversionRejectionVariables() const { return conversionRejection_ ; }
00482 
00483   private:
00484 
00485     // attributes
00486     ConversionRejection conversionRejection_ ;
00487 
00488 
00489   //=======================================================
00490   // Preselection, Ambiguity and Pflow Information
00491   //=======================================================
00492 
00493   public :
00494 
00495     // accessors
00496     bool ecalDriven() const ; // return true if ecalDrivenSeed() and passingCutBasedPreselection()
00497     bool passingCutBasedPreselection() const { return passCutBasedPreselection_ ; }
00498     bool passingMvaPreselection() const { return passMvaPreslection_ ; }
00499     bool ambiguous() const { return ambiguous_ ; }
00500     float mva() const { return mva_ ; }
00501 
00502     // setters
00503     void setPassCutBasedPreselection( bool flag ) { passCutBasedPreselection_ = flag ; }
00504     void setPassMvaPreselection( bool flag ) { passMvaPreslection_ = flag ; }
00505     void setAmbiguous( bool flag ) { ambiguous_ = flag ; }
00506     void setMva( float mva ) { mva_ = mva ; }
00507 
00508   private:
00509 
00510     // attributes
00511     bool passCutBasedPreselection_ ;
00512     bool passMvaPreslection_ ;
00513     bool ambiguous_ ;
00514     float mva_ ; // electron ID variable from mva (tracker driven electrons)
00515 
00516 
00517   //=======================================================
00518   // Brem Fraction and Classification
00519   // * fbrem given to the GsfElectron constructor
00520   // * classification computed later
00521   //=======================================================
00522 
00523   public :
00524 
00525     enum Classification { UNKNOWN=-1, GOLDEN=0, BIGBREM=1, OLDNARROW=2, SHOWERING=3, GAP=4 } ;
00526 
00527     // accessors
00528     float fbrem() const { return fbrem_ ; }
00529     int numberOfBrems() const { return basicClustersSize()-1 ; }
00530     Classification classification() const { return class_ ; }
00531 
00532     // setters
00533     void classifyElectron( Classification myclass ) { class_ = myclass ; }
00534 
00535   private:
00536 
00537     // attributes
00538     float fbrem_ ; // the brem fraction from gsf fit: (track momentum in - track momentum out) / track momentum in
00539     Classification class_ ; // fbrem and number of clusters based electron classification
00540 
00541 
00542   //=======================================================
00543   // Corrections
00544   //
00545   // The only methods, with classification, which modify
00546   // the electrons after they have been constructed.
00547   // They change a given characteristic, such as the super-cluster
00548   // energy, and propagate the change consistently
00549   // to all the depending attributes.
00550   // We expect the methods to be called in a given order
00551   // and so to store specific kind of corrections
00552   // 1) classify()
00553   // 2) correctEcalEnergy() : depending on classification and eta
00554   // 3) correctMomemtum() : depending on classification and acal energy and tracker momentum errors
00555   //
00556   // Beware that correctEcalEnergy() is modifying few attributes which
00557   // were potentially used for preselection, whose value used in
00558   // preselection will not be available any more :
00559   // hcalDepth1OverEcal, hcalDepth2OverEcal, eSuperClusterOverP,
00560   // eSeedClusterOverP, eEleClusterOverPout.
00561   //=======================================================
00562 
00563   public :
00564 
00565     struct Corrections
00566      {
00567       bool isEcalEnergyCorrected ;  // true if ecal energy has been corrected
00568       float ecalEnergy ;            // ecal corrected energy (if !isEcalEnergyCorrected this value is identical to the supercluster energy)
00569       float ecalEnergyError ;       // error on correctedCaloEnergy
00570       bool isMomentumCorrected ;    // true if E-p combination has been applied (if not the electron momentum is the ecal corrected energy)
00571       float trackMomentumError ;    // track momentum error from gsf fit
00572       float electronMomentumError ; // the final electron momentum error
00573       Corrections()
00574        : isEcalEnergyCorrected(false), ecalEnergy(0.), ecalEnergyError(999.),
00575              isMomentumCorrected(false), trackMomentumError(999.), electronMomentumError(999.)
00576        {}
00577      } ;
00578 
00579     // correctors
00580     void correctEcalEnergy( float newEnergy, float newEnergyError ) ;
00581     void correctMomentum
00582      ( const LorentzVector & momentum,
00583        float trackMomentumError, float electronMomentumError ) ;
00584 
00585     // accessors
00586     bool isEcalEnergyCorrected() const { return corrections_.isEcalEnergyCorrected ; }
00587     float ecalEnergy() const { return corrections_.ecalEnergy ; }
00588     float ecalEnergyError() const { return corrections_.ecalEnergyError ; }
00589     bool isMomentumCorrected() const { return corrections_.isMomentumCorrected ; }
00590     float trackMomentumError() const { return corrections_.trackMomentumError ; }
00591     float electronMomentumError() const { return corrections_.electronMomentumError ; }
00592     const Corrections & corrections() const { return corrections_ ; }
00593 
00594     // for backward compatibility
00595     float caloEnergy() const { return ecalEnergy() ; }
00596     //void correctElectronEnergyScale( const float newEnergy )
00597     // { correctEcalEnergy(newEnergy) ; }
00598     //void correctElectronFourMomentum
00599     // ( const LorentzVector & m,
00600     //   float & enErr, float  & tMerr)
00601     // { correctMomentum(m,enErr,tMerr,0) ; }
00602     bool isEnergyScaleCorrected() const { return isEcalEnergyCorrected() ; }
00603 
00604   private:
00605 
00606     // attributes
00607     Corrections corrections_ ;
00608 
00609  } ;
00610 
00611   //typedef GsfElectron PixelMatchGsfElectron ;
00612 
00613  }
00614 
00615 #endif