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  }
49  ( int charge, const ChargeInfo & chargeInfo,
50  const GsfElectronCoreRef & core,
51  const TrackClusterMatching & tcm, const TrackExtrapolations & te,
52  const ClosestCtfTrack & ctfInfo,
53  const FiducialFlags & ff, const ShowerShape & ss,
54  const ShowerShape& full5x5_ss,
55  const ConversionRejection & crv
56  )
57  : chargeInfo_(chargeInfo),
58  core_(core),
59  trackClusterMatching_(tcm), trackExtrapolations_(te),
60  //closestCtfTrack_(ctfInfo),
61  fiducialFlags_(ff), showerShape_(ss), full5x5_showerShape_(full5x5_ss),
62  conversionRejection_(crv)
63  {
64  init() ;
65  setCharge(charge) ;
66  setVertex(math::XYZPoint(te.positionAtVtx.x(),te.positionAtVtx.y(),te.positionAtVtx.z())) ;
67  setPdgId(-11*charge) ;
68  /*if (ecalDrivenSeed())*/ corrections_.correctedEcalEnergy = superCluster()->energy() ;
69  //assert(ctfInfo.ctfTrack==(GsfElectron::core()->ctfTrack())) ;
70  //assert(ctfInfo.shFracInnerHits==(GsfElectron::core()->ctfGsfOverlap())) ;
71  }
72 
74  ( const GsfElectron & electron,
75  const GsfElectronCoreRef & core )
76  : RecoCandidate(electron),
77  chargeInfo_(electron.chargeInfo_),
78  core_(core),
79  trackClusterMatching_(electron.trackClusterMatching_),
80  trackExtrapolations_(electron.trackExtrapolations_),
81  //closestCtfTrack_(electron.closestCtfTrack_),
82  fiducialFlags_(electron.fiducialFlags_),
83  showerShape_(electron.showerShape_),
84  full5x5_showerShape_(electron.full5x5_showerShape_),
85  dr03_(electron.dr03_), dr04_(electron.dr04_),
86  conversionRejection_(electron.conversionRejection_),
87  pfIso_(electron.pfIso_),
88  mvaInput_(electron.mvaInput_),
89  mvaOutput_(electron.mvaOutput_),
90  passCutBasedPreselection_(electron.passCutBasedPreselection_),
91  passPflowPreselection_(electron.passPflowPreselection_),
92  passMvaPreslection_(electron.passMvaPreslection_),
93  ambiguous_(electron.ambiguous_),
94  ambiguousGsfTracks_(electron.ambiguousGsfTracks_),
95  classVariables_(electron.classVariables_),
96  class_(electron.class_),
97  corrections_(electron.corrections_),
98  pixelMatchVariables_(electron.pixelMatchVariables_)
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,
107  const CaloClusterPtr & electronCluster,
108  const TrackRef & closestCtfTrack,
109  const TrackBaseRef & conversionPartner,
110  const GsfTrackRefVector & ambiguousTracks )
111  : RecoCandidate(electron),
112  chargeInfo_(electron.chargeInfo_),
113  core_(core),
114  trackClusterMatching_(electron.trackClusterMatching_),
115  trackExtrapolations_(electron.trackExtrapolations_),
116  //closestCtfTrack_(electron.closestCtfTrack_),
117  fiducialFlags_(electron.fiducialFlags_),
118  showerShape_(electron.showerShape_),
119  full5x5_showerShape_(electron.full5x5_showerShape_),
120  dr03_(electron.dr03_), dr04_(electron.dr04_),
121  conversionRejection_(electron.conversionRejection_),
122  pfIso_(electron.pfIso_),
123  mvaInput_(electron.mvaInput_),
124  mvaOutput_(electron.mvaOutput_),
125  passCutBasedPreselection_(electron.passCutBasedPreselection_),
126  passPflowPreselection_(electron.passPflowPreselection_),
127  passMvaPreslection_(electron.passMvaPreslection_),
128  ambiguous_(electron.ambiguous_),
129  ambiguousGsfTracks_(ambiguousTracks),
130  //mva_(electron.mva_),
131  classVariables_(electron.classVariables_),
132  class_(electron.class_),
133  corrections_(electron.corrections_),
134  pixelMatchVariables_(electron.pixelMatchVariables_)
135  {
136  trackClusterMatching_.electronCluster = electronCluster ;
137  //closestCtfTrack_.ctfTrack = closestCtfTrack ;
138  conversionRejection_.partner = conversionPartner ;
139  //assert(closestCtfTrack==core->ctfTrack()) ;
140  //assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
141  // TO BE DONE
142  // Check that the new edm references are really
143  // the clones of the former references, and therefore other attributes
144  // stay valid :
145  // * electron.core_ ~ core ?
146  // * electron.trackClusterMatching_.electronCluster ~ electronCluster ?
147  // * electron.closestCtfTrack_.ctfTrack ~ closestCtfTrack ?
148  // * electron.ambiguousGsfTracks_ ~ ambiguousTracks ?
149  }
150 
151 bool GsfElectron::overlap( const Candidate & c ) const {
152  const RecoCandidate * o = dynamic_cast<const RecoCandidate *>( & c );
153  return ( o != 0 &&
154  ( checkOverlap( gsfTrack(), o->gsfTrack() ) ||
156  );
157  //?? return false;
158 }
159 
161  { return new GsfElectron(*this) ; }
162 
164  (
165  const GsfElectronCoreRef & core,
166  const CaloClusterPtr & electronCluster,
167  const TrackRef & closestCtfTrack,
168  const TrackBaseRef & conversionPartner,
169  const GsfTrackRefVector & ambiguousTracks
170  ) const
171  { return new GsfElectron(*this,core,electronCluster,closestCtfTrack,conversionPartner,ambiguousTracks) ; }
172 
174  {
176  }
177 
180 
181 void GsfElectron::setCorrectedEcalEnergy( float newEnergy )
182  {
184  momentum *= newEnergy/momentum.e() ;
185  setP4(momentum) ;
190  corrections_.correctedEcalEnergy = newEnergy ;
192  }
193 
195  { corrections_.trackMomentumError = trackErr ; }
196 
198  ( P4Kind kind, const reco::Candidate::LorentzVector & p4, float error, bool setCandidate )
199  {
200  switch(kind)
201  {
202  case P4_FROM_SUPER_CLUSTER:
203  corrections_.fromSuperClusterP4 = p4 ;
204  corrections_.fromSuperClusterP4Error = error ;
205  break ;
206  case P4_COMBINATION:
207  corrections_.combinedP4 = p4 ;
208  corrections_.combinedP4Error = error ;
209  break ;
210  case P4_PFLOW_COMBINATION:
211  corrections_.pflowP4 = p4 ;
212  corrections_.pflowP4Error = error ;
213  break ;
214  default:
215  throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
216  }
217  if (setCandidate)
218  {
219  setP4(p4) ;
220  corrections_.candidateP4Kind = kind ;
221  }
222  }
223 
225  {
226  switch(kind)
227  {
229  case P4_COMBINATION: return corrections_.combinedP4 ;
231  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
232  }
233  }
234 
235 
236 float GsfElectron::p4Error( P4Kind kind ) const
237  {
238  switch(kind)
239  {
243  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
244  }
245  }
246 
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:69
MvaInput mvaInput_
Definition: GsfElectron.h:634
PixelMatchVariables pixelMatchVariables_
Definition: GsfElectron.h:838
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:198
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
Classification class_
Definition: GsfElectron.h:710
ConversionRejection conversionRejection_
Definition: GsfElectron.h:561
int init
Definition: HydjetWrapper.h:67
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:236
Corrections corrections_
Definition: GsfElectron.h:802
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:646
GsfTrackRefVector ambiguousGsfTracks_
Definition: GsfElectron.h:671
ChargeInfo chargeInfo_
Definition: GsfElectron.h:164
PflowIsolationVariables pfIso_
Definition: GsfElectron.h:633
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:178
MvaOutput mvaOutput_
Definition: GsfElectron.h:635
FiducialFlags fiducialFlags_
Definition: GsfElectron.h:366
ShowerShape showerShape_
Definition: GsfElectron.h:465
double p4[4]
Definition: TauolaWrapper.h:92
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
IsolationVariables dr04_
Definition: GsfElectron.h:526
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:194
ClassificationVariables classVariables_
Definition: GsfElectron.h:709
GsfElectronCoreRef core_
Definition: GsfElectron.h:205
ShowerShape full5x5_showerShape_
Definition: GsfElectron.h:466
virtual Vector momentum() const final
spatial momentum vector
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
virtual bool overlap(const Candidate &) const
check overlap with another candidate
Definition: GsfElectron.cc:151
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:181
GsfElectron * clone() const
returns a clone of the Candidate object
Definition: GsfElectron.cc:160
volatile std::atomic< bool > shutdown_flag false
TrackClusterMatching trackClusterMatching_
Definition: GsfElectron.h:266
bool passCutBasedPreselection_
Definition: GsfElectron.h:667
IsolationVariables dr03_
Definition: GsfElectron.h:525
TrackExtrapolations trackExtrapolations_
Definition: GsfElectron.h:307
bool ecalDriven() const
Definition: GsfElectron.cc:173
bool passPflowPreselection_
Definition: GsfElectron.h:668
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
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:183
bool ecalDrivenSeed() const
Definition: GsfElectron.h:186