CMS 3D CMS Logo

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 
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();
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();
71  setPdgId(-11 * charge);
73 }
74 
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)
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 }
reco::LeafCandidate::setPdgId
void setPdgId(int pdgId) final
Definition: LeafCandidate.h:178
reco::GsfElectron::trackClusterMatching_
TrackClusterMatching trackClusterMatching_
Definition: GsfElectron.h:253
reco::LeafCandidate::momentum
Vector momentum() const final
spatial momentum vector
Definition: LeafCandidate.h:118
reco::GsfElectron::ClosestCtfTrack
Definition: GsfElectron.h:181
reco::GsfElectron::TrackClusterMatching::electronCluster
CaloClusterPtr electronCluster
Definition: GsfElectron.h:203
reco::GsfElectron::Corrections::combinedP4Error
float combinedP4Error
Definition: GsfElectron.h:843
reco::GsfElectron::gsfTrack
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:164
reco::GsfElectron::Corrections::correctedEcalEnergy
float correctedEcalEnergy
Definition: GsfElectron.h:835
reco::GsfElectron::Corrections::candidateP4Kind
P4Kind candidateP4Kind
Definition: GsfElectron.h:846
reco::GsfElectron::Corrections::pflowP4Error
float pflowP4Error
Definition: GsfElectron.h:845
reco::GsfElectron::ChargeInfo
Definition: GsfElectron.h:123
reco::GsfElectron::corrections_
Corrections corrections_
Definition: GsfElectron.h:899
reco::RecoCandidate::checkOverlap
bool checkOverlap(const R &r1, const R &r2) const
check if two components overlap
Definition: RecoCandidate.h:67
reco::GsfElectron::conversionRejection_
ConversionRejection conversionRejection_
Definition: GsfElectron.h:662
reco::GsfElectron::full5x5_showerShape_
ShowerShape full5x5_showerShape_
Definition: GsfElectron.h:513
BasicCluster.h
reco::GsfElectron::core_
GsfElectronCoreRef core_
Definition: GsfElectron.h:195
math::XYZTLorentzVectorD
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
reco::GsfElectron::P4_COMBINATION
Definition: GsfElectron.h:831
reco::GsfElectron::passCutBasedPreselection_
bool passCutBasedPreselection_
Definition: GsfElectron.h:769
reco::GsfElectron::p4Error
float p4Error(P4Kind kind) const
Definition: GsfElectron.cc:230
reco::GsfElectron::Corrections::correctedEcalEnergyError
float correctedEcalEnergyError
Definition: GsfElectron.h:836
reco::GsfElectron::ShowerShape::hcalOverEcal
std::array< float, 7 > hcalOverEcal
Definition: GsfElectron.h:379
edm::RefVector< GsfTrackCollection >
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
relativeConstraints.error
error
Definition: relativeConstraints.py:53
parallelization.uint
uint
Definition: parallelization.py:124
BasicClusterFwd.h
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
edm::Ref< GsfElectronCoreCollection >
reco::GsfElectron::GsfElectron
GsfElectron()
Definition: GsfElectron.cc:18
reco::GsfElectron::Corrections::combinedP4
LorentzVector combinedP4
Definition: GsfElectron.h:842
reco::GsfElectron::core
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
reco::GsfElectron::setTrackMomentumError
void setTrackMomentumError(float trackMomentumError)
Definition: GsfElectron.cc:192
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
reco::GsfElectron::setP4
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
Definition: GsfElectron.cc:194
reco::GsfElectron::Corrections::fromSuperClusterP4Error
float fromSuperClusterP4Error
Definition: GsfElectron.h:841
reco::GsfElectron::ConversionRejection
Definition: GsfElectron.h:635
reco::GsfElectron::ShowerShape
Definition: GsfElectron.h:366
alignCSCRings.ff
ff
Definition: alignCSCRings.py:148
reco::GsfElectron::ecalDrivenSeed
bool ecalDrivenSeed() const
Definition: GsfElectron.h:166
reco::GsfElectron::FiducialFlags
Definition: GsfElectron.h:317
reco::GsfElectron
Definition: GsfElectron.h:35
reco::GsfElectron::dr04_
IsolationVariables dr04_
Definition: GsfElectron.h:628
reco::GsfElectron::P4_FROM_SUPER_CLUSTER
Definition: GsfElectron.h:831
reco::GsfElectron::hcalToRun2EffDepth
void hcalToRun2EffDepth()
Definition: GsfElectron.cc:243
GsfElectron.h
reco::LeafCandidate::setVertex
void setVertex(const Point &vertex) override
set vertex
Definition: LeafCandidate.h:173
reco::GsfElectron::Corrections::pflowP4
LorentzVector pflowP4
Definition: GsfElectron.h:844
reco::GsfElectron::UNKNOWN
Definition: GsfElectron.h:786
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
reco::GsfElectron::showerShape_
ShowerShape showerShape_
Definition: GsfElectron.h:512
reco::GsfElectron::P4Kind
P4Kind
Definition: GsfElectron.h:831
reco::GsfElectron::setCorrectedEcalEnergyError
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:170
core
Definition: __init__.py:1
reco::GsfElectron::TrackClusterMatching
Definition: GsfElectron.h:202
reco::GsfElectron::TrackClusterMatching::eSuperClusterOverP
float eSuperClusterOverP
Definition: GsfElectron.h:204
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::GsfElectron::clone
GsfElectron * clone() const override
returns a clone of the Candidate object
Definition: GsfElectron.cc:158
reco::GsfElectron::IsolationVariables::hcalRecHitSumEt
std::array< float, 7 > hcalRecHitSumEt
Definition: GsfElectron.h:548
reco::GsfElectron::TrackExtrapolations
Definition: GsfElectron.h:260
reco::GsfElectron::dr03_
IsolationVariables dr03_
Definition: GsfElectron.h:627
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
reco::GsfElectron::passPflowPreselection_
bool passPflowPreselection_
Definition: GsfElectron.h:770
p4
double p4[4]
Definition: TauolaWrapper.h:92
GsfTrack.h
reco::GsfElectron::passingCutBasedPreselection
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:750
reco::GsfElectron::ecalDriven
bool ecalDriven() const
Definition: GsfElectron.cc:168
reco::LeafCandidate::charge
int charge() const final
electric charge
Definition: LeafCandidate.h:106
reco::GsfElectron::class_
Classification class_
Definition: GsfElectron.h:807
reco::RecoCandidate
Definition: RecoCandidate.h:20
reco::GsfElectron::closestCtfTrack
virtual ClosestCtfTrack closestCtfTrack() const
Definition: GsfElectron.h:189
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
CalibrationSummaryClient_cfi.kind
kind
Definition: CalibrationSummaryClient_cfi.py:37
edm::Ptr< CaloCluster >
reco::Candidate
Definition: Candidate.h:27
reco::GsfElectron::electronCluster
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:228
reco::GsfElectron::Corrections::trackMomentumError
float trackMomentumError
Definition: GsfElectron.h:838
reco::GsfElectron::ConversionRejection::partner
TrackBaseRef partner
Definition: GsfElectron.h:637
reco::GsfElectron::P4_PFLOW_COMBINATION
Definition: GsfElectron.h:831
reco::GsfElectron::overlap
bool overlap(const Candidate &) const override
check overlap with another candidate
Definition: GsfElectron.cc:152
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
reco::GsfElectron::Corrections::fromSuperClusterP4
LorentzVector fromSuperClusterP4
Definition: GsfElectron.h:840
Exception
Definition: hltDiff.cc:245
reco::LeafCandidate::setCharge
void setCharge(Charge q) final
set electric charge
Definition: LeafCandidate.h:108
reco::GsfElectron::init
void init()
Definition: GsfElectron.cc:10
edm::RefToBase< reco::Track >
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:163
reco::GsfElectron::ShowerShape::hcalOverEcalBc
std::array< float, 7 > hcalOverEcalBc
Definition: GsfElectron.h:381
reco::GsfElectron::setCorrectedEcalEnergy
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:174
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
reco::GsfElectron::Corrections::isEcalEnergyCorrected
bool isEcalEnergyCorrected
Definition: GsfElectron.h:834
reco::GsfElectron::SaturationInfo
Definition: GsfElectron.h:520
reco::GsfElectron::passMvaPreslection_
bool passMvaPreslection_
Definition: GsfElectron.h:771
reco::GsfElectron::ambiguous_
bool ambiguous_
Definition: GsfElectron.h:772
reco::GsfElectron::TrackExtrapolations::positionAtVtx
math::XYZPointF positionAtVtx
Definition: GsfElectron.h:261