CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
GsfElectronAlgo Class Reference

#include <GsfElectronAlgo.h>

Classes

struct  Configuration
 
struct  CutsConfiguration
 
struct  EcalRecHitsConfiguration
 
struct  ElectronData
 
struct  EventData
 
class  HeavyObjectCache
 
struct  IsolationConfiguration
 
struct  StrategyConfiguration
 
struct  Tokens
 

Public Member Functions

void completeElectrons (reco::GsfElectronCollection &electrons, edm::Event const &event, edm::EventSetup const &eventSetup, const HeavyObjectCache *hoc)
 
 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)
 

Private Member Functions

EventData beginEvent (edm::Event const &event, CaloGeometry const &caloGeometry, EcalSeverityLevelAlgo const &ecalSeveretyLevelAlgo)
 
reco::GsfElectron::SaturationInfo calculateSaturationInfo (const reco::SuperClusterRef &, EventData const &eventData) const
 
template<bool full5x5>
reco::GsfElectron::ShowerShape calculateShowerShape (const reco::SuperClusterRef &, ElectronHcalHelper const &hcalHelper, EventData const &eventData, CaloTopology const &topology, CaloGeometry const &geometry) const
 
void checkSetup (edm::EventSetup const &eventSetup)
 
void createElectron (reco::GsfElectronCollection &electrons, ElectronData &electronData, EventData &eventData, CaloTopology const &topology, CaloGeometry const &geometry, MultiTrajectoryStateTransform const &mtsTransform, double magneticFieldInTesla, const HeavyObjectCache *)
 
void setCutBasedPreselectionFlag (reco::GsfElectron &ele, const reco::BeamSpot &) const
 
void setPixelMatchInfomation (reco::GsfElectron &) const
 

Private Attributes

const edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
const edm::ESGetToken< CaloTopology, CaloTopologyRecordcaloTopologyToken_
 
const Configuration cfg_
 
std::unique_ptr< EcalClusterFunctionBaseClasscrackCorrectionFunction_
 
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdecalSeveretyLevelAlgoToken_
 
ElectronHcalHelper hcalHelper_
 
ElectronHcalHelper hcalHelperPflow_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
RegressionHelper regHelper_
 
std::unique_ptr< EcalClusterFunctionBaseClasssuperClusterErrorFunction_
 
const EleTkIsolFromCands tkIsol03Calc_
 
const EleTkIsolFromCands tkIsol04Calc_
 
const EleTkIsolFromCands tkIsolHEEP03Calc_
 
const EleTkIsolFromCands tkIsolHEEP04Calc_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 

Detailed Description

Definition at line 53 of file GsfElectronAlgo.h.

Constructor & Destructor Documentation

GsfElectronAlgo::GsfElectronAlgo ( const Tokens input,
const StrategyConfiguration strategy,
const CutsConfiguration cutsCfg,
const CutsConfiguration cutsCfgPflow,
const ElectronHcalHelper::Configuration hcalCfg,
const ElectronHcalHelper::Configuration hcalCfgPflow,
const IsolationConfiguration iso,
const EcalRecHitsConfiguration recHits,
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 
)

Definition at line 371 of file GsfElectronAlgo.cc.

References caloGeometryToken_, caloTopologyToken_, crackCorrectionFunction_, L1TMuonDQMOffline_cfi::cuts, ecalSeveretyLevelAlgoToken_, hcalHelper_, hcalHelperPflow_, input, SiStripFineDelayHit_cfi::MagneticField, magneticFieldToken_, regHelper_, superClusterErrorFunction_, tkIsol03Calc_, tkIsol04Calc_, tkIsolHEEP03Calc_, tkIsolHEEP04Calc_, and trackerGeometryToken_.

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 {}
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
const EleTkIsolFromCands tkIsol03Calc_
const EleTkIsolFromCands tkIsolHEEP04Calc_
std::unique_ptr< EcalClusterFunctionBaseClass > superClusterErrorFunction_
ElectronHcalHelper hcalHelper_
static std::string const input
Definition: EdmProvDump.cc:48
RegressionHelper regHelper_
const Configuration cfg_
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSeveretyLevelAlgoToken_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const EleTkIsolFromCands tkIsol04Calc_
const EleTkIsolFromCands tkIsolHEEP03Calc_
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
ElectronHcalHelper hcalHelperPflow_

Member Function Documentation

GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent ( edm::Event const &  event,
CaloGeometry const &  caloGeometry,
EcalSeverityLevelAlgo const &  ecalSeveretyLevelAlgo 
)
private

Definition at line 420 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::Tokens::barrelRecHitCollection, HLT_2018_cff::barrelRecHits, GsfElectronAlgo::Tokens::beamSpotTag, cfg_, GsfElectronAlgo::Tokens::conversions, GsfElectronAlgo::Tokens::ctfTracks, DetId::Ecal, GsfElectronAlgo::IsolationConfiguration::eMinBarrel, GsfElectronAlgo::IsolationConfiguration::eMinEndcaps, GsfElectronAlgo::Tokens::endcapRecHitCollection, HLT_2018_cff::endcapRecHits, GsfElectronAlgo::IsolationConfiguration::etMinBarrel, GsfElectronAlgo::IsolationConfiguration::etMinEndcaps, GsfElectronAlgo::IsolationConfiguration::etMinHcal, event(), GsfElectronAlgo::EventData::event, GsfElectronAlgo::StrategyConfiguration::fillConvVtxFitProb, GsfElectronAlgo::Tokens::gsfElectronCores, GsfElectronAlgo::Tokens::gsfPfRecTracksTag, hcalHelper_, hcalHelperPflow_, GsfElectronAlgo::Tokens::hcalTowersTag, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalBarrel, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalEndcaps, GsfElectronAlgo::IsolationConfiguration::intRadiusHcal, GsfElectronAlgo::Configuration::iso, GsfElectronAlgo::IsolationConfiguration::jurassicWidth, GsfElectronAlgo::Tokens::pflowGsfElectronsTag, GsfElectronAlgo::Tokens::previousGsfElectrons, ElectronHcalHelper::readEvent(), GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, GsfElectronAlgo::Configuration::recHits, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, GsfElectronAlgo::Tokens::seedsTag, EgammaRecHitIsolation::setUseNumCrystals(), GsfElectronAlgo::Configuration::strategy, GsfElectronAlgo::Configuration::tokens, HLT_2018_cff::towers, GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks, GsfElectronAlgo::IsolationConfiguration::useNumCrystals, GsfElectronAlgo::IsolationConfiguration::vetoClustered, and GsfElectronAlgo::Tokens::vtxCollectionTag.

Referenced by completeElectrons().

422  {
423  // prepare access to hcal data
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 }
void readEvent(const edm::Event &)
edm::EDGetTokenT< reco::ConversionCollection > conversions
edm::EDGetTokenT< CaloTowerCollection > hcalTowersTag
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag
edm::EDGetTokenT< reco::VertexCollection > vtxCollectionTag
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
ElectronHcalHelper hcalHelper_
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
edm::EDGetTokenT< reco::GsfElectronCollection > pflowGsfElectronsTag
const Configuration cfg_
void setUseNumCrystals(bool b=true)
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
const IsolationConfiguration iso
edm::EDGetTokenT< reco::TrackCollection > ctfTracks
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
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
const StrategyConfiguration strategy
edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons
const EcalRecHitsConfiguration recHits
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
Definition: event.py:1
ElectronHcalHelper hcalHelperPflow_
reco::GsfElectron::SaturationInfo GsfElectronAlgo::calculateSaturationInfo ( const reco::SuperClusterRef theClus,
EventData const &  eventData 
) const
private

Definition at line 262 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, hgcalTestNeighbor_cfi::detector, EcalBarrel, IOMC_cff::ecalRecHit, edm::SortedCollection< T, SORT >::end(), GsfElectronAlgo::EventData::endcapRecHits, edm::SortedCollection< T, SORT >::find(), reco::GsfElectron::SaturationInfo::isSeedSaturated, reco::GsfElectron::SaturationInfo::nSaturatedXtals, reco::CaloCluster::seed(), and DetId::subdetId().

Referenced by createElectron().

263  {
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 }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
const_iterator end() const
Definition: DetId.h:17
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:218
iterator find(key_type k)
template<bool full5x5>
reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape ( const reco::SuperClusterRef theClus,
ElectronHcalHelper const &  hcalHelper,
EventData const &  eventData,
CaloTopology const &  topology,
CaloGeometry const &  geometry 
) const
private

Definition at line 294 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, cfg_, hgcalTestNeighbor_cfi::detector, EgHLTOffHistBins_cfi::e1x5, reco::GsfElectron::ShowerShape::e1x5, reco::GsfElectron::ShowerShape::e2nd, reco::GsfElectron::ShowerShape::e2x5Bottom, reco::GsfElectron::ShowerShape::e2x5Left, reco::GsfElectron::ShowerShape::e2x5Max, reco::GsfElectron::ShowerShape::e2x5Right, reco::GsfElectron::ShowerShape::e2x5Top, reco::GsfElectron::ShowerShape::e5x5, reco::GsfElectron::ShowerShape::eBottom, EcalBarrel, reco::GsfElectron::ShowerShape::eLeft, cosmicPhotonAnalyzer_cfi::eMax, reco::GsfElectron::ShowerShape::eMax, GsfElectronAlgo::EventData::endcapRecHits, reco::GsfElectron::ShowerShape::eRight, reco::GsfElectron::ShowerShape::eTop, ElectronHcalHelper::hasActiveHcal(), reco::GsfElectron::ShowerShape::hcalDepth1OverEcal, reco::GsfElectron::ShowerShape::hcalDepth1OverEcalBc, reco::GsfElectron::ShowerShape::hcalDepth2OverEcal, reco::GsfElectron::ShowerShape::hcalDepth2OverEcalBc, ElectronHcalHelper::hcalESumDepth1(), ElectronHcalHelper::hcalESumDepth1BehindClusters(), ElectronHcalHelper::hcalESumDepth2(), ElectronHcalHelper::hcalESumDepth2BehindClusters(), ElectronHcalHelper::hcalTowersBehindClusters(), reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), reco::GsfElectron::ShowerShape::invalidHcal, edm::isNotFinite(), reco::GsfElectron::ShowerShape::r9, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, FastTrackerRecHitMaskProducer_cfi::recHits, GsfElectronAlgo::Configuration::recHits, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, Scenarios_cff::scale, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIetaIphi, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), and DetId::subdetId().

298  {
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 =
337  hcalHelper.hcalESumDepth1BehindClusters(showerShape.hcalTowersBehindClusters) / scale;
338  showerShape.hcalDepth2OverEcalBc =
339  hcalHelper.hcalESumDepth2BehindClusters(showerShape.hcalTowersBehindClusters) / scale;
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 }
CaloTopology const * topology(0)
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
const Configuration cfg_
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:209
T sqrt(T t)
Definition: SSEVec.h:19
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:368
Definition: DetId.h:17
const EcalRecHitsConfiguration recHits
void GsfElectronAlgo::checkSetup ( edm::EventSetup const &  eventSetup)
private

Definition at line 406 of file GsfElectronAlgo.cc.

References cfg_, RegressionHelper::checkSetup(), ElectronHcalHelper::checkSetup(), crackCorrectionFunction_, hcalHelper_, hcalHelperPflow_, regHelper_, GsfElectronAlgo::Configuration::strategy, superClusterErrorFunction_, GsfElectronAlgo::StrategyConfiguration::useCombinationRegression, and GsfElectronAlgo::StrategyConfiguration::useEcalRegression.

Referenced by completeElectrons().

406  {
411 
413  superClusterErrorFunction_->init(es);
414  }
416  crackCorrectionFunction_->init(es);
417  }
418 }
std::unique_ptr< EcalClusterFunctionBaseClass > superClusterErrorFunction_
void checkSetup(const edm::EventSetup &)
ElectronHcalHelper hcalHelper_
RegressionHelper regHelper_
const Configuration cfg_
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
const StrategyConfiguration strategy
void checkSetup(const edm::EventSetup &)
ElectronHcalHelper hcalHelperPflow_
void GsfElectronAlgo::completeElectrons ( reco::GsfElectronCollection electrons,
edm::Event const &  event,
edm::EventSetup const &  eventSetup,
const HeavyObjectCache hoc 
)

Definition at line 539 of file GsfElectronAlgo.cc.

References beginEvent(), GsfElectronAlgo::ElectronData::calculateTSOS(), caloGeometryToken_, caloTopologyToken_, checkSetup(), createElectron(), ecalSeveretyLevelAlgoToken_, edm::EventSetup::getData(), mps_fire::i, edm::Ref< C, T, F >::isNull(), HLT_2018_cff::magneticField, magneticFieldToken_, and trackerGeometryToken_.

542  {
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 }
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSeveretyLevelAlgoToken_
void checkSetup(edm::EventSetup const &eventSetup)
std::vector< GsfElectronCore > GsfElectronCoreCollection
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
bool isNull() const
Checks for null.
Definition: Ref.h:235
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
EventData beginEvent(edm::Event const &event, CaloGeometry const &caloGeometry, EcalSeverityLevelAlgo const &ecalSeveretyLevelAlgo)
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
Definition: event.py:1
void createElectron(reco::GsfElectronCollection &electrons, ElectronData &electronData, EventData &eventData, CaloTopology const &topology, CaloGeometry const &geometry, MultiTrajectoryStateTransform const &mtsTransform, double magneticFieldInTesla, const HeavyObjectCache *)
void GsfElectronAlgo::createElectron ( reco::GsfElectronCollection electrons,
ElectronData electronData,
EventData eventData,
CaloTopology const &  topology,
CaloGeometry const &  geometry,
MultiTrajectoryStateTransform const &  mtsTransform,
double  magneticFieldInTesla,
const HeavyObjectCache hoc 
)
private

Definition at line 706 of file GsfElectronAlgo.cc.

References funct::abs(), RegressionHelper::applyCombinationRegression(), RegressionHelper::applyEcalRegression(), GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::ElectronData::calculateMode(), GsfElectronAlgo::ElectronData::calculateMomentum(), calculateSaturationInfo(), EleTkIsolFromCands::calIsolPt(), cfg_, GetRecoTauVFromDQM_MC_cff::cl, egamma::classBasedElectronEnergy(), egamma::classBasedElectronEnergyUncertainty(), egamma::classifyElectron(), GsfElectronAlgo::ElectronData::computeCharge(), ConversionInfo::conversionPartnerCtfTk, ConversionInfo::conversionPartnerGsfTk, GsfElectronAlgo::EventData::conversions, GsfElectronAlgo::ElectronData::coreRef, egamma::correctElectronMomentum(), crackCorrectionFunction_, reco::GsfElectron::ClosestCtfTrack::ctfTrack, GsfElectronAlgo::ElectronData::ctfTrackRef, lowPtGsfElectronCores_cff::ctfTracks, GsfElectronAlgo::StrategyConfiguration::ctfTracksCheck, GsfElectronAlgo::EventData::currentCtfTracks, ConversionInfo::dcot, reco::GsfElectron::ConversionRejection::dcot, reco::GsfElectron::TrackClusterMatching::deltaEtaEleClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaEtaSeedClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaEtaSuperClusterAtVtx, reco::GsfElectron::TrackClusterMatching::deltaPhiEleClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaPhiSeedClusterAtCalo, reco::GsfElectron::TrackClusterMatching::deltaPhiSuperClusterAtVtx, DetId::det(), hgcalTestNeighbor_cfi::detector, ConversionInfo::dist, reco::GsfElectron::ConversionRejection::dist, MillePedeFileConverter_cfg::e, EcalBarrel, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalEnergyFromClassBasedParameterization, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalErrorFromClassBasedParameterization, EcalEndcap, GsfElectronAlgo::EventData::ecalEndcapIsol03, GsfElectronAlgo::EventData::ecalEndcapIsol04, reco::GsfElectron::IsolationVariables::ecalRecHitSumEt, reco::GsfElectron::TrackClusterMatching::eEleClusterOverPout, ele_convert(), reco::GsfElectron::TrackClusterMatching::electronCluster, GsfElectronAlgo::ElectronData::eleMom, GsfElectronAlgo::ElectronData::elePos, GsfElectronAlgo::EventData::endcapRecHits, reco::CaloCluster::energy(), reco::GsfElectron::TrackClusterMatching::eSeedClusterOverP, reco::GsfElectron::TrackClusterMatching::eSeedClusterOverPout, reco::GsfElectron::TrackClusterMatching::eSuperClusterOverP, Exception, JetMETHLTOfflineSource_cfi::feta, GsfElectronAlgo::StrategyConfiguration::fillConvVtxFitProb, ConversionInfo::flag, reco::GsfElectron::ConversionRejection::flags, geometry, egamma::getClosestCtfToGsf(), egammaTools::getConversionInfo(), GsfElectronAlgo::ElectronData::getEleBasicCluster(), EgammaRecHitIsolation::getEtSum(), EgammaTowerIsolation::getTowerEtSum(), ConversionTools::getVtxFitProb(), GsfElectronAlgo::ElectronData::gsfTrackRef, GsfElectronAlgo::EventData::hadDepth1Isolation03, GsfElectronAlgo::EventData::hadDepth1Isolation03Bc, GsfElectronAlgo::EventData::hadDepth1Isolation04, GsfElectronAlgo::EventData::hadDepth1Isolation04Bc, GsfElectronAlgo::EventData::hadDepth2Isolation03, GsfElectronAlgo::EventData::hadDepth2Isolation03Bc, GsfElectronAlgo::EventData::hadDepth2Isolation04, GsfElectronAlgo::EventData::hadDepth2Isolation04Bc, reco::GsfElectron::IsolationVariables::hcalDepth1TowerSumEt, reco::GsfElectron::IsolationVariables::hcalDepth1TowerSumEtBc, reco::GsfElectron::IsolationVariables::hcalDepth2TowerSumEt, reco::GsfElectron::IsolationVariables::hcalDepth2TowerSumEtBc, hcalHelper_, hcalHelperPflow_, reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), EBDetId::ietaAbs(), GsfElectronAlgo::ElectronData::innMom, reco::GsfElectron::FiducialFlags::isEB, reco::GsfElectron::FiducialFlags::isEBEEGap, reco::GsfElectron::FiducialFlags::isEBEtaGap, reco::GsfElectron::FiducialFlags::isEBPhiGap, reco::GsfElectron::FiducialFlags::isEE, reco::GsfElectron::FiducialFlags::isEEDeeGap, reco::GsfElectron::FiducialFlags::isEERingGap, EcalTools::isHGCalDet(), EEDetId::isNextToDBoundary(), EBDetId::isNextToEtaBoundary(), EBDetId::isNextToPhiBoundary(), EEDetId::isNextToRingBoundary(), edm::Ref< C, T, F >::isNull(), edm::HandleBase::isValid(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), ConversionTools::matchedConversion(), reco::GsfElectron::TrackExtrapolations::momentumAtCalo, reco::GsfElectron::TrackExtrapolations::momentumAtEleClus, reco::GsfElectron::TrackExtrapolations::momentumAtVtx, reco::GsfElectron::TrackExtrapolations::momentumAtVtxWithConstraint, reco::GsfElectron::TrackExtrapolations::momentumOut, or, GsfElectronAlgo::EventData::originalCtfTracks, GsfElectronAlgo::EventData::originalGsfTracks, GsfElectronAlgo::ElectronData::outMom, AlCaHLTBitMon_ParallelJobs::p, reco::GsfElectron::P4_COMBINATION, reco::GsfElectron::ConversionRejection::partner, reco::BeamSpot::position(), reco::CaloCluster::position(), reco::GsfElectron::TrackExtrapolations::positionAtCalo, reco::GsfElectron::TrackExtrapolations::positionAtVtx, GsfElectronAlgo::StrategyConfiguration::PreSelectMVA, GsfElectronAlgo::StrategyConfiguration::pureTrackerDrivenEcalErrorFromSimpleParameterization, reco::GsfElectron::ConversionRejection::radius, ConversionInfo::radiusOfConversion, regHelper_, HLT_2018_cff::region, GsfElectronAlgo::EventData::retreiveOriginalTrackCollections(), SimDataFormats::CaloAnalysis::sc, GsfElectronAlgo::ElectronData::sclMom, GsfElectronAlgo::ElectronData::sclPos, GsfElectronAlgo::ElectronData::seedMom, GsfElectronAlgo::ElectronData::seedPos, GsfElectronAlgo::HeavyObjectCache::sElectronMVAEstimator, setCutBasedPreselectionFlag(), setPixelMatchInfomation(), GsfElectronAlgo::ElectronData::shFracInnerHits, reco::GsfElectron::ClosestCtfTrack::shFracInnerHits, egamma::simpleElectronEnergyUncertainty(), GsfElectronAlgo::Configuration::strategy, DetId::subdetId(), superClusterErrorFunction_, GsfElectronAlgo::ElectronData::superClusterRef, tkIsol03Calc_, tkIsol04Calc_, tkIsolHEEP03Calc_, tkIsolHEEP04Calc_, reco::GsfElectron::IsolationVariables::tkSumPt, reco::GsfElectron::IsolationVariables::tkSumPtHEEP, ecaldqm::topology(), SiStripSubdetector::UNKNOWN, GsfElectronAlgo::StrategyConfiguration::useCombinationRegression, GsfElectronAlgo::StrategyConfiguration::useEcalRegression, GsfElectronAlgo::EventData::vertices, reco::GsfElectron::ConversionRejection::vtxFitProb, GsfElectronAlgo::ElectronData::vtxMom, GsfElectronAlgo::ElectronData::vtxMomWithConstraint, GsfElectronAlgo::ElectronData::vtxPos, and GsfElectronAlgo::ElectronData::vtxTSOS.

Referenced by completeElectrons().

713  {
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);
781  ele_convert(electronData.vtxMomWithConstraint, tkExtra.momentumAtVtxWithConstraint);
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 
860  edm::Handle<reco::TrackCollection> ctfTracks = eventData.originalCtfTracks;
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(
960  egamma::classBasedElectronEnergy(ele, *eventData.beamspot, *crackCorrectionFunction_));
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)) {
1000  dr03.hcalDepth1TowerSumEt = eventData.hadDepth1Isolation03.getTowerEtSum(&ele);
1001  dr03.hcalDepth2TowerSumEt = eventData.hadDepth2Isolation03.getTowerEtSum(&ele);
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);
1008  dr04.hcalDepth1TowerSumEt = eventData.hadDepth1Isolation04.getTowerEtSum(&ele);
1009  dr04.hcalDepth2TowerSumEt = eventData.hadDepth2Isolation04.getTowerEtSum(&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 }
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
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)
double classBasedElectronEnergyUncertainty(reco::GsfElectron const &)
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)
const EleTkIsolFromCands tkIsolHEEP04Calc_
CaloTopology const * topology(0)
void setPixelMatchInfomation(reco::GsfElectron &) const
std::unique_ptr< EcalClusterFunctionBaseClass > superClusterErrorFunction_
ElectronHcalHelper hcalHelper_
const reco::TrackRef conversionPartnerCtfTk
RegressionHelper regHelper_
const Configuration cfg_
double simpleElectronEnergyUncertainty(reco::GsfElectron const &)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:209
static float getVtxFitProb(const reco::Conversion *conv)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:35
const int flag
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
const double radiusOfConversion
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:368
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
double energy() const
cluster energy
Definition: CaloCluster.h:148
double calIsolPt(Args &&...args) const
float classBasedElectronEnergy(reco::GsfElectron const &, reco::BeamSpot const &, EcalClusterFunctionBaseClass const &crackCorrectionFunction)
static bool isNextToDBoundary(EEDetId id)
Definition: EEDetId.cc:279
bool isValid() const
Definition: HandleBase.h:70
bool isNull() const
Checks for null.
Definition: Ref.h:235
#define LogTrace(id)
const double dcot
const reco::GsfTrackRef conversionPartnerGsfTk
Definition: DetId.h:17
ElectronMomentum correctElectronMomentum(reco::GsfElectron const &, TrajectoryStateOnSurface const &)
Detector
Definition: DetId.h:24
reco::GsfElectron::SaturationInfo calculateSaturationInfo(const reco::SuperClusterRef &, EventData const &eventData) const
void ele_convert(const Type1 &obj1, Type2 &obj2)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
const StrategyConfiguration strategy
math::XYZVectorF momentumAtVtxWithConstraint
Definition: GsfElectron.h:262
ESHandle< TrackerGeometry > geometry
void applyEcalRegression(reco::GsfElectron &electron, const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< EcalRecHitCollection > &rechitsEB, const edm::Handle< EcalRecHitCollection > &rechitsEE) const
const EleTkIsolFromCands tkIsol04Calc_
const EleTkIsolFromCands tkIsolHEEP03Calc_
std::pair< reco::TrackRef, float > getClosestCtfToGsf(reco::GsfTrackRef const &, edm::Handle< reco::TrackCollection > const &ctfTracksH)
reco::GsfElectron::Classification classifyElectron(reco::GsfElectron const &)
ElectronHcalHelper hcalHelperPflow_
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
void GsfElectronAlgo::setCutBasedPreselectionFlag ( reco::GsfElectron ele,
const reco::BeamSpot bs 
) const
private

Definition at line 587 of file GsfElectronAlgo.cc.

References funct::abs(), edm::RefToBase< T >::castTo(), looper::cfg, cfg_, reco::GsfElectron::core(), GsfElectronAlgo::Configuration::cuts, GsfElectronAlgo::Configuration::cutsPflow, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), hgcalTestNeighbor_cfi::detector, EcalBarrel, EcalEndcap, reco::GsfElectron::eSuperClusterOverP(), PVValHelper::eta, Exception, GsfElectronAlgo::StrategyConfiguration::gedElectronMode, reco::GsfElectron::gsfTrack(), reco::GsfElectron::hcalDepth1OverEcal(), reco::GsfElectron::hcalDepth2OverEcal(), reco::GsfElectron::hcalOverEcal(), reco::GsfElectron::hcalOverEcalBc(), reco::CaloCluster::hitsAndFractions(), GsfElectronAlgo::CutsConfiguration::isBarrel, reco::GsfElectron::isEB(), reco::GsfElectron::isEBEEGap(), reco::GsfElectron::isEBEtaGap(), reco::GsfElectron::isEBPhiGap(), reco::GsfElectron::isEE(), reco::GsfElectron::isEEDeeGap(), reco::GsfElectron::isEERingGap(), GsfElectronAlgo::CutsConfiguration::isEndcaps, GsfElectronAlgo::CutsConfiguration::isFiducial, edm::Ref< C, T, F >::isNull(), LogTrace, GsfElectronAlgo::CutsConfiguration::maxDeltaEtaBarrel, GsfElectronAlgo::CutsConfiguration::maxDeltaEtaEndcaps, GsfElectronAlgo::CutsConfiguration::maxDeltaPhiBarrel, GsfElectronAlgo::CutsConfiguration::maxDeltaPhiEndcaps, GsfElectronAlgo::CutsConfiguration::maxEOverPBarrel, GsfElectronAlgo::CutsConfiguration::maxEOverPEndcaps, GsfElectronAlgo::CutsConfiguration::maxHBarrelCone, GsfElectronAlgo::CutsConfiguration::maxHBarrelTower, GsfElectronAlgo::CutsConfiguration::maxHEndcapsCone, GsfElectronAlgo::CutsConfiguration::maxHEndcapsTower, GsfElectronAlgo::CutsConfiguration::maxHOverEBarrelCone, GsfElectronAlgo::CutsConfiguration::maxHOverEBarrelTower, GsfElectronAlgo::CutsConfiguration::maxHOverEEndcapsCone, GsfElectronAlgo::CutsConfiguration::maxHOverEEndcapsTower, GsfElectronAlgo::CutsConfiguration::maxSigmaIetaIetaBarrel, GsfElectronAlgo::CutsConfiguration::maxSigmaIetaIetaEndcaps, GsfElectronAlgo::CutsConfiguration::maxTIP, GsfElectronAlgo::CutsConfiguration::minEOverPBarrel, GsfElectronAlgo::CutsConfiguration::minEOverPEndcaps, GsfElectronAlgo::CutsConfiguration::minSCEtBarrel, GsfElectronAlgo::CutsConfiguration::minSCEtEndcaps, packedPFCandidateRefMixer_cfi::pf, reco::BeamSpot::position(), SurveyInfoScenario_cff::seed, GsfElectronAlgo::CutsConfiguration::seedFromTEC, reco::GsfElectron::setPassCutBasedPreselection(), reco::GsfElectron::sigmaIetaIeta(), GsfElectronAlgo::Configuration::strategy, and reco::GsfElectron::superCluster().

Referenced by createElectron().

587  {
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 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
void setPassCutBasedPreselection(bool flag)
Definition: GsfElectron.h:687
bool isEBEtaGap() const
Definition: GsfElectron.h:333
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
bool isEBEEGap() const
Definition: GsfElectron.h:331
float hcalDepth2OverEcal() const
Definition: GsfElectron.h:418
bool isEERingGap() const
Definition: GsfElectron.h:337
bool isEEDeeGap() const
Definition: GsfElectron.h:336
bool isEE() const
Definition: GsfElectron.h:329
bool isEB() const
Definition: GsfElectron.h:328
const Configuration cfg_
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:209
float sigmaIetaIeta() const
Definition: GsfElectron.h:411
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:228
float hcalOverEcal() const
Definition: GsfElectron.h:419
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float hcalOverEcalBc() const
Definition: GsfElectron.h:425
bool isNull() const
Checks for null.
Definition: Ref.h:235
#define LogTrace(id)
float hcalDepth1OverEcal() const
Definition: GsfElectron.h:417
const CutsConfiguration cutsPflow
REF castTo() const
Definition: RefToBase.h:257
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
const StrategyConfiguration strategy
const CutsConfiguration cuts
bool isEBPhiGap() const
Definition: GsfElectron.h:334
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
const Point & position() const
position
Definition: BeamSpot.h:59
void GsfElectronAlgo::setPixelMatchInfomation ( reco::GsfElectron ele) const
private

Definition at line 1041 of file GsfElectronAlgo.cc.

References edm::RefToBase< T >::castTo(), reco::LeafCandidate::charge(), reco::GsfElectron::gsfTrack(), edm::RefToBase< T >::isNull(), edm::Ref< C, T, F >::isNull(), SurveyInfoScenario_cff::seed, reco::GsfElectron::setPixelMatchDPhi1(), reco::GsfElectron::setPixelMatchDPhi2(), reco::GsfElectron::setPixelMatchDRz1(), reco::GsfElectron::setPixelMatchDRz2(), and reco::GsfElectron::setPixelMatchSubdetectors().

Referenced by createElectron().

1041  {
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 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
void setPixelMatchDRz2(float dRz2)
Definition: GsfElectron.h:849
void setPixelMatchDPhi1(float dPhi1)
Definition: GsfElectron.h:846
int charge() const final
electric charge
void setPixelMatchSubdetectors(int sd1, int sd2)
Definition: GsfElectron.h:845
bool isNull() const
Checks for null.
Definition: Ref.h:235
void setPixelMatchDPhi2(float dPhi2)
Definition: GsfElectron.h:847
REF castTo() const
Definition: RefToBase.h:257
bool isNull() const
Checks for null.
Definition: RefToBase.h:295
void setPixelMatchDRz1(float dRz1)
Definition: GsfElectron.h:848

Member Data Documentation

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> GsfElectronAlgo::caloGeometryToken_
private

Definition at line 261 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), and GsfElectronAlgo().

const edm::ESGetToken<CaloTopology, CaloTopologyRecord> GsfElectronAlgo::caloTopologyToken_
private

Definition at line 262 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), and GsfElectronAlgo().

const Configuration GsfElectronAlgo::cfg_
private
std::unique_ptr<EcalClusterFunctionBaseClass> GsfElectronAlgo::crackCorrectionFunction_
private

Definition at line 270 of file GsfElectronAlgo.h.

Referenced by checkSetup(), createElectron(), and GsfElectronAlgo().

const edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> GsfElectronAlgo::ecalSeveretyLevelAlgoToken_
private

Definition at line 264 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), and GsfElectronAlgo().

ElectronHcalHelper GsfElectronAlgo::hcalHelper_
private

Definition at line 267 of file GsfElectronAlgo.h.

Referenced by beginEvent(), checkSetup(), createElectron(), and GsfElectronAlgo().

ElectronHcalHelper GsfElectronAlgo::hcalHelperPflow_
private

Definition at line 268 of file GsfElectronAlgo.h.

Referenced by beginEvent(), checkSetup(), createElectron(), and GsfElectronAlgo().

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> GsfElectronAlgo::magneticFieldToken_
private

Definition at line 260 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), and GsfElectronAlgo().

RegressionHelper GsfElectronAlgo::regHelper_
private

Definition at line 271 of file GsfElectronAlgo.h.

Referenced by checkSetup(), createElectron(), and GsfElectronAlgo().

std::unique_ptr<EcalClusterFunctionBaseClass> GsfElectronAlgo::superClusterErrorFunction_
private

Definition at line 269 of file GsfElectronAlgo.h.

Referenced by checkSetup(), createElectron(), and GsfElectronAlgo().

const EleTkIsolFromCands GsfElectronAlgo::tkIsol03Calc_
private

Definition at line 255 of file GsfElectronAlgo.h.

Referenced by createElectron(), and GsfElectronAlgo().

const EleTkIsolFromCands GsfElectronAlgo::tkIsol04Calc_
private

Definition at line 256 of file GsfElectronAlgo.h.

Referenced by createElectron(), and GsfElectronAlgo().

const EleTkIsolFromCands GsfElectronAlgo::tkIsolHEEP03Calc_
private

Definition at line 257 of file GsfElectronAlgo.h.

Referenced by createElectron(), and GsfElectronAlgo().

const EleTkIsolFromCands GsfElectronAlgo::tkIsolHEEP04Calc_
private

Definition at line 258 of file GsfElectronAlgo.h.

Referenced by createElectron(), and GsfElectronAlgo().

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> GsfElectronAlgo::trackerGeometryToken_
private

Definition at line 263 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), and GsfElectronAlgo().