CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | 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  PFClusterIsolationConfiguration
 
struct  StrategyConfiguration
 
struct  Tokens
 

Public Member Functions

reco::GsfElectronCollection completeElectrons (edm::Event const &event, edm::EventSetup const &eventSetup, const HeavyObjectCache *hoc)
 
 GsfElectronAlgo (const Tokens &, const StrategyConfiguration &, const CutsConfiguration &cutsCfg, const ElectronHcalHelper::Configuration &hcalCone, const ElectronHcalHelper::Configuration &hcalBc, const IsolationConfiguration &, const PFClusterIsolationConfiguration &, const EcalRecHitsConfiguration &, 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 Types

typedef EcalPFClusterIsolation< reco::GsfElectronElectronEcalPFClusterIsolation
 
typedef HcalPFClusterIsolation< reco::GsfElectronElectronHcalPFClusterIsolation
 

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 &hcalHelperCone, ElectronHcalHelper const &hcalHelperBc, EventData const &eventData, CaloTopology const &topology, CaloGeometry const &geometry, EcalPFRecHitThresholds const &thresholds) 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 *, egamma::conv::TrackTableView ctfTable, egamma::conv::TrackTableView gsfTable, EcalPFRecHitThresholds const &thresholds)
 
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_
 
std::unique_ptr< ElectronEcalPFClusterIsolationecalisoAlgo_
 
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcdecalPFRechitThresholdsToken_
 
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdecalSeveretyLevelAlgoToken_
 
ElectronHcalHelper hcalHelperBc_
 
ElectronHcalHelper hcalHelperCone_
 
std::unique_ptr< ElectronHcalPFClusterIsolationhcalisoAlgo_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
RegressionHelper regHelper_
 
const EleTkIsolFromCands::Configuration tkIsol03CalcCfg_
 
const EleTkIsolFromCands::Configuration tkIsol04CalcCfg_
 
const EleTkIsolFromCands::Configuration tkIsolHEEP03CalcCfg_
 
const EleTkIsolFromCands::Configuration tkIsolHEEP04CalcCfg_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 

Detailed Description

Definition at line 54 of file GsfElectronAlgo.h.

Member Typedef Documentation

◆ ElectronEcalPFClusterIsolation

Definition at line 301 of file GsfElectronAlgo.h.

◆ ElectronHcalPFClusterIsolation

Definition at line 303 of file GsfElectronAlgo.h.

Constructor & Destructor Documentation

◆ GsfElectronAlgo()

GsfElectronAlgo::GsfElectronAlgo ( const Tokens input,
const StrategyConfiguration strategy,
const CutsConfiguration cutsCfg,
const ElectronHcalHelper::Configuration hcalCone,
const ElectronHcalHelper::Configuration hcalBc,
const IsolationConfiguration iso,
const PFClusterIsolationConfiguration pfiso,
const EcalRecHitsConfiguration recHits,
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 
)

PF ECAL cluster based isolations

Definition at line 396 of file GsfElectronAlgo.cc.

References input, and FastTrackerRecHitMaskProducer_cfi::recHits.

411  : cfg_{input, strategy, cuts, iso, pfiso, recHits},
412  tkIsol03CalcCfg_(tkIsol03),
413  tkIsol04CalcCfg_(tkIsol04),
414  tkIsolHEEP03CalcCfg_(tkIsolHEEP03),
415  tkIsolHEEP04CalcCfg_(tkIsolHEEP04),
416  magneticFieldToken_{cc.esConsumes()},
417  caloGeometryToken_{cc.esConsumes()},
418  caloTopologyToken_{cc.esConsumes()},
419  trackerGeometryToken_{cc.esConsumes()},
420  ecalSeveretyLevelAlgoToken_{cc.esConsumes()},
421  ecalPFRechitThresholdsToken_{cc.esConsumes()},
422  hcalHelperCone_{hcalCone, std::move(cc)},
423  hcalHelperBc_{hcalBc, std::move(cc)},
424  crackCorrectionFunction_{std::forward<std::unique_ptr<EcalClusterFunctionBaseClass>>(crackCorrectionFunction)},
426 
427 {
429  ecalisoAlgo_ = std::make_unique<ElectronEcalPFClusterIsolation>(pfiso.ecaldrMax,
430  pfiso.ecaldrVetoBarrel,
431  pfiso.ecaldrVetoEndcap,
432  pfiso.ecaletaStripBarrel,
433  pfiso.ecaletaStripEndcap,
434  pfiso.ecalenergyBarrel,
435  pfiso.ecalenergyEndcap);
436  hcalisoAlgo_ = std::make_unique<ElectronHcalPFClusterIsolation>(pfiso.hcaldrMax,
437  pfiso.hcaldrVetoBarrel,
438  pfiso.hcaldrVetoEndcap,
439  pfiso.hcaletaStripBarrel,
440  pfiso.hcaletaStripEndcap,
441  pfiso.hcalenergyBarrel,
442  pfiso.hcalenergyEndcap,
443  pfiso.hcaluseEt);
444 }
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
static std::string const input
Definition: EdmProvDump.cc:50
RegressionHelper regHelper_
const Configuration cfg_
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRechitThresholdsToken_
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSeveretyLevelAlgoToken_
const EleTkIsolFromCands::Configuration tkIsol03CalcCfg_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
const EleTkIsolFromCands::Configuration tkIsolHEEP04CalcCfg_
const StrategyConfiguration strategy
ElectronHcalHelper hcalHelperCone_
ElectronHcalHelper hcalHelperBc_
std::unique_ptr< ElectronHcalPFClusterIsolation > hcalisoAlgo_
std::unique_ptr< ElectronEcalPFClusterIsolation > ecalisoAlgo_
const EleTkIsolFromCands::Configuration tkIsolHEEP03CalcCfg_
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
def move(src, dest)
Definition: eostools.py:511
const EleTkIsolFromCands::Configuration tkIsol04CalcCfg_

Member Function Documentation

◆ beginEvent()

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

Definition at line 455 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::Tokens::barrelRecHitCollection, HLT_2023v12_cff::barrelRecHits, GsfElectronAlgo::Tokens::beamSpotTag, cfg_, GsfElectronAlgo::StrategyConfiguration::computePfClusterIso, GsfElectronAlgo::Tokens::conversions, Reconstruction_hiPF_cff::ctfTracks, GsfElectronAlgo::Tokens::ctfTracks, DetId::Ecal, GsfElectronAlgo::IsolationConfiguration::eMinBarrel, GsfElectronAlgo::IsolationConfiguration::eMinEndcaps, GsfElectronAlgo::Tokens::endcapRecHitCollection, HLT_2023v12_cff::endcapRecHits, GsfElectronAlgo::IsolationConfiguration::etMinBarrel, GsfElectronAlgo::IsolationConfiguration::etMinEndcaps, GsfElectronAlgo::IsolationConfiguration::etMinHcal, GsfElectronAlgo::EventData::event, edmPickEvents::event, GsfElectronAlgo::StrategyConfiguration::fillConvVtxFitProb, GsfElectronAlgo::Tokens::gsfElectronCores, ecalDrivenElectronSeeds_cfi::hbheRecHits, GsfElectronAlgo::Tokens::hbheRecHitsTag, ElectronHcalHelper::hcalChannelQuality(), hcalHelperCone_, ElectronHcalHelper::hcalSevLvlComputer(), ElectronHcalHelper::hcalTopology(), GsfElectronAlgo::IsolationConfiguration::intRadiusEcalBarrel, GsfElectronAlgo::IsolationConfiguration::intRadiusEcalEndcaps, GsfElectronAlgo::IsolationConfiguration::intRadiusHcal, EgammaHcalIsolation::isBehindClusterSeed, GsfElectronAlgo::Configuration::iso, GsfElectronAlgo::IsolationConfiguration::jurassicWidth, ElectronHcalHelper::maxSeverityHB(), ElectronHcalHelper::maxSeverityHE(), GsfElectronAlgo::Tokens::pfClusterProducer, GsfElectronAlgo::Tokens::pfClusterProducerHCAL, GsfElectronAlgo::Tokens::pfClusterProducerHFEM, GsfElectronAlgo::Tokens::pfClusterProducerHFHAD, GsfElectronAlgo::Configuration::pfiso, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, GsfElectronAlgo::Configuration::recHits, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, GsfElectronAlgo::Tokens::seedsTag, GsfElectronAlgo::Configuration::strategy, tkIsol03CalcCfg_, tkIsol04CalcCfg_, tkIsolHEEP03CalcCfg_, tkIsolHEEP04CalcCfg_, GsfElectronAlgo::Configuration::tokens, ElectronHcalHelper::towerMap(), GsfElectronAlgo::PFClusterIsolationConfiguration::useHF, GsfElectronAlgo::IsolationConfiguration::useNumCrystals, GsfElectronAlgo::IsolationConfiguration::vetoClustered, GsfElectronAlgo::Tokens::vtxCollectionTag, and EgammaHcalIsolation::withinConeAroundCluster.

Referenced by completeElectrons().

457  {
458  auto const& hbheRecHits = event.get(cfg_.tokens.hbheRecHitsTag);
459 
460  // Isolation algos
461  float egHcalIsoConeSizeOutSmall = 0.3, egHcalIsoConeSizeOutLarge = 0.4;
462  float egHcalIsoConeSizeIn = cfg_.iso.intRadiusHcal, egHcalIsoPtMin = cfg_.iso.etMinHcal;
463 
464  float egIsoConeSizeOutSmall = 0.3, egIsoConeSizeOutLarge = 0.4, egIsoJurassicWidth = cfg_.iso.jurassicWidth;
465  float egIsoPtMinBarrel = cfg_.iso.etMinBarrel, egIsoEMinBarrel = cfg_.iso.eMinBarrel,
466  egIsoConeSizeInBarrel = cfg_.iso.intRadiusEcalBarrel;
467  float egIsoPtMinEndcap = cfg_.iso.etMinEndcaps, egIsoEMinEndcap = cfg_.iso.eMinEndcaps,
468  egIsoConeSizeInEndcap = cfg_.iso.intRadiusEcalEndcaps;
469 
470  auto barrelRecHits = event.getHandle(cfg_.tokens.barrelRecHitCollection);
471  auto endcapRecHits = event.getHandle(cfg_.tokens.endcapRecHitCollection);
472 
474  std::vector<edm::Handle<reco::PFClusterCollection>> hcalPFClusters;
476  ecalPFClusters = event.getHandle(cfg_.tokens.pfClusterProducer);
477  hcalPFClusters.push_back(event.getHandle(cfg_.tokens.pfClusterProducerHCAL));
478  if (cfg_.pfiso.useHF) {
479  hcalPFClusters.push_back(event.getHandle(cfg_.tokens.pfClusterProducerHFEM));
480  hcalPFClusters.push_back(event.getHandle(cfg_.tokens.pfClusterProducerHFHAD));
481  }
482  }
483 
484  auto ctfTracks = event.getHandle(cfg_.tokens.ctfTracks);
485 
486  EventData eventData{
487  .event = &event,
488  .beamspot = &event.get(cfg_.tokens.beamSpotTag),
489  .coreElectrons = event.getHandle(cfg_.tokens.gsfElectronCores),
490  .barrelRecHits = barrelRecHits,
491  .endcapRecHits = endcapRecHits,
492  .currentCtfTracks = ctfTracks,
493  .seeds = event.getHandle(cfg_.tokens.seedsTag),
494  .vertices = event.getHandle(cfg_.tokens.vtxCollectionTag),
495  .conversions = cfg_.strategy.fillConvVtxFitProb ? event.getHandle(cfg_.tokens.conversions)
497 
498  .hadIsolation03 = EgammaHcalIsolation(
500  egHcalIsoConeSizeOutSmall,
502  egHcalIsoConeSizeIn,
503  EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}},
504  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
506  EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}},
507  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
508  egHcalIsoPtMin,
509  egHcalIsoPtMin,
510  egHcalIsoPtMin,
511  egHcalIsoPtMin,
512  egHcalIsoPtMin,
513  egHcalIsoPtMin}},
515  hbheRecHits,
516  caloGeometry,
521  .hadIsolation04 = EgammaHcalIsolation(
523  egHcalIsoConeSizeOutLarge,
525  egHcalIsoConeSizeIn,
526  EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}},
527  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
529  EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}},
530  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
531  egHcalIsoPtMin,
532  egHcalIsoPtMin,
533  egHcalIsoPtMin,
534  egHcalIsoPtMin,
535  egHcalIsoPtMin,
536  egHcalIsoPtMin}},
538  hbheRecHits,
539  caloGeometry,
544  .hadIsolation03Bc = EgammaHcalIsolation(
546  egHcalIsoConeSizeOutSmall,
548  0.,
549  EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}},
550  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
552  EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}},
553  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
554  egHcalIsoPtMin,
555  egHcalIsoPtMin,
556  egHcalIsoPtMin,
557  egHcalIsoPtMin,
558  egHcalIsoPtMin,
559  egHcalIsoPtMin}},
561  hbheRecHits,
562  caloGeometry,
567  .hadIsolation04Bc = EgammaHcalIsolation(
569  egHcalIsoConeSizeOutLarge,
571  0.,
572  EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}},
573  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
575  EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}},
576  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
577  egHcalIsoPtMin,
578  egHcalIsoPtMin,
579  egHcalIsoPtMin,
580  egHcalIsoPtMin,
581  egHcalIsoPtMin,
582  egHcalIsoPtMin}},
584  hbheRecHits,
585  caloGeometry,
590 
591  .ecalBarrelIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall,
592  egIsoConeSizeInBarrel,
593  egIsoJurassicWidth,
594  egIsoPtMinBarrel,
595  egIsoEMinBarrel,
596  &caloGeometry,
597  *barrelRecHits,
598  &ecalSeveretyLevelAlgo,
599  DetId::Ecal),
600  .ecalBarrelIsol04 = EgammaRecHitIsolation(egIsoConeSizeOutLarge,
601  egIsoConeSizeInBarrel,
602  egIsoJurassicWidth,
603  egIsoPtMinBarrel,
604  egIsoEMinBarrel,
605  &caloGeometry,
606  *barrelRecHits,
607  &ecalSeveretyLevelAlgo,
608  DetId::Ecal),
609  .ecalEndcapIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall,
610  egIsoConeSizeInEndcap,
611  egIsoJurassicWidth,
612  egIsoPtMinEndcap,
613  egIsoEMinEndcap,
614  &caloGeometry,
615  *endcapRecHits,
616  &ecalSeveretyLevelAlgo,
617  DetId::Ecal),
618  .ecalEndcapIsol04 = EgammaRecHitIsolation(egIsoConeSizeOutLarge,
619  egIsoConeSizeInEndcap,
620  egIsoJurassicWidth,
621  egIsoPtMinEndcap,
622  egIsoEMinEndcap,
623  &caloGeometry,
624  *endcapRecHits,
625  &ecalSeveretyLevelAlgo,
626  DetId::Ecal),
627  .tkIsol03Calc = EleTkIsolFromCands(tkIsol03CalcCfg_, *ctfTracks),
628  .tkIsol04Calc = EleTkIsolFromCands(tkIsol04CalcCfg_, *ctfTracks),
629  .tkIsolHEEP03Calc = EleTkIsolFromCands(tkIsolHEEP03CalcCfg_, *ctfTracks),
630  .tkIsolHEEP04Calc = EleTkIsolFromCands(tkIsolHEEP04CalcCfg_, *ctfTracks),
631  .originalCtfTracks = {},
632  .originalGsfTracks = {},
633 
634  .ecalClustersHandle = ecalPFClusters,
635  .hcalClustersHandle = hcalPFClusters
636 
637  };
638 
639  eventData.ecalBarrelIsol03.setUseNumCrystals(cfg_.iso.useNumCrystals);
640  eventData.ecalBarrelIsol03.setVetoClustered(cfg_.iso.vetoClustered);
641  eventData.ecalBarrelIsol03.doSeverityChecks(eventData.barrelRecHits.product(),
643  eventData.ecalBarrelIsol03.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedBarrel);
644  eventData.ecalBarrelIsol04.setUseNumCrystals(cfg_.iso.useNumCrystals);
645  eventData.ecalBarrelIsol04.setVetoClustered(cfg_.iso.vetoClustered);
646  eventData.ecalBarrelIsol04.doSeverityChecks(eventData.barrelRecHits.product(),
648  eventData.ecalBarrelIsol04.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedBarrel);
649  eventData.ecalEndcapIsol03.setUseNumCrystals(cfg_.iso.useNumCrystals);
650  eventData.ecalEndcapIsol03.setVetoClustered(cfg_.iso.vetoClustered);
651  eventData.ecalEndcapIsol03.doSeverityChecks(eventData.endcapRecHits.product(),
653  eventData.ecalEndcapIsol03.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedEndcaps);
654  eventData.ecalEndcapIsol04.setUseNumCrystals(cfg_.iso.useNumCrystals);
655  eventData.ecalEndcapIsol04.setVetoClustered(cfg_.iso.vetoClustered);
656  eventData.ecalEndcapIsol04.doSeverityChecks(eventData.endcapRecHits.product(),
658  eventData.ecalEndcapIsol04.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedEndcaps);
659 
660  return eventData;
661 }
edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitsTag
edm::EDGetTokenT< reco::ConversionCollection > conversions
const auto towerMap() const
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHFEM
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHCAL
edm::EDGetTokenT< reco::VertexCollection > vtxCollectionTag
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHFHAD
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
const Configuration cfg_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
const EleTkIsolFromCands::Configuration tkIsol03CalcCfg_
const IsolationConfiguration iso
edm::EDGetTokenT< reco::TrackCollection > ctfTracks
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
const EleTkIsolFromCands::Configuration tkIsolHEEP04CalcCfg_
const PFClusterIsolationConfiguration pfiso
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducer
const StrategyConfiguration strategy
const EcalRecHitsConfiguration recHits
ElectronHcalHelper hcalHelperCone_
const auto hcalTopology() const
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
const auto hcalChannelQuality() const
std::array< double, 4 > arrayHB
const EleTkIsolFromCands::Configuration tkIsolHEEP03CalcCfg_
const EleTkIsolFromCands::Configuration tkIsol04CalcCfg_
Definition: event.py:1
const auto hcalSevLvlComputer() const
std::array< double, 7 > arrayHE

◆ calculateSaturationInfo()

reco::GsfElectron::SaturationInfo GsfElectronAlgo::calculateSaturationInfo ( const reco::SuperClusterRef theClus,
EventData const &  eventData 
) const
private

Definition at line 276 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, hgcalTestNeighbor_cfi::detector, EcalBarrel, ecalRecHit_cfi::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().

277  {
279 
280  const reco::CaloCluster& seedCluster = *(theClus->seed());
281  DetId seedXtalId = seedCluster.seed();
282  int detector = seedXtalId.subdetId();
283  const EcalRecHitCollection* ecalRecHits = nullptr;
284  if (detector == EcalBarrel)
285  ecalRecHits = eventData.barrelRecHits.product();
286  else
287  ecalRecHits = eventData.endcapRecHits.product();
288 
289  int nSaturatedXtals = 0;
290  bool isSeedSaturated = false;
291  for (auto&& hitFractionPair : theClus->hitsAndFractions()) {
292  auto&& ecalRecHit = ecalRecHits->find(hitFractionPair.first);
293  if (ecalRecHit == ecalRecHits->end())
294  continue;
295  if (ecalRecHit->checkFlag(EcalRecHit::Flags::kSaturated)) {
296  nSaturatedXtals++;
297  if (seedXtalId == ecalRecHit->detid())
298  isSeedSaturated = true;
299  }
300  }
301  si.nSaturatedXtals = nSaturatedXtals;
302  si.isSeedSaturated = isSeedSaturated;
303 
304  return si;
305 }
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:219
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
iterator find(key_type k)

◆ calculateShowerShape()

template<bool full5x5>
reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape ( const reco::SuperClusterRef theClus,
ElectronHcalHelper const &  hcalHelperCone,
ElectronHcalHelper const &  hcalHelperBc,
EventData const &  eventData,
CaloTopology const &  topology,
CaloGeometry const &  geometry,
EcalPFRecHitThresholds const &  thresholds 
) const
private

Definition at line 308 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::EventData::barrelRecHits, cfg_, GsfElectronAlgo::Configuration::cuts, 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(), ElectronHcalHelper::hcalESum(), reco::GsfElectron::ShowerShape::hcalOverEcal, reco::GsfElectron::ShowerShape::hcalOverEcalBc, ElectronHcalHelper::hcalTowersBehindClusters(), reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), l1ctLayer2EG_cff::id, reco::GsfElectron::ShowerShape::invalidHcal, edm::isNotFinite(), EgammaLocalCovParamDefaults::kRelEnCut, GsfElectronAlgo::CutsConfiguration::multThresEB, GsfElectronAlgo::CutsConfiguration::multThresEE, reco::GsfElectron::ShowerShape::pre7DepthHcal, reco::GsfElectron::ShowerShape::r9, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps, FastTrackerRecHitMaskProducer_cfi::recHits, GsfElectronAlgo::Configuration::recHits, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel, GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps, L1EGammaClusterEmuProducer_cfi::scale, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIetaIphi, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), DetId::subdetId(), particleFlowZeroSuppressionECAL_cff::thresholds, and parallelization::uint.

314  {
315  using ClusterTools = EcalClusterToolsT<full5x5>;
316  reco::GsfElectron::ShowerShape showerShape;
317 
318  const reco::CaloCluster& seedCluster = *(theClus->seed());
319  // temporary, till CaloCluster->seed() is made available
320  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first;
321  int detector = seedXtalId.subdetId();
322 
323  const EcalRecHitCollection* recHits = nullptr;
324  std::vector<int> recHitFlagsToBeExcluded;
325  std::vector<int> recHitSeverityToBeExcluded;
326  if (detector == EcalBarrel) {
327  recHits = eventData.barrelRecHits.product();
328  recHitFlagsToBeExcluded = cfg_.recHits.recHitFlagsToBeExcludedBarrel;
329  recHitSeverityToBeExcluded = cfg_.recHits.recHitSeverityToBeExcludedBarrel;
330  } else {
331  recHits = eventData.endcapRecHits.product();
332  recHitFlagsToBeExcluded = cfg_.recHits.recHitFlagsToBeExcludedEndcaps;
333  recHitSeverityToBeExcluded = cfg_.recHits.recHitSeverityToBeExcludedEndcaps;
334  }
335 
336  const auto& covariances = ClusterTools::covariances(seedCluster, recHits, &topology, &geometry);
337 
338  // do noise-cleaning for full5x5, by passing per crystal PF recHit thresholds and mult values
339  // mult values for EB and EE were obtained by dedicated studies
340  const auto& localCovariances = full5x5 ? ClusterTools::localCovariances(seedCluster,
341  recHits,
342  &topology,
344  &thresholds,
347  : ClusterTools::localCovariances(seedCluster, recHits, &topology);
348 
349  showerShape.sigmaEtaEta = sqrt(covariances[0]);
350  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]);
351  if (!edm::isNotFinite(localCovariances[2]))
352  showerShape.sigmaIphiIphi = sqrt(localCovariances[2]);
353  showerShape.e1x5 = ClusterTools::e1x5(seedCluster, recHits, &topology);
354  showerShape.e2x5Max = ClusterTools::e2x5Max(seedCluster, recHits, &topology);
355  showerShape.e5x5 = ClusterTools::e5x5(seedCluster, recHits, &topology);
356  showerShape.r9 = ClusterTools::e3x3(seedCluster, recHits, &topology) / theClus->rawEnergy();
357 
358  const float scale = full5x5 ? showerShape.e5x5 : theClus->energy();
359 
360  for (uint id = 0; id < showerShape.hcalOverEcal.size(); ++id) {
361  showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*theClus, id + 1) / scale;
362  showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*theClus, id + 1) / scale;
363  }
364  showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*theClus);
365  showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*theClus);
366  showerShape.pre7DepthHcal = false;
367 
368  // extra shower shapes
369  const float see_by_spp = showerShape.sigmaIetaIeta * showerShape.sigmaIphiIphi;
370  if (see_by_spp > 0) {
371  showerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp;
372  } else if (localCovariances[1] > 0) {
373  showerShape.sigmaIetaIphi = 1.f;
374  } else {
375  showerShape.sigmaIetaIphi = -1.f;
376  }
377  showerShape.eMax = ClusterTools::eMax(seedCluster, recHits);
378  showerShape.e2nd = ClusterTools::e2nd(seedCluster, recHits);
379  showerShape.eTop = ClusterTools::eTop(seedCluster, recHits, &topology);
380  showerShape.eLeft = ClusterTools::eLeft(seedCluster, recHits, &topology);
381  showerShape.eRight = ClusterTools::eRight(seedCluster, recHits, &topology);
382  showerShape.eBottom = ClusterTools::eBottom(seedCluster, recHits, &topology);
383 
384  showerShape.e2x5Left = ClusterTools::e2x5Left(seedCluster, recHits, &topology);
385  showerShape.e2x5Right = ClusterTools::e2x5Right(seedCluster, recHits, &topology);
386  showerShape.e2x5Top = ClusterTools::e2x5Top(seedCluster, recHits, &topology);
387  showerShape.e2x5Bottom = ClusterTools::e2x5Bottom(seedCluster, recHits, &topology);
388 
389  return showerShape;
390 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
const Configuration cfg_
std::array< float, 7 > hcalOverEcal
Definition: GsfElectron.h:371
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< CaloTowerDetId > hcalTowersBehindClusters
Definition: GsfElectron.h:374
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
std::array< float, 7 > hcalOverEcalBc
Definition: GsfElectron.h:373
const CutsConfiguration cuts
const EcalRecHitsConfiguration recHits

◆ checkSetup()

void GsfElectronAlgo::checkSetup ( edm::EventSetup const &  eventSetup)
private

◆ completeElectrons()

reco::GsfElectronCollection GsfElectronAlgo::completeElectrons ( edm::Event const &  event,
edm::EventSetup const &  eventSetup,
const HeavyObjectCache hoc 
)

Definition at line 663 of file GsfElectronAlgo.cc.

References ElectronHcalHelper::beginEvent(), beginEvent(), GsfElectronAlgo::ElectronData::calculateTSOS(), caloGeometryToken_, caloTopologyToken_, checkSetup(), GsfElectronAlgo::ElectronData::coreRef, createElectron(), GsfElectronAlgo::ElectronData::ctfTrackRef, ecalPFRechitThresholdsToken_, ecalSeveretyLevelAlgoToken_, pwdgSkimBPark_cfi::electrons, options_cfi::eventSetup, hcalHelperBc_, hcalHelperCone_, mps_fire::i, edm::Ref< C, T, F >::isNull(), HLT_2023v12_cff::magneticField, magneticFieldToken_, particleFlowZeroSuppressionECAL_cff::thresholds, and trackerGeometryToken_.

665  {
667 
668  auto const& magneticField = eventSetup.getData(magneticFieldToken_);
669  auto const& caloGeometry = eventSetup.getData(caloGeometryToken_);
670  auto const& caloTopology = eventSetup.getData(caloTopologyToken_);
671  auto const& trackerGeometry = eventSetup.getData(trackerGeometryToken_);
672  auto const& ecalSeveretyLevelAlgo = eventSetup.getData(ecalSeveretyLevelAlgoToken_);
673  auto const& thresholds = eventSetup.getData(ecalPFRechitThresholdsToken_);
674 
675  // prepare access to hcal data
678 
680  auto eventData = beginEvent(event, caloGeometry, ecalSeveretyLevelAlgo);
681  double magneticFieldInTesla = magneticField.inTesla(GlobalPoint(0., 0., 0.)).z();
682 
683  MultiTrajectoryStateTransform mtsTransform(&trackerGeometry, &magneticField);
684  GsfConstraintAtVertex constraintAtVtx(&trackerGeometry, &magneticField);
685 
686  std::optional<egamma::conv::TrackTable> ctfTrackTable = std::nullopt;
687  std::optional<egamma::conv::TrackTable> gsfTrackTable = std::nullopt;
688 
689  const GsfElectronCoreCollection* coreCollection = eventData.coreElectrons.product();
690  for (unsigned int i = 0; i < coreCollection->size(); ++i) {
691  // check there is no existing electron with this core
692  const GsfElectronCoreRef coreRef = edm::Ref<GsfElectronCoreCollection>(eventData.coreElectrons, i);
693 
694  // check there is a super-cluster
695  if (coreRef->superCluster().isNull())
696  continue;
697 
698  // prepare internal structure for electron specific data
699  ElectronData electronData(coreRef, *eventData.beamspot);
700 
701  // calculate and check Trajectory StatesOnSurface....
702  if (!electronData.calculateTSOS(mtsTransform, constraintAtVtx))
703  continue;
704 
705  eventData.retreiveOriginalTrackCollections(electronData.ctfTrackRef, electronData.coreRef->gsfTrack());
706 
707  if (!eventData.originalCtfTracks.isValid()) {
708  eventData.originalCtfTracks = eventData.currentCtfTracks;
709  }
710 
711  if (ctfTrackTable == std::nullopt) {
712  ctfTrackTable = egamma::conv::TrackTable(*eventData.originalCtfTracks);
713  }
714  if (gsfTrackTable == std::nullopt) {
715  gsfTrackTable = egamma::conv::TrackTable(*eventData.originalGsfTracks);
716  }
717 
719  electronData,
720  eventData,
721  caloTopology,
722  caloGeometry,
723  mtsTransform,
724  magneticFieldInTesla,
725  hoc,
726  ctfTrackTable.value(),
727  gsfTrackTable.value(),
728  thresholds);
729 
730  } // loop over tracks
731  return electrons;
732 }
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void createElectron(reco::GsfElectronCollection &electrons, ElectronData &electronData, EventData &eventData, CaloTopology const &topology, CaloGeometry const &geometry, MultiTrajectoryStateTransform const &mtsTransform, double magneticFieldInTesla, const HeavyObjectCache *, egamma::conv::TrackTableView ctfTable, egamma::conv::TrackTableView gsfTable, EcalPFRecHitThresholds const &thresholds)
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRechitThresholdsToken_
const edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSeveretyLevelAlgoToken_
void checkSetup(edm::EventSetup const &eventSetup)
void beginEvent(const edm::Event &evt, const edm::EventSetup &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_
edm::soa::AddColumns< edm::soa::PtEtaPhiTable, TrackTableSpecificColumns >::type TrackTable
ElectronHcalHelper hcalHelperCone_
ElectronHcalHelper hcalHelperBc_
EventData beginEvent(edm::Event const &event, CaloGeometry const &caloGeometry, EcalSeverityLevelAlgo const &ecalSeveretyLevelAlgo)
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
Definition: event.py:1

◆ createElectron()

void GsfElectronAlgo::createElectron ( reco::GsfElectronCollection electrons,
ElectronData electronData,
EventData eventData,
CaloTopology const &  topology,
CaloGeometry const &  geometry,
MultiTrajectoryStateTransform const &  mtsTransform,
double  magneticFieldInTesla,
const HeavyObjectCache hoc,
egamma::conv::TrackTableView  ctfTable,
egamma::conv::TrackTableView  gsfTable,
EcalPFRecHitThresholds const &  thresholds 
)
private

Definition at line 852 of file GsfElectronAlgo.cc.

References funct::abs(), RegressionHelper::applyCombinationRegression(), RegressionHelper::applyEcalRegression(), GsfElectronAlgo::EventData::barrelRecHits, GsfElectronAlgo::EventData::beamspot, GsfElectronAlgo::ElectronData::calculateMode(), GsfElectronAlgo::ElectronData::calculateMomentum(), calculateSaturationInfo(), cfg_, haddnano::cl, egamma::classBasedElectronEnergy(), egamma::classBasedElectronEnergyUncertainty(), egamma::classifyElectron(), GsfElectronAlgo::ElectronData::computeCharge(), GsfElectronAlgo::StrategyConfiguration::computePfClusterIso, GsfElectronAlgo::EventData::conversions, GsfElectronAlgo::ElectronData::coreRef, egamma::correctElectronMomentum(), crackCorrectionFunction_, reco::GsfElectron::ClosestCtfTrack::ctfTrack, GsfElectronAlgo::ElectronData::ctfTrackRef, Reconstruction_hiPF_cff::ctfTracks, GsfElectronAlgo::EventData::currentCtfTracks, 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, reco::GsfElectron::ConversionRejection::dist, MillePedeFileConverter_cfg::e, EcalBarrel, GsfElectronAlgo::EventData::ecalBarrelIsol03, GsfElectronAlgo::EventData::ecalBarrelIsol04, egamma::ecalClusterEnergyUncertaintyElectronSpecific(), GsfElectronAlgo::EventData::ecalClustersHandle, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalEnergyFromClassBasedParameterization, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalErrorFromClassBasedParameterization, EcalEndcap, GsfElectronAlgo::EventData::ecalEndcapIsol03, GsfElectronAlgo::EventData::ecalEndcapIsol04, ecalisoAlgo_, reco::GsfElectron::IsolationVariables::ecalRecHitSumEt, reco::GsfElectron::TrackClusterMatching::eEleClusterOverPout, ele_convert(), reco::GsfElectron::TrackClusterMatching::electronCluster, pwdgSkimBPark_cfi::electrons, 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, egamma::conv::findConversion(), reco::GsfElectron::ConversionRejection::flags, relativeConstraints::geometry, GsfElectronAlgo::ElectronData::getEleBasicCluster(), EgammaRecHitIsolation::getEtSum(), EgammaHcalIsolation::getHcalEtSum(), EgammaHcalIsolation::getHcalEtSumBc(), ConversionTools::getVtxFitProb(), GsfElectronAlgo::EventData::hadIsolation03, GsfElectronAlgo::EventData::hadIsolation03Bc, GsfElectronAlgo::EventData::hadIsolation04, GsfElectronAlgo::EventData::hadIsolation04Bc, GsfElectronAlgo::EventData::hcalClustersHandle, hcalHelperBc_, hcalHelperCone_, hcalisoAlgo_, reco::GsfElectron::IsolationVariables::hcalRecHitSumEt, reco::GsfElectron::IsolationVariables::hcalRecHitSumEtBc, reco::CaloCluster::hitsAndFractions(), l1ctLayer2EG_cff::id, edm::HandleBase::id(), edm::Ref< C, T, F >::id(), 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 >::isNonnull(), edm::Ref< C, T, F >::isNull(), 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, 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, reco::GsfElectron::IsolationVariables::pre7DepthHcal, GsfElectronAlgo::StrategyConfiguration::PreSelectMVA, GsfElectronAlgo::StrategyConfiguration::pureTrackerDrivenEcalErrorFromSimpleParameterization, reco::GsfElectron::ConversionRejection::radius, regHelper_, HLT_2023v12_cff::region, 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(), reco::GsfElectron::PflowIsolationVariables::sumEcalClusterEt, reco::GsfElectron::PflowIsolationVariables::sumHcalClusterEt, GsfElectronAlgo::ElectronData::superClusterRef, particleFlowZeroSuppressionECAL_cff::thresholds, GsfElectronAlgo::EventData::tkIsol03Calc, GsfElectronAlgo::EventData::tkIsol04Calc, GsfElectronAlgo::EventData::tkIsolHEEP03Calc, GsfElectronAlgo::EventData::tkIsolHEEP04Calc, reco::GsfElectron::IsolationVariables::tkSumPt, reco::GsfElectron::IsolationVariables::tkSumPtHEEP, parallelization::uint, SiStripSubdetector::UNKNOWN, GsfElectronAlgo::StrategyConfiguration::useCombinationRegression, GsfElectronAlgo::StrategyConfiguration::useDefaultEnergyCorrection, 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().

862  {
863  // charge ID
864  int eleCharge;
865  GsfElectron::ChargeInfo eleChargeInfo;
866  electronData.computeCharge(eleCharge, eleChargeInfo);
867 
868  // electron basic cluster
869  CaloClusterPtr elbcRef = electronData.getEleBasicCluster(mtsTransform);
870 
871  // Seed cluster
872  const reco::CaloCluster& seedCluster = *(electronData.superClusterRef->seed());
873 
874  // seed Xtal
875  // temporary, till CaloCluster->seed() is made available
876  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first;
877 
878  electronData.calculateMode();
879 
880  //====================================================
881  // Candidate attributes
882  //====================================================
883 
884  Candidate::LorentzVector momentum = electronData.calculateMomentum();
885 
886  //====================================================
887  // Track-Cluster Matching
888  //====================================================
889 
891  tcMatching.electronCluster = elbcRef;
892  tcMatching.eSuperClusterOverP =
893  (electronData.vtxMom.mag() > 0) ? (electronData.superClusterRef->energy() / electronData.vtxMom.mag()) : (-1.);
894  tcMatching.eSeedClusterOverP =
895  (electronData.vtxMom.mag() > 0.) ? (seedCluster.energy() / electronData.vtxMom.mag()) : (-1);
896  tcMatching.eSeedClusterOverPout =
897  (electronData.seedMom.mag() > 0.) ? (seedCluster.energy() / electronData.seedMom.mag()) : (-1.);
898  tcMatching.eEleClusterOverPout =
899  (electronData.eleMom.mag() > 0.) ? (elbcRef->energy() / electronData.eleMom.mag()) : (-1.);
900 
901  EleRelPointPair scAtVtx(
902  electronData.superClusterRef->position(), electronData.sclPos, eventData.beamspot->position());
903  tcMatching.deltaEtaSuperClusterAtVtx = scAtVtx.dEta();
904  tcMatching.deltaPhiSuperClusterAtVtx = scAtVtx.dPhi();
905 
906  EleRelPointPair seedAtCalo(seedCluster.position(), electronData.seedPos, eventData.beamspot->position());
907  tcMatching.deltaEtaSeedClusterAtCalo = seedAtCalo.dEta();
908  tcMatching.deltaPhiSeedClusterAtCalo = seedAtCalo.dPhi();
909 
910  EleRelPointPair ecAtCalo(elbcRef->position(), electronData.elePos, eventData.beamspot->position());
911  tcMatching.deltaEtaEleClusterAtCalo = ecAtCalo.dEta();
912  tcMatching.deltaPhiEleClusterAtCalo = ecAtCalo.dPhi();
913 
914  //=======================================================
915  // Track extrapolations
916  //=======================================================
917 
919  ele_convert(electronData.vtxPos, tkExtra.positionAtVtx);
920  ele_convert(electronData.sclPos, tkExtra.positionAtCalo);
921  ele_convert(electronData.vtxMom, tkExtra.momentumAtVtx);
922  ele_convert(electronData.sclMom, tkExtra.momentumAtCalo);
923  ele_convert(electronData.seedMom, tkExtra.momentumOut);
924  ele_convert(electronData.eleMom, tkExtra.momentumAtEleClus);
925  ele_convert(electronData.vtxMomWithConstraint, tkExtra.momentumAtVtxWithConstraint);
926 
927  //=======================================================
928  // Closest Ctf Track
929  //=======================================================
930 
932  ctfInfo.ctfTrack = electronData.ctfTrackRef;
933  ctfInfo.shFracInnerHits = electronData.shFracInnerHits;
934 
935  //====================================================
936  // FiducialFlags, using nextToBoundary definition of gaps
937  //====================================================
938 
939  reco::GsfElectron::FiducialFlags fiducialFlags;
940  int region = seedXtalId.det();
941  int detector = seedXtalId.subdetId();
942  double feta = std::abs(electronData.superClusterRef->position().eta());
943  if (detector == EcalBarrel) {
944  fiducialFlags.isEB = true;
945  EBDetId ebdetid(seedXtalId);
946  if (EBDetId::isNextToEtaBoundary(ebdetid)) {
947  if (ebdetid.ietaAbs() == 85) {
948  fiducialFlags.isEBEEGap = true;
949  } else {
950  fiducialFlags.isEBEtaGap = true;
951  }
952  }
953  if (EBDetId::isNextToPhiBoundary(ebdetid)) {
954  fiducialFlags.isEBPhiGap = true;
955  }
956  } else if (detector == EcalEndcap) {
957  fiducialFlags.isEE = true;
958  EEDetId eedetid(seedXtalId);
959  if (EEDetId::isNextToRingBoundary(eedetid)) {
960  if (std::abs(feta) < 2.) {
961  fiducialFlags.isEBEEGap = true;
962  } else {
963  fiducialFlags.isEERingGap = true;
964  }
965  }
966  if (EEDetId::isNextToDBoundary(eedetid)) {
967  fiducialFlags.isEEDeeGap = true;
968  }
970  fiducialFlags.isEE = true;
971  //HGCalDetId eeDetid(seedXtalId);
972  // fill in fiducial information when we know how to use it...
973  } else {
974  throw cms::Exception("GsfElectronAlgo|UnknownXtalRegion")
975  << "createElectron(): do not know if it is a barrel or endcap seed cluster !!!!";
976  }
977 
978  //====================================================
979  // SaturationInfo
980  //====================================================
981 
982  auto saturationInfo = calculateSaturationInfo(electronData.superClusterRef, eventData);
983 
984  //====================================================
985  // ShowerShape
986  //====================================================
987 
988  reco::GsfElectron::ShowerShape showerShape;
989  reco::GsfElectron::ShowerShape full5x5_showerShape;
991  showerShape = calculateShowerShape<false>(
992  electronData.superClusterRef, hcalHelperCone_, hcalHelperBc_, eventData, topology, geometry, thresholds);
993  full5x5_showerShape = calculateShowerShape<true>(
994  electronData.superClusterRef, hcalHelperCone_, hcalHelperBc_, eventData, topology, geometry, thresholds);
995  }
996 
997  //====================================================
998  // ConversionRejection
999  //====================================================
1000 
1001  edm::Handle<reco::TrackCollection> ctfTracks = eventData.originalCtfTracks;
1002  if (!ctfTracks.isValid()) {
1003  ctfTracks = eventData.currentCtfTracks;
1004  }
1005 
1006  {
1007  //get the references to the gsf and ctf tracks that are made
1008  //by the electron
1009  const reco::TrackRef el_ctftrack = electronData.coreRef->ctfTrack();
1010  const reco::GsfTrackRef& el_gsftrack = electronData.coreRef->gsfTrack();
1011 
1012  //protect against the wrong collection being passed to the function
1013  if (el_ctftrack.isNonnull() && el_ctftrack.id() != ctfTracks.id())
1014  throw cms::Exception("ConversionFinderError")
1015  << "ProductID of ctf track collection does not match ProductID of electron's CTF track! \n";
1016  if (el_gsftrack.isNonnull() && el_gsftrack.id() != eventData.originalGsfTracks.id())
1017  throw cms::Exception("ConversionFinderError")
1018  << "ProductID of gsf track collection does not match ProductID of electron's GSF track! \n";
1019  }
1020 
1021  // values of conversionInfo.flag
1022  // -9999 : Partner track was not found
1023  // 0 : Partner track found in the CTF collection using
1024  // 1 : Partner track found in the CTF collection using
1025  // 2 : Partner track found in the GSF collection using
1026  // 3 : Partner track found in the GSF collection using the electron's GSF track
1027  auto conversionInfo = egamma::conv::findConversion(*electronData.coreRef, ctfTable, gsfTable, magneticFieldInTesla);
1028 
1030  conversionVars.flags = conversionInfo.flag;
1031  conversionVars.dist = conversionInfo.dist;
1032  conversionVars.dcot = conversionInfo.dcot;
1033  conversionVars.radius = conversionInfo.radiusOfConversion;
1035  //this is an intentionally bugged version which ignores the GsfTrack
1036  //this is a bug which was introduced in reduced e/gamma where the GsfTrack gets
1037  //relinked to a new collection which means it can no longer match the conversion
1038  //as it matches based on product/id
1039  //we keep this defination for the MVAs
1040  const auto matchedConv = ConversionTools::matchedConversion(
1041  electronData.coreRef->ctfTrack(), *eventData.conversions, eventData.beamspot->position(), 2.0, 1e-6, 0);
1042  conversionVars.vtxFitProb = ConversionTools::getVtxFitProb(matchedConv);
1043  }
1044  if (conversionInfo.conversionPartnerCtfTkIdx) {
1045  conversionVars.partner = TrackBaseRef(reco::TrackRef(ctfTracks, conversionInfo.conversionPartnerCtfTkIdx.value()));
1046  } else if (conversionInfo.conversionPartnerGsfTkIdx) {
1047  conversionVars.partner =
1048  TrackBaseRef(reco::GsfTrackRef(eventData.originalGsfTracks, conversionInfo.conversionPartnerGsfTkIdx.value()));
1049  }
1050 
1051  //====================================================
1052  // Go !
1053  //====================================================
1054 
1055  electrons.emplace_back(eleCharge,
1056  eleChargeInfo,
1057  electronData.coreRef,
1058  tcMatching,
1059  tkExtra,
1060  ctfInfo,
1061  fiducialFlags,
1062  showerShape,
1063  full5x5_showerShape,
1064  conversionVars,
1065  saturationInfo);
1066  auto& ele = electrons.back();
1067  // Will be overwritten later in the case of the regression
1068  ele.setCorrectedEcalEnergyError(egamma::ecalClusterEnergyUncertaintyElectronSpecific(*(ele.superCluster())));
1069  ele.setP4(GsfElectron::P4_FROM_SUPER_CLUSTER, momentum, 0, true);
1070  ele.setMass(0.0);
1071 
1072  //====================================================
1073  // brems fractions
1074  //====================================================
1075 
1076  if (electronData.innMom.mag() > 0.) {
1077  ele.setTrackFbrem((electronData.innMom.mag() - electronData.outMom.mag()) / electronData.innMom.mag());
1078  }
1079 
1080  // the supercluster is the refined one The seed is not necessarily the first cluster
1081  // hence the use of the electronCluster
1082  SuperClusterRef sc = ele.superCluster();
1083  if (!(sc.isNull())) {
1084  CaloClusterPtr cl = ele.electronCluster();
1085  if (sc->clustersSize() > 1) {
1086  float pf_fbrem = (sc->energy() - cl->energy()) / sc->energy();
1087  ele.setSuperClusterFbrem(pf_fbrem);
1088  } else {
1089  ele.setSuperClusterFbrem(0);
1090  }
1091  }
1092 
1093  //====================================================
1094  // classification and corrections
1095  //====================================================
1096  // classification
1097  const auto elClass = egamma::classifyElectron(ele);
1098  ele.setClassification(elClass);
1099 
1100  bool unexpectedClassification = elClass == GsfElectron::UNKNOWN || elClass > GsfElectron::GAP;
1101  if (unexpectedClassification) {
1102  edm::LogWarning("GsfElectronAlgo") << "unexpected classification";
1103  }
1104 
1105  // ecal energy
1106  if (cfg_.strategy.useEcalRegression) // new
1107  {
1108  regHelper_.applyEcalRegression(ele, *eventData.vertices, *eventData.barrelRecHits, *eventData.endcapRecHits);
1109  } else // original implementation
1110  {
1112  if (ele.core()->ecalDrivenSeed()) {
1113  if (cfg_.strategy.ecalDrivenEcalEnergyFromClassBasedParameterization && !unexpectedClassification) {
1114  if (ele.isEcalEnergyCorrected()) {
1115  edm::LogWarning("ElectronEnergyCorrector::classBasedElectronEnergy") << "already done";
1116  } else {
1117  ele.setCorrectedEcalEnergy(
1118  egamma::classBasedElectronEnergy(ele, *eventData.beamspot, *crackCorrectionFunction_));
1119  }
1120  }
1122  ele.setCorrectedEcalEnergyError(egamma::classBasedElectronEnergyUncertainty(ele));
1123  }
1124  } else {
1126  ele.setCorrectedEcalEnergyError(egamma::simpleElectronEnergyUncertainty(ele));
1127  }
1128  }
1129  }
1130  }
1131 
1132  // momentum
1133  // Keep the default correction running first. The track momentum error is computed in there
1134  if (cfg_.strategy.useDefaultEnergyCorrection && ele.core()->ecalDrivenSeed() && !unexpectedClassification) {
1135  if (ele.p4Error(reco::GsfElectron::P4_COMBINATION) != 999.) {
1136  edm::LogWarning("ElectronMomentumCorrector::correct") << "already done";
1137  } else {
1138  auto p = egamma::correctElectronMomentum(ele, electronData.vtxTSOS);
1139  ele.correctMomentum(p.momentum, p.trackError, p.finalError);
1140  }
1141  }
1143  {
1145  }
1146 
1147  //====================================================
1148  // now isolation variables
1149  //====================================================
1151  dr03.tkSumPt = eventData.tkIsol03Calc(*ele.gsfTrack()).ptSum;
1152  dr04.tkSumPt = eventData.tkIsol04Calc(*ele.gsfTrack()).ptSum;
1153  dr03.tkSumPtHEEP = eventData.tkIsolHEEP03Calc(*ele.gsfTrack()).ptSum;
1154  dr04.tkSumPtHEEP = eventData.tkIsolHEEP04Calc(*ele.gsfTrack()).ptSum;
1155 
1157  for (uint id = 0; id < dr03.hcalRecHitSumEt.size(); ++id) {
1158  dr03.hcalRecHitSumEt[id] = eventData.hadIsolation03.getHcalEtSum(&ele, id + 1);
1159  dr03.hcalRecHitSumEtBc[id] = eventData.hadIsolation03Bc.getHcalEtSumBc(&ele, id + 1);
1160 
1161  dr04.hcalRecHitSumEt[id] = eventData.hadIsolation04.getHcalEtSum(&ele, id + 1);
1162  dr04.hcalRecHitSumEtBc[id] = eventData.hadIsolation04Bc.getHcalEtSumBc(&ele, id + 1);
1163  }
1164 
1165  dr03.ecalRecHitSumEt = eventData.ecalBarrelIsol03.getEtSum(&ele);
1166  dr03.ecalRecHitSumEt += eventData.ecalEndcapIsol03.getEtSum(&ele);
1167 
1168  dr04.ecalRecHitSumEt = eventData.ecalBarrelIsol04.getEtSum(&ele);
1169  dr04.ecalRecHitSumEt += eventData.ecalEndcapIsol04.getEtSum(&ele);
1170  }
1171 
1172  dr03.pre7DepthHcal = false;
1173  dr04.pre7DepthHcal = false;
1174 
1175  ele.setIsolation03(dr03);
1176  ele.setIsolation04(dr04);
1177 
1178  //====================================================
1179  // PFclusters based ISO !
1180  // Added in CMSSW_12_0_1 at this stage to be able to use them in PF ID DNN
1181  //====================================================
1184  isoVariables.sumEcalClusterEt = ecalisoAlgo_->getSum(ele, eventData.ecalClustersHandle);
1185  isoVariables.sumHcalClusterEt = hcalisoAlgo_->getSum(ele, eventData.hcalClustersHandle);
1186  // Other Pfiso variables are initialized at 0 and not used
1187  ele.setPfIsolationVariables(isoVariables);
1188  }
1189 
1190  //====================================================
1191  // preselection flag
1192  //====================================================
1193 
1194  setCutBasedPreselectionFlag(ele, *eventData.beamspot);
1195  //setting mva flag, currently GedGsfElectron and GsfElectron pre-selection flags have desynced
1196  //this is for GedGsfElectrons, GsfElectrons (ie old pre 7X std reco) resets this later on
1197  //in the function "addPfInfo"
1198  //yes this is awful, we'll fix it once we work out how to...
1199  float mvaValue = hoc->sElectronMVAEstimator->mva(ele, *(eventData.vertices));
1200  ele.setPassMvaPreselection(mvaValue > cfg_.strategy.PreSelectMVA);
1201 
1202  //====================================================
1203  // Pixel match variables
1204  //====================================================
1206 
1207  LogTrace("GsfElectronAlgo") << "Constructed new electron with energy " << ele.p4().e();
1208 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
static bool isHGCalDet(DetId::Detector thedet)
identify HGCal cells
Definition: EcalTools.h:49
std::array< float, 7 > hcalRecHitSumEt
Definition: GsfElectron.h:540
void applyCombinationRegression(reco::GsfElectron &ele) const
static bool isNextToEtaBoundary(EBDetId id)
Definition: EBDetId.cc:108
double classBasedElectronEnergyUncertainty(reco::GsfElectron const &)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
void setCutBasedPreselectionFlag(reco::GsfElectron &ele, const reco::BeamSpot &) const
std::array< float, 7 > hcalRecHitSumEtBc
Definition: GsfElectron.h:541
ConversionInfo findConversion(const reco::GsfElectronCore &gsfElectron, TrackTableView ctfTable, TrackTableView gsfTable, float bFieldAtOrigin, float minFracSharedHits=0.45f)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
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)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
#define LogTrace(id)
RegressionHelper regHelper_
const Configuration cfg_
double simpleElectronEnergyUncertainty(reco::GsfElectron const &)
static float getVtxFitProb(const reco::Conversion *conv)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:35
static bool isNextToPhiBoundary(EBDetId id)
Definition: EBDetId.cc:113
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unique_ptr< EcalClusterFunctionBaseClass > crackCorrectionFunction_
static bool isNextToRingBoundary(EEDetId id)
Definition: EEDetId.cc:284
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
float classBasedElectronEnergy(reco::GsfElectron const &, reco::BeamSpot const &, EcalClusterFunctionBaseClass const &crackCorrectionFunction)
static bool isNextToDBoundary(EEDetId id)
Definition: EEDetId.cc:279
bool isNull() const
Checks for null.
Definition: Ref.h:235
reco::GsfElectron::SaturationInfo calculateSaturationInfo(const reco::SuperClusterRef &, EventData const &eventData) const
double energy() const
cluster energy
Definition: CaloCluster.h:149
ProductIndex id() const
Definition: ProductID.h:35
Definition: DetId.h:17
ElectronMomentum correctElectronMomentum(reco::GsfElectron const &, TrajectoryStateOnSurface const &)
float ecalClusterEnergyUncertaintyElectronSpecific(reco::SuperCluster const &superCluster)
Detector
Definition: DetId.h:24
void setPixelMatchInfomation(reco::GsfElectron &) const
void ele_convert(const Type1 &obj1, Type2 &obj2)
void applyEcalRegression(reco::GsfElectron &electron, const reco::VertexCollection &vertices, const EcalRecHitCollection &rechitsEB, const EcalRecHitCollection &rechitsEE) const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
const StrategyConfiguration strategy
math::XYZVectorF momentumAtVtxWithConstraint
Definition: GsfElectron.h:262
ElectronHcalHelper hcalHelperCone_
ElectronHcalHelper hcalHelperBc_
std::unique_ptr< ElectronHcalPFClusterIsolation > hcalisoAlgo_
std::unique_ptr< ElectronEcalPFClusterIsolation > ecalisoAlgo_
Log< level::Warning, false > LogWarning
reco::GsfElectron::Classification classifyElectron(reco::GsfElectron const &)

◆ setCutBasedPreselectionFlag()

void GsfElectronAlgo::setCutBasedPreselectionFlag ( reco::GsfElectron ele,
const reco::BeamSpot bs 
) const
private

Definition at line 734 of file GsfElectronAlgo.cc.

References funct::abs(), cms::cuda::bs, looper::cfg, cfg_, reco::GsfElectron::core(), GsfElectronAlgo::Configuration::cuts, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), hgcalTestNeighbor_cfi::detector, EcalBarrel, EcalEndcap, reco::GsfElectron::eSuperClusterOverP(), PVValHelper::eta, Exception, reco::GsfElectron::gsfTrack(), reco::GsfElectron::hcalOverEcal(), reco::GsfElectron::hcalOverEcalBc(), reco::CaloCluster::hitsAndFractions(), reco::GsfElectron::isEB(), reco::GsfElectron::isEBEEGap(), reco::GsfElectron::isEBEtaGap(), reco::GsfElectron::isEBPhiGap(), reco::GsfElectron::isEE(), reco::GsfElectron::isEEDeeGap(), reco::GsfElectron::isEERingGap(), edm::Ref< C, T, F >::isNull(), LogTrace, packedPFCandidateRefMixer_cfi::pf, fileCollector::seed, GsfElectronAlgo::CutsConfiguration::seedFromTEC, reco::GsfElectron::setPassCutBasedPreselection(), reco::GsfElectron::sigmaIetaIeta(), and reco::GsfElectron::superCluster().

Referenced by createElectron().

734  {
735  // default value
736  ele.setPassCutBasedPreselection(false);
737 
738  // kind of seeding
739  bool eg = ele.core()->ecalDrivenSeed();
740  bool pf = ele.core()->trackerDrivenSeed() && !ele.core()->ecalDrivenSeed();
741  if (eg && pf) {
742  throw cms::Exception("GsfElectronAlgo|BothEcalAndPureTrackerDriven")
743  << "An electron cannot be both egamma and purely pflow";
744  }
745  if ((!eg) && (!pf)) {
746  throw cms::Exception("GsfElectronAlgo|NeitherEcalNorPureTrackerDriven")
747  << "An electron cannot be neither egamma nor purely pflow";
748  }
749 
750  CutsConfiguration const& cfg = cfg_.cuts;
751 
752  // Et cut
753  double etaValue = EleRelPoint(ele.superCluster()->position(), bs.position()).eta();
754  double etValue = ele.superCluster()->energy() / cosh(etaValue);
755  LogTrace("GsfElectronAlgo") << "Et : " << etValue;
756  if (ele.isEB() && (etValue < cfg.minSCEtBarrel))
757  return;
758  if (ele.isEE() && (etValue < cfg.minSCEtEndcaps))
759  return;
760  LogTrace("GsfElectronAlgo") << "Et criteria are satisfied";
761 
762  // E/p cut
763  double eopValue = ele.eSuperClusterOverP();
764  LogTrace("GsfElectronAlgo") << "E/p : " << eopValue;
765  if (ele.isEB() && (eopValue > cfg.maxEOverPBarrel))
766  return;
767  if (ele.isEE() && (eopValue > cfg.maxEOverPEndcaps))
768  return;
769  if (ele.isEB() && (eopValue < cfg.minEOverPBarrel))
770  return;
771  if (ele.isEE() && (eopValue < cfg.minEOverPEndcaps))
772  return;
773  LogTrace("GsfElectronAlgo") << "E/p criteria are satisfied";
774 
775  // HoE cuts
776  LogTrace("GsfElectronAlgo") << "HoE : " << ele.hcalOverEcal();
777  double hoeCone = ele.hcalOverEcal();
778  double hoeBc = ele.hcalOverEcalBc();
779  const reco::CaloCluster& seedCluster = *(ele.superCluster()->seed());
780  int detector = seedCluster.hitsAndFractions()[0].first.subdetId();
781  bool HoEveto = false;
782  double scle = ele.superCluster()->energy();
783 
784  if (detector == EcalBarrel)
785  HoEveto = hoeCone * scle < cfg.maxHBarrelCone || hoeBc * scle < cfg.maxHBarrelBc ||
786  hoeCone < cfg.maxHOverEBarrelCone || hoeBc < cfg.maxHOverEBarrelBc;
787  else if (detector == EcalEndcap)
788  HoEveto = hoeCone * scle < cfg.maxHEndcapsCone || hoeBc * scle < cfg.maxHEndcapsBc ||
789  hoeCone < cfg.maxHOverEEndcapsCone || hoeBc < cfg.maxHOverEEndcapsBc;
790 
791  if (!HoEveto)
792  return;
793  LogTrace("GsfElectronAlgo") << "H/E criteria are satisfied";
794 
795  // delta eta criteria
796  double deta = ele.deltaEtaSuperClusterTrackAtVtx();
797  LogTrace("GsfElectronAlgo") << "delta eta : " << deta;
798  if (ele.isEB() && (std::abs(deta) > cfg.maxDeltaEtaBarrel))
799  return;
800  if (ele.isEE() && (std::abs(deta) > cfg.maxDeltaEtaEndcaps))
801  return;
802  LogTrace("GsfElectronAlgo") << "Delta eta criteria are satisfied";
803 
804  // delta phi criteria
805  double dphi = ele.deltaPhiSuperClusterTrackAtVtx();
806  LogTrace("GsfElectronAlgo") << "delta phi : " << dphi;
807  if (ele.isEB() && (std::abs(dphi) > cfg.maxDeltaPhiBarrel))
808  return;
809  if (ele.isEE() && (std::abs(dphi) > cfg.maxDeltaPhiEndcaps))
810  return;
811  LogTrace("GsfElectronAlgo") << "Delta phi criteria are satisfied";
812 
813  // sigma ieta ieta
814  LogTrace("GsfElectronAlgo") << "sigma ieta ieta : " << ele.sigmaIetaIeta();
815  if (ele.isEB() && (ele.sigmaIetaIeta() > cfg.maxSigmaIetaIetaBarrel))
816  return;
817  if (ele.isEE() && (ele.sigmaIetaIeta() > cfg.maxSigmaIetaIetaEndcaps))
818  return;
819  LogTrace("GsfElectronAlgo") << "Sigma ieta ieta criteria are satisfied";
820 
821  // fiducial
822  if (!ele.isEB() && cfg.isBarrel)
823  return;
824  if (!ele.isEE() && cfg.isEndcaps)
825  return;
826  if (cfg.isFiducial &&
827  (ele.isEBEEGap() || ele.isEBEtaGap() || ele.isEBPhiGap() || ele.isEERingGap() || ele.isEEDeeGap()))
828  return;
829  LogTrace("GsfElectronAlgo") << "Fiducial flags criteria are satisfied";
830 
831  // seed in TEC
832  edm::RefToBase<TrajectorySeed> seed = ele.gsfTrack()->extra()->seedRef();
833  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
834  if (eg && !cfg_.cuts.seedFromTEC) {
835  if (elseed.isNull()) {
836  throw cms::Exception("GsfElectronAlgo|NotElectronSeed") << "The GsfTrack seed is not an ElectronSeed ?!";
837  } else {
838  if (elseed->subDet(1) == 6)
839  return;
840  }
841  }
842 
843  // transverse impact parameter
844  if (std::abs(ele.gsfTrack()->dxy(bs.position())) > cfg.maxTIP)
845  return;
846  LogTrace("GsfElectronAlgo") << "TIP criterion is satisfied";
847 
848  LogTrace("GsfElectronAlgo") << "All cut based criteria are satisfied";
849  ele.setPassCutBasedPreselection(true);
850 }
void setPassCutBasedPreselection(bool flag)
Definition: GsfElectron.h:770
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
bool isEBPhiGap() const
Definition: GsfElectron.h:334
float sigmaIetaIeta() const
Definition: GsfElectron.h:419
bool isEERingGap() const
Definition: GsfElectron.h:337
float hcalOverEcalBc(const ShowerShape &ss, int depth) const
Definition: GsfElectron.h:442
bool isEBEtaGap() const
Definition: GsfElectron.h:333
#define LogTrace(id)
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
bool isEB() const
Definition: GsfElectron.h:328
const Configuration cfg_
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
bool isEBEEGap() const
Definition: GsfElectron.h:331
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isEEDeeGap() const
Definition: GsfElectron.h:336
bool isNull() const
Checks for null.
Definition: Ref.h:235
float hcalOverEcal(const ShowerShape &ss, int depth) const
Definition: GsfElectron.h:425
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:228
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
bool isEE() const
Definition: GsfElectron.h:329
const CutsConfiguration cuts
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155

◆ setPixelMatchInfomation()

void GsfElectronAlgo::setPixelMatchInfomation ( reco::GsfElectron ele) const
private

Definition at line 1211 of file GsfElectronAlgo.cc.

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

Referenced by createElectron().

1211  {
1212  int sd1 = 0;
1213  int sd2 = 0;
1214  float dPhi1 = 0;
1215  float dPhi2 = 0;
1216  float dRz1 = 0;
1217  float dRz2 = 0;
1218  edm::RefToBase<TrajectorySeed> seed = ele.gsfTrack()->extra()->seedRef();
1219  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
1220  if (seed.isNull()) {
1221  } else {
1222  if (elseed.isNull()) {
1223  } else {
1224  sd1 = elseed->subDet(0);
1225  sd2 = elseed->subDet(1);
1226  dPhi1 = (ele.charge() > 0) ? elseed->dPhiPos(0) : elseed->dPhiNeg(0);
1227  dPhi2 = (ele.charge() > 0) ? elseed->dPhiPos(1) : elseed->dPhiNeg(1);
1228  dRz1 = (ele.charge() > 0) ? elseed->dRZPos(0) : elseed->dRZNeg(0);
1229  dRz2 = (ele.charge() > 0) ? elseed->dRZPos(1) : elseed->dRZNeg(1);
1230  }
1231  }
1232  ele.setPixelMatchSubdetectors(sd1, sd2);
1233  ele.setPixelMatchDPhi1(dPhi1);
1234  ele.setPixelMatchDPhi2(dPhi2);
1235  ele.setPixelMatchDRz1(dRz1);
1236  ele.setPixelMatchDRz2(dRz2);
1237 }
void setPixelMatchDRz2(float dRz2)
Definition: GsfElectron.h:933
void setPixelMatchDPhi1(float dPhi1)
Definition: GsfElectron.h:930
void setPixelMatchSubdetectors(int sd1, int sd2)
Definition: GsfElectron.h:929
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
bool isNull() const
Checks for null.
Definition: Ref.h:235
void setPixelMatchDPhi2(float dPhi2)
Definition: GsfElectron.h:931
void setPixelMatchDRz1(float dRz1)
Definition: GsfElectron.h:932
int charge() const final
electric charge

Member Data Documentation

◆ caloGeometryToken_

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

Definition at line 288 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ caloTopologyToken_

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

Definition at line 289 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ cfg_

const Configuration GsfElectronAlgo::cfg_
private

◆ crackCorrectionFunction_

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

Definition at line 297 of file GsfElectronAlgo.h.

Referenced by checkSetup(), and createElectron().

◆ ecalisoAlgo_

std::unique_ptr<ElectronEcalPFClusterIsolation> GsfElectronAlgo::ecalisoAlgo_
private

Definition at line 302 of file GsfElectronAlgo.h.

Referenced by createElectron().

◆ ecalPFRechitThresholdsToken_

const edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> GsfElectronAlgo::ecalPFRechitThresholdsToken_
private

Definition at line 292 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ ecalSeveretyLevelAlgoToken_

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

Definition at line 291 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ hcalHelperBc_

ElectronHcalHelper GsfElectronAlgo::hcalHelperBc_
private

Definition at line 296 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), and createElectron().

◆ hcalHelperCone_

ElectronHcalHelper GsfElectronAlgo::hcalHelperCone_
private

Definition at line 295 of file GsfElectronAlgo.h.

Referenced by beginEvent(), completeElectrons(), and createElectron().

◆ hcalisoAlgo_

std::unique_ptr<ElectronHcalPFClusterIsolation> GsfElectronAlgo::hcalisoAlgo_
private

Definition at line 304 of file GsfElectronAlgo.h.

Referenced by createElectron().

◆ magneticFieldToken_

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

Definition at line 287 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ regHelper_

RegressionHelper GsfElectronAlgo::regHelper_
private

Definition at line 298 of file GsfElectronAlgo.h.

Referenced by checkSetup(), and createElectron().

◆ tkIsol03CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsol03CalcCfg_
private

Definition at line 282 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ tkIsol04CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsol04CalcCfg_
private

Definition at line 283 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ tkIsolHEEP03CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsolHEEP03CalcCfg_
private

Definition at line 284 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ tkIsolHEEP04CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsolHEEP04CalcCfg_
private

Definition at line 285 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ trackerGeometryToken_

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

Definition at line 290 of file GsfElectronAlgo.h.

Referenced by completeElectrons().