CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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),
36  trackClusterMatching_(tcm), trackExtrapolations_(te),
37  //closestCtfTrack_(ctfInfo),
38  fiducialFlags_(ff), showerShape_(ss), conversionRejection_(crv)
39  {
40  init() ;
41  setCharge(charge) ;
42  setVertex(math::XYZPoint(te.positionAtVtx.x(),te.positionAtVtx.y(),te.positionAtVtx.z())) ;
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  ( const GsfElectron & electron,
51  const GsfElectronCoreRef & core )
52  : RecoCandidate(electron),
53  chargeInfo_(electron.chargeInfo_),
54  core_(core),
55  trackClusterMatching_(electron.trackClusterMatching_),
56  trackExtrapolations_(electron.trackExtrapolations_),
57  //closestCtfTrack_(electron.closestCtfTrack_),
58  fiducialFlags_(electron.fiducialFlags_),
59  showerShape_(electron.showerShape_),
60  dr03_(electron.dr03_), dr04_(electron.dr04_),
61  conversionRejection_(electron.conversionRejection_),
62  pfShowerShape_(electron.pfShowerShape_),
63  pfIso_(electron.pfIso_),
64  mvaInput_(electron.mvaInput_),
65  mvaOutput_(electron.mvaOutput_),
66  passCutBasedPreselection_(electron.passCutBasedPreselection_),
67  passPflowPreselection_(electron.passPflowPreselection_),
68  passMvaPreslection_(electron.passMvaPreslection_),
69  ambiguous_(electron.ambiguous_),
70  ambiguousGsfTracks_(electron.ambiguousGsfTracks_),
71  classVariables_(electron.classVariables_),
72  class_(electron.class_),
73  corrections_(electron.corrections_)
74  {
75  assert(electron.core()->ctfTrack()==core->ctfTrack()) ;
76  assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
77  }
78 
80  ( const GsfElectron & electron,
81  const GsfElectronCoreRef & core,
82  const CaloClusterPtr & electronCluster,
83  const TrackRef & closestCtfTrack,
84  const TrackBaseRef & conversionPartner,
85  const GsfTrackRefVector & ambiguousTracks )
86  : RecoCandidate(electron),
87  chargeInfo_(electron.chargeInfo_),
88  core_(core),
89  trackClusterMatching_(electron.trackClusterMatching_),
90  trackExtrapolations_(electron.trackExtrapolations_),
91  //closestCtfTrack_(electron.closestCtfTrack_),
92  fiducialFlags_(electron.fiducialFlags_),
93  showerShape_(electron.showerShape_),
94  dr03_(electron.dr03_), dr04_(electron.dr04_),
95  conversionRejection_(electron.conversionRejection_),
96  pfShowerShape_(electron.pfShowerShape_),
97  pfIso_(electron.pfIso_),
98  mvaInput_(electron.mvaInput_),
99  mvaOutput_(electron.mvaOutput_),
100  passCutBasedPreselection_(electron.passCutBasedPreselection_),
101  passPflowPreselection_(electron.passPflowPreselection_),
102  passMvaPreslection_(electron.passMvaPreslection_),
103  ambiguous_(electron.ambiguous_),
104  ambiguousGsfTracks_(ambiguousTracks),
105  //mva_(electron.mva_),
106  classVariables_(electron.classVariables_),
107  class_(electron.class_),
108  corrections_(electron.corrections_)
109  {
110  trackClusterMatching_.electronCluster = electronCluster ;
111  //closestCtfTrack_.ctfTrack = closestCtfTrack ;
112  conversionRejection_.partner = conversionPartner ;
113  assert(closestCtfTrack==core->ctfTrack()) ;
114  assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
115  // TO BE DONE
116  // Check that the new edm references are really
117  // the clones of the former references, and therefore other attributes
118  // stay valid :
119  // * electron.core_ ~ core ?
120  // * electron.trackClusterMatching_.electronCluster ~ electronCluster ?
121  // * electron.closestCtfTrack_.ctfTrack ~ closestCtfTrack ?
122  // * electron.ambiguousGsfTracks_ ~ ambiguousTracks ?
123  }
124 
125 bool GsfElectron::overlap( const Candidate & c ) const {
126  const RecoCandidate * o = dynamic_cast<const RecoCandidate *>( & c );
127  return ( o != 0 &&
128  ( checkOverlap( gsfTrack(), o->gsfTrack() ) ||
130  );
131  //?? return false;
132 }
133 
135  { return new GsfElectron(*this) ; }
136 
138  (
139  const GsfElectronCoreRef & core,
140  const CaloClusterPtr & electronCluster,
141  const TrackRef & closestCtfTrack,
142  const TrackBaseRef & conversionPartner,
143  const GsfTrackRefVector & ambiguousTracks
144  ) const
145  { return new GsfElectron(*this,core,electronCluster,closestCtfTrack,conversionPartner,ambiguousTracks) ; }
146 
148  {
150  {
151  edm::LogWarning("GsfElectronAlgo|UndefinedPreselectionInfo")
152  <<"All preselection flags are false,"
153  <<" either the data is too old or electrons were not preselected." ;
154  }
156  }
157 
160 
161 void GsfElectron::setCorrectedEcalEnergy( float newEnergy )
162  {
164  momentum *= newEnergy/momentum.e() ;
165  setP4(momentum) ;
170  corrections_.correctedEcalEnergy = newEnergy ;
172  }
173 
175  { corrections_.trackMomentumError = trackErr ; }
176 
178  ( P4Kind kind, const reco::Candidate::LorentzVector & p4, float error, bool setCandidate )
179  {
180  switch(kind)
181  {
182  case P4_FROM_SUPER_CLUSTER:
183  corrections_.fromSuperClusterP4 = p4 ;
184  corrections_.fromSuperClusterP4Error = error ;
185  break ;
186  case P4_COMBINATION:
187  corrections_.combinedP4 = p4 ;
188  corrections_.combinedP4Error = error ;
189  break ;
190  case P4_PFLOW_COMBINATION:
191  corrections_.pflowP4 = p4 ;
192  corrections_.pflowP4Error = error ;
193  break ;
194  default:
195  throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
196  }
197  if (setCandidate)
198  {
199  setP4(p4) ;
200  corrections_.candidateP4Kind = kind ;
201  }
202  }
203 
205  {
206  switch(kind)
207  {
209  case P4_COMBINATION: return corrections_.combinedP4 ;
211  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
212  }
213  }
214 
215 
216 float GsfElectron::p4Error( P4Kind kind ) const
217  {
218  switch(kind)
219  {
223  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
224  }
225  }
226 
virtual reco::GsfTrackRef gsfTrack() const
reference to a GsfTrack
bool checkOverlap(const R &r1, const R &r2) const
check if two components overlap
Definition: RecoCandidate.h:64
MvaInput mvaInput_
Definition: GsfElectron.h:573
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:178
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:15
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
Classification class_
Definition: GsfElectron.h:652
ShowerShape pfShowerShape_
Definition: GsfElectron.h:571
ConversionRejection conversionRejection_
Definition: GsfElectron.h:506
int init
Definition: HydjetWrapper.h:63
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:216
Corrections corrections_
Definition: GsfElectron.h:741
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:585
bool passingMvaPreselection() const
Definition: GsfElectron.h:601
GsfTrackRefVector ambiguousGsfTracks_
Definition: GsfElectron.h:610
ChargeInfo chargeInfo_
Definition: GsfElectron.h:151
double charge(const std::vector< uint8_t > &Ampls)
PflowIsolationVariables pfIso_
Definition: GsfElectron.h:572
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:158
MvaOutput mvaOutput_
Definition: GsfElectron.h:574
FiducialFlags fiducialFlags_
Definition: GsfElectron.h:346
ShowerShape showerShape_
Definition: GsfElectron.h:411
double p4[4]
Definition: TauolaWrapper.h:92
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
IsolationVariables dr04_
Definition: GsfElectron.h:471
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:174
ClassificationVariables classVariables_
Definition: GsfElectron.h:651
GsfElectronCoreRef core_
Definition: GsfElectron.h:191
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
virtual Vector momentum() const GCC11_FINAL
spatial momentum vector
virtual bool overlap(const Candidate &) const
check overlap with another candidate
Definition: GsfElectron.cc:125
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:161
GsfElectron * clone() const
returns a clone of the Candidate object
Definition: GsfElectron.cc:134
TrackClusterMatching trackClusterMatching_
Definition: GsfElectron.h:249
bool passCutBasedPreselection_
Definition: GsfElectron.h:606
IsolationVariables dr03_
Definition: GsfElectron.h:470
TrackExtrapolations trackExtrapolations_
Definition: GsfElectron.h:287
bool ecalDriven() const
Definition: GsfElectron.cc:147
bool passPflowPreselection_
Definition: GsfElectron.h:607
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
float energyError(float E, float *par)
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
bool ecalDrivenSeed() const
Definition: GsfElectron.h:172