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  pfShowerShape_(electron.pfShowerShape_),
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  {
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  pfShowerShape_(electron.pfShowerShape_),
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  {
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  edm::LogWarning("GsfElectronAlgo|UndefinedPreselectionInfo")
177  <<"All preselection flags are false,"
178  <<" either the data is too old or electrons were not preselected." ;
179  }
181  }
182 
185 
186 void GsfElectron::setCorrectedEcalEnergy( float newEnergy )
187  {
189  momentum *= newEnergy/momentum.e() ;
190  setP4(momentum) ;
195  corrections_.correctedEcalEnergy = newEnergy ;
197  }
198 
200  { corrections_.trackMomentumError = trackErr ; }
201 
203  ( P4Kind kind, const reco::Candidate::LorentzVector & p4, float error, bool setCandidate )
204  {
205  switch(kind)
206  {
207  case P4_FROM_SUPER_CLUSTER:
208  corrections_.fromSuperClusterP4 = p4 ;
209  corrections_.fromSuperClusterP4Error = error ;
210  break ;
211  case P4_COMBINATION:
212  corrections_.combinedP4 = p4 ;
213  corrections_.combinedP4Error = error ;
214  break ;
215  case P4_PFLOW_COMBINATION:
216  corrections_.pflowP4 = p4 ;
217  corrections_.pflowP4Error = error ;
218  break ;
219  default:
220  throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
221  }
222  if (setCandidate)
223  {
224  setP4(p4) ;
225  corrections_.candidateP4Kind = kind ;
226  }
227  }
228 
230  {
231  switch(kind)
232  {
234  case P4_COMBINATION: return corrections_.combinedP4 ;
236  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
237  }
238  }
239 
240 
241 float GsfElectron::p4Error( P4Kind kind ) const
242  {
243  switch(kind)
244  {
248  default: throw cms::Exception("GsfElectron")<<"unexpected p4 kind: "<<kind ;
249  }
250  }
251 
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:618
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:203
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
Classification class_
Definition: GsfElectron.h:697
ShowerShape pfShowerShape_
Definition: GsfElectron.h:616
ConversionRejection conversionRejection_
Definition: GsfElectron.h:544
int init
Definition: HydjetWrapper.h:62
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:241
Corrections corrections_
Definition: GsfElectron.h:789
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:630
bool passingMvaPreselection() const
Definition: GsfElectron.h:646
GsfTrackRefVector ambiguousGsfTracks_
Definition: GsfElectron.h:655
ChargeInfo chargeInfo_
Definition: GsfElectron.h:164
double charge(const std::vector< uint8_t > &Ampls)
PflowIsolationVariables pfIso_
Definition: GsfElectron.h:617
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:183
MvaOutput mvaOutput_
Definition: GsfElectron.h:619
FiducialFlags fiducialFlags_
Definition: GsfElectron.h:363
ShowerShape showerShape_
Definition: GsfElectron.h:448
double p4[4]
Definition: TauolaWrapper.h:92
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
IsolationVariables dr04_
Definition: GsfElectron.h:509
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:199
ClassificationVariables classVariables_
Definition: GsfElectron.h:696
GsfElectronCoreRef core_
Definition: GsfElectron.h:205
ShowerShape full5x5_showerShape_
Definition: GsfElectron.h:449
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
virtual Vector momentum() const GCC11_FINAL
spatial momentum vector
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:186
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:263
bool passCutBasedPreselection_
Definition: GsfElectron.h:651
IsolationVariables dr03_
Definition: GsfElectron.h:508
TrackExtrapolations trackExtrapolations_
Definition: GsfElectron.h:304
bool ecalDriven() const
Definition: GsfElectron.cc:172
bool passPflowPreselection_
Definition: GsfElectron.h:652
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