CMS 3D CMS Logo

GsfElectronAlgo.cc
Go to the documentation of this file.
30 
31 #include <Math/Point3D.h>
32 #include <sstream>
33 #include <algorithm>
34 
35 using namespace edm;
36 using namespace reco;
37 
39  // soft electron MVA
41  sconfig.vweightsfiles = conf.getParameter<std::vector<std::string>>("SoftElecMVAFilesString");
42  sElectronMVAEstimator.reset(new SoftElectronMVAEstimator(sconfig));
43  // isolated electron MVA
45  iconfig.vweightsfiles = conf.getParameter<std::vector<std::string>>("ElecMVAFilesString");
46  iElectronMVAEstimator.reset(new ElectronMVAEstimator(iconfig));
47 }
48 
49 //===================================================================
50 // GsfElectronAlgo::EventData
51 //===================================================================
52 
54  // utilities
55  void retreiveOriginalTrackCollections(const reco::TrackRef&, const reco::GsfTrackRef&);
56 
57  // general
58  edm::Event const* event;
60 
61  // input collections
72 
73  // isolation helpers
80 
81  //Isolation Value Maps for PF and EcalDriven electrons
82  typedef std::vector<edm::Handle<edm::ValueMap<double>>> IsolationValueMaps;
83  IsolationValueMaps pfIsolationValues;
84  IsolationValueMaps edIsolationValues;
85 
88 
89  bool originalCtfTrackCollectionRetreived = false;
90  bool originalGsfTrackCollectionRetreived = false;
91 };
92 
93 //===================================================================
94 // GsfElectronAlgo::ElectronData
95 //===================================================================
96 
98  // Refs to subproducts
105 
106  // constructors
108 
109  // utilities
110  void computeCharge(int& charge, reco::GsfElectron::ChargeInfo& info);
111  reco::CaloClusterPtr getEleBasicCluster(MultiTrajectoryStateTransform const&);
112  bool calculateTSOS(MultiTrajectoryStateTransform const&, GsfConstraintAtVertex const&);
113  void calculateMode();
114  reco::Candidate::LorentzVector calculateMomentum();
115 
116  // TSOS
124 
125  // mode
126  GlobalVector innMom, seedMom, eleMom, sclMom, vtxMom, outMom;
127  GlobalPoint innPos, seedPos, elePos, sclPos, vtxPos, outPos;
129 };
130 
132  const reco::GsfTrackRef& gsfTrack) {
133  if ((!originalCtfTrackCollectionRetreived) && (ctfTrack.isNonnull())) {
134  event->get(ctfTrack.id(), originalCtfTracks);
135  originalCtfTrackCollectionRetreived = true;
136  }
137  if ((!originalGsfTrackCollectionRetreived) && (gsfTrack.isNonnull())) {
138  event->get(gsfTrack.id(), originalGsfTracks);
139  originalGsfTrackCollectionRetreived = true;
140  }
141 }
142 
144  : coreRef(core),
145  gsfTrackRef(coreRef->gsfTrack()),
146  superClusterRef(coreRef->superCluster()),
147  ctfTrackRef(coreRef->ctfTrack()),
148  shFracInnerHits(coreRef->ctfGsfOverlap()),
149  beamSpot(bs) {}
150 
152  // determine charge from SC
153  GlobalPoint orig, scpos;
154  ele_convert(beamSpot.position(), orig);
155  ele_convert(superClusterRef->position(), scpos);
156  GlobalVector scvect(scpos - orig);
157  GlobalPoint inntkpos = innTSOS.globalPosition();
158  GlobalVector inntkvect = GlobalVector(inntkpos - orig);
159  float dPhiInnEle = normalizedPhi(scvect.barePhi() - inntkvect.barePhi());
160  if (dPhiInnEle > 0)
161  info.scPixCharge = -1;
162  else
163  info.scPixCharge = 1;
164 
165  // flags
166  int chargeGsf = gsfTrackRef->charge();
167  info.isGsfScPixConsistent = ((chargeGsf * info.scPixCharge) > 0);
168  info.isGsfCtfConsistent = (ctfTrackRef.isNonnull() && ((chargeGsf * ctfTrackRef->charge()) > 0));
170 
171  // default charge
172  if (info.isGsfScPixConsistent || ctfTrackRef.isNull()) {
173  charge = info.scPixCharge;
174  } else {
175  charge = ctfTrackRef->charge();
176  }
177 }
178 
180  CaloClusterPtr eleRef;
181  TrajectoryStateOnSurface tempTSOS;
183  float dphimin = 1.e30;
184  for (auto const& bc : superClusterRef->clusters()) {
185  GlobalPoint posclu(bc->position().x(), bc->position().y(), bc->position().z());
186  tempTSOS = mtsTransform.extrapolatedState(outTSOS, posclu);
187  if (!tempTSOS.isValid())
188  tempTSOS = outTSOS;
189  GlobalPoint extrap = tempTSOS.globalPosition();
190  float dphi = EleRelPointPair(posclu, extrap, beamSpot.position()).dPhi();
191  if (std::abs(dphi) < dphimin) {
192  dphimin = std::abs(dphi);
193  eleRef = bc;
194  eleTSOS = tempTSOS;
195  }
196  }
197  return eleRef;
198 }
199 
201  GsfConstraintAtVertex const& constraintAtVtx) {
202  //at innermost point
203  innTSOS = mtsTransform.innerStateOnSurface(*gsfTrackRef);
204  if (!innTSOS.isValid())
205  return false;
206 
207  //at vertex
208  // innermost state propagation to the beam spot position
211  vtxTSOS = mtsTransform.extrapolatedState(innTSOS, bsPos);
212  if (!vtxTSOS.isValid())
213  vtxTSOS = innTSOS;
214 
215  //at seed
216  outTSOS = mtsTransform.outerStateOnSurface(*gsfTrackRef);
217  if (!outTSOS.isValid())
218  return false;
219 
220  // TrajectoryStateOnSurface seedTSOS
221  seedTSOS = mtsTransform.extrapolatedState(outTSOS,
222  GlobalPoint(superClusterRef->seed()->position().x(),
223  superClusterRef->seed()->position().y(),
224  superClusterRef->seed()->position().z()));
225  if (!seedTSOS.isValid())
226  seedTSOS = outTSOS;
227 
228  // at scl
229  sclTSOS = mtsTransform.extrapolatedState(
231  if (!sclTSOS.isValid())
232  sclTSOS = outTSOS;
233 
234  // constrained momentum
236 
237  return true;
238 }
239 
254 }
255 
257  double scale = superClusterRef->energy() / vtxMom.mag();
259  vtxMom.x() * scale, vtxMom.y() * scale, vtxMom.z() * scale, superClusterRef->energy());
260 }
261 
263  EventData const& eventData) const {
265 
266  const reco::CaloCluster& seedCluster = *(theClus->seed());
267  DetId seedXtalId = seedCluster.seed();
268  int detector = seedXtalId.subdetId();
269  const EcalRecHitCollection* ecalRecHits = nullptr;
270  if (detector == EcalBarrel)
271  ecalRecHits = eventData.barrelRecHits.product();
272  else
273  ecalRecHits = eventData.endcapRecHits.product();
274 
275  int nSaturatedXtals = 0;
276  bool isSeedSaturated = false;
277  for (auto&& hitFractionPair : theClus->hitsAndFractions()) {
278  auto&& ecalRecHit = ecalRecHits->find(hitFractionPair.first);
279  if (ecalRecHit == ecalRecHits->end())
280  continue;
281  if (ecalRecHit->checkFlag(EcalRecHit::Flags::kSaturated)) {
282  nSaturatedXtals++;
283  if (seedXtalId == ecalRecHit->detid())
284  isSeedSaturated = true;
285  }
286  }
287  si.nSaturatedXtals = nSaturatedXtals;
288  si.isSeedSaturated = isSeedSaturated;
289 
290  return si;
291 }
292 
293 template <bool full5x5>
295  ElectronHcalHelper const& hcalHelper,
296  EventData const& eventData,
297  CaloTopology const& topology,
298  CaloGeometry const& geometry) const {
299  using ClusterTools = EcalClusterToolsT<full5x5>;
300  reco::GsfElectron::ShowerShape showerShape;
301 
302  const reco::CaloCluster& seedCluster = *(theClus->seed());
303  // temporary, till CaloCluster->seed() is made available
304  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first;
305  int detector = seedXtalId.subdetId();
306 
307  const EcalRecHitCollection* recHits = nullptr;
308  std::vector<int> recHitFlagsToBeExcluded;
309  std::vector<int> recHitSeverityToBeExcluded;
310  if (detector == EcalBarrel) {
311  recHits = eventData.barrelRecHits.product();
312  recHitFlagsToBeExcluded = cfg_.recHits.recHitFlagsToBeExcludedBarrel;
313  recHitSeverityToBeExcluded = cfg_.recHits.recHitSeverityToBeExcludedBarrel;
314  } else {
315  recHits = eventData.endcapRecHits.product();
316  recHitFlagsToBeExcluded = cfg_.recHits.recHitFlagsToBeExcludedEndcaps;
317  recHitSeverityToBeExcluded = cfg_.recHits.recHitSeverityToBeExcludedEndcaps;
318  }
319 
320  std::vector<float> covariances = ClusterTools::covariances(seedCluster, recHits, &topology, &geometry);
321  std::vector<float> localCovariances = ClusterTools::localCovariances(seedCluster, recHits, &topology);
322  showerShape.sigmaEtaEta = sqrt(covariances[0]);
323  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]);
324  if (!edm::isNotFinite(localCovariances[2]))
325  showerShape.sigmaIphiIphi = sqrt(localCovariances[2]);
326  showerShape.e1x5 = ClusterTools::e1x5(seedCluster, recHits, &topology);
327  showerShape.e2x5Max = ClusterTools::e2x5Max(seedCluster, recHits, &topology);
328  showerShape.e5x5 = ClusterTools::e5x5(seedCluster, recHits, &topology);
329  showerShape.r9 = ClusterTools::e3x3(seedCluster, recHits, &topology) / theClus->rawEnergy();
330 
331  const float scale = full5x5 ? showerShape.e5x5 : theClus->energy();
332 
333  showerShape.hcalDepth1OverEcal = hcalHelper.hcalESumDepth1(*theClus) / theClus->energy();
334  showerShape.hcalDepth2OverEcal = hcalHelper.hcalESumDepth2(*theClus) / theClus->energy();
335  showerShape.hcalTowersBehindClusters = hcalHelper.hcalTowersBehindClusters(*theClus);
336  showerShape.hcalDepth1OverEcalBc =
338  showerShape.hcalDepth2OverEcalBc =
340  showerShape.invalidHcal = (showerShape.hcalDepth1OverEcalBc == 0 && showerShape.hcalDepth2OverEcalBc == 0 &&
341  !hcalHelper.hasActiveHcal(*theClus));
342 
343  // extra shower shapes
344  const float see_by_spp = showerShape.sigmaIetaIeta * showerShape.sigmaIphiIphi;
345  if (see_by_spp > 0) {
346  showerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp;
347  } else if (localCovariances[1] > 0) {
348  showerShape.sigmaIetaIphi = 1.f;
349  } else {
350  showerShape.sigmaIetaIphi = -1.f;
351  }
352  showerShape.eMax = ClusterTools::eMax(seedCluster, recHits);
353  showerShape.e2nd = ClusterTools::e2nd(seedCluster, recHits);
354  showerShape.eTop = ClusterTools::eTop(seedCluster, recHits, &topology);
355  showerShape.eLeft = ClusterTools::eLeft(seedCluster, recHits, &topology);
356  showerShape.eRight = ClusterTools::eRight(seedCluster, recHits, &topology);
357  showerShape.eBottom = ClusterTools::eBottom(seedCluster, recHits, &topology);
358 
359  showerShape.e2x5Left = ClusterTools::e2x5Left(seedCluster, recHits, &topology);
360  showerShape.e2x5Right = ClusterTools::e2x5Right(seedCluster, recHits, &topology);
361  showerShape.e2x5Top = ClusterTools::e2x5Top(seedCluster, recHits, &topology);
362  showerShape.e2x5Bottom = ClusterTools::e2x5Bottom(seedCluster, recHits, &topology);
363 
364  return showerShape;
365 }
366 
367 //===================================================================
368 // GsfElectronAlgo
369 //===================================================================
370 
372  const StrategyConfiguration& strategy,
373  const CutsConfiguration& cuts,
374  const CutsConfiguration& cutsPflow,
376  const ElectronHcalHelper::Configuration& hcalPflow,
377  const IsolationConfiguration& iso,
379  std::unique_ptr<EcalClusterFunctionBaseClass>&& superClusterErrorFunction,
380  std::unique_ptr<EcalClusterFunctionBaseClass>&& crackCorrectionFunction,
382  const edm::ParameterSet& tkIsol03,
383  const edm::ParameterSet& tkIsol04,
384  const edm::ParameterSet& tkIsolHEEP03,
385  const edm::ParameterSet& tkIsolHEEP04,
387  : cfg_{input, strategy, cuts, cutsPflow, iso, recHits},
388  tkIsol03Calc_(tkIsol03),
389  tkIsol04Calc_(tkIsol04),
390  tkIsolHEEP03Calc_(tkIsolHEEP03),
391  tkIsolHEEP04Calc_(tkIsolHEEP04),
397  hcalHelper_{hcal},
398  hcalHelperPflow_{hcalPflow},
400  std::forward<std::unique_ptr<EcalClusterFunctionBaseClass>>(superClusterErrorFunction)},
401  crackCorrectionFunction_{std::forward<std::unique_ptr<EcalClusterFunctionBaseClass>>(crackCorrectionFunction)},
402  regHelper_{reg}
403 
404 {}
405 
411 
413  superClusterErrorFunction_->init(es);
414  }
416  crackCorrectionFunction_->init(es);
417  }
418 }
419 
421  CaloGeometry const& caloGeometry,
422  EcalSeverityLevelAlgo const& ecalSeveretyLevelAlgo) {
423  // prepare access to hcal data
424  hcalHelper_.readEvent(event);
426 
427  auto const& towers = event.get(cfg_.tokens.hcalTowersTag);
428 
429  // Isolation algos
430  float egHcalIsoConeSizeOutSmall = 0.3, egHcalIsoConeSizeOutLarge = 0.4;
431  float egHcalIsoConeSizeIn = cfg_.iso.intRadiusHcal, egHcalIsoPtMin = cfg_.iso.etMinHcal;
432  int egHcalDepth1 = 1, egHcalDepth2 = 2;
433 
434  float egIsoConeSizeOutSmall = 0.3, egIsoConeSizeOutLarge = 0.4, egIsoJurassicWidth = cfg_.iso.jurassicWidth;
435  float egIsoPtMinBarrel = cfg_.iso.etMinBarrel, egIsoEMinBarrel = cfg_.iso.eMinBarrel,
436  egIsoConeSizeInBarrel = cfg_.iso.intRadiusEcalBarrel;
437  float egIsoPtMinEndcap = cfg_.iso.etMinEndcaps, egIsoEMinEndcap = cfg_.iso.eMinEndcaps,
438  egIsoConeSizeInEndcap = cfg_.iso.intRadiusEcalEndcaps;
439 
440  auto barrelRecHits = event.getHandle(cfg_.tokens.barrelRecHitCollection);
441  auto endcapRecHits = event.getHandle(cfg_.tokens.endcapRecHitCollection);
442 
443  EventData eventData{
444  .event = &event,
445  .beamspot = &event.get(cfg_.tokens.beamSpotTag),
446  .previousElectrons = event.getHandle(cfg_.tokens.previousGsfElectrons),
447  .pflowElectrons = event.getHandle(cfg_.tokens.pflowGsfElectronsTag),
448  .coreElectrons = event.getHandle(cfg_.tokens.gsfElectronCores),
449  .barrelRecHits = barrelRecHits,
450  .endcapRecHits = endcapRecHits,
451  .currentCtfTracks = event.getHandle(cfg_.tokens.ctfTracks),
452  .seeds = event.getHandle(cfg_.tokens.seedsTag),
453  .gsfPfRecTracks = cfg_.strategy.useGsfPfRecTracks ? event.getHandle(cfg_.tokens.gsfPfRecTracksTag)
455  .vertices = event.getHandle(cfg_.tokens.vtxCollectionTag),
456  .conversions = cfg_.strategy.fillConvVtxFitProb ? event.getHandle(cfg_.tokens.conversions)
458  .hadDepth1Isolation03 =
459  EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth1, &towers),
460  .hadDepth1Isolation04 =
461  EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth1, &towers),
462  .hadDepth2Isolation03 =
463  EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth2, &towers),
464  .hadDepth2Isolation04 =
465  EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth2, &towers),
466  .hadDepth1Isolation03Bc =
467  EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, 0., egHcalIsoPtMin, egHcalDepth1, &towers),
468  .hadDepth1Isolation04Bc =
469  EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, 0., egHcalIsoPtMin, egHcalDepth1, &towers),
470  .hadDepth2Isolation03Bc =
471  EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, 0., egHcalIsoPtMin, egHcalDepth2, &towers),
472  .hadDepth2Isolation04Bc =
473  EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, 0., egHcalIsoPtMin, egHcalDepth2, &towers),
474  .ecalBarrelIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall,
475  egIsoConeSizeInBarrel,
476  egIsoJurassicWidth,
477  egIsoPtMinBarrel,
478  egIsoEMinBarrel,
479  &caloGeometry,
480  *barrelRecHits,
481  &ecalSeveretyLevelAlgo,
482  DetId::Ecal),
483  .ecalBarrelIsol04 = EgammaRecHitIsolation(egIsoConeSizeOutLarge,
484  egIsoConeSizeInBarrel,
485  egIsoJurassicWidth,
486  egIsoPtMinBarrel,
487  egIsoEMinBarrel,
488  &caloGeometry,
489  *barrelRecHits,
490  &ecalSeveretyLevelAlgo,
491  DetId::Ecal),
492  .ecalEndcapIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall,
493  egIsoConeSizeInEndcap,
494  egIsoJurassicWidth,
495  egIsoPtMinEndcap,
496  egIsoEMinEndcap,
497  &caloGeometry,
498  *endcapRecHits,
499  &ecalSeveretyLevelAlgo,
500  DetId::Ecal),
501  .ecalEndcapIsol04 = EgammaRecHitIsolation(egIsoConeSizeOutLarge,
502  egIsoConeSizeInEndcap,
503  egIsoJurassicWidth,
504  egIsoPtMinEndcap,
505  egIsoEMinEndcap,
506  &caloGeometry,
507  *endcapRecHits,
508  &ecalSeveretyLevelAlgo,
509  DetId::Ecal),
510  .pfIsolationValues = {},
511  .edIsolationValues = {},
512  .originalCtfTracks = {},
513  .originalGsfTracks = {}};
514 
515  eventData.ecalBarrelIsol03.setUseNumCrystals(cfg_.iso.useNumCrystals);
516  eventData.ecalBarrelIsol03.setVetoClustered(cfg_.iso.vetoClustered);
517  eventData.ecalBarrelIsol03.doSeverityChecks(eventData.barrelRecHits.product(),
519  eventData.ecalBarrelIsol03.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedBarrel);
520  eventData.ecalBarrelIsol04.setUseNumCrystals(cfg_.iso.useNumCrystals);
521  eventData.ecalBarrelIsol04.setVetoClustered(cfg_.iso.vetoClustered);
522  eventData.ecalBarrelIsol04.doSeverityChecks(eventData.barrelRecHits.product(),
524  eventData.ecalBarrelIsol04.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedBarrel);
525  eventData.ecalEndcapIsol03.setUseNumCrystals(cfg_.iso.useNumCrystals);
526  eventData.ecalEndcapIsol03.setVetoClustered(cfg_.iso.vetoClustered);
527  eventData.ecalEndcapIsol03.doSeverityChecks(eventData.endcapRecHits.product(),
529  eventData.ecalEndcapIsol03.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedEndcaps);
530  eventData.ecalEndcapIsol04.setUseNumCrystals(cfg_.iso.useNumCrystals);
531  eventData.ecalEndcapIsol04.setVetoClustered(cfg_.iso.vetoClustered);
532  eventData.ecalEndcapIsol04.doSeverityChecks(eventData.endcapRecHits.product(),
534  eventData.ecalEndcapIsol04.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedEndcaps);
535 
536  return eventData;
537 }
538 
540  edm::Event const& event,
541  edm::EventSetup const& eventSetup,
543  auto const& magneticField = eventSetup.getData(magneticFieldToken_);
544  auto const& caloGeometry = eventSetup.getData(caloGeometryToken_);
545  auto const& caloTopology = eventSetup.getData(caloTopologyToken_);
546  auto const& trackerGeometry = eventSetup.getData(trackerGeometryToken_);
547  auto const& ecalSeveretyLevelAlgo = eventSetup.getData(ecalSeveretyLevelAlgoToken_);
548 
549  checkSetup(eventSetup);
550  auto eventData = beginEvent(event, caloGeometry, ecalSeveretyLevelAlgo);
551  double magneticFieldInTesla = magneticField.inTesla(GlobalPoint(0., 0., 0.)).z();
552 
553  MultiTrajectoryStateTransform mtsTransform(&trackerGeometry, &magneticField);
554  GsfConstraintAtVertex constraintAtVtx(eventSetup);
555 
556  const GsfElectronCoreCollection* coreCollection = eventData.coreElectrons.product();
557  for (unsigned int i = 0; i < coreCollection->size(); ++i) {
558  // check there is no existing electron with this core
559  const GsfElectronCoreRef coreRef = edm::Ref<GsfElectronCoreCollection>(eventData.coreElectrons, i);
560  bool coreFound = false;
561  for (auto const& ele : electrons) {
562  if (ele.core() == coreRef) {
563  coreFound = true;
564  break;
565  }
566  }
567  if (coreFound)
568  continue;
569 
570  // check there is a super-cluster
571  if (coreRef->superCluster().isNull())
572  continue;
573 
574  // prepare internal structure for electron specific data
575  ElectronData electronData(coreRef, *eventData.beamspot);
576 
577  // calculate and check Trajectory StatesOnSurface....
578  if (!electronData.calculateTSOS(mtsTransform, constraintAtVtx))
579  continue;
580 
582  electrons, electronData, eventData, caloTopology, caloGeometry, mtsTransform, magneticFieldInTesla, hoc);
583 
584  } // loop over tracks
585 }
586 
588  // default value
589  ele.setPassCutBasedPreselection(false);
590 
591  // kind of seeding
592  bool eg = ele.core()->ecalDrivenSeed();
593  bool pf = ele.core()->trackerDrivenSeed() && !ele.core()->ecalDrivenSeed();
594  bool gedMode = cfg_.strategy.gedElectronMode;
595  if (eg && pf) {
596  throw cms::Exception("GsfElectronAlgo|BothEcalAndPureTrackerDriven")
597  << "An electron cannot be both egamma and purely pflow";
598  }
599  if ((!eg) && (!pf)) {
600  throw cms::Exception("GsfElectronAlgo|NeitherEcalNorPureTrackerDriven")
601  << "An electron cannot be neither egamma nor purely pflow";
602  }
603 
604  const CutsConfiguration* cfg = ((eg || gedMode) ? &cfg_.cuts : &cfg_.cutsPflow);
605 
606  // Et cut
607  double etaValue = EleRelPoint(ele.superCluster()->position(), bs.position()).eta();
608  double etValue = ele.superCluster()->energy() / cosh(etaValue);
609  LogTrace("GsfElectronAlgo") << "Et : " << etValue;
610  if (ele.isEB() && (etValue < cfg->minSCEtBarrel))
611  return;
612  if (ele.isEE() && (etValue < cfg->minSCEtEndcaps))
613  return;
614  LogTrace("GsfElectronAlgo") << "Et criteria are satisfied";
615 
616  // E/p cut
617  double eopValue = ele.eSuperClusterOverP();
618  LogTrace("GsfElectronAlgo") << "E/p : " << eopValue;
619  if (ele.isEB() && (eopValue > cfg->maxEOverPBarrel))
620  return;
621  if (ele.isEE() && (eopValue > cfg->maxEOverPEndcaps))
622  return;
623  if (ele.isEB() && (eopValue < cfg->minEOverPBarrel))
624  return;
625  if (ele.isEE() && (eopValue < cfg->minEOverPEndcaps))
626  return;
627  LogTrace("GsfElectronAlgo") << "E/p criteria are satisfied";
628 
629  // HoE cuts
630  LogTrace("GsfElectronAlgo") << "HoE1 : " << ele.hcalDepth1OverEcal() << ", HoE2 : " << ele.hcalDepth2OverEcal();
631  double hoeCone = ele.hcalOverEcal();
632  double hoeTower = ele.hcalOverEcalBc();
633  const reco::CaloCluster& seedCluster = *(ele.superCluster()->seed());
634  int detector = seedCluster.hitsAndFractions()[0].first.subdetId();
635  bool HoEveto = false;
636  double scle = ele.superCluster()->energy();
637 
638  if (detector == EcalBarrel)
639  HoEveto = hoeCone * scle < cfg->maxHBarrelCone || hoeTower * scle < cfg->maxHBarrelTower ||
640  hoeCone < cfg->maxHOverEBarrelCone || hoeTower < cfg->maxHOverEBarrelTower;
641  else if (detector == EcalEndcap)
642  HoEveto = hoeCone * scle < cfg->maxHEndcapsCone || hoeTower * scle < cfg->maxHEndcapsTower ||
643  hoeCone < cfg->maxHOverEEndcapsCone || hoeTower < cfg->maxHOverEEndcapsTower;
644 
645  if (!HoEveto)
646  return;
647  LogTrace("GsfElectronAlgo") << "H/E criteria are satisfied";
648 
649  // delta eta criteria
650  double deta = ele.deltaEtaSuperClusterTrackAtVtx();
651  LogTrace("GsfElectronAlgo") << "delta eta : " << deta;
652  if (ele.isEB() && (std::abs(deta) > cfg->maxDeltaEtaBarrel))
653  return;
654  if (ele.isEE() && (std::abs(deta) > cfg->maxDeltaEtaEndcaps))
655  return;
656  LogTrace("GsfElectronAlgo") << "Delta eta criteria are satisfied";
657 
658  // delta phi criteria
659  double dphi = ele.deltaPhiSuperClusterTrackAtVtx();
660  LogTrace("GsfElectronAlgo") << "delta phi : " << dphi;
661  if (ele.isEB() && (std::abs(dphi) > cfg->maxDeltaPhiBarrel))
662  return;
663  if (ele.isEE() && (std::abs(dphi) > cfg->maxDeltaPhiEndcaps))
664  return;
665  LogTrace("GsfElectronAlgo") << "Delta phi criteria are satisfied";
666 
667  // sigma ieta ieta
668  LogTrace("GsfElectronAlgo") << "sigma ieta ieta : " << ele.sigmaIetaIeta();
669  if (ele.isEB() && (ele.sigmaIetaIeta() > cfg->maxSigmaIetaIetaBarrel))
670  return;
671  if (ele.isEE() && (ele.sigmaIetaIeta() > cfg->maxSigmaIetaIetaEndcaps))
672  return;
673  LogTrace("GsfElectronAlgo") << "Sigma ieta ieta criteria are satisfied";
674 
675  // fiducial
676  if (!ele.isEB() && cfg->isBarrel)
677  return;
678  if (!ele.isEE() && cfg->isEndcaps)
679  return;
680  if (cfg->isFiducial &&
681  (ele.isEBEEGap() || ele.isEBEtaGap() || ele.isEBPhiGap() || ele.isEERingGap() || ele.isEEDeeGap()))
682  return;
683  LogTrace("GsfElectronAlgo") << "Fiducial flags criteria are satisfied";
684 
685  // seed in TEC
686  edm::RefToBase<TrajectorySeed> seed = ele.gsfTrack()->extra()->seedRef();
687  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
688  if (eg && !cfg_.cuts.seedFromTEC) {
689  if (elseed.isNull()) {
690  throw cms::Exception("GsfElectronAlgo|NotElectronSeed") << "The GsfTrack seed is not an ElectronSeed ?!";
691  } else {
692  if (elseed->subDet(1) == 6)
693  return;
694  }
695  }
696 
697  // transverse impact parameter
698  if (std::abs(ele.gsfTrack()->dxy(bs.position())) > cfg->maxTIP)
699  return;
700  LogTrace("GsfElectronAlgo") << "TIP criterion is satisfied";
701 
702  LogTrace("GsfElectronAlgo") << "All cut based criteria are satisfied";
703  ele.setPassCutBasedPreselection(true);
704 }
705 
707  ElectronData& electronData,
708  EventData& eventData,
709  CaloTopology const& topology,
710  CaloGeometry const& geometry,
711  MultiTrajectoryStateTransform const& mtsTransform,
712  double magneticFieldInTesla,
714  // eventually check ctf track
715  if (cfg_.strategy.ctfTracksCheck && electronData.ctfTrackRef.isNull()) {
716  electronData.ctfTrackRef = egamma::getClosestCtfToGsf(electronData.gsfTrackRef, eventData.currentCtfTracks).first;
717  }
718 
719  // charge ID
720  int eleCharge;
721  GsfElectron::ChargeInfo eleChargeInfo;
722  electronData.computeCharge(eleCharge, eleChargeInfo);
723 
724  // electron basic cluster
725  CaloClusterPtr elbcRef = electronData.getEleBasicCluster(mtsTransform);
726 
727  // Seed cluster
728  const reco::CaloCluster& seedCluster = *(electronData.superClusterRef->seed());
729 
730  // seed Xtal
731  // temporary, till CaloCluster->seed() is made available
732  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first;
733 
734  electronData.calculateMode();
735 
736  //====================================================
737  // Candidate attributes
738  //====================================================
739 
740  Candidate::LorentzVector momentum = electronData.calculateMomentum();
741 
742  //====================================================
743  // Track-Cluster Matching
744  //====================================================
745 
747  tcMatching.electronCluster = elbcRef;
748  tcMatching.eSuperClusterOverP =
749  (electronData.vtxMom.mag() > 0) ? (electronData.superClusterRef->energy() / electronData.vtxMom.mag()) : (-1.);
750  tcMatching.eSeedClusterOverP =
751  (electronData.vtxMom.mag() > 0.) ? (seedCluster.energy() / electronData.vtxMom.mag()) : (-1);
752  tcMatching.eSeedClusterOverPout =
753  (electronData.seedMom.mag() > 0.) ? (seedCluster.energy() / electronData.seedMom.mag()) : (-1.);
754  tcMatching.eEleClusterOverPout =
755  (electronData.eleMom.mag() > 0.) ? (elbcRef->energy() / electronData.eleMom.mag()) : (-1.);
756 
757  EleRelPointPair scAtVtx(
758  electronData.superClusterRef->position(), electronData.sclPos, eventData.beamspot->position());
759  tcMatching.deltaEtaSuperClusterAtVtx = scAtVtx.dEta();
760  tcMatching.deltaPhiSuperClusterAtVtx = scAtVtx.dPhi();
761 
762  EleRelPointPair seedAtCalo(seedCluster.position(), electronData.seedPos, eventData.beamspot->position());
763  tcMatching.deltaEtaSeedClusterAtCalo = seedAtCalo.dEta();
764  tcMatching.deltaPhiSeedClusterAtCalo = seedAtCalo.dPhi();
765 
766  EleRelPointPair ecAtCalo(elbcRef->position(), electronData.elePos, eventData.beamspot->position());
767  tcMatching.deltaEtaEleClusterAtCalo = ecAtCalo.dEta();
768  tcMatching.deltaPhiEleClusterAtCalo = ecAtCalo.dPhi();
769 
770  //=======================================================
771  // Track extrapolations
772  //=======================================================
773 
775  ele_convert(electronData.vtxPos, tkExtra.positionAtVtx);
776  ele_convert(electronData.sclPos, tkExtra.positionAtCalo);
777  ele_convert(electronData.vtxMom, tkExtra.momentumAtVtx);
778  ele_convert(electronData.sclMom, tkExtra.momentumAtCalo);
779  ele_convert(electronData.seedMom, tkExtra.momentumOut);
780  ele_convert(electronData.eleMom, tkExtra.momentumAtEleClus);
782 
783  //=======================================================
784  // Closest Ctf Track
785  //=======================================================
786 
788  ctfInfo.ctfTrack = electronData.ctfTrackRef;
789  ctfInfo.shFracInnerHits = electronData.shFracInnerHits;
790 
791  //====================================================
792  // FiducialFlags, using nextToBoundary definition of gaps
793  //====================================================
794 
795  reco::GsfElectron::FiducialFlags fiducialFlags;
796  int region = seedXtalId.det();
797  int detector = seedXtalId.subdetId();
798  double feta = std::abs(electronData.superClusterRef->position().eta());
799  if (detector == EcalBarrel) {
800  fiducialFlags.isEB = true;
801  EBDetId ebdetid(seedXtalId);
802  if (EBDetId::isNextToEtaBoundary(ebdetid)) {
803  if (ebdetid.ietaAbs() == 85) {
804  fiducialFlags.isEBEEGap = true;
805  } else {
806  fiducialFlags.isEBEtaGap = true;
807  }
808  }
809  if (EBDetId::isNextToPhiBoundary(ebdetid)) {
810  fiducialFlags.isEBPhiGap = true;
811  }
812  } else if (detector == EcalEndcap) {
813  fiducialFlags.isEE = true;
814  EEDetId eedetid(seedXtalId);
815  if (EEDetId::isNextToRingBoundary(eedetid)) {
816  if (std::abs(feta) < 2.) {
817  fiducialFlags.isEBEEGap = true;
818  } else {
819  fiducialFlags.isEERingGap = true;
820  }
821  }
822  if (EEDetId::isNextToDBoundary(eedetid)) {
823  fiducialFlags.isEEDeeGap = true;
824  }
825  } else if (EcalTools::isHGCalDet((DetId::Detector)region)) {
826  fiducialFlags.isEE = true;
827  //HGCalDetId eeDetid(seedXtalId);
828  // fill in fiducial information when we know how to use it...
829  } else {
830  throw cms::Exception("GsfElectronAlgo|UnknownXtalRegion")
831  << "createElectron(): do not know if it is a barrel or endcap seed cluster !!!!";
832  }
833 
834  //====================================================
835  // SaturationInfo
836  //====================================================
837 
838  auto saturationInfo = calculateSaturationInfo(electronData.superClusterRef, eventData);
839 
840  //====================================================
841  // ShowerShape
842  //====================================================
843 
844  reco::GsfElectron::ShowerShape showerShape;
845  reco::GsfElectron::ShowerShape full5x5_showerShape;
846  if (!EcalTools::isHGCalDet((DetId::Detector)region)) {
847  const bool pflow = !(electronData.coreRef->ecalDrivenSeed());
848  auto const& hcalHelper = pflow ? hcalHelperPflow_ : hcalHelper_;
849  showerShape = calculateShowerShape<false>(electronData.superClusterRef, hcalHelper, eventData, topology, geometry);
850  full5x5_showerShape =
851  calculateShowerShape<true>(electronData.superClusterRef, hcalHelper, eventData, topology, geometry);
852  }
853 
854  //====================================================
855  // ConversionRejection
856  //====================================================
857 
858  eventData.retreiveOriginalTrackCollections(electronData.ctfTrackRef, electronData.coreRef->gsfTrack());
859 
861  if (!ctfTracks.isValid()) {
862  ctfTracks = eventData.currentCtfTracks;
863  }
864 
865  // values of conversionInfo.flag
866  // -9999 : Partner track was not found
867  // 0 : Partner track found in the CTF collection using
868  // 1 : Partner track found in the CTF collection using
869  // 2 : Partner track found in the GSF collection using
870  // 3 : Partner track found in the GSF collection using the electron's GSF track
872  *electronData.coreRef, ctfTracks, eventData.originalGsfTracks, magneticFieldInTesla);
873 
875  conversionVars.flags = conversionInfo.flag;
876  conversionVars.dist = conversionInfo.dist;
877  conversionVars.dcot = conversionInfo.dcot;
878  conversionVars.radius = conversionInfo.radiusOfConversion;
880  //this is an intentionally bugged version which ignores the GsfTrack
881  //this is a bug which was introduced in reduced e/gamma where the GsfTrack gets
882  //relinked to a new collection which means it can no longer match the conversion
883  //as it matches based on product/id
884  //we keep this defination for the MVAs
885  const auto matchedConv = ConversionTools::matchedConversion(
886  electronData.coreRef->ctfTrack(), *eventData.conversions, eventData.beamspot->position(), 2.0, 1e-6, 0);
887  conversionVars.vtxFitProb = ConversionTools::getVtxFitProb(matchedConv);
888  }
889  if ((conversionVars.flags == 0) or (conversionVars.flags == 1))
890  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerCtfTk);
891  else if ((conversionVars.flags == 2) or (conversionVars.flags == 3))
892  conversionVars.partner = TrackBaseRef(conversionInfo.conversionPartnerGsfTk);
893 
894  //====================================================
895  // Go !
896  //====================================================
897 
898  electrons.emplace_back(eleCharge,
899  eleChargeInfo,
900  electronData.coreRef,
901  tcMatching,
902  tkExtra,
903  ctfInfo,
904  fiducialFlags,
905  showerShape,
906  full5x5_showerShape,
907  conversionVars,
908  saturationInfo);
909  auto& ele = electrons.back();
910  // Will be overwritten later in the case of the regression
911  ele.setCorrectedEcalEnergyError(superClusterErrorFunction_->getValue(*(ele.superCluster()), 0));
912  ele.setP4(GsfElectron::P4_FROM_SUPER_CLUSTER, momentum, 0, true);
913 
914  //====================================================
915  // brems fractions
916  //====================================================
917 
918  if (electronData.innMom.mag() > 0.) {
919  ele.setTrackFbrem((electronData.innMom.mag() - electronData.outMom.mag()) / electronData.innMom.mag());
920  }
921 
922  // the supercluster is the refined one The seed is not necessarily the first cluster
923  // hence the use of the electronCluster
924  SuperClusterRef sc = ele.superCluster();
925  if (!(sc.isNull())) {
926  CaloClusterPtr cl = ele.electronCluster();
927  if (sc->clustersSize() > 1) {
928  float pf_fbrem = (sc->energy() - cl->energy()) / sc->energy();
929  ele.setSuperClusterFbrem(pf_fbrem);
930  } else {
931  ele.setSuperClusterFbrem(0);
932  }
933  }
934 
935  //====================================================
936  // classification and corrections
937  //====================================================
938  // classification
939  const auto elClass = egamma::classifyElectron(ele);
940  ele.setClassification(elClass);
941 
942  bool unexpectedClassification = elClass == GsfElectron::UNKNOWN || elClass > GsfElectron::GAP;
943  if (unexpectedClassification) {
944  edm::LogWarning("GsfElectronAlgo") << "unexpected classification";
945  }
946 
947  // ecal energy
948  if (cfg_.strategy.useEcalRegression) // new
949  {
950  regHelper_.applyEcalRegression(ele, eventData.vertices, eventData.barrelRecHits, eventData.endcapRecHits);
951  } else // original implementation
952  {
953  if (!EcalTools::isHGCalDet((DetId::Detector)region)) {
954  if (ele.core()->ecalDrivenSeed()) {
955  if (cfg_.strategy.ecalDrivenEcalEnergyFromClassBasedParameterization && !unexpectedClassification) {
956  if (ele.isEcalEnergyCorrected()) {
957  edm::LogWarning("ElectronEnergyCorrector::classBasedElectronEnergy") << "already done";
958  } else {
959  ele.setCorrectedEcalEnergy(
961  }
962  }
964  ele.setCorrectedEcalEnergyError(egamma::classBasedElectronEnergyUncertainty(ele));
965  }
966  } else {
968  ele.setCorrectedEcalEnergyError(egamma::simpleElectronEnergyUncertainty(ele));
969  }
970  }
971  }
972  }
973 
974  // momentum
975  // Keep the default correction running first. The track momentum error is computed in there
976  if (ele.core()->ecalDrivenSeed() && !unexpectedClassification) {
977  if (ele.p4Error(reco::GsfElectron::P4_COMBINATION) != 999.) {
978  edm::LogWarning("ElectronMomentumCorrector::correct") << "already done";
979  } else {
980  auto p = egamma::correctElectronMomentum(ele, electronData.vtxTSOS);
981  ele.correctMomentum(p.momentum, p.trackError, p.finalError);
982  }
983  }
985  {
987  }
988 
989  //====================================================
990  // now isolation variables
991  //====================================================
992 
994  dr03.tkSumPt = tkIsol03Calc_.calIsolPt(*ele.gsfTrack(), *eventData.currentCtfTracks);
995  dr04.tkSumPt = tkIsol04Calc_.calIsolPt(*ele.gsfTrack(), *eventData.currentCtfTracks);
996  dr03.tkSumPtHEEP = tkIsolHEEP03Calc_.calIsolPt(*ele.gsfTrack(), *eventData.currentCtfTracks);
997  dr04.tkSumPtHEEP = tkIsolHEEP04Calc_.calIsolPt(*ele.gsfTrack(), *eventData.currentCtfTracks);
998 
999  if (!EcalTools::isHGCalDet((DetId::Detector)region)) {
1002  dr03.hcalDepth1TowerSumEtBc =
1003  eventData.hadDepth1Isolation03Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters));
1004  dr03.hcalDepth2TowerSumEtBc =
1005  eventData.hadDepth2Isolation03Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters));
1006  dr03.ecalRecHitSumEt = eventData.ecalBarrelIsol03.getEtSum(&ele);
1007  dr03.ecalRecHitSumEt += eventData.ecalEndcapIsol03.getEtSum(&ele);
1010  dr04.hcalDepth1TowerSumEtBc =
1011  eventData.hadDepth1Isolation04Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters));
1012  dr04.hcalDepth2TowerSumEtBc =
1013  eventData.hadDepth2Isolation04Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters));
1014  dr04.ecalRecHitSumEt = eventData.ecalBarrelIsol04.getEtSum(&ele);
1015  dr04.ecalRecHitSumEt += eventData.ecalEndcapIsol04.getEtSum(&ele);
1016  }
1017  ele.setIsolation03(dr03);
1018  ele.setIsolation04(dr04);
1019 
1020  //====================================================
1021  // preselection flag
1022  //====================================================
1023 
1024  setCutBasedPreselectionFlag(ele, *eventData.beamspot);
1025  //setting mva flag, currently GedGsfElectron and GsfElectron pre-selection flags have desynced
1026  //this is for GedGsfElectrons, GsfElectrons (ie old pre 7X std reco) resets this later on
1027  //in the function "addPfInfo"
1028  //yes this is awful, we'll fix it once we work out how to...
1029  float mvaValue = hoc->sElectronMVAEstimator->mva(ele, *(eventData.vertices));
1030  ele.setPassMvaPreselection(mvaValue > cfg_.strategy.PreSelectMVA);
1031 
1032  //====================================================
1033  // Pixel match variables
1034  //====================================================
1036 
1037  LogTrace("GsfElectronAlgo") << "Constructed new electron with energy " << ele.p4().e();
1038 }
1039 
1040 // Pixel match variables
1042  int sd1 = 0;
1043  int sd2 = 0;
1044  float dPhi1 = 0;
1045  float dPhi2 = 0;
1046  float dRz1 = 0;
1047  float dRz2 = 0;
1048  edm::RefToBase<TrajectorySeed> seed = ele.gsfTrack()->extra()->seedRef();
1049  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
1050  if (seed.isNull()) {
1051  } else {
1052  if (elseed.isNull()) {
1053  } else {
1054  sd1 = elseed->subDet(0);
1055  sd2 = elseed->subDet(1);
1056  dPhi1 = (ele.charge() > 0) ? elseed->dPhiPos(0) : elseed->dPhiNeg(0);
1057  dPhi2 = (ele.charge() > 0) ? elseed->dPhiPos(1) : elseed->dPhiNeg(1);
1058  dRz1 = (ele.charge() > 0) ? elseed->dRZPos(0) : elseed->dRZNeg(0);
1059  dRz2 = (ele.charge() > 0) ? elseed->dRZPos(1) : elseed->dRZNeg(1);
1060  }
1061  }
1062  ele.setPixelMatchSubdetectors(sd1, sd2);
1063  ele.setPixelMatchDPhi1(dPhi1);
1064  ele.setPixelMatchDPhi2(dPhi2);
1065  ele.setPixelMatchDRz1(dRz1);
1066  ele.setPixelMatchDRz2(dRz2);
1067 }
TrajectoryStateOnSurface constrainAtBeamSpot(const reco::GsfTrack &, const reco::BeamSpot &) const
(multi)TSOS after including the beamspot
edm::Handle< reco::TrackCollection > originalCtfTracks
T getParameter(std::string const &) const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
EgammaRecHitIsolation ecalEndcapIsol04
EgammaRecHitIsolation ecalBarrelIsol03
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
edm::Handle< reco::ElectronSeedCollection > seeds
const double dist
Definition: ConversionInfo.h:9
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:153
void applyCombinationRegression(reco::GsfElectron &ele) const
static bool isHGCalDet(DetId::Detector thedet)
identify HGCal cells
Definition: EcalTools.h:48
void setCutBasedPreselectionFlag(reco::GsfElectron &ele, const reco::BeamSpot &) const
const EleTkIsolFromCands tkIsol03Calc_
static bool isNextToEtaBoundary(EBDetId id)
Definition: EBDetId.cc:108
EgammaRecHitIsolation ecalEndcapIsol03
static reco::Conversion const * matchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
static const TGPicture * info(bool iBackgroundIsBlack)
void setPassCutBasedPreselection(bool flag)
Definition: GsfElectron.h:687
double classBasedElectronEnergyUncertainty(reco::GsfElectron const &)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
void setPixelMatchDRz2(float dRz2)
Definition: GsfElectron.h:849
EgammaTowerIsolation hadDepth1Isolation03
bool isEBEtaGap() const
Definition: GsfElectron.h:333
void readEvent(const edm::Event &)
edm::EDGetTokenT< reco::ConversionCollection > conversions
edm::EDGetTokenT< CaloTowerCollection > hcalTowersTag
ConversionInfo getConversionInfo(const reco::GsfElectronCore &, const edm::Handle< reco::TrackCollection > &ctftracks_h, const edm::Handle< reco::GsfTrackCollection > &gsftracks_h, const double bFieldAtOrigin, const double minFracSharedHits=0.45)
EgammaTowerIsolation hadDepth2Isolation03
const EleTkIsolFromCands tkIsolHEEP04Calc_
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
void completeElectrons(reco::GsfElectronCollection &electrons, edm::Event const &event, edm::EventSetup const &eventSetup, const HeavyObjectCache *hoc)
CaloTopology const * topology(0)
void retreiveOriginalTrackCollections(const reco::TrackRef &, const reco::GsfTrackRef &)
void setPixelMatchDPhi1(float dPhi1)
Definition: GsfElectron.h:846
bool isEBEEGap() const
Definition: GsfElectron.h:331
float hcalDepth2OverEcal() const
Definition: GsfElectron.h:418
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
double getEtSum(const reco::Candidate *emObject) const
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:8
Definition: __init__.py:1
TrajectoryStateOnSurface sclTSOS
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
EgammaTowerIsolation hadDepth1Isolation04Bc
edm::Handle< EcalRecHitCollection > endcapRecHits
void setPixelMatchInfomation(reco::GsfElectron &) const
T y() const
Definition: PV3DBase.h:60
EgammaTowerIsolation hadDepth1Isolation03Bc
std::unique_ptr< EcalClusterFunctionBaseClass > superClusterErrorFunction_
GlobalPoint globalPosition() const
edm::Event const * event
int charge() const final
electric charge
void checkSetup(const edm::EventSetup &)
bool isEERingGap() const
Definition: GsfElectron.h:337
edm::EDGetTokenT< reco::VertexCollection > vtxCollectionTag
void computeCharge(int &charge, reco::GsfElectron::ChargeInfo &info)
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
TrajectoryStateOnSurface innTSOS
reco::GsfElectron::ShowerShape calculateShowerShape(const reco::SuperClusterRef &, ElectronHcalHelper const &hcalHelper, EventData const &eventData, CaloTopology const &topology, CaloGeometry const &geometry) const
bool isEEDeeGap() const
Definition: GsfElectron.h:336
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
ElectronHcalHelper hcalHelper_
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
bool isEE() const
Definition: GsfElectron.h:329
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
bool isEB() const
Definition: GsfElectron.h:328
const reco::TrackRef conversionPartnerCtfTk
TrajectoryStateOnSurface outerStateOnSurface(const reco::GsfTrack &tk) const
void setPixelMatchSubdetectors(int sd1, int sd2)
Definition: GsfElectron.h:845
static std::string const input
Definition: EdmProvDump.cc:48
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
edm::EDGetTokenT< reco::GsfElectronCollection > pflowGsfElectronsTag
RegressionHelper regHelper_
const Configuration cfg_
TrajectoryStateOnSurface constrainedVtxTSOS
bool getData(T &iHolder) const
Definition: EventSetup.h:113
T barePhi() const
Definition: PV3DBase.h:65
double simpleElectronEnergyUncertainty(reco::GsfElectron const &)
void setUseNumCrystals(bool b=true)
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:209
static float getVtxFitProb(const reco::Conversion *conv)
T mag() const
Definition: PV3DBase.h:64
float sigmaIetaIeta() const
Definition: GsfElectron.h:411
EgammaTowerIsolation hadDepth1Isolation04
TrajectoryStateOnSurface extrapolatedState(const TrajectoryStateOnSurface tsos, const GlobalPoint &point) const
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:35
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSeveretyLevelAlgoToken_
void checkSetup(edm::EventSetup const &eventSetup)
bool positionFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalPoint &position)
const int flag
T sqrt(T t)
Definition: SSEVec.h:19
static bool isNextToPhiBoundary(EBDetId id)
Definition: EBDetId.cc:113
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::Handle< EcalRecHitCollection > barrelRecHits
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:228
T z() const
Definition: PV3DBase.h:61
std::vector< GsfElectronCore > GsfElectronCoreCollection
const double radiusOfConversion
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
float hcalOverEcal() const
Definition: GsfElectron.h:419
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
IsolationValueMaps pfIsolationValues
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HeavyObjectCache(const edm::ParameterSet &)
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:368
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
const IsolationConfiguration iso
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
edm::EDGetTokenT< reco::TrackCollection > ctfTracks
double energy() const
cluster energy
Definition: CaloCluster.h:148
double calIsolPt(Args &&...args) const
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
const reco::BeamSpot * beamspot
EgammaTowerIsolation hadDepth2Isolation04Bc
float classBasedElectronEnergy(reco::GsfElectron const &, reco::BeamSpot const &, EcalClusterFunctionBaseClass const &crackCorrectionFunction)
edm::Handle< reco::ConversionCollection > conversions
static bool isNextToDBoundary(EEDetId id)
Definition: EEDetId.cc:279
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:70
float hcalOverEcalBc() const
Definition: GsfElectron.h:425
bool isNull() const
Checks for null.
Definition: Ref.h:235
#define LogTrace(id)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const double dcot
const_iterator end() const
edm::Handle< reco::GsfElectronCollection > previousElectrons
const reco::GsfTrackRef conversionPartnerGsfTk
float hcalDepth1OverEcal() const
Definition: GsfElectron.h:417
bool calculateTSOS(MultiTrajectoryStateTransform const &, GsfConstraintAtVertex const &)
void setPixelMatchDPhi2(float dPhi2)
Definition: GsfElectron.h:847
reco::CaloClusterPtr getEleBasicCluster(MultiTrajectoryStateTransform const &)
Definition: DetId.h:17
const CutsConfiguration cutsPflow
edm::Handle< reco::VertexCollection > vertices
edm::Handle< reco::GsfElectronCollection > pflowElectrons
EgammaRecHitIsolation ecalBarrelIsol04
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:218
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
ElectronMomentum correctElectronMomentum(reco::GsfElectron const &, TrajectoryStateOnSurface const &)
bool hasActiveHcal(const reco::SuperCluster &sc) const
GsfElectronAlgo(const Tokens &, const StrategyConfiguration &, const CutsConfiguration &cutsCfg, const CutsConfiguration &cutsCfgPflow, const ElectronHcalHelper::Configuration &hcalCfg, const ElectronHcalHelper::Configuration &hcalCfgPflow, const IsolationConfiguration &, const EcalRecHitsConfiguration &, std::unique_ptr< EcalClusterFunctionBaseClass > &&superClusterErrorFunction, std::unique_ptr< EcalClusterFunctionBaseClass > &&crackCorrectionFunction, const RegressionHelper::Configuration &regCfg, const edm::ParameterSet &tkIsol03Cfg, const edm::ParameterSet &tkIsol04Cfg, const edm::ParameterSet &tkIsolHEEP03Cfg, const edm::ParameterSet &tkIsolHEEP04Cfg, edm::ConsumesCollector &&cc)
Detector
Definition: DetId.h:24
reco::GsfElectron::SaturationInfo calculateSaturationInfo(const reco::SuperClusterRef &, EventData const &eventData) const
REF castTo() const
Definition: RefToBase.h:257
bool isNull() const
Checks for null.
Definition: RefToBase.h:295
const reco::GsfTrackRef gsfTrackRef
EgammaTowerIsolation hadDepth2Isolation03Bc
void ele_convert(const Type1 &obj1, Type2 &obj2)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
const StrategyConfiguration strategy
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers) const
std::vector< std::string > vweightsfiles
math::XYZVectorF momentumAtVtxWithConstraint
Definition: GsfElectron.h:262
TrajectoryStateOnSurface innerStateOnSurface(const reco::GsfTrack &tk) const
TrajectoryStateOnSurface seedTSOS
ESHandle< TrackerGeometry > geometry
edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons
iterator find(key_type k)
fixed size matrix
edm::Handle< reco::GsfTrackCollection > originalGsfTracks
const CutsConfiguration cuts
HLT enums.
void applyEcalRegression(reco::GsfElectron &electron, const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< EcalRecHitCollection > &rechitsEB, const edm::Handle< EcalRecHitCollection > &rechitsEE) const
const EcalRecHitsConfiguration recHits
const EleTkIsolFromCands tkIsol04Calc_
const reco::GsfElectronCoreRef coreRef
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc) const
bool isEBPhiGap() const
Definition: GsfElectron.h:334
edm::Handle< reco::TrackCollection > currentCtfTracks
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
const reco::SuperClusterRef superClusterRef
TrajectoryStateOnSurface eleTSOS
const Point & position() const
position
Definition: BeamSpot.h:59
const EleTkIsolFromCands tkIsolHEEP03Calc_
std::unique_ptr< const SoftElectronMVAEstimator > sElectronMVAEstimator
std::pair< reco::TrackRef, float > getClosestCtfToGsf(reco::GsfTrackRef const &, edm::Handle< reco::TrackCollection > const &ctfTracksH)
TrajectoryStateOnSurface outTSOS
ElectronData(const reco::GsfElectronCoreRef &core, const reco::BeamSpot &bs)
bool momentumFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalVector &momentum)
IsolationValueMaps edIsolationValues
EventData beginEvent(edm::Event const &event, CaloGeometry const &caloGeometry, EcalSeverityLevelAlgo const &ecalSeveretyLevelAlgo)
T x() const
Definition: PV3DBase.h:59
edm::Handle< reco::GsfElectronCoreCollection > coreElectrons
int ietaAbs() const
get the absolute value of the crystal ieta
Definition: EBDetId.h:47
EgammaTowerIsolation hadDepth2Isolation04
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
reco::GsfElectron::Classification classifyElectron(reco::GsfElectron const &)
void checkSetup(const edm::EventSetup &)
void setPixelMatchDRz1(float dRz1)
Definition: GsfElectron.h:848
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers) const
Definition: event.py:1
math::PtEtaPhiELorentzVectorF LorentzVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
ElectronHcalHelper hcalHelperPflow_
edm::Handle< reco::GsfPFRecTrackCollection > gsfPfRecTracks
TrajectoryStateOnSurface vtxTSOS
void createElectron(reco::GsfElectronCollection &electrons, ElectronData &electronData, EventData &eventData, CaloTopology const &topology, CaloGeometry const &geometry, MultiTrajectoryStateTransform const &mtsTransform, double magneticFieldInTesla, const HeavyObjectCache *)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
reco::Candidate::LorentzVector calculateMomentum()
const reco::BeamSpot beamSpot