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  {
14  ambiguous_ = true ;
15  fbrem_ = 0 ;
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  float fbrem
34  )
35  : chargeInfo_(chargeInfo),
36  core_(core),
37  trackClusterMatching_(tcm), trackExtrapolations_(te),
38  //closestCtfTrack_(ctfInfo),
39  fiducialFlags_(ff), showerShape_(ss), conversionRejection_(crv)
40  {
41  init() ;
42  fbrem_ = fbrem ;
43  setCharge(charge) ;
44  setVertex(math::XYZPoint(te.positionAtVtx.x(),te.positionAtVtx.y(),te.positionAtVtx.z())) ;
45  setPdgId(-11*charge) ;
46  /*if (ecalDrivenSeed())*/ corrections_.ecalEnergy = superCluster()->energy() ;
47  assert(ctfInfo.ctfTrack==(GsfElectron::core()->ctfTrack())) ;
48  assert(ctfInfo.shFracInnerHits==(GsfElectron::core()->ctfGsfOverlap())) ;
49  }
50 
52  ( const GsfElectron & electron,
53  const GsfElectronCoreRef & core )
54  : RecoCandidate(electron),
55  chargeInfo_(electron.chargeInfo_),
56  core_(core),
57  trackClusterMatching_(electron.trackClusterMatching_),
58  trackExtrapolations_(electron.trackExtrapolations_),
59  //closestCtfTrack_(electron.closestCtfTrack_),
60  fiducialFlags_(electron.fiducialFlags_),
61  showerShape_(electron.showerShape_),
62  dr03_(electron.dr03_), dr04_(electron.dr04_),
63  conversionRejection_(electron.conversionRejection_),
64  passCutBasedPreselection_(electron.passCutBasedPreselection_),
65  passMvaPreslection_(electron.passMvaPreslection_),
66  ambiguous_(electron.ambiguous_),
67  ambiguousGsfTracks_(electron.ambiguousGsfTracks_),
68  //mva_(electron.mva_),
69  fbrem_(electron.fbrem_),
70  class_(electron.class_),
71  corrections_(electron.corrections_)
72  {
73  assert(electron.core()->ctfTrack()==core->ctfTrack()) ;
74  assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
75  }
76 
78  ( const GsfElectron & electron,
79  const GsfElectronCoreRef & core,
80  const CaloClusterPtr & electronCluster,
81  const TrackRef & closestCtfTrack,
82  const TrackBaseRef & conversionPartner,
83  const GsfTrackRefVector & ambiguousTracks )
84  : RecoCandidate(electron),
85  chargeInfo_(electron.chargeInfo_),
86  core_(core),
87  trackClusterMatching_(electron.trackClusterMatching_),
88  trackExtrapolations_(electron.trackExtrapolations_),
89  //closestCtfTrack_(electron.closestCtfTrack_),
90  fiducialFlags_(electron.fiducialFlags_),
91  showerShape_(electron.showerShape_),
92  dr03_(electron.dr03_), dr04_(electron.dr04_),
93  conversionRejection_(electron.conversionRejection_),
94  passCutBasedPreselection_(electron.passCutBasedPreselection_),
95  passMvaPreslection_(electron.passMvaPreslection_),
96  ambiguous_(electron.ambiguous_),
97  ambiguousGsfTracks_(ambiguousTracks),
98  //mva_(electron.mva_),
99  fbrem_(electron.fbrem_),
100  class_(electron.class_),
101  corrections_(electron.corrections_)
102  {
103  trackClusterMatching_.electronCluster = electronCluster ;
104  //closestCtfTrack_.ctfTrack = closestCtfTrack ;
105  conversionRejection_.partner = conversionPartner ;
106  assert(closestCtfTrack==core->ctfTrack()) ;
107  assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
108  // TO BE DONE
109  // Check that the new edm references are really
110  // the clones of the former references, and therefore other attributes
111  // stay valid :
112  // * electron.core_ ~ core ?
113  // * electron.trackClusterMatching_.electronCluster ~ electronCluster ?
114  // * electron.closestCtfTrack_.ctfTrack ~ closestCtfTrack ?
115  // * electron.ambiguousGsfTracks_ ~ ambiguousTracks ?
116  }
117 
118 bool GsfElectron::overlap( const Candidate & c ) const {
119  const RecoCandidate * o = dynamic_cast<const RecoCandidate *>( & c );
120  return ( o != 0 &&
121  ( checkOverlap( gsfTrack(), o->gsfTrack() ) ||
123  );
124  //?? return false;
125 }
126 
128  { return new GsfElectron(*this) ; }
129 
131  (
132  const GsfElectronCoreRef & core,
133  const CaloClusterPtr & electronCluster,
134  const TrackRef & closestCtfTrack,
135  const TrackBaseRef & conversionPartner,
136  const GsfTrackRefVector & ambiguousTracks
137  ) const
138  { return new GsfElectron(*this,core,electronCluster,closestCtfTrack,conversionPartner,ambiguousTracks) ; }
139 
141  {
143  {
144  edm::LogWarning("GsfElectronAlgo|UndefinedPreselectionInfo")
145  <<"All preselection flags are false,"
146  <<" either the data is too old or electrons were not preselected." ;
147  }
149  }
150 
151 void GsfElectron::setCorrectedEcalEnergy( float newEnergy, float newEnergyError )
152  {
154  momentum *= newEnergy/momentum.e() ;
155  setP4(momentum) ;
161  corrections_.ecalEnergy = newEnergy ;
162  corrections_.ecalEnergyError = newEnergyError ;
164  }
165 
167  { corrections_.trackMomentumError = trackErr ; }
168 
170  ( P4Kind kind, const reco::Candidate::LorentzVector & p4, float error, bool setCandidate )
171  {
172  switch(kind)
173  {
174  case P4_FROM_SUPER_CLUSTER:
175  corrections_.fromSuperClusterP4 = p4 ;
176  corrections_.fromSuperClusterP4Error = error ;
177  break ;
178  case P4_COMBINATION:
179  corrections_.combinedP4 = p4 ;
180  corrections_.combinedP4Error = error ;
181  break ;
182  case P4_PFLOW_COMBINATION:
183  corrections_.pflowP4 = p4 ;
184  corrections_.pflowP4Error = error ;
185  break ;
186  default:
187  throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
188  }
189  if (setCandidate)
190  {
191  setP4(p4) ;
192  corrections_.candidateP4Kind = kind ;
193  }
194  }
195 
197  {
198  switch(kind)
199  {
201  case P4_COMBINATION: return corrections_.combinedP4 ;
203  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
204  }
205  }
206 
207 
208 float GsfElectron::p4Error( P4Kind kind ) const
209  {
210  switch(kind)
211  {
215  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
216  }
217  }
218 
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:67
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:170
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:15
Classification class_
Definition: GsfElectron.h:611
ConversionRejection conversionRejection_
Definition: GsfElectron.h:492
int init
Definition: HydjetWrapper.h:63
virtual Vector momentum() const
spatial momentum vector
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:208
Corrections corrections_
Definition: GsfElectron.h:695
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:566
bool passingMvaPreselection() const
Definition: GsfElectron.h:567
SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
GsfTrackRefVector ambiguousGsfTracks_
Definition: GsfElectron.h:586
ChargeInfo chargeInfo_
Definition: GsfElectron.h:151
double charge(const std::vector< uint8_t > &Ampls)
FiducialFlags fiducialFlags_
Definition: GsfElectron.h:356
ShowerShape showerShape_
Definition: GsfElectron.h:407
double p4[4]
Definition: TauolaWrapper.h:92
IsolationVariables dr04_
Definition: GsfElectron.h:457
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:166
GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
GsfElectronCoreRef core_
Definition: GsfElectron.h:177
tuple ff
Definition: createTree.py:204
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
virtual bool overlap(const Candidate &) const
check overlap with another candidate
Definition: GsfElectron.cc:118
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:39
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
void setCorrectedEcalEnergy(float newEnergy, float newEnergyError)
Definition: GsfElectron.cc:151
GsfElectron * clone() const
returns a clone of the Candidate object
Definition: GsfElectron.cc:127
TrackClusterMatching trackClusterMatching_
Definition: GsfElectron.h:235
bool passCutBasedPreselection_
Definition: GsfElectron.h:583
IsolationVariables dr03_
Definition: GsfElectron.h:456
TrackExtrapolations trackExtrapolations_
Definition: GsfElectron.h:273
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
bool ecalDriven() const
Definition: GsfElectron.cc:140
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
bool ecalDrivenSeed() const
Definition: GsfElectron.h:170