CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
reco::PFCandidateElectronExtra Class Reference

#include <PFCandidateElectronExtra.h>

Public Types

enum  MvaVariable {
  MVA_FIRST = 0, MVA_LnPtGsf = MVA_FIRST, MVA_EtaGsf, MVA_SigmaPtOverPt,
  MVA_Fbrem, MVA_Chi2Gsf, MVA_NhitsKf, MVA_Chi2Kf,
  MVA_EtotOverPin, MVA_EseedOverPout, MVA_EbremOverDeltaP, MVA_DeltaEtaTrackCluster,
  MVA_LogSigmaEtaEta, MVA_HOverHE, MVA_LateBrem, MVA_FirstBrem,
  MVA_MVA, MVA_LAST
}
 
enum  StatusFlag {
  X = 0, Selected, ECALDrivenPreselected, MVASelected,
  Rejected
}
 

Public Member Functions

bool electronStatus (StatusFlag) const
 access to the status More...
 
int electronStatus () const
 access to the status More...
 
reco::GsfTrackRef gsfTrackRef () const
 return a reference to the corresponding GSF track More...
 
float hadEnergy () const
 access to specific variables More...
 
reco::TrackRef kfTrackRef () const
 return a reference to the corresponding KF track More...
 
bool mvaStatus (MvaVariable flag) const
 access to mva variable status More...
 
float mvaVariable (MvaVariable var) const
 access to any variable More...
 
const std::vector< float > & mvaVariables () const
 access to the mva variables More...
 
 PFCandidateElectronExtra ()
 constructor More...
 
 PFCandidateElectronExtra (const GsfTrackRef &)
 constructor More...
 
void setClusterEnergies (const std::vector< float > &energies)
 set the cluster energies. the Pout should be saved first More...
 
void setDeltaEta (float val)
 set the delta eta More...
 
void setEarlyBrem (float val)
 set EarlyBrem More...
 
void setGsfTrackPout (const math::XYZTLorentzVector &pout)
 set the pout (not trivial to get from the GSF track) More...
 
void setGsfTrackRef (const reco::GsfTrackRef &ref)
 set gsftrack reference More...
 
void setHadEnergy (float val)
 set the had energy. The cluster energies should be entered before More...
 
void setKfTrackRef (const reco::TrackRef &ref)
 set kf track reference More...
 
void setLateBrem (float val)
 set LateBrem More...
 
void setMVA (float val)
 set the result (mostly for debugging) More...
 
void setSigmaEtaEta (float val)
 set the sigmaetaeta More...
 
void setStatus (StatusFlag type, bool status=true)
 set status More...
 
float sigmaEtaEta () const
 
 ~PFCandidateElectronExtra ()
 destructor More...
 

Private Member Functions

void setVariable (MvaVariable type, float var)
 

Private Attributes

std::vector< float > clusterEnergies_
 energy of individual clusters (corrected). The first cluster is the seed More...
 
float deltaEta_
 
float earlyBrem_
 
reco::GsfTrackRef gsfTrackRef_
 Ref to the GSF track. More...
 
float hadEnergy_
 
reco::TrackRef kfTrackRef_
 Ref to the KF track. More...
 
float lateBrem_
 
int mvaStatus_
 status of mva variables More...
 
std::vector< float > mvaVariables_
 mva variables - transient ! More...
 
math::XYZTLorentzVector pout_
 Variables entering the MVA that should be saved. More...
 
float sigmaEtaEta_
 
int status_
 Status of the electron. More...
 

Detailed Description

extra information on the electron particle candidate from particle flow

Definition at line 16 of file PFCandidateElectronExtra.h.

Member Enumeration Documentation

◆ MvaVariable

Enumerator
MVA_FIRST 
MVA_LnPtGsf 
MVA_EtaGsf 
MVA_SigmaPtOverPt 
MVA_Fbrem 
MVA_Chi2Gsf 
MVA_NhitsKf 
MVA_Chi2Kf 
MVA_EtotOverPin 
MVA_EseedOverPout 
MVA_EbremOverDeltaP 
MVA_DeltaEtaTrackCluster 
MVA_LogSigmaEtaEta 
MVA_HOverHE 
MVA_LateBrem 
MVA_FirstBrem 
MVA_MVA 
MVA_LAST 

Definition at line 27 of file PFCandidateElectronExtra.h.

27  {
28  MVA_FIRST = 0,
30  MVA_EtaGsf,
32  MVA_Fbrem,
35  MVA_Chi2Kf,
44  MVA_MVA,
45  MVA_LAST
46  };

◆ StatusFlag

Enumerator
Selected 
ECALDrivenPreselected 
MVASelected 
Rejected 

Definition at line 18 of file PFCandidateElectronExtra.h.

Constructor & Destructor Documentation

◆ PFCandidateElectronExtra() [1/2]

PFCandidateElectronExtra::PFCandidateElectronExtra ( )

constructor

Definition at line 8 of file PFCandidateElectronExtra.cc.

References gsfTrackRef_, hadEnergy_, kfTrackRef_, visualization-live-secondInstance_cfg::m, MVA_FIRST, MVA_LAST, mvaStatus_, mvaVariables_, pout_, sigmaEtaEta_, and status_.

8  {
9  status_ = 0;
10  mvaStatus_ = 0;
11  pout_ = math::XYZTLorentzVector(0., 0., 0., 0.);
12  hadEnergy_ = -9999.;
13  sigmaEtaEta_ = -9999.;
14 
15  for (MvaVariable m = MVA_FIRST; m < MVA_LAST; m = MvaVariable(m + 1))
16  mvaVariables_.push_back(-9999.);
17 
20 }
edm::Ref< GsfTrackCollection > GsfTrackRef
persistent reference to a GsfTrack
Definition: GsfTrackFwd.h:13
math::XYZTLorentzVector pout_
Variables entering the MVA that should be saved.
int mvaStatus_
status of mva variables
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
reco::TrackRef kfTrackRef_
Ref to the KF track.
reco::GsfTrackRef gsfTrackRef_
Ref to the GSF track.
int status_
Status of the electron.
std::vector< float > mvaVariables_
mva variables - transient !
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20

◆ PFCandidateElectronExtra() [2/2]

PFCandidateElectronExtra::PFCandidateElectronExtra ( const GsfTrackRef gsfTrack)

constructor

Definition at line 22 of file PFCandidateElectronExtra.cc.

References gsfTrackRef_, hadEnergy_, kfTrackRef_, dqm-mbProfile::log, visualization-live-secondInstance_cfg::m, MVA_Chi2Gsf, MVA_EtaGsf, MVA_Fbrem, MVA_FIRST, MVA_LAST, MVA_LnPtGsf, MVA_SigmaPtOverPt, mvaStatus_, mvaVariables_, pout_, setVariable(), sigmaEtaEta_, and status_.

22  {
23  status_ = 0;
24  mvaStatus_ = 0;
25  pout_ = math::XYZTLorentzVector(0., 0., 0., 0.);
26  hadEnergy_ = -9999.;
27  sigmaEtaEta_ = -9999.;
28 
29  for (MvaVariable m = MVA_FIRST; m < MVA_LAST; m = MvaVariable(m + 1))
30  mvaVariables_.push_back(-9999.);
31 
32  gsfTrackRef_ = gsfTrack;
34 
36  setVariable(MVA_EtaGsf, gsfTrackRef_->etaMode());
37  setVariable(MVA_Chi2Gsf, gsfTrackRef_->normalizedChi2());
38  float ptmodeerror = gsfTrackRef_->ptModeError();
39  if (ptmodeerror > 0.)
40  setVariable(MVA_SigmaPtOverPt, ptmodeerror / gsfTrackRef_->ptMode());
41  else
43 
44  setVariable(MVA_Fbrem, (gsfTrackRef_->ptMode() - pout_.pt()) / gsfTrackRef_->ptMode());
45 }
void setVariable(MvaVariable type, float var)
math::XYZTLorentzVector pout_
Variables entering the MVA that should be saved.
int mvaStatus_
status of mva variables
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
reco::TrackRef kfTrackRef_
Ref to the KF track.
reco::GsfTrackRef gsfTrackRef_
Ref to the GSF track.
int status_
Status of the electron.
std::vector< float > mvaVariables_
mva variables - transient !
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20

◆ ~PFCandidateElectronExtra()

reco::PFCandidateElectronExtra::~PFCandidateElectronExtra ( )
inline

destructor

Definition at line 54 of file PFCandidateElectronExtra.h.

54 { ; }

Member Function Documentation

◆ electronStatus() [1/2]

bool PFCandidateElectronExtra::electronStatus ( StatusFlag  flag) const

access to the status

Definition at line 131 of file PFCandidateElectronExtra.cc.

References RemoveAddSevLevel::flag, and status_.

131 { return status_ & (1 << flag); }
int status_
Status of the electron.

◆ electronStatus() [2/2]

int reco::PFCandidateElectronExtra::electronStatus ( ) const
inline

access to the status

Definition at line 98 of file PFCandidateElectronExtra.h.

References status_.

98 { return status_; }
int status_
Status of the electron.

◆ gsfTrackRef()

reco::GsfTrackRef reco::PFCandidateElectronExtra::gsfTrackRef ( ) const
inline

return a reference to the corresponding GSF track

Definition at line 63 of file PFCandidateElectronExtra.h.

References gsfTrackRef_.

Referenced by PFElectronExtraEqual::operator()().

63 { return gsfTrackRef_; }
reco::GsfTrackRef gsfTrackRef_
Ref to the GSF track.

◆ hadEnergy()

float reco::PFCandidateElectronExtra::hadEnergy ( ) const
inline

access to specific variables

Definition at line 110 of file PFCandidateElectronExtra.h.

References hadEnergy_.

◆ kfTrackRef()

reco::TrackRef reco::PFCandidateElectronExtra::kfTrackRef ( ) const
inline

return a reference to the corresponding KF track

Definition at line 66 of file PFCandidateElectronExtra.h.

References kfTrackRef_.

66 { return kfTrackRef_; }
reco::TrackRef kfTrackRef_
Ref to the KF track.

◆ mvaStatus()

bool PFCandidateElectronExtra::mvaStatus ( MvaVariable  flag) const

access to mva variable status

Definition at line 133 of file PFCandidateElectronExtra.cc.

References RemoveAddSevLevel::flag, and mvaStatus_.

Referenced by mvaVariable(), and reco::operator<<().

133 { return mvaStatus_ & (1 << (flag)); }
int mvaStatus_
status of mva variables

◆ mvaVariable()

float PFCandidateElectronExtra::mvaVariable ( MvaVariable  var) const

access to any variable

Definition at line 135 of file PFCandidateElectronExtra.cc.

References mvaStatus(), mvaVariables_, and trigObjTnPSource_cfi::var.

Referenced by reco::operator<<().

135  {
136  return (mvaStatus(var) ? mvaVariables_[var] : -9999.);
137 }
std::vector< float > mvaVariables_
mva variables - transient !
bool mvaStatus(MvaVariable flag) const
access to mva variable status

◆ mvaVariables()

const std::vector<float>& reco::PFCandidateElectronExtra::mvaVariables ( ) const
inline

access to the mva variables

Definition at line 104 of file PFCandidateElectronExtra.h.

References mvaVariables_.

104 { return mvaVariables_; }
std::vector< float > mvaVariables_
mva variables - transient !

◆ setClusterEnergies()

void PFCandidateElectronExtra::setClusterEnergies ( const std::vector< float > &  energies)

set the cluster energies. the Pout should be saved first

Definition at line 90 of file PFCandidateElectronExtra.cc.

References clusterEnergies_, gsfTrackRef_, hadEnergy_, MVA_EbremOverDeltaP, MVA_EseedOverPout, MVA_EtotOverPin, pout_, setHadEnergy(), setVariable(), and mathSSE::sqrt().

90  {
91  clusterEnergies_ = energies;
92 
93  if (pout_.t() != 0.)
95 
96  const float m_el2 = 0.00051 * 0.00051;
97  float Ein_gsf = sqrt(gsfTrackRef_->pMode() * gsfTrackRef_->pMode() + m_el2);
98 
99  float etot = 0;
100  unsigned size = clusterEnergies_.size();
101  // std::cout << " N clusters " << size << std::endl;
102  float ebrem = 0.;
103  for (unsigned ic = 0; ic < size; ++ic) {
104  etot += clusterEnergies_[ic];
105  if (ic > 0)
106  ebrem += clusterEnergies_[ic];
107  }
108  setVariable(MVA_EtotOverPin, etot / Ein_gsf);
109  setVariable(MVA_EbremOverDeltaP, ebrem / (Ein_gsf - pout_.t()));
110 
111  // recompute - as in PFElectronAglo, the had energy is filled before the cluster energies
112  if (hadEnergy_ != -9999.)
114 }
size
Write out results.
std::vector< float > clusterEnergies_
energy of individual clusters (corrected). The first cluster is the seed
void setVariable(MvaVariable type, float var)
math::XYZTLorentzVector pout_
Variables entering the MVA that should be saved.
T sqrt(T t)
Definition: SSEVec.h:23
reco::GsfTrackRef gsfTrackRef_
Ref to the GSF track.
void setHadEnergy(float val)
set the had energy. The cluster energies should be entered before

◆ setDeltaEta()

void PFCandidateElectronExtra::setDeltaEta ( float  val)

◆ setEarlyBrem()

void PFCandidateElectronExtra::setEarlyBrem ( float  val)

◆ setGsfTrackPout()

void PFCandidateElectronExtra::setGsfTrackPout ( const math::XYZTLorentzVector pout)

set the pout (not trivial to get from the GSF track)

Definition at line 49 of file PFCandidateElectronExtra.cc.

References pout_.

49 { pout_ = pout; }
math::XYZTLorentzVector pout_
Variables entering the MVA that should be saved.

◆ setGsfTrackRef()

void PFCandidateElectronExtra::setGsfTrackRef ( const reco::GsfTrackRef ref)

set gsftrack reference

Definition at line 47 of file PFCandidateElectronExtra.cc.

References gsfTrackRef_.

47 { gsfTrackRef_ = ref; }
reco::GsfTrackRef gsfTrackRef_
Ref to the GSF track.

◆ setHadEnergy()

void PFCandidateElectronExtra::setHadEnergy ( float  val)

set the had energy. The cluster energies should be entered before

Definition at line 74 of file PFCandidateElectronExtra.cc.

References clusterEnergies_, hadEnergy_, MVA_HOverHE, setVariable(), and heppy_batch::val.

Referenced by setClusterEnergies().

74  {
75  hadEnergy_ = val;
76  if (!clusterEnergies_.empty())
78 }
std::vector< float > clusterEnergies_
energy of individual clusters (corrected). The first cluster is the seed
void setVariable(MvaVariable type, float var)

◆ setKfTrackRef()

void PFCandidateElectronExtra::setKfTrackRef ( const reco::TrackRef ref)

set kf track reference

Definition at line 51 of file PFCandidateElectronExtra.cc.

References nano_mu_digi_cff::float, edm::Ref< C, T, F >::isNonnull(), kfTrackRef_, MVA_Chi2Kf, MVA_NhitsKf, and setVariable().

51  {
52  kfTrackRef_ = ref;
53  float nhit_kf = 0;
54  float chi2_kf = -0.01;
55  // if the reference is null, it does not mean that the variables have not been set
56  if (kfTrackRef_.isNonnull()) {
57  nhit_kf = (float)kfTrackRef_->hitPattern().trackerLayersWithMeasurement();
58  chi2_kf = kfTrackRef_->normalizedChi2();
59  }
60  setVariable(MVA_NhitsKf, nhit_kf);
61  setVariable(MVA_Chi2Kf, chi2_kf);
62 }
void setVariable(MvaVariable type, float var)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
reco::TrackRef kfTrackRef_
Ref to the KF track.

◆ setLateBrem()

void PFCandidateElectronExtra::setLateBrem ( float  val)

◆ setMVA()

void PFCandidateElectronExtra::setMVA ( float  val)

set the result (mostly for debugging)

Definition at line 116 of file PFCandidateElectronExtra.cc.

References MVA_MVA, setVariable(), and heppy_batch::val.

◆ setSigmaEtaEta()

void PFCandidateElectronExtra::setSigmaEtaEta ( float  val)

◆ setStatus()

void PFCandidateElectronExtra::setStatus ( StatusFlag  type,
bool  status = true 
)

set status

Definition at line 123 of file PFCandidateElectronExtra.cc.

References mps_update::status, and status_.

123  {
124  if (status) {
125  status_ |= (1 << type);
126  } else {
127  status_ &= ~(1 << type);
128  }
129 }
int status_
Status of the electron.

◆ setVariable()

void PFCandidateElectronExtra::setVariable ( MvaVariable  type,
float  var 
)
private

◆ sigmaEtaEta()

float reco::PFCandidateElectronExtra::sigmaEtaEta ( ) const
inline

Definition at line 111 of file PFCandidateElectronExtra.h.

References sigmaEtaEta_.

Member Data Documentation

◆ clusterEnergies_

std::vector<float> reco::PFCandidateElectronExtra::clusterEnergies_
private

energy of individual clusters (corrected). The first cluster is the seed

Definition at line 123 of file PFCandidateElectronExtra.h.

Referenced by setClusterEnergies(), and setHadEnergy().

◆ deltaEta_

float reco::PFCandidateElectronExtra::deltaEta_
private

Definition at line 140 of file PFCandidateElectronExtra.h.

Referenced by setDeltaEta().

◆ earlyBrem_

float reco::PFCandidateElectronExtra::earlyBrem_
private

Definition at line 136 of file PFCandidateElectronExtra.h.

Referenced by setEarlyBrem().

◆ gsfTrackRef_

reco::GsfTrackRef reco::PFCandidateElectronExtra::gsfTrackRef_
private

Ref to the GSF track.

Definition at line 118 of file PFCandidateElectronExtra.h.

Referenced by gsfTrackRef(), PFCandidateElectronExtra(), setClusterEnergies(), and setGsfTrackRef().

◆ hadEnergy_

float reco::PFCandidateElectronExtra::hadEnergy_
private

◆ kfTrackRef_

reco::TrackRef reco::PFCandidateElectronExtra::kfTrackRef_
private

Ref to the KF track.

Definition at line 120 of file PFCandidateElectronExtra.h.

Referenced by kfTrackRef(), PFCandidateElectronExtra(), and setKfTrackRef().

◆ lateBrem_

float reco::PFCandidateElectronExtra::lateBrem_
private

Definition at line 137 of file PFCandidateElectronExtra.h.

Referenced by setLateBrem().

◆ mvaStatus_

int reco::PFCandidateElectronExtra::mvaStatus_
private

status of mva variables

Definition at line 129 of file PFCandidateElectronExtra.h.

Referenced by mvaStatus(), PFCandidateElectronExtra(), and setVariable().

◆ mvaVariables_

std::vector<float> reco::PFCandidateElectronExtra::mvaVariables_
private

mva variables - transient !

Definition at line 126 of file PFCandidateElectronExtra.h.

Referenced by mvaVariable(), mvaVariables(), PFCandidateElectronExtra(), and setVariable().

◆ pout_

math::XYZTLorentzVector reco::PFCandidateElectronExtra::pout_
private

Variables entering the MVA that should be saved.

Definition at line 135 of file PFCandidateElectronExtra.h.

Referenced by PFCandidateElectronExtra(), setClusterEnergies(), and setGsfTrackPout().

◆ sigmaEtaEta_

float reco::PFCandidateElectronExtra::sigmaEtaEta_
private

◆ status_

int reco::PFCandidateElectronExtra::status_
private

Status of the electron.

Definition at line 132 of file PFCandidateElectronExtra.h.

Referenced by electronStatus(), PFCandidateElectronExtra(), and setStatus().