CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GsfElectron.cc
Go to the documentation of this file.
5 
6 using namespace reco;
7 
9 
12  passPflowPreselection_ = false;
13  passMvaPreslection_ = false;
14  ambiguous_ = true;
15  class_ = UNKNOWN;
16 }
17 
19 
20 GsfElectron::GsfElectron(const GsfElectronCoreRef& core) : core_(core) { init(); }
21 
23  const ChargeInfo& chargeInfo,
24  const GsfElectronCoreRef& core,
25  const TrackClusterMatching& tcm,
26  const TrackExtrapolations& te,
27  const ClosestCtfTrack& ctfInfo,
28  const FiducialFlags& ff,
29  const ShowerShape& ss,
30  const ConversionRejection& crv)
31  : chargeInfo_(chargeInfo),
32  core_(core),
33  trackClusterMatching_(tcm),
34  trackExtrapolations_(te),
35  //closestCtfTrack_(ctfInfo),
36  fiducialFlags_(ff),
37  showerShape_(ss),
38  conversionRejection_(crv) {
39  init();
40  setCharge(charge);
42  setPdgId(-11 * charge);
43  /*if (ecalDrivenSeed())*/ corrections_.correctedEcalEnergy = superCluster()->energy();
44  // assert(ctfInfo.ctfTrack==(GsfElectron::core()->ctfTrack())) ;
45  // assert(ctfInfo.shFracInnerHits==(GsfElectron::core()->ctfGsfOverlap())) ;
46 }
47 
49  const ChargeInfo& chargeInfo,
50  const GsfElectronCoreRef& core,
51  const TrackClusterMatching& tcm,
52  const TrackExtrapolations& te,
53  const ClosestCtfTrack& ctfInfo,
54  const FiducialFlags& ff,
55  const ShowerShape& ss,
56  const ShowerShape& full5x5_ss,
57  const ConversionRejection& crv,
58  const SaturationInfo& si)
59  : chargeInfo_(chargeInfo),
60  core_(core),
61  trackClusterMatching_(tcm),
62  trackExtrapolations_(te),
63  fiducialFlags_(ff),
64  showerShape_(ss),
65  full5x5_showerShape_(full5x5_ss),
66  saturationInfo_(si),
67  conversionRejection_(crv) {
68  init();
69  setCharge(charge);
71  setPdgId(-11 * charge);
73 }
74 
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  saturationInfo_(electron.saturationInfo_),
86  dr03_(electron.dr03_),
87  dr04_(electron.dr04_),
88  conversionRejection_(electron.conversionRejection_),
89  pfIso_(electron.pfIso_),
90  mvaInput_(electron.mvaInput_),
91  mvaOutput_(electron.mvaOutput_),
92  passCutBasedPreselection_(electron.passCutBasedPreselection_),
93  passPflowPreselection_(electron.passPflowPreselection_),
94  passMvaPreslection_(electron.passMvaPreslection_),
95  ambiguous_(electron.ambiguous_),
96  ambiguousGsfTracks_(electron.ambiguousGsfTracks_),
97  classVariables_(electron.classVariables_),
98  class_(electron.class_),
99  corrections_(electron.corrections_),
100  pixelMatchVariables_(electron.pixelMatchVariables_) {
101  //assert(electron.core()->ctfTrack()==core->ctfTrack()) ;
102  //assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
103 }
104 
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  saturationInfo_(electron.saturationInfo_),
121  dr03_(electron.dr03_),
122  dr04_(electron.dr04_),
123  conversionRejection_(electron.conversionRejection_),
124  pfIso_(electron.pfIso_),
125  mvaInput_(electron.mvaInput_),
126  mvaOutput_(electron.mvaOutput_),
127  passCutBasedPreselection_(electron.passCutBasedPreselection_),
128  passPflowPreselection_(electron.passPflowPreselection_),
129  passMvaPreslection_(electron.passMvaPreslection_),
130  ambiguous_(electron.ambiguous_),
131  ambiguousGsfTracks_(ambiguousTracks),
132  //mva_(electron.mva_),
133  classVariables_(electron.classVariables_),
134  class_(electron.class_),
135  corrections_(electron.corrections_),
136  pixelMatchVariables_(electron.pixelMatchVariables_) {
138  //closestCtfTrack_.ctfTrack = closestCtfTrack ;
139  conversionRejection_.partner = conversionPartner;
140  //assert(closestCtfTrack==core->ctfTrack()) ;
141  //assert(electron.core()->ctfGsfOverlap()==core->ctfGsfOverlap()) ;
142  // TO BE DONE
143  // Check that the new edm references are really
144  // the clones of the former references, and therefore other attributes
145  // stay valid :
146  // * electron.core_ ~ core ?
147  // * electron.trackClusterMatching_.electronCluster ~ electronCluster ?
148  // * electron.closestCtfTrack_.ctfTrack ~ closestCtfTrack ?
149  // * electron.ambiguousGsfTracks_ ~ ambiguousTracks ?
150 }
151 
152 bool GsfElectron::overlap(const Candidate& c) const {
153  const RecoCandidate* o = dynamic_cast<const RecoCandidate*>(&c);
154  return (o != nullptr && (checkOverlap(gsfTrack(), o->gsfTrack()) || checkOverlap(superCluster(), o->superCluster())));
155  //?? return false;
156 }
157 
158 GsfElectron* GsfElectron::clone() const { return new GsfElectron(*this); }
159 
161  const CaloClusterPtr& electronCluster,
162  const TrackRef& closestCtfTrack,
163  const TrackBaseRef& conversionPartner,
164  const GsfTrackRefVector& ambiguousTracks) const {
165  return new GsfElectron(*this, core, electronCluster, closestCtfTrack, conversionPartner, ambiguousTracks);
166 }
167 
169 
172 }
173 
174 void GsfElectron::setCorrectedEcalEnergy(float newEnergy) { setCorrectedEcalEnergy(newEnergy, true); }
175 
176 void GsfElectron::setCorrectedEcalEnergy(float newEnergy, bool rescaleDependentValues) {
178  momentum *= newEnergy / momentum.e();
179  setP4(momentum);
180  if (corrections_.correctedEcalEnergy > 0. && rescaleDependentValues) {
181  for (size_t id = 0; id < showerShape_.hcalOverEcal.size(); ++id) {
184  }
187  }
188  corrections_.correctedEcalEnergy = newEnergy;
190 }
191 
193 
194 void GsfElectron::setP4(P4Kind kind, const reco::Candidate::LorentzVector& p4, float error, bool setCandidate) {
195  switch (kind) {
199  break;
200  case P4_COMBINATION:
203  break;
207  break;
208  default:
209  throw cms::Exception("GsfElectron") << "unexpected p4 kind: " << kind;
210  }
211  if (setCandidate) {
212  setP4(p4);
214  }
215 }
216 
218  switch (kind) {
221  case P4_COMBINATION:
222  return corrections_.combinedP4;
224  return corrections_.pflowP4;
225  default:
226  throw cms::Exception("GsfElectron") << "unexpected p4 kind: " << kind;
227  }
228 }
229 
231  switch (kind) {
234  case P4_COMBINATION:
237  return corrections_.pflowP4Error;
238  default:
239  throw cms::Exception("GsfElectron") << "unexpected p4 kind: " << kind;
240  }
241 }
242 
244  auto& ss1 = showerShape_;
245  auto& ss2 = full5x5_showerShape_;
246  auto& iv1 = dr03_;
247  auto& iv2 = dr04_;
248 
249  for (uint id = 2u; id < ss1.hcalOverEcal.size(); ++id) {
250  ss1.hcalOverEcal[1] += ss1.hcalOverEcal[id];
251  ss1.hcalOverEcalBc[1] += ss1.hcalOverEcalBc[id];
252 
253  ss1.hcalOverEcal[id] = 0.f;
254  ss1.hcalOverEcalBc[id] = 0.f;
255 
256  ss2.hcalOverEcal[1] += ss2.hcalOverEcal[id];
257  ss2.hcalOverEcalBc[1] += ss2.hcalOverEcalBc[id];
258 
259  ss2.hcalOverEcal[id] = 0.f;
260  ss2.hcalOverEcalBc[id] = 0.f;
261 
262  iv1.hcalRecHitSumEt[1] += iv1.hcalRecHitSumEt[id];
263  iv1.hcalRecHitSumEtBc[1] += iv1.hcalRecHitSumEtBc[id];
264 
265  iv1.hcalRecHitSumEt[id] = 0.f;
266  iv1.hcalRecHitSumEtBc[id] = 0.f;
267 
268  iv2.hcalRecHitSumEt[1] += iv2.hcalRecHitSumEt[id];
269  iv2.hcalRecHitSumEtBc[1] += iv2.hcalRecHitSumEtBc[id];
270 
271  iv2.hcalRecHitSumEt[id] = 0.f;
272  iv2.hcalRecHitSumEtBc[id] = 0.f;
273  }
274 }
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:220
virtual reco::GsfTrackRef gsfTrack() const
reference to a GsfTrack
std::array< float, 7 > hcalRecHitSumEt
Definition: GsfElectron.h:540
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:194
const edm::EventSetup & c
Vector momentum() const final
spatial momentum vector
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
uint16_t *__restrict__ id
Classification class_
Definition: GsfElectron.h:820
ConversionRejection conversionRejection_
Definition: GsfElectron.h:654
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:230
Corrections corrections_
Definition: GsfElectron.h:912
bool overlap(const Candidate &) const override
check overlap with another candidate
Definition: GsfElectron.cc:152
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:763
GsfElectron * clone() const override
returns a clone of the Candidate object
Definition: GsfElectron.cc:158
const LorentzVector & p4() const final
four-momentum Lorentz vector
void setVertex(const Point &vertex) override
set vertex
void setCharge(Charge q) final
set electric charge
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
std::array< float, 7 > hcalOverEcal
Definition: GsfElectron.h:371
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:170
ShowerShape showerShape_
Definition: GsfElectron.h:504
IsolationVariables dr04_
Definition: GsfElectron.h:620
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:192
GsfElectronCoreRef core_
Definition: GsfElectron.h:187
ShowerShape full5x5_showerShape_
Definition: GsfElectron.h:505
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
std::array< float, 7 > hcalOverEcalBc
Definition: GsfElectron.h:373
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:174
TrackClusterMatching trackClusterMatching_
Definition: GsfElectron.h:245
bool passCutBasedPreselection_
Definition: GsfElectron.h:782
IsolationVariables dr03_
Definition: GsfElectron.h:619
bool ecalDriven() const
Definition: GsfElectron.cc:168
void setPdgId(int pdgId) final
bool passPflowPreselection_
Definition: GsfElectron.h:783
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
bool ecalDrivenSeed() const
Definition: GsfElectron.h:158
void hcalToRun2EffDepth()
Definition: GsfElectron.cc:243