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  dr03_(electron.dr03_), dr04_(electron.dr04_),
85  conversionRejection_(electron.conversionRejection_),
86  pfIso_(electron.pfIso_),
87  mvaInput_(electron.mvaInput_),
88  mvaOutput_(electron.mvaOutput_),
89  passCutBasedPreselection_(electron.passCutBasedPreselection_),
90  passPflowPreselection_(electron.passPflowPreselection_),
91  passMvaPreslection_(electron.passMvaPreslection_),
92  ambiguous_(electron.ambiguous_),
93  ambiguousGsfTracks_(electron.ambiguousGsfTracks_),
94  classVariables_(electron.classVariables_),
95  class_(electron.class_),
96  corrections_(electron.corrections_),
97  pixelMatchVariables_(electron.pixelMatchVariables_)
98  {
99  assert(electron.core()->ctfTrack()==core->ctfTrack()) ;
100  assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
101  }
102 
104  ( const GsfElectron & electron,
105  const GsfElectronCoreRef & core,
106  const CaloClusterPtr & electronCluster,
107  const TrackRef & closestCtfTrack,
108  const TrackBaseRef & conversionPartner,
109  const GsfTrackRefVector & ambiguousTracks )
110  : RecoCandidate(electron),
111  chargeInfo_(electron.chargeInfo_),
112  core_(core),
113  trackClusterMatching_(electron.trackClusterMatching_),
114  trackExtrapolations_(electron.trackExtrapolations_),
115  //closestCtfTrack_(electron.closestCtfTrack_),
116  fiducialFlags_(electron.fiducialFlags_),
117  showerShape_(electron.showerShape_),
118  full5x5_showerShape_(electron.full5x5_showerShape_),
119  dr03_(electron.dr03_), dr04_(electron.dr04_),
120  conversionRejection_(electron.conversionRejection_),
121  pfIso_(electron.pfIso_),
122  mvaInput_(electron.mvaInput_),
123  mvaOutput_(electron.mvaOutput_),
124  passCutBasedPreselection_(electron.passCutBasedPreselection_),
125  passPflowPreselection_(electron.passPflowPreselection_),
126  passMvaPreslection_(electron.passMvaPreslection_),
127  ambiguous_(electron.ambiguous_),
128  ambiguousGsfTracks_(ambiguousTracks),
129  //mva_(electron.mva_),
130  classVariables_(electron.classVariables_),
131  class_(electron.class_),
132  corrections_(electron.corrections_),
133  pixelMatchVariables_(electron.pixelMatchVariables_)
134  {
135  trackClusterMatching_.electronCluster = electronCluster ;
136  //closestCtfTrack_.ctfTrack = closestCtfTrack ;
137  conversionRejection_.partner = conversionPartner ;
138  assert(closestCtfTrack==core->ctfTrack()) ;
139  assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
140  // TO BE DONE
141  // Check that the new edm references are really
142  // the clones of the former references, and therefore other attributes
143  // stay valid :
144  // * electron.core_ ~ core ?
145  // * electron.trackClusterMatching_.electronCluster ~ electronCluster ?
146  // * electron.closestCtfTrack_.ctfTrack ~ closestCtfTrack ?
147  // * electron.ambiguousGsfTracks_ ~ ambiguousTracks ?
148  }
149 
150 bool GsfElectron::overlap( const Candidate & c ) const {
151  const RecoCandidate * o = dynamic_cast<const RecoCandidate *>( & c );
152  return ( o != 0 &&
153  ( checkOverlap( gsfTrack(), o->gsfTrack() ) ||
155  );
156  //?? return false;
157 }
158 
160  { return new GsfElectron(*this) ; }
161 
163  (
164  const GsfElectronCoreRef & core,
165  const CaloClusterPtr & electronCluster,
166  const TrackRef & closestCtfTrack,
167  const TrackBaseRef & conversionPartner,
168  const GsfTrackRefVector & ambiguousTracks
169  ) const
170  { return new GsfElectron(*this,core,electronCluster,closestCtfTrack,conversionPartner,ambiguousTracks) ; }
171 
173  {
175  }
176 
179 
180 void GsfElectron::setCorrectedEcalEnergy( float newEnergy )
181  {
183  momentum *= newEnergy/momentum.e() ;
184  setP4(momentum) ;
189  corrections_.correctedEcalEnergy = newEnergy ;
191  }
192 
194  { corrections_.trackMomentumError = trackErr ; }
195 
197  ( P4Kind kind, const reco::Candidate::LorentzVector & p4, float error, bool setCandidate )
198  {
199  switch(kind)
200  {
201  case P4_FROM_SUPER_CLUSTER:
202  corrections_.fromSuperClusterP4 = p4 ;
203  corrections_.fromSuperClusterP4Error = error ;
204  break ;
205  case P4_COMBINATION:
206  corrections_.combinedP4 = p4 ;
207  corrections_.combinedP4Error = error ;
208  break ;
209  case P4_PFLOW_COMBINATION:
210  corrections_.pflowP4 = p4 ;
211  corrections_.pflowP4Error = error ;
212  break ;
213  default:
214  throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
215  }
216  if (setCandidate)
217  {
218  setP4(p4) ;
219  corrections_.candidateP4Kind = kind ;
220  }
221  }
222 
224  {
225  switch(kind)
226  {
228  case P4_COMBINATION: return corrections_.combinedP4 ;
230  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
231  }
232  }
233 
234 
235 float GsfElectron::p4Error( P4Kind kind ) const
236  {
237  switch(kind)
238  {
242  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
243  }
244  }
245 
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:63
MvaInput mvaInput_
Definition: GsfElectron.h:620
PixelMatchVariables pixelMatchVariables_
Definition: GsfElectron.h:824
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:197
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:696
ConversionRejection conversionRejection_
Definition: GsfElectron.h:547
int init
Definition: HydjetWrapper.h:62
virtual Vector momentum() const
spatial momentum vector
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:235
Corrections corrections_
Definition: GsfElectron.h:788
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:632
GsfTrackRefVector ambiguousGsfTracks_
Definition: GsfElectron.h:657
ChargeInfo chargeInfo_
Definition: GsfElectron.h:164
PflowIsolationVariables pfIso_
Definition: GsfElectron.h:619
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:177
MvaOutput mvaOutput_
Definition: GsfElectron.h:621
FiducialFlags fiducialFlags_
Definition: GsfElectron.h:366
ShowerShape showerShape_
Definition: GsfElectron.h:451
double p4[4]
Definition: TauolaWrapper.h:92
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
IsolationVariables dr04_
Definition: GsfElectron.h:512
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:193
ClassificationVariables classVariables_
Definition: GsfElectron.h:695
GsfElectronCoreRef core_
Definition: GsfElectron.h:205
ShowerShape full5x5_showerShape_
Definition: GsfElectron.h:452
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:150
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:180
GsfElectron * clone() const
returns a clone of the Candidate object
Definition: GsfElectron.cc:159
volatile std::atomic< bool > shutdown_flag false
TrackClusterMatching trackClusterMatching_
Definition: GsfElectron.h:266
bool passCutBasedPreselection_
Definition: GsfElectron.h:653
IsolationVariables dr03_
Definition: GsfElectron.h:511
TrackExtrapolations trackExtrapolations_
Definition: GsfElectron.h:307
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
bool ecalDriven() const
Definition: GsfElectron.cc:172
bool passPflowPreselection_
Definition: GsfElectron.h:654
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