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, const HcalPFCuts *hcalCuts)
 
 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 HcalPFCuts *hcalCuts) 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, const HcalPFCuts *hcalCuts)
 
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 304 of file GsfElectronAlgo.h.

◆ ElectronHcalPFClusterIsolation

Definition at line 306 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 400 of file GsfElectronAlgo.cc.

References input, genparticles_cff::iso, and FastTrackerRecHitMaskProducer_cfi::recHits.

415  : cfg_{input, strategy, cuts, iso, pfiso, recHits},
416  tkIsol03CalcCfg_(tkIsol03),
417  tkIsol04CalcCfg_(tkIsol04),
418  tkIsolHEEP03CalcCfg_(tkIsolHEEP03),
419  tkIsolHEEP04CalcCfg_(tkIsolHEEP04),
420  magneticFieldToken_{cc.esConsumes()},
421  caloGeometryToken_{cc.esConsumes()},
422  caloTopologyToken_{cc.esConsumes()},
423  trackerGeometryToken_{cc.esConsumes()},
424  ecalSeveretyLevelAlgoToken_{cc.esConsumes()},
425  ecalPFRechitThresholdsToken_{cc.esConsumes()},
426  hcalHelperCone_{hcalCone, std::move(cc)},
427  hcalHelperBc_{hcalBc, std::move(cc)},
428  crackCorrectionFunction_{std::forward<std::unique_ptr<EcalClusterFunctionBaseClass>>(crackCorrectionFunction)},
430 
431 {
433  ecalisoAlgo_ = std::make_unique<ElectronEcalPFClusterIsolation>(pfiso.ecaldrMax,
434  pfiso.ecaldrVetoBarrel,
435  pfiso.ecaldrVetoEndcap,
436  pfiso.ecaletaStripBarrel,
437  pfiso.ecaletaStripEndcap,
438  pfiso.ecalenergyBarrel,
439  pfiso.ecalenergyEndcap);
440  hcalisoAlgo_ = std::make_unique<ElectronHcalPFClusterIsolation>(pfiso.hcaldrMax,
441  pfiso.hcaldrVetoBarrel,
442  pfiso.hcaldrVetoEndcap,
443  pfiso.hcaletaStripBarrel,
444  pfiso.hcaletaStripEndcap,
445  pfiso.hcalenergyBarrel,
446  pfiso.hcalenergyEndcap,
447  pfiso.hcaluseEt);
448 }
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_
strategy
Definition: nnet_common.h:18
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 459 of file GsfElectronAlgo.cc.

References GsfElectronAlgo::Tokens::barrelRecHitCollection, HLT_2024v14_cff::barrelRecHits, GsfElectronAlgo::Tokens::beamSpotTag, cfg_, GsfElectronAlgo::StrategyConfiguration::computePfClusterIso, GsfElectronAlgo::Tokens::conversions, GsfElectronAlgo::Tokens::ctfTracks, DetId::Ecal, GsfElectronAlgo::IsolationConfiguration::eMinBarrel, GsfElectronAlgo::IsolationConfiguration::eMinEndcaps, GsfElectronAlgo::Tokens::endcapRecHitCollection, HLT_2024v14_cff::endcapRecHits, ElectronHcalHelper::eThresHB(), ElectronHcalHelper::eThresHE(), 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().

461  {
462  auto const& hbheRecHits = event.get(cfg_.tokens.hbheRecHitsTag);
463 
464  // Isolation algos
465  float egHcalIsoConeSizeOutSmall = 0.3, egHcalIsoConeSizeOutLarge = 0.4;
466  float egHcalIsoConeSizeIn = cfg_.iso.intRadiusHcal, egHcalIsoPtMin = cfg_.iso.etMinHcal;
467 
468  float egIsoConeSizeOutSmall = 0.3, egIsoConeSizeOutLarge = 0.4, egIsoJurassicWidth = cfg_.iso.jurassicWidth;
469  float egIsoPtMinBarrel = cfg_.iso.etMinBarrel, egIsoEMinBarrel = cfg_.iso.eMinBarrel,
470  egIsoConeSizeInBarrel = cfg_.iso.intRadiusEcalBarrel;
471  float egIsoPtMinEndcap = cfg_.iso.etMinEndcaps, egIsoEMinEndcap = cfg_.iso.eMinEndcaps,
472  egIsoConeSizeInEndcap = cfg_.iso.intRadiusEcalEndcaps;
473 
474  auto barrelRecHits = event.getHandle(cfg_.tokens.barrelRecHitCollection);
475  auto endcapRecHits = event.getHandle(cfg_.tokens.endcapRecHitCollection);
476 
478  std::vector<edm::Handle<reco::PFClusterCollection>> hcalPFClusters;
480  ecalPFClusters = event.getHandle(cfg_.tokens.pfClusterProducer);
481  hcalPFClusters.push_back(event.getHandle(cfg_.tokens.pfClusterProducerHCAL));
482  if (cfg_.pfiso.useHF) {
483  hcalPFClusters.push_back(event.getHandle(cfg_.tokens.pfClusterProducerHFEM));
484  hcalPFClusters.push_back(event.getHandle(cfg_.tokens.pfClusterProducerHFHAD));
485  }
486  }
487 
488  auto ctfTracks = event.getHandle(cfg_.tokens.ctfTracks);
489 
490  EventData eventData{
491  .event = &event,
492  .beamspot = &event.get(cfg_.tokens.beamSpotTag),
493  .coreElectrons = event.getHandle(cfg_.tokens.gsfElectronCores),
494  .barrelRecHits = barrelRecHits,
495  .endcapRecHits = endcapRecHits,
496  .currentCtfTracks = ctfTracks,
497  .seeds = event.getHandle(cfg_.tokens.seedsTag),
498  .vertices = event.getHandle(cfg_.tokens.vtxCollectionTag),
499  .conversions = cfg_.strategy.fillConvVtxFitProb ? event.getHandle(cfg_.tokens.conversions)
501 
502  .hadIsolation03 = EgammaHcalIsolation(
504  egHcalIsoConeSizeOutSmall,
506  egHcalIsoConeSizeIn,
508  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
511  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
512  egHcalIsoPtMin,
513  egHcalIsoPtMin,
514  egHcalIsoPtMin,
515  egHcalIsoPtMin,
516  egHcalIsoPtMin,
517  egHcalIsoPtMin}},
519  hbheRecHits,
520  caloGeometry,
525  .hadIsolation04 = EgammaHcalIsolation(
527  egHcalIsoConeSizeOutLarge,
529  egHcalIsoConeSizeIn,
531  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
534  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
535  egHcalIsoPtMin,
536  egHcalIsoPtMin,
537  egHcalIsoPtMin,
538  egHcalIsoPtMin,
539  egHcalIsoPtMin,
540  egHcalIsoPtMin}},
542  hbheRecHits,
543  caloGeometry,
548  .hadIsolation03Bc = EgammaHcalIsolation(
550  egHcalIsoConeSizeOutSmall,
552  0.,
554  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
557  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
558  egHcalIsoPtMin,
559  egHcalIsoPtMin,
560  egHcalIsoPtMin,
561  egHcalIsoPtMin,
562  egHcalIsoPtMin,
563  egHcalIsoPtMin}},
565  hbheRecHits,
566  caloGeometry,
571  .hadIsolation04Bc = EgammaHcalIsolation(
573  egHcalIsoConeSizeOutLarge,
575  0.,
577  EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}},
580  EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin,
581  egHcalIsoPtMin,
582  egHcalIsoPtMin,
583  egHcalIsoPtMin,
584  egHcalIsoPtMin,
585  egHcalIsoPtMin,
586  egHcalIsoPtMin}},
588  hbheRecHits,
589  caloGeometry,
594 
595  .ecalBarrelIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall,
596  egIsoConeSizeInBarrel,
597  egIsoJurassicWidth,
598  egIsoPtMinBarrel,
599  egIsoEMinBarrel,
600  &caloGeometry,
601  *barrelRecHits,
602  &ecalSeveretyLevelAlgo,
603  DetId::Ecal),
604  .ecalBarrelIsol04 = EgammaRecHitIsolation(egIsoConeSizeOutLarge,
605  egIsoConeSizeInBarrel,
606  egIsoJurassicWidth,
607  egIsoPtMinBarrel,
608  egIsoEMinBarrel,
609  &caloGeometry,
610  *barrelRecHits,
611  &ecalSeveretyLevelAlgo,
612  DetId::Ecal),
613  .ecalEndcapIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall,
614  egIsoConeSizeInEndcap,
615  egIsoJurassicWidth,
616  egIsoPtMinEndcap,
617  egIsoEMinEndcap,
618  &caloGeometry,
619  *endcapRecHits,
620  &ecalSeveretyLevelAlgo,
621  DetId::Ecal),
622  .ecalEndcapIsol04 = EgammaRecHitIsolation(egIsoConeSizeOutLarge,
623  egIsoConeSizeInEndcap,
624  egIsoJurassicWidth,
625  egIsoPtMinEndcap,
626  egIsoEMinEndcap,
627  &caloGeometry,
628  *endcapRecHits,
629  &ecalSeveretyLevelAlgo,
630  DetId::Ecal),
631  .tkIsol03Calc = EleTkIsolFromCands(tkIsol03CalcCfg_, *ctfTracks),
632  .tkIsol04Calc = EleTkIsolFromCands(tkIsol04CalcCfg_, *ctfTracks),
633  .tkIsolHEEP03Calc = EleTkIsolFromCands(tkIsolHEEP03CalcCfg_, *ctfTracks),
634  .tkIsolHEEP04Calc = EleTkIsolFromCands(tkIsolHEEP04CalcCfg_, *ctfTracks),
635  .originalCtfTracks = {},
636  .originalGsfTracks = {},
637 
638  .ecalClustersHandle = ecalPFClusters,
639  .hcalClustersHandle = hcalPFClusters
640 
641  };
642 
643  eventData.ecalBarrelIsol03.setUseNumCrystals(cfg_.iso.useNumCrystals);
644  eventData.ecalBarrelIsol03.setVetoClustered(cfg_.iso.vetoClustered);
645  eventData.ecalBarrelIsol03.doSeverityChecks(eventData.barrelRecHits.product(),
647  eventData.ecalBarrelIsol03.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedBarrel);
648  eventData.ecalBarrelIsol04.setUseNumCrystals(cfg_.iso.useNumCrystals);
649  eventData.ecalBarrelIsol04.setVetoClustered(cfg_.iso.vetoClustered);
650  eventData.ecalBarrelIsol04.doSeverityChecks(eventData.barrelRecHits.product(),
652  eventData.ecalBarrelIsol04.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedBarrel);
653  eventData.ecalEndcapIsol03.setUseNumCrystals(cfg_.iso.useNumCrystals);
654  eventData.ecalEndcapIsol03.setVetoClustered(cfg_.iso.vetoClustered);
655  eventData.ecalEndcapIsol03.doSeverityChecks(eventData.endcapRecHits.product(),
657  eventData.ecalEndcapIsol03.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedEndcaps);
658  eventData.ecalEndcapIsol04.setUseNumCrystals(cfg_.iso.useNumCrystals);
659  eventData.ecalEndcapIsol04.setVetoClustered(cfg_.iso.vetoClustered);
660  eventData.ecalEndcapIsol04.doSeverityChecks(eventData.endcapRecHits.product(),
662  eventData.ecalEndcapIsol04.doFlagChecks(cfg_.recHits.recHitFlagsToBeExcludedEndcaps);
663 
664  return eventData;
665 }
edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitsTag
EgammaHcalIsolation::arrayHB eThresHB() const
edm::EDGetTokenT< reco::ConversionCollection > conversions
const auto towerMap() const
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducerHFEM
EgammaHcalIsolation::arrayHE eThresHE() const
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 279 of file GsfElectronAlgo.cc.

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

Referenced by createElectron().

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

Definition at line 311 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, electrons_cff::e2nd, reco::GsfElectron::ShowerShape::e2x5Bottom, electrons_cff::e2x5Bottom, reco::GsfElectron::ShowerShape::e2x5Left, electrons_cff::e2x5Left, reco::GsfElectron::ShowerShape::e2x5Max, reco::GsfElectron::ShowerShape::e2x5Right, electrons_cff::e2x5Right, reco::GsfElectron::ShowerShape::e2x5Top, electrons_cff::e2x5Top, reco::GsfElectron::ShowerShape::e5x5, electrons_cff::e5x5, reco::GsfElectron::ShowerShape::eBottom, electrons_cff::eBottom, EcalBarrel, reco::GsfElectron::ShowerShape::eLeft, electrons_cff::eLeft, cosmicPhotonAnalyzer_cfi::eMax, reco::GsfElectron::ShowerShape::eMax, GsfElectronAlgo::EventData::endcapRecHits, reco::GsfElectron::ShowerShape::eRight, electrons_cff::eRight, reco::GsfElectron::ShowerShape::eTop, electrons_cff::eTop, ElectronHcalHelper::hasActiveHcal(), ElectronHcalHelper::hcalESum(), reco::GsfElectron::ShowerShape::hcalOverEcal, reco::GsfElectron::ShowerShape::hcalOverEcalBc, ElectronHcalHelper::hcalTowersBehindClusters(), reco::GsfElectron::ShowerShape::hcalTowersBehindClusters, reco::CaloCluster::hitsAndFractions(), EcalPhiSymFlatTableProducers_cfi::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, isotrackNtupler::scale, reco::GsfElectron::ShowerShape::sigmaEtaEta, reco::GsfElectron::ShowerShape::sigmaIetaIeta, reco::GsfElectron::ShowerShape::sigmaIetaIphi, reco::GsfElectron::ShowerShape::sigmaIphiIphi, mathSSE::sqrt(), DetId::subdetId(), particleFlowZeroSuppressionECAL_cff::thresholds, HLT_2024v14_cff::topology, and parallelization::uint.

318  {
319  using ClusterTools = EcalClusterToolsT<full5x5>;
320  reco::GsfElectron::ShowerShape showerShape;
321 
322  const reco::CaloCluster& seedCluster = *(theClus->seed());
323  // temporary, till CaloCluster->seed() is made available
324  DetId seedXtalId = seedCluster.hitsAndFractions()[0].first;
325  int detector = seedXtalId.subdetId();
326 
327  const EcalRecHitCollection* recHits = nullptr;
328  std::vector<int> recHitFlagsToBeExcluded;
329  std::vector<int> recHitSeverityToBeExcluded;
330  if (detector == EcalBarrel) {
331  recHits = eventData.barrelRecHits.product();
332  recHitFlagsToBeExcluded = cfg_.recHits.recHitFlagsToBeExcludedBarrel;
333  recHitSeverityToBeExcluded = cfg_.recHits.recHitSeverityToBeExcludedBarrel;
334  } else {
335  recHits = eventData.endcapRecHits.product();
336  recHitFlagsToBeExcluded = cfg_.recHits.recHitFlagsToBeExcludedEndcaps;
337  recHitSeverityToBeExcluded = cfg_.recHits.recHitSeverityToBeExcludedEndcaps;
338  }
339 
340  const auto& covariances = ClusterTools::covariances(seedCluster, recHits, &topology, &geometry);
341 
342  // do noise-cleaning for full5x5, by passing per crystal PF recHit thresholds and mult values
343  // mult values for EB and EE were obtained by dedicated studies
344  const auto& localCovariances = full5x5 ? ClusterTools::localCovariances(seedCluster,
345  recHits,
346  &topology,
348  &thresholds,
351  : ClusterTools::localCovariances(seedCluster, recHits, &topology);
352 
353  showerShape.sigmaEtaEta = sqrt(covariances[0]);
354  showerShape.sigmaIetaIeta = sqrt(localCovariances[0]);
355  if (!edm::isNotFinite(localCovariances[2]))
356  showerShape.sigmaIphiIphi = sqrt(localCovariances[2]);
357  showerShape.e1x5 = ClusterTools::e1x5(seedCluster, recHits, &topology);
358  showerShape.e2x5Max = ClusterTools::e2x5Max(seedCluster, recHits, &topology);
359  showerShape.e5x5 = ClusterTools::e5x5(seedCluster, recHits, &topology);
360  showerShape.r9 = ClusterTools::e3x3(seedCluster, recHits, &topology) / theClus->rawEnergy();
361 
362  const float scale = full5x5 ? showerShape.e5x5 : theClus->energy();
363 
364  for (uint id = 0; id < showerShape.hcalOverEcal.size(); ++id) {
365  showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*theClus, id + 1, hcalCuts) / scale;
366  showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*theClus, id + 1, hcalCuts) / scale;
367  }
368  showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*theClus);
369  showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*theClus);
370  showerShape.pre7DepthHcal = false;
371 
372  // extra shower shapes
373  const float see_by_spp = showerShape.sigmaIetaIeta * showerShape.sigmaIphiIphi;
374  if (see_by_spp > 0) {
375  showerShape.sigmaIetaIphi = localCovariances[1] / see_by_spp;
376  } else if (localCovariances[1] > 0) {
377  showerShape.sigmaIetaIphi = 1.f;
378  } else {
379  showerShape.sigmaIetaIphi = -1.f;
380  }
381  showerShape.eMax = ClusterTools::eMax(seedCluster, recHits);
382  showerShape.e2nd = ClusterTools::e2nd(seedCluster, recHits);
383  showerShape.eTop = ClusterTools::eTop(seedCluster, recHits, &topology);
384  showerShape.eLeft = ClusterTools::eLeft(seedCluster, recHits, &topology);
385  showerShape.eRight = ClusterTools::eRight(seedCluster, recHits, &topology);
386  showerShape.eBottom = ClusterTools::eBottom(seedCluster, recHits, &topology);
387 
388  showerShape.e2x5Left = ClusterTools::e2x5Left(seedCluster, recHits, &topology);
389  showerShape.e2x5Right = ClusterTools::e2x5Right(seedCluster, recHits, &topology);
390  showerShape.e2x5Top = ClusterTools::e2x5Top(seedCluster, recHits, &topology);
391  showerShape.e2x5Bottom = ClusterTools::e2x5Bottom(seedCluster, recHits, &topology);
392 
393  return showerShape;
394 }
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:23
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,
const HcalPFCuts hcalCuts 
)

Definition at line 667 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_2024v14_cff::magneticField, magneticFieldToken_, particleFlowZeroSuppressionECAL_cff::thresholds, and trackerGeometryToken_.

670  {
672 
673  auto const& magneticField = eventSetup.getData(magneticFieldToken_);
674  auto const& caloGeometry = eventSetup.getData(caloGeometryToken_);
675  auto const& caloTopology = eventSetup.getData(caloTopologyToken_);
676  auto const& trackerGeometry = eventSetup.getData(trackerGeometryToken_);
677  auto const& ecalSeveretyLevelAlgo = eventSetup.getData(ecalSeveretyLevelAlgoToken_);
678  auto const& thresholds = eventSetup.getData(ecalPFRechitThresholdsToken_);
679 
680  // prepare access to hcal data
683 
685  auto eventData = beginEvent(event, caloGeometry, ecalSeveretyLevelAlgo);
686  double magneticFieldInTesla = magneticField.inTesla(GlobalPoint(0., 0., 0.)).z();
687 
688  MultiTrajectoryStateTransform mtsTransform(&trackerGeometry, &magneticField);
689  GsfConstraintAtVertex constraintAtVtx(&trackerGeometry, &magneticField);
690 
691  std::optional<egamma::conv::TrackTable> ctfTrackTable = std::nullopt;
692  std::optional<egamma::conv::TrackTable> gsfTrackTable = std::nullopt;
693 
694  const GsfElectronCoreCollection* coreCollection = eventData.coreElectrons.product();
695  for (unsigned int i = 0; i < coreCollection->size(); ++i) {
696  // check there is no existing electron with this core
697  const GsfElectronCoreRef coreRef = edm::Ref<GsfElectronCoreCollection>(eventData.coreElectrons, i);
698 
699  // check there is a super-cluster
700  if (coreRef->superCluster().isNull())
701  continue;
702 
703  // prepare internal structure for electron specific data
704  ElectronData electronData(coreRef, *eventData.beamspot);
705 
706  // calculate and check Trajectory StatesOnSurface....
707  if (!electronData.calculateTSOS(mtsTransform, constraintAtVtx))
708  continue;
709 
710  eventData.retreiveOriginalTrackCollections(electronData.ctfTrackRef, electronData.coreRef->gsfTrack());
711 
712  if (!eventData.originalCtfTracks.isValid()) {
713  eventData.originalCtfTracks = eventData.currentCtfTracks;
714  }
715 
716  if (ctfTrackTable == std::nullopt) {
717  ctfTrackTable = egamma::conv::TrackTable(*eventData.originalCtfTracks);
718  }
719  if (gsfTrackTable == std::nullopt) {
720  gsfTrackTable = egamma::conv::TrackTable(*eventData.originalGsfTracks);
721  }
722 
724  electronData,
725  eventData,
726  caloTopology,
727  caloGeometry,
728  mtsTransform,
729  magneticFieldInTesla,
730  hoc,
731  ctfTrackTable.value(),
732  gsfTrackTable.value(),
733  thresholds,
734  hcalCuts);
735 
736  } // loop over tracks
737  return electrons;
738 }
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
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 HcalPFCuts *hcalCuts)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
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:229
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,
const HcalPFCuts hcalCuts 
)
private

Definition at line 858 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, 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(), EcalPhiSymFlatTableProducers_cfi::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(), 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, 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_, nano_mu_digi_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, HLT_2024v14_cff::topology, 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().

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

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

1230  {
1231  int sd1 = 0;
1232  int sd2 = 0;
1233  float dPhi1 = 0;
1234  float dPhi2 = 0;
1235  float dRz1 = 0;
1236  float dRz2 = 0;
1237  edm::RefToBase<TrajectorySeed> seed = ele.gsfTrack()->extra()->seedRef();
1238  ElectronSeedRef elseed = seed.castTo<ElectronSeedRef>();
1239  if (seed.isNull()) {
1240  } else {
1241  if (elseed.isNull()) {
1242  } else {
1243  sd1 = elseed->subDet(0);
1244  sd2 = elseed->subDet(1);
1245  dPhi1 = (ele.charge() > 0) ? elseed->dPhiPos(0) : elseed->dPhiNeg(0);
1246  dPhi2 = (ele.charge() > 0) ? elseed->dPhiPos(1) : elseed->dPhiNeg(1);
1247  dRz1 = (ele.charge() > 0) ? elseed->dRZPos(0) : elseed->dRZNeg(0);
1248  dRz2 = (ele.charge() > 0) ? elseed->dRZPos(1) : elseed->dRZNeg(1);
1249  }
1250  }
1251  ele.setPixelMatchSubdetectors(sd1, sd2);
1252  ele.setPixelMatchDPhi1(dPhi1);
1253  ele.setPixelMatchDPhi2(dPhi2);
1254  ele.setPixelMatchDRz1(dRz1);
1255  ele.setPixelMatchDRz2(dRz2);
1256 }
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:229
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 291 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ caloTopologyToken_

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

Definition at line 292 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ cfg_

const Configuration GsfElectronAlgo::cfg_
private

◆ crackCorrectionFunction_

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

Definition at line 300 of file GsfElectronAlgo.h.

Referenced by checkSetup(), and createElectron().

◆ ecalisoAlgo_

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

Definition at line 305 of file GsfElectronAlgo.h.

Referenced by createElectron().

◆ ecalPFRechitThresholdsToken_

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

Definition at line 295 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ ecalSeveretyLevelAlgoToken_

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

Definition at line 294 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ hcalHelperBc_

ElectronHcalHelper GsfElectronAlgo::hcalHelperBc_
private

Definition at line 299 of file GsfElectronAlgo.h.

Referenced by completeElectrons(), and createElectron().

◆ hcalHelperCone_

ElectronHcalHelper GsfElectronAlgo::hcalHelperCone_
private

Definition at line 298 of file GsfElectronAlgo.h.

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

◆ hcalisoAlgo_

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

Definition at line 307 of file GsfElectronAlgo.h.

Referenced by createElectron().

◆ magneticFieldToken_

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

Definition at line 290 of file GsfElectronAlgo.h.

Referenced by completeElectrons().

◆ regHelper_

RegressionHelper GsfElectronAlgo::regHelper_
private

Definition at line 301 of file GsfElectronAlgo.h.

Referenced by checkSetup(), and createElectron().

◆ tkIsol03CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsol03CalcCfg_
private

Definition at line 285 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ tkIsol04CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsol04CalcCfg_
private

Definition at line 286 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ tkIsolHEEP03CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsolHEEP03CalcCfg_
private

Definition at line 287 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ tkIsolHEEP04CalcCfg_

const EleTkIsolFromCands::Configuration GsfElectronAlgo::tkIsolHEEP04CalcCfg_
private

Definition at line 288 of file GsfElectronAlgo.h.

Referenced by beginEvent().

◆ trackerGeometryToken_

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

Definition at line 293 of file GsfElectronAlgo.h.

Referenced by completeElectrons().