CMS 3D CMS Logo

GsfElectron.cc
Go to the documentation of this file.
5 
6 using namespace reco ;
7 
9 
11  {
15  ambiguous_ = true ;
16  class_ = UNKNOWN ;
17  }
18 
20  { init() ; }
21 
23  : core_(core)
24  { init() ; }
25 
27  ( int charge, const ChargeInfo & chargeInfo,
28  const GsfElectronCoreRef & core,
29  const TrackClusterMatching & tcm, const TrackExtrapolations & te,
30  const ClosestCtfTrack & ctfInfo,
31  const FiducialFlags & ff, const ShowerShape & ss,
32  const ConversionRejection & crv
33  )
34  : chargeInfo_(chargeInfo),
35  core_(core),
37  //closestCtfTrack_(ctfInfo),
39  {
40  init() ;
41  setCharge(charge) ;
43  setPdgId(-11*charge) ;
44  /*if (ecalDrivenSeed())*/ corrections_.correctedEcalEnergy = superCluster()->energy() ;
45  // assert(ctfInfo.ctfTrack==(GsfElectron::core()->ctfTrack())) ;
46  // assert(ctfInfo.shFracInnerHits==(GsfElectron::core()->ctfGsfOverlap())) ;
47  }
48 
50  ( int charge, const ChargeInfo & chargeInfo,
51  const GsfElectronCoreRef & core,
52  const TrackClusterMatching & tcm, const TrackExtrapolations & te,
53  const ClosestCtfTrack & ctfInfo,
54  const FiducialFlags & ff, const ShowerShape & ss,
55  const ShowerShape& full5x5_ss,
56  const ConversionRejection & crv,
57  const SaturationInfo& si
58  )
59  : chargeInfo_(chargeInfo),
60  core_(core),
64  {
65  init() ;
66  setCharge(charge) ;
68  setPdgId(-11*charge) ;
70  }
71 
73  ( const GsfElectron & electron,
74  const GsfElectronCoreRef & core )
75  : RecoCandidate(electron),
76  chargeInfo_(electron.chargeInfo_),
77  core_(core),
80  //closestCtfTrack_(electron.closestCtfTrack_),
82  showerShape_(electron.showerShape_),
85  dr03_(electron.dr03_), dr04_(electron.dr04_),
87  pfIso_(electron.pfIso_),
88  mvaInput_(electron.mvaInput_),
89  mvaOutput_(electron.mvaOutput_),
93  ambiguous_(electron.ambiguous_),
96  class_(electron.class_),
97  corrections_(electron.corrections_),
99  {
100  //assert(electron.core()->ctfTrack()==core->ctfTrack()) ;
101  //assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
102  }
103 
105  ( const GsfElectron & electron,
106  const GsfElectronCoreRef & core,
108  const TrackRef & closestCtfTrack,
109  const TrackBaseRef & conversionPartner,
110  const GsfTrackRefVector & ambiguousTracks )
111  : RecoCandidate(electron),
112  chargeInfo_(electron.chargeInfo_),
113  core_(core),
116  //closestCtfTrack_(electron.closestCtfTrack_),
117  fiducialFlags_(electron.fiducialFlags_),
118  showerShape_(electron.showerShape_),
121  dr03_(electron.dr03_), dr04_(electron.dr04_),
123  pfIso_(electron.pfIso_),
124  mvaInput_(electron.mvaInput_),
125  mvaOutput_(electron.mvaOutput_),
129  ambiguous_(electron.ambiguous_),
130  ambiguousGsfTracks_(ambiguousTracks),
131  //mva_(electron.mva_),
133  class_(electron.class_),
134  corrections_(electron.corrections_),
136  {
138  //closestCtfTrack_.ctfTrack = closestCtfTrack ;
139  conversionRejection_.partner = conversionPartner ;
140  //assert(closestCtfTrack==core->ctfTrack()) ;
141  //assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
142  // TO BE DONE
143  // Check that the new edm references are really
144  // the clones of the former references, and therefore other attributes
145  // stay valid :
146  // * electron.core_ ~ core ?
147  // * electron.trackClusterMatching_.electronCluster ~ electronCluster ?
148  // * electron.closestCtfTrack_.ctfTrack ~ closestCtfTrack ?
149  // * electron.ambiguousGsfTracks_ ~ ambiguousTracks ?
150  }
151 
152 bool GsfElectron::overlap( const Candidate & c ) const {
153  const RecoCandidate * o = dynamic_cast<const RecoCandidate *>( & c );
154  return ( o != nullptr &&
155  ( checkOverlap( gsfTrack(), o->gsfTrack() ) ||
157  );
158  //?? return false;
159 }
160 
162  { return new GsfElectron(*this) ; }
163 
165  (
166  const GsfElectronCoreRef & core,
167  const CaloClusterPtr & electronCluster,
168  const TrackRef & closestCtfTrack,
169  const TrackBaseRef & conversionPartner,
170  const GsfTrackRefVector & ambiguousTracks
171  ) const
172  { return new GsfElectron(*this,core,electronCluster,closestCtfTrack,conversionPartner,ambiguousTracks) ; }
173 
175  {
177  }
178 
181 
182 void GsfElectron::setCorrectedEcalEnergy( float newEnergy )
183  {
185  momentum *= newEnergy/momentum.e() ;
186  setP4(momentum) ;
191  corrections_.correctedEcalEnergy = newEnergy ;
193  }
194 
196  { corrections_.trackMomentumError = trackErr ; }
197 
199  ( P4Kind kind, const reco::Candidate::LorentzVector & p4, float error, bool setCandidate )
200  {
201  switch(kind)
202  {
206  break ;
207  case P4_COMBINATION:
210  break ;
214  break ;
215  default:
216  throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
217  }
218  if (setCandidate)
219  {
220  setP4(p4) ;
222  }
223  }
224 
226  {
227  switch(kind)
228  {
230  case P4_COMBINATION: return corrections_.combinedP4 ;
232  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
233  }
234  }
235 
236 
237 float GsfElectron::p4Error( P4Kind kind ) const
238  {
239  switch(kind)
240  {
244  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
245  }
246  }
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:248
virtual reco::GsfTrackRef gsfTrack() const
reference to a GsfTrack
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
bool checkOverlap(const R &r1, const R &r2) const
check if two components overlap
Definition: RecoCandidate.h:69
MvaInput mvaInput_
Definition: GsfElectron.h:707
PixelMatchVariables pixelMatchVariables_
Definition: GsfElectron.h:911
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:199
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
GsfElectron * clone() const override
returns a clone of the Candidate object
Definition: GsfElectron.cc:161
bool overlap(const Candidate &) const override
check overlap with another candidate
Definition: GsfElectron.cc:152
Classification class_
Definition: GsfElectron.h:783
ConversionRejection conversionRejection_
Definition: GsfElectron.h:627
Definition: __init__.py:1
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:237
Corrections corrections_
Definition: GsfElectron.h:875
SaturationInfo saturationInfo_
Definition: GsfElectron.h:527
int charge() const final
electric charge
Definition: LeafCandidate.h:91
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:719
GsfTrackRefVector ambiguousGsfTracks_
Definition: GsfElectron.h:744
ChargeInfo chargeInfo_
Definition: GsfElectron.h:167
void setVertex(const Point &vertex) override
set vertex
void setCharge(Charge q) final
set electric charge
Definition: LeafCandidate.h:93
PflowIsolationVariables pfIso_
Definition: GsfElectron.h:706
Vector momentum() const final
spatial momentum vector
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:179
MvaOutput mvaOutput_
Definition: GsfElectron.h:708
FiducialFlags fiducialFlags_
Definition: GsfElectron.h:380
ShowerShape showerShape_
Definition: GsfElectron.h:503
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
IsolationVariables dr04_
Definition: GsfElectron.h:589
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:195
ClassificationVariables classVariables_
Definition: GsfElectron.h:782
GsfElectronCoreRef core_
Definition: GsfElectron.h:211
ShowerShape full5x5_showerShape_
Definition: GsfElectron.h:504
const ChargeInfo & chargeInfo() const
Definition: GsfElectron.h:158
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:182
fixed size matrix
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
RecoCandidate()
default constructor
Definition: RecoCandidate.h:23
TrackClusterMatching trackClusterMatching_
Definition: GsfElectron.h:272
bool passCutBasedPreselection_
Definition: GsfElectron.h:740
IsolationVariables dr03_
Definition: GsfElectron.h:588
TrackExtrapolations trackExtrapolations_
Definition: GsfElectron.h:313
bool ecalDriven() const
Definition: GsfElectron.cc:174
void setPdgId(int pdgId) final
bool passPflowPreselection_
Definition: GsfElectron.h:741
virtual ClosestCtfTrack closestCtfTrack() const
Definition: GsfElectron.h:206
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
float energyError(float E, float *par)
bool ecalDrivenSeed() const
Definition: GsfElectron.h:188