CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
GsfElectronBaseProducer Class Reference

#include <GsfElectronBaseProducer.h>

Inheritance diagram for GsfElectronBaseProducer:
edm::stream::EDProducer< edm::GlobalCache< GsfElectronAlgo::HeavyObjectCache > > GEDGsfElectronProducer GsfElectronProducer

Public Member Functions

 GsfElectronBaseProducer (const edm::ParameterSet &, const GsfElectronAlgo::HeavyObjectCache *)
 
void produce (edm::Event &event, const edm::EventSetup &setup) override
 
 ~GsfElectronBaseProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< GsfElectronAlgo::HeavyObjectCache > >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
static void globalEndJob (GsfElectronAlgo::HeavyObjectCache const *)
 
static std::unique_ptr< GsfElectronAlgo::HeavyObjectCacheinitializeGlobalCache (const edm::ParameterSet &conf)
 

Protected Member Functions

void beginEvent (edm::Event &, const edm::EventSetup &)
 
void fillEvent (reco::GsfElectronCollection &electrons, edm::Event &event)
 
const edm::OrphanHandle< reco::GsfElectronCollection > & orphanHandle () const
 

Protected Attributes

std::unique_ptr< GsfElectronAlgoalgo_
 
const GsfElectronAlgo::CutsConfiguration cutsCfg_
 
const GsfElectronAlgo::CutsConfiguration cutsCfgPflow_
 
edm::ParameterSet edIsoVals_
 
ElectronHcalHelper::Configuration hcalCfg_
 
ElectronHcalHelper::Configuration hcalCfgPflow_
 
GsfElectronAlgo::Tokens inputCfg_
 
edm::ParameterSet pfIsoVals_
 
edm::EDGetTokenT< edm::ValueMap< float > > pfMVA_
 
GsfElectronAlgo::StrategyConfiguration strategyCfg_
 

Private Member Functions

void checkEcalSeedingParameters (edm::ParameterSet const &)
 
bool isPreselected (reco::GsfElectron const &ele) const
 
void setAmbiguityData (reco::GsfElectronCollection &electrons, edm::Event const &event, bool ignoreNotPreselected=true) const
 

Private Attributes

bool ecalSeedingParametersChecked_
 
const edm::EDPutTokenT< reco::GsfElectronCollectionelectronPutToken_
 
edm::OrphanHandle< reco::GsfElectronCollectionorphanHandle_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< GsfElectronAlgo::HeavyObjectCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 26 of file GsfElectronBaseProducer.h.

Constructor & Destructor Documentation

GsfElectronBaseProducer::GsfElectronBaseProducer ( const edm::ParameterSet cfg,
const GsfElectronAlgo::HeavyObjectCache  
)
explicit

Definition at line 238 of file GsfElectronBaseProducer.cc.

References GsfElectronAlgo::StrategyConfiguration::addPflowElectrons, algo_, GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy, GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy, GsfElectronAlgo::StrategyConfiguration::applyAmbResolution, GsfElectronAlgo::StrategyConfiguration::applyPreselection, GsfElectronAlgo::Tokens::barrelRecHitCollection, GsfElectronAlgo::Tokens::beamSpotTag, ElectronHcalHelper::Configuration::checkHcalStatus, gedGsfElectrons_cfi::combinationRegressionWeightLabels, GsfElectronAlgo::Tokens::conversions, GsfElectronAlgo::Tokens::ctfTracks, GsfElectronAlgo::StrategyConfiguration::ctfTracksCheck, cutsCfg_, cutsCfgPflow_, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalEnergyFromClassBasedParameterization, GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalErrorFromClassBasedParameterization, RegressionHelper::Configuration::ecalRegressionWeightLabels, edIsoVals_, GsfElectronAlgo::Tokens::endcapRecHitCollection, electronEcalRecHitIsolationLcone_cfi::etMinBarrel, GsfElectronAlgo::StrategyConfiguration::fillConvVtxFitProb, GsfElectronAlgo::StrategyConfiguration::gedElectronMode, timingPdfMaker::get, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), GsfElectronAlgo::Tokens::gsfElectronCores, GsfElectronAlgo::Tokens::gsfPfRecTracksTag, hcalCfg_, hcalCfgPflow_, ElectronHcalHelper::Configuration::hcalTowers, GsfElectronAlgo::Tokens::hcalTowersTag, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEPtMin, inputCfg_, GsfElectronAlgo::IsolationConfiguration::intRadiusHcal, GsfElectronAlgo::StrategyConfiguration::MaxElePtForOnlyMVA, Skims_PA_cff::name, pfIsoVals_, GsfElectronAlgo::Tokens::pflowGsfElectronsTag, pfMVA_, GsfElectronAlgo::StrategyConfiguration::PreSelectMVA, GsfElectronAlgo::Tokens::previousGsfElectrons, GsfElectronAlgo::StrategyConfiguration::pureTrackerDrivenEcalErrorFromSimpleParameterization, GsfElectronAlgo::Tokens::seedsTag, strategyCfg_, AlCaHLTBitMon_QueryRunRegistry::string, GsfElectronAlgo::StrategyConfiguration::useCombinationRegression, GsfElectronAlgo::StrategyConfiguration::useEcalRegression, GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks, ElectronHcalHelper::Configuration::useTowers, electronEcalRecHitIsolationLcone_cfi::vetoClustered, GsfElectronAlgo::Tokens::vtxCollectionTag, and ~GsfElectronBaseProducer().

239  : cutsCfg_(makeCutsConfiguration(cfg.getParameter<edm::ParameterSet>("preselection"))),
240  cutsCfgPflow_(makeCutsConfiguration(cfg.getParameter<edm::ParameterSet>("preselectionPflow"))),
242  electronPutToken_(produces<GsfElectronCollection>()) {
244  consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("previousGsfElectronsTag"));
246  consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("pflowGsfElectronsTag"));
248  consumes<reco::GsfElectronCoreCollection>(cfg.getParameter<edm::InputTag>("gsfElectronCoresTag"));
249  inputCfg_.hcalTowersTag = consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers"));
251  consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("barrelRecHitCollectionTag"));
253  consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("endcapRecHitCollectionTag"));
254  pfMVA_ = consumes<edm::ValueMap<float>>(cfg.getParameter<edm::InputTag>("pfMvaTag"));
255  inputCfg_.ctfTracks = consumes<reco::TrackCollection>(cfg.getParameter<edm::InputTag>("ctfTracksTag"));
256  // used to check config consistency with seeding
257  inputCfg_.seedsTag = consumes<reco::ElectronSeedCollection>(cfg.getParameter<edm::InputTag>("seedsTag"));
258  inputCfg_.beamSpotTag = consumes<reco::BeamSpot>(cfg.getParameter<edm::InputTag>("beamSpotTag"));
260  consumes<reco::GsfPFRecTrackCollection>(cfg.getParameter<edm::InputTag>("gsfPfRecTracksTag"));
261  inputCfg_.vtxCollectionTag = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("vtxTag"));
262  if (cfg.getParameter<bool>("fillConvVtxFitProb"))
263  inputCfg_.conversions = consumes<reco::ConversionCollection>(cfg.getParameter<edm::InputTag>("conversionsTag"));
264 
265  if (cfg.getParameter<bool>("useIsolationValues")) {
266  pfIsoVals_ = cfg.getParameter<edm::ParameterSet>("pfIsolationValues");
268  mayConsume<edm::ValueMap<double>>(pfIsoVals_.getParameter<edm::InputTag>(name));
269  }
270 
271  edIsoVals_ = cfg.getParameter<edm::ParameterSet>("edIsolationValues");
273  mayConsume<edm::ValueMap<double>>(edIsoVals_.getParameter<edm::InputTag>(name));
274  }
275  }
276 
277  strategyCfg_.useGsfPfRecTracks = cfg.getParameter<bool>("useGsfPfRecTracks");
278  strategyCfg_.applyPreselection = cfg.getParameter<bool>("applyPreselection");
280  cfg.getParameter<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization");
282  cfg.getParameter<bool>("ecalDrivenEcalErrorFromClassBasedParameterization");
284  cfg.getParameter<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization");
285  strategyCfg_.applyAmbResolution = cfg.getParameter<bool>("applyAmbResolution");
286  strategyCfg_.ambSortingStrategy = cfg.getParameter<unsigned>("ambSortingStrategy");
287  strategyCfg_.ambClustersOverlapStrategy = cfg.getParameter<unsigned>("ambClustersOverlapStrategy");
288  strategyCfg_.addPflowElectrons = cfg.getParameter<bool>("addPflowElectrons");
289  strategyCfg_.ctfTracksCheck = cfg.getParameter<bool>("ctfTracksCheck");
290  strategyCfg_.gedElectronMode = cfg.getParameter<bool>("gedElectronMode");
291  strategyCfg_.PreSelectMVA = cfg.getParameter<double>("PreSelectMVA");
292  strategyCfg_.MaxElePtForOnlyMVA = cfg.getParameter<double>("MaxElePtForOnlyMVA");
293  strategyCfg_.useEcalRegression = cfg.getParameter<bool>("useEcalRegression");
294  strategyCfg_.useCombinationRegression = cfg.getParameter<bool>("useCombinationRegression");
295  strategyCfg_.fillConvVtxFitProb = cfg.getParameter<bool>("fillConvVtxFitProb");
296 
297  // hcal helpers
298  auto const& psetPreselection = cfg.getParameter<edm::ParameterSet>("preselection");
299  hcalCfg_.hOverEConeSize = psetPreselection.getParameter<double>("hOverEConeSize");
300  if (hcalCfg_.hOverEConeSize > 0) {
301  hcalCfg_.useTowers = true;
302  hcalCfg_.checkHcalStatus = cfg.getParameter<bool>("checkHcalStatus");
303  hcalCfg_.hcalTowers = consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers"));
304  hcalCfg_.hOverEPtMin = psetPreselection.getParameter<double>("hOverEPtMin");
305  }
306  auto const& psetPreselectionPflow = cfg.getParameter<edm::ParameterSet>("preselectionPflow");
307  hcalCfgPflow_.hOverEConeSize = psetPreselectionPflow.getParameter<double>("hOverEConeSize");
308  if (hcalCfgPflow_.hOverEConeSize > 0) {
309  hcalCfgPflow_.useTowers = true;
310  hcalCfgPflow_.checkHcalStatus = cfg.getParameter<bool>("checkHcalStatus");
311  hcalCfgPflow_.hcalTowers = consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers"));
312  hcalCfgPflow_.hOverEPtMin = psetPreselectionPflow.getParameter<double>("hOverEPtMin");
313  }
314 
315  // Ecal rec hits configuration
317  auto const& flagnamesbarrel = cfg.getParameter<std::vector<std::string>>("recHitFlagsToBeExcludedBarrel");
318  recHitsCfg.recHitFlagsToBeExcludedBarrel = StringToEnumValue<EcalRecHit::Flags>(flagnamesbarrel);
319  auto const& flagnamesendcaps = cfg.getParameter<std::vector<std::string>>("recHitFlagsToBeExcludedEndcaps");
320  recHitsCfg.recHitFlagsToBeExcludedEndcaps = StringToEnumValue<EcalRecHit::Flags>(flagnamesendcaps);
321  auto const& severitynamesbarrel = cfg.getParameter<std::vector<std::string>>("recHitSeverityToBeExcludedBarrel");
322  recHitsCfg.recHitSeverityToBeExcludedBarrel =
323  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesbarrel);
324  auto const& severitynamesendcaps = cfg.getParameter<std::vector<std::string>>("recHitSeverityToBeExcludedEndcaps");
325  recHitsCfg.recHitSeverityToBeExcludedEndcaps =
326  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesendcaps);
327  //recHitsCfg.severityLevelCut = cfg.getParameter<int>("severityLevelCut") ;
328 
329  // isolation
331  .intRadiusHcal = cfg.getParameter<double>("intRadiusHcal"),
332  .etMinHcal = cfg.getParameter<double>("etMinHcal"),
333  .intRadiusEcalBarrel = cfg.getParameter<double>("intRadiusEcalBarrel"),
334  .intRadiusEcalEndcaps = cfg.getParameter<double>("intRadiusEcalEndcaps"),
335  .jurassicWidth = cfg.getParameter<double>("jurassicWidth"),
336  .etMinBarrel = cfg.getParameter<double>("etMinBarrel"),
337  .eMinBarrel = cfg.getParameter<double>("eMinBarrel"),
338  .etMinEndcaps = cfg.getParameter<double>("etMinEndcaps"),
339  .eMinEndcaps = cfg.getParameter<double>("eMinEndcaps"),
340  .vetoClustered = cfg.getParameter<bool>("vetoClustered"),
341  .useNumCrystals = cfg.getParameter<bool>("useNumCrystals")};
342 
343  const RegressionHelper::Configuration regressionCfg{
344  .ecalRegressionWeightLabels = cfg.getParameter<std::vector<std::string>>("ecalRefinedRegressionWeightLabels"),
345  .ecalWeightsFromDB = cfg.getParameter<bool>("ecalWeightsFromDB"),
346  .ecalRegressionWeightFiles = cfg.getParameter<std::vector<std::string>>("ecalRefinedRegressionWeightFiles"),
348  cfg.getParameter<std::vector<std::string>>("combinationRegressionWeightLabels"),
349  .combinationWeightsFromDB = cfg.getParameter<bool>("combinationWeightsFromDB"),
350  .combinationRegressionWeightFiles =
351  cfg.getParameter<std::vector<std::string>>("combinationRegressionWeightFile")};
352 
353  // create algo
354  algo_ = std::make_unique<GsfElectronAlgo>(
355  inputCfg_,
356  strategyCfg_,
357  cutsCfg_,
359  hcalCfg_,
361  isoCfg,
362  recHitsCfg,
363  EcalClusterFunctionFactory::get()->create(cfg.getParameter<std::string>("superClusterErrorFunction"), cfg),
364  EcalClusterFunctionFactory::get()->create(cfg.getParameter<std::string>("crackCorrectionFunction"), cfg),
365  regressionCfg,
366  cfg.getParameter<edm::ParameterSet>("trkIsol03Cfg"),
367  cfg.getParameter<edm::ParameterSet>("trkIsol04Cfg"),
368  cfg.getParameter<edm::ParameterSet>("trkIsolHEEP03Cfg"),
369  cfg.getParameter<edm::ParameterSet>("trkIsolHEEP04Cfg"),
370  consumesCollector());
371 }
T getParameter(std::string const &) const
std::unique_ptr< GsfElectronAlgo > algo_
edm::EDGetTokenT< reco::ConversionCollection > conversions
edm::EDGetTokenT< CaloTowerCollection > hcalTowersTag
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag
std::vector< std::string > ecalRegressionWeightLabels
edm::EDGetTokenT< reco::VertexCollection > vtxCollectionTag
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
edm::EDGetTokenT< reco::GsfElectronCollection > pflowGsfElectronsTag
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:168
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
edm::EDGetTokenT< reco::TrackCollection > ctfTracks
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
ElectronHcalHelper::Configuration hcalCfg_
ElectronHcalHelper::Configuration hcalCfgPflow_
GsfElectronAlgo::StrategyConfiguration strategyCfg_
edm::EDGetTokenT< edm::ValueMap< float > > pfMVA_
edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons
const edm::EDPutTokenT< reco::GsfElectronCollection > electronPutToken_
GsfElectronAlgo::Tokens inputCfg_
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
const GsfElectronAlgo::CutsConfiguration cutsCfgPflow_
const GsfElectronAlgo::CutsConfiguration cutsCfg_
GsfElectronBaseProducer::~GsfElectronBaseProducer ( )
overridedefault

Referenced by GsfElectronBaseProducer().

Member Function Documentation

void GsfElectronBaseProducer::beginEvent ( edm::Event event,
const edm::EventSetup setup 
)
protected

Definition at line 375 of file GsfElectronBaseProducer.cc.

References checkEcalSeedingParameters(), ecalSeedingParametersChecked_, inputCfg_, edm::HandleBase::isValid(), edm::parameterSet(), edm::HandleBase::provenance(), and GsfElectronAlgo::Tokens::seedsTag.

Referenced by GsfElectronProducer::beginEvent().

375  {
376  // check configuration
380  event.getByToken(inputCfg_.seedsTag, seeds);
381  if (!seeds.isValid()) {
382  edm::LogWarning("GsfElectronAlgo|UnreachableSeedsProvenance")
383  << "Cannot check consistency of parameters with ecal seeding ones,"
384  << " because the original collection of seeds is not any more available.";
385  } else {
387  }
388  }
389 }
void checkEcalSeedingParameters(edm::ParameterSet const &)
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
bool isValid() const
Definition: HandleBase.h:70
GsfElectronAlgo::Tokens inputCfg_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
Provenance const * provenance() const
Definition: HandleBase.h:74
void GsfElectronBaseProducer::checkEcalSeedingParameters ( edm::ParameterSet const &  pset)
private

Definition at line 412 of file GsfElectronBaseProducer.cc.

References cutsCfg_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), hcalCfg_, ElectronHcalHelper::Configuration::hOverEConeSize, GsfElectronAlgo::CutsConfiguration::maxHOverEBarrelCone, GsfElectronAlgo::CutsConfiguration::maxHOverEEndcapsCone, GsfElectronAlgo::CutsConfiguration::minSCEtBarrel, and GsfElectronAlgo::CutsConfiguration::minSCEtEndcaps.

Referenced by beginEvent().

412  {
413  if (!pset.exists("SeedConfiguration")) {
414  return;
415  }
416  edm::ParameterSet seedConfiguration = pset.getParameter<edm::ParameterSet>("SeedConfiguration");
417 
418  if (seedConfiguration.getParameter<bool>("applyHOverECut")) {
419  if ((hcalCfg_.hOverEConeSize != 0) &&
420  (hcalCfg_.hOverEConeSize != seedConfiguration.getParameter<double>("hOverEConeSize"))) {
421  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
422  << "The H/E cone size (" << hcalCfg_.hOverEConeSize << ") is different from ecal seeding ("
423  << seedConfiguration.getParameter<double>("hOverEConeSize") << ").";
424  }
425  if (cutsCfg_.maxHOverEBarrelCone < seedConfiguration.getParameter<double>("maxHOverEBarrel")) {
426  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
427  << "The max barrel cone H/E is lower than during ecal seeding.";
428  }
429  if (cutsCfg_.maxHOverEEndcapsCone < seedConfiguration.getParameter<double>("maxHOverEEndcaps")) {
430  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
431  << "The max endcaps cone H/E is lower than during ecal seeding.";
432  }
433  }
434 
435  if (cutsCfg_.minSCEtBarrel < seedConfiguration.getParameter<double>("SCEtCut")) {
436  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
437  << "The minimum super-cluster Et in barrel is lower than during ecal seeding.";
438  }
439  if (cutsCfg_.minSCEtEndcaps < seedConfiguration.getParameter<double>("SCEtCut")) {
440  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
441  << "The minimum super-cluster Et in endcaps is lower than during ecal seeding.";
442  }
443 }
T getParameter(std::string const &) const
ElectronHcalHelper::Configuration hcalCfg_
const GsfElectronAlgo::CutsConfiguration cutsCfg_
void GsfElectronBaseProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 44 of file GsfElectronBaseProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), edm::ParameterSet::getParameter(), HLT_2018_cff::InputTag, gedGsfElectrons_cfi::maxDeltaEtaEndcaps, gedGsfElectrons_cfi::maxDeltaPhiEndcaps, Reconstruction_hiPF_cff::maxEOverPEndcaps, gedGsfElectrons_cfi::maxHOverEEndcapsCone, gedGsfElectrons_cfi::maxHOverEEndcapsTower, gsfElectrons_cfi::minMVA, GsfElectronAlgo::CutsConfiguration::minSCEtBarrel, gedGsfElectrons_cfi::minSCEtEndcaps, muonDTDigis_cfi::pset, EleTkIsolFromCands::pSetDescript(), and AlCaHLTBitMon_QueryRunRegistry::string.

44  {
46  // input collections
47  desc.add<edm::InputTag>("gsfElectronCoresTag", edm::InputTag("gedGsfElectronCores"));
48  desc.add<edm::InputTag>("pflowGsfElectronsTag", edm::InputTag(""));
49  desc.add<edm::InputTag>("pfMvaTag", edm::InputTag(""));
50  desc.add<edm::InputTag>("previousGsfElectronsTag", edm::InputTag(""));
51  desc.add<edm::InputTag>("hcalTowers", edm::InputTag("towerMaker"));
52  desc.add<edm::InputTag>("vtxTag", edm::InputTag("offlinePrimaryVertices"));
53  desc.add<edm::InputTag>("conversionsTag", edm::InputTag("allConversions"));
54  desc.add<edm::InputTag>("gsfPfRecTracksTag", edm::InputTag("pfTrackElec"));
55  desc.add<edm::InputTag>("barrelRecHitCollectionTag", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
56  desc.add<edm::InputTag>("endcapRecHitCollectionTag", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
57  desc.add<edm::InputTag>("seedsTag", edm::InputTag("ecalDrivenElectronSeeds"));
58  desc.add<edm::InputTag>("beamSpotTag", edm::InputTag("offlineBeamSpot"));
59  desc.add<edm::InputTag>("egmPFCandidatesTag", edm::InputTag("particleFlowEGamma"));
60  desc.add<bool>("checkHcalStatus", true);
61 
62  // steering
63  desc.add<bool>("gedElectronMode", true);
64  desc.add<bool>("useCombinationRegression", true);
65  desc.add<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization", false);
66  desc.add<bool>("ecalDrivenEcalErrorFromClassBasedParameterization", false);
67  desc.add<bool>("applyPreselection", true);
68  desc.add<bool>("useEcalRegression", true);
69  desc.add<bool>("applyAmbResolution", false);
70  desc.add<bool>("useGsfPfRecTracks", true);
71  desc.add<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization", true);
72  desc.add<unsigned int>("ambSortingStrategy", 1);
73  desc.add<unsigned int>("ambClustersOverlapStrategy", 1);
74  desc.add<bool>("addPflowElectrons", true); // this one should be transfered to the "core" level
75  desc.add<bool>("fillConvVtxFitProb", true);
76 
77  // Ecal rec hits configuration
78  desc.add<std::vector<std::string>>("recHitFlagsToBeExcludedBarrel");
79  desc.add<std::vector<std::string>>("recHitFlagsToBeExcludedEndcaps");
80  desc.add<std::vector<std::string>>("recHitSeverityToBeExcludedBarrel");
81  desc.add<std::vector<std::string>>("recHitSeverityToBeExcludedEndcaps");
82 
83  // Isolation algos configuration
84  desc.add("trkIsol03Cfg", EleTkIsolFromCands::pSetDescript());
85  desc.add("trkIsol04Cfg", EleTkIsolFromCands::pSetDescript());
86  desc.add("trkIsolHEEP03Cfg", EleTkIsolFromCands::pSetDescript());
87  desc.add("trkIsolHEEP04Cfg", EleTkIsolFromCands::pSetDescript());
88  desc.add<bool>("useNumCrystals", true);
89  desc.add<double>("etMinBarrel", 0.0);
90  desc.add<double>("etMinEndcaps", 0.11);
91  desc.add<double>("etMinHcal", 0.0);
92  desc.add<double>("eMinBarrel", 0.095);
93  desc.add<double>("eMinEndcaps", 0.0);
94  desc.add<double>("intRadiusEcalBarrel", 3.0);
95  desc.add<double>("intRadiusEcalEndcaps", 3.0);
96  desc.add<double>("intRadiusHcal", 0.15);
97  desc.add<double>("jurassicWidth", 1.5);
98  desc.add<bool>("vetoClustered", false);
99  {
101  psd0.add<std::string>("propagatorAlongTISE", "PropagatorWithMaterial");
102  psd0.add<std::string>("propagatorOppositeTISE", "PropagatorWithMaterialOpposite");
103  desc.add<edm::ParameterSetDescription>("TransientInitialStateEstimatorParameters", psd0);
104  }
105 
106  // backward compatibility mechanism for ctf tracks
107  desc.add<bool>("ctfTracksCheck", true);
108  desc.add<edm::InputTag>("ctfTracksTag", edm::InputTag("generalTracks"));
109 
110  desc.add<double>("MaxElePtForOnlyMVA", 50.0);
111  desc.add<double>("PreSelectMVA", -0.1);
112 
113  {
115  psd0.add<double>("minSCEtBarrel", 0.0);
116  psd0.add<double>("minSCEtEndcaps", 0.0);
117  psd0.add<double>("minEOverPBarrel", 0.0);
118  psd0.add<double>("minEOverPEndcaps", 0.0);
119  psd0.add<double>("maxEOverPBarrel", 999999999.0);
120  psd0.add<double>("maxEOverPEndcaps", 999999999.0);
121  psd0.add<double>("maxDeltaEtaBarrel", 999999999.0);
122  psd0.add<double>("maxDeltaEtaEndcaps", 999999999.0);
123  psd0.add<double>("maxDeltaPhiBarrel", 999999999.0);
124  psd0.add<double>("maxDeltaPhiEndcaps", 999999999.0);
125  psd0.add<double>("hOverEConeSize", 0.15);
126  psd0.add<double>("hOverEPtMin", 0.0);
127  psd0.add<double>("maxHOverEBarrelCone", 999999999.0);
128  psd0.add<double>("maxHOverEEndcapsCone", 999999999.0);
129  psd0.add<double>("maxHBarrelCone", 0.0);
130  psd0.add<double>("maxHEndcapsCone", 0.0);
131  psd0.add<double>("maxHOverEBarrelTower", 999999999.0);
132  psd0.add<double>("maxHOverEEndcapsTower", 999999999.0);
133  psd0.add<double>("maxHBarrelTower", 0.0);
134  psd0.add<double>("maxHEndcapsTower", 0.0);
135  psd0.add<double>("maxSigmaIetaIetaBarrel", 999999999.0);
136  psd0.add<double>("maxSigmaIetaIetaEndcaps", 999999999.0);
137  psd0.add<double>("maxFbremBarrel", 999999999.0);
138  psd0.add<double>("maxFbremEndcaps", 999999999.0);
139  psd0.add<bool>("isBarrel", false);
140  psd0.add<bool>("isEndcaps", false);
141  psd0.add<bool>("isFiducial", false);
142  psd0.add<bool>("seedFromTEC", true);
143  psd0.add<double>("maxTIP", 999999999.0);
144  psd0.add<double>("minMVA", -0.4);
145  psd0.add<double>("minMvaByPassForIsolated", -0.4);
146  // preselection parameters (ecal driven electrons)
147  desc.add<edm::ParameterSetDescription>("preselection", psd0);
148  // preselection parameters (tracker driven only electrons)
149  desc.add<edm::ParameterSetDescription>("preselectionPflow", psd0);
150  }
151 
152  // Corrections
153  desc.add<std::string>("superClusterErrorFunction", "EcalClusterEnergyUncertaintyObjectSpecific");
154  desc.add<std::string>("crackCorrectionFunction", "EcalClusterCrackCorrection");
155 
156  desc.add<bool>("ecalWeightsFromDB", true);
157  desc.add<std::vector<std::string>>("ecalRefinedRegressionWeightFiles", {})
158  ->setComment("if not from DB. Otherwise, keep empty");
159  desc.add<bool>("combinationWeightsFromDB", true);
160  desc.add<std::vector<std::string>>("combinationRegressionWeightFile", {})
161  ->setComment("if not from DB. Otherwise, keep empty");
162 
163  // regression. The labels are needed in all cases.
164  desc.add<std::vector<std::string>>("ecalRefinedRegressionWeightLabels", {});
165  desc.add<std::vector<std::string>>("combinationRegressionWeightLabels", {});
166 
167  // Iso values
168  desc.add<bool>("useIsolationValues", false);
169 
170  {
172  psd0.add<edm::InputTag>("edSumPhotonEt", edm::InputTag("elEDIsoValueGamma04"));
173  psd0.add<edm::InputTag>("edSumNeutralHadronEt", edm::InputTag("elEDIsoValueNeutral04"));
174  psd0.add<edm::InputTag>("edSumChargedHadronPt", edm::InputTag("elEDIsoValueCharged04"));
175  desc.add<edm::ParameterSetDescription>("edIsolationValues", psd0);
176  }
177  {
179  psd0.add<edm::InputTag>("pfSumNeutralHadronEt", edm::InputTag("elPFIsoValueNeutral04"));
180  psd0.add<edm::InputTag>("pfSumChargedHadronPt", edm::InputTag("elPFIsoValueCharged04"));
181  psd0.add<edm::InputTag>("pfSumPhotonEt", edm::InputTag("elPFIsoValueGamma04"));
182  desc.add<edm::ParameterSetDescription>("pfIsolationValues", psd0);
183  }
184 
185  desc.add<std::vector<std::string>>(
186  "ElecMVAFilesString",
187  {
188  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_10_17Feb2011.weights.xml",
189  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_12_17Feb2011.weights.xml",
190  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_20_17Feb2011.weights.xml",
191  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_22_17Feb2011.weights.xml",
192  });
193  desc.add<std::vector<std::string>>(
194  "SoftElecMVAFilesString",
195  {
196  "RecoEgamma/ElectronIdentification/data/TMVA_BDTSoftElectrons_7Feb2014.weights.xml",
197  });
198 
199  descriptions.addDefault(desc);
200 }
void addDefault(ParameterSetDescription const &psetDescription)
static edm::ParameterSetDescription pSetDescript()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void GsfElectronBaseProducer::fillEvent ( reco::GsfElectronCollection electrons,
edm::Event event 
)
protected

Definition at line 391 of file GsfElectronBaseProducer.cc.

References reco::GsfElectron::ambiguous(), GsfElectronAlgo::StrategyConfiguration::applyAmbResolution, GsfElectronAlgo::StrategyConfiguration::applyPreselection, electronPutToken_, isPreselected(), eostools::move(), orphanHandle_, setAmbiguityData(), and strategyCfg_.

Referenced by GsfElectronProducer::produce(), and GEDGsfElectronProducer::produce().

391  {
392  // all electrons
393  logElectrons(electrons, event, "GsfElectronAlgo Info (before preselection)");
394  // preselection
396  electrons.erase(
397  std::remove_if(electrons.begin(), electrons.end(), [this](auto const& ele) { return !isPreselected(ele); }),
398  electrons.end());
399  logElectrons(electrons, event, "GsfElectronAlgo Info (after preselection)");
400  }
401  // ambiguity
402  setAmbiguityData(electrons, event);
404  electrons.erase(std::remove_if(electrons.begin(), electrons.end(), std::mem_fn(&reco::GsfElectron::ambiguous)),
405  electrons.end());
406  logElectrons(electrons, event, "GsfElectronAlgo Info (after amb. solving)");
407  }
408  // final filling
410 }
void setAmbiguityData(reco::GsfElectronCollection &electrons, edm::Event const &event, bool ignoreNotPreselected=true) const
bool ambiguous() const
Definition: GsfElectron.h:681
GsfElectronAlgo::StrategyConfiguration strategyCfg_
const edm::EDPutTokenT< reco::GsfElectronCollection > electronPutToken_
bool isPreselected(reco::GsfElectron const &ele) const
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle< reco::GsfElectronCollection > orphanHandle_
static void GsfElectronBaseProducer::globalEndJob ( GsfElectronAlgo::HeavyObjectCache const *  )
inlinestatic

Definition at line 37 of file GsfElectronBaseProducer.h.

37 {}
static std::unique_ptr<GsfElectronAlgo::HeavyObjectCache> GsfElectronBaseProducer::initializeGlobalCache ( const edm::ParameterSet conf)
inlinestatic

Definition at line 33 of file GsfElectronBaseProducer.h.

33  {
34  return std::make_unique<GsfElectronAlgo::HeavyObjectCache>(conf);
35  }
bool GsfElectronBaseProducer::isPreselected ( reco::GsfElectron const &  ele) const
private

Definition at line 547 of file GsfElectronBaseProducer.cc.

References DEFINE_FWK_MODULE, reco::GsfElectron::ecalDrivenSeed(), GsfElectronAlgo::StrategyConfiguration::gedElectronMode, GsfElectronAlgo::StrategyConfiguration::MaxElePtForOnlyMVA, reco::GsfElectron::passingCutBasedPreselection(), reco::GsfElectron::passingMvaPreselection(), reco::GsfElectron::passingPflowPreselection(), reco::LeafCandidate::pt(), and strategyCfg_.

Referenced by fillEvent(), and setAmbiguityData().

547  {
548  bool passCutBased = ele.passingCutBasedPreselection();
549  bool passPF = ele.passingPflowPreselection();
550  // it is worth nothing for gedGsfElectrons, this does nothing as its not set
551  // till GedGsfElectron finaliser, this is always false
553  bool passmva = ele.passingMvaPreselection();
554  if (!ele.ecalDrivenSeed()) {
555  if (ele.pt() > strategyCfg_.MaxElePtForOnlyMVA)
556  return passmva && passCutBased;
557  else
558  return passmva;
559  } else
560  return (passCutBased || passPF || passmva);
561  } else {
562  return passCutBased || passPF;
563  }
564 
565  return true;
566 }
GsfElectronAlgo::StrategyConfiguration strategyCfg_
const edm::OrphanHandle<reco::GsfElectronCollection>& GsfElectronBaseProducer::orphanHandle ( ) const
inlineprotected

Definition at line 51 of file GsfElectronBaseProducer.h.

Referenced by GEDGsfElectronProducer::fillGsfElectronValueMap().

51 { return orphanHandle_; }
edm::OrphanHandle< reco::GsfElectronCollection > orphanHandle_
void GsfElectronBaseProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
inlineoverride

Definition at line 40 of file GsfElectronBaseProducer.h.

References pwdgSkimBPark_cfi::electrons, and ntuple::fillEvent().

40  {
42  algo_->completeElectrons(electrons, event, setup, globalCache());
43  fillEvent(electrons, event);
44  }
std::unique_ptr< GsfElectronAlgo > algo_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void fillEvent(reco::GsfElectronCollection &electrons, edm::Event &event)
void GsfElectronBaseProducer::setAmbiguityData ( reco::GsfElectronCollection electrons,
edm::Event const &  event,
bool  ignoreNotPreselected = true 
) const
private

Definition at line 449 of file GsfElectronBaseProducer.cc.

References GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy, GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy, GsfElectronAlgo::Tokens::barrelRecHitCollection, HLT_2018_cff::barrelRecHits, GsfElectronAlgo::Tokens::beamSpotTag, StorageManager_cfg::e1, metsig::electron, photonAnalyzer_cfi::eMin, GsfElectronAlgo::Tokens::endcapRecHitCollection, HLT_2018_cff::endcapRecHits, PVValHelper::eta, Exception, newFWLiteAna::found, edm::Ref< C, T, F >::get(), uncleanedOnlyElectronSequence_cff::gsfPfRecTracks, GsfElectronAlgo::Tokens::gsfPfRecTracksTag, inputCfg_, egamma::isBetterElectron(), egamma::isInnermostElectron(), isPreselected(), LogDebug, egamma::sharedEnergy(), strategyCfg_, MessageLogger_cff::threshold, and GsfElectronAlgo::StrategyConfiguration::useGsfPfRecTracks.

Referenced by fillEvent().

451  {
452  // Getting required event data
453  auto const& beamspot = event.get(inputCfg_.beamSpotTag);
456  auto const& barrelRecHits = event.get(inputCfg_.barrelRecHitCollection);
457  auto const& endcapRecHits = event.get(inputCfg_.endcapRecHitCollection);
458 
459  if (strategyCfg_.ambSortingStrategy == 0) {
460  std::sort(electrons.begin(), electrons.end(), egamma::isBetterElectron);
461  } else if (strategyCfg_.ambSortingStrategy == 1) {
462  std::sort(electrons.begin(), electrons.end(), egamma::isInnermostElectron);
463  } else {
464  throw cms::Exception("GsfElectronAlgo|UnknownAmbiguitySortingStrategy")
465  << "value of strategyCfg_.ambSortingStrategy is : " << strategyCfg_.ambSortingStrategy;
466  }
467 
468  // init
469  for (auto& electron : electrons) {
470  electron.clearAmbiguousGsfTracks();
471  electron.setAmbiguous(false);
472  }
473 
474  // get ambiguous from GsfPfRecTracks
476  for (auto& e1 : electrons) {
477  bool found = false;
478  for (auto const& gsfPfRecTrack : *gsfPfRecTracks.product()) {
479  if (gsfPfRecTrack.gsfTrackRef() == e1.gsfTrack()) {
480  if (found) {
481  edm::LogWarning("GsfElectronAlgo") << "associated gsfPfRecTrack already found";
482  } else {
483  found = true;
484  for (auto const& duplicate : gsfPfRecTrack.convBremGsfPFRecTrackRef()) {
485  e1.addAmbiguousGsfTrack(duplicate->gsfTrackRef());
486  }
487  }
488  }
489  }
490  }
491  }
492  // or search overlapping clusters
493  else {
494  for (auto e1 = electrons.begin(); e1 != electrons.end(); ++e1) {
495  if (e1->ambiguous())
496  continue;
497  if (ignoreNotPreselected && !isPreselected(*e1))
498  continue;
499 
500  SuperClusterRef scRef1 = e1->superCluster();
501  CaloClusterPtr eleClu1 = e1->electronCluster();
502  LogDebug("GsfElectronAlgo") << "Blessing electron with E/P " << e1->eSuperClusterOverP() << ", cluster "
503  << scRef1.get() << " & track " << e1->gsfTrack().get();
504 
505  for (auto e2 = e1 + 1; e2 != electrons.end(); ++e2) {
506  if (e2->ambiguous())
507  continue;
508  if (ignoreNotPreselected && !isPreselected(*e2))
509  continue;
510 
511  SuperClusterRef scRef2 = e2->superCluster();
512  CaloClusterPtr eleClu2 = e2->electronCluster();
513 
514  // search if same cluster
515  bool sameCluster = false;
517  sameCluster = (scRef1 == scRef2);
518  } else if (strategyCfg_.ambClustersOverlapStrategy == 1) {
519  float eMin = 1.;
520  float threshold = eMin * cosh(EleRelPoint(scRef1->position(), beamspot.position()).eta());
521  using egamma::sharedEnergy;
522  sameCluster = ((sharedEnergy(*eleClu1, *eleClu2, barrelRecHits, endcapRecHits) >= threshold) ||
523  (sharedEnergy(*scRef1->seed(), *eleClu2, barrelRecHits, endcapRecHits) >= threshold) ||
524  (sharedEnergy(*eleClu1, *scRef2->seed(), barrelRecHits, endcapRecHits) >= threshold) ||
525  (sharedEnergy(*scRef1->seed(), *scRef2->seed(), barrelRecHits, endcapRecHits) >= threshold));
526  } else {
527  throw cms::Exception("GsfElectronAlgo|UnknownAmbiguityClustersOverlapStrategy")
528  << "value of strategyCfg_.ambClustersOverlapStrategy is : " << strategyCfg_.ambClustersOverlapStrategy;
529  }
530 
531  // main instructions
532  if (sameCluster) {
533  LogDebug("GsfElectronAlgo") << "Discarding electron with E/P " << e2->eSuperClusterOverP() << ", cluster "
534  << scRef2.get() << " and track " << e2->gsfTrack().get();
535  e1->addAmbiguousGsfTrack(e2->gsfTrack());
536  e2->setAmbiguous(true);
537  } else if (e1->gsfTrack() == e2->gsfTrack()) {
538  edm::LogWarning("GsfElectronAlgo") << "Forgetting electron with E/P " << e2->eSuperClusterOverP()
539  << ", cluster " << scRef2.get() << " and track " << e2->gsfTrack().get();
540  e2->setAmbiguous(true);
541  }
542  }
543  }
544  }
545 }
#define LogDebug(id)
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
bool isBetterElectron(reco::GsfElectron const &, reco::GsfElectron const &)
bool isInnermostElectron(reco::GsfElectron const &, reco::GsfElectron const &)
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
GsfElectronAlgo::StrategyConfiguration strategyCfg_
float sharedEnergy(reco::CaloCluster const &clu1, reco::CaloCluster const &clu2, EcalRecHitCollection const &barrelRecHits, EcalRecHitCollection const &endcapRecHits)
GsfElectronAlgo::Tokens inputCfg_
bool isPreselected(reco::GsfElectron const &ele) const
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection

Member Data Documentation

std::unique_ptr<GsfElectronAlgo> GsfElectronBaseProducer::algo_
protected
const GsfElectronAlgo::CutsConfiguration GsfElectronBaseProducer::cutsCfg_
protected
const GsfElectronAlgo::CutsConfiguration GsfElectronBaseProducer::cutsCfgPflow_
protected
bool GsfElectronBaseProducer::ecalSeedingParametersChecked_
private

Definition at line 75 of file GsfElectronBaseProducer.h.

Referenced by beginEvent().

edm::ParameterSet GsfElectronBaseProducer::edIsoVals_
protected
const edm::EDPutTokenT<reco::GsfElectronCollection> GsfElectronBaseProducer::electronPutToken_
private

Definition at line 79 of file GsfElectronBaseProducer.h.

Referenced by fillEvent().

ElectronHcalHelper::Configuration GsfElectronBaseProducer::hcalCfg_
protected
ElectronHcalHelper::Configuration GsfElectronBaseProducer::hcalCfgPflow_
protected

Definition at line 59 of file GsfElectronBaseProducer.h.

Referenced by GsfElectronBaseProducer().

GsfElectronAlgo::Tokens GsfElectronBaseProducer::inputCfg_
protected
edm::OrphanHandle<reco::GsfElectronCollection> GsfElectronBaseProducer::orphanHandle_
private

Definition at line 77 of file GsfElectronBaseProducer.h.

Referenced by fillEvent().

edm::ParameterSet GsfElectronBaseProducer::pfIsoVals_
protected
edm::EDGetTokenT<edm::ValueMap<float> > GsfElectronBaseProducer::pfMVA_
protected
GsfElectronAlgo::StrategyConfiguration GsfElectronBaseProducer::strategyCfg_
protected