CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
GsfElectronProducer Class Reference
Inheritance diagram for GsfElectronProducer:
edm::stream::EDProducer< edm::GlobalCache< GsfElectronAlgo::HeavyObjectCache > >

Public Member Functions

 GsfElectronProducer (const edm::ParameterSet &, const GsfElectronAlgo::HeavyObjectCache *)
 
void produce (edm::Event &event, const edm::EventSetup &setup) 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)
 

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

std::unique_ptr< GsfElectronAlgoalgo_
 
const GsfElectronAlgo::CutsConfiguration cutsCfg_
 
bool ecalSeedingParametersChecked_
 
edm::EDGetTokenT< reco::PFCandidateCollectionegmPFCandidateCollection_
 
const edm::EDPutTokenT< reco::GsfElectronCollectionelectronPutToken_
 
const edm::EDGetTokenT< reco::GsfPFRecTrackCollectiongsfPfRecTracksTag_
 
ElectronHcalHelper::Configuration hcalCfg_
 
GsfElectronAlgo::Tokens inputCfg_
 
const bool resetMvaValuesUsingPFCandidates_
 
GsfElectronAlgo::StrategyConfiguration strategyCfg_
 
const bool useGsfPfRecTracks_
 

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 76 of file GsfElectronProducer.cc.

Constructor & Destructor Documentation

◆ GsfElectronProducer()

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

Definition at line 284 of file GsfElectronProducer.cc.

285  : cutsCfg_{makeCutsConfiguration(cfg.getParameter<edm::ParameterSet>("preselection"))},
287  electronPutToken_(produces<GsfElectronCollection>()),
288  gsfPfRecTracksTag_(consumes<reco::GsfPFRecTrackCollection>(cfg.getParameter<edm::InputTag>("gsfPfRecTracksTag"))),
289  useGsfPfRecTracks_(cfg.getParameter<bool>("useGsfPfRecTracks")),
290  resetMvaValuesUsingPFCandidates_(cfg.getParameter<bool>("resetMvaValuesUsingPFCandidates")) {
293  consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("egmPFCandidatesTag"));
294  }
295 
297  consumes<reco::GsfElectronCoreCollection>(cfg.getParameter<edm::InputTag>("gsfElectronCoresTag"));
298  inputCfg_.hcalTowersTag = consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers"));
300  consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("barrelRecHitCollectionTag"));
302  consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("endcapRecHitCollectionTag"));
303  inputCfg_.ctfTracks = consumes<reco::TrackCollection>(cfg.getParameter<edm::InputTag>("ctfTracksTag"));
304  // used to check config consistency with seeding
305  inputCfg_.seedsTag = consumes<reco::ElectronSeedCollection>(cfg.getParameter<edm::InputTag>("seedsTag"));
306  inputCfg_.beamSpotTag = consumes<reco::BeamSpot>(cfg.getParameter<edm::InputTag>("beamSpotTag"));
307  inputCfg_.vtxCollectionTag = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("vtxTag"));
308  if (cfg.getParameter<bool>("fillConvVtxFitProb"))
309  inputCfg_.conversions = consumes<reco::ConversionCollection>(cfg.getParameter<edm::InputTag>("conversionsTag"));
310 
311  strategyCfg_.useDefaultEnergyCorrection = cfg.getParameter<bool>("useDefaultEnergyCorrection");
312  strategyCfg_.applyPreselection = cfg.getParameter<bool>("applyPreselection");
314  cfg.getParameter<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization");
316  cfg.getParameter<bool>("ecalDrivenEcalErrorFromClassBasedParameterization");
318  cfg.getParameter<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization");
319  strategyCfg_.applyAmbResolution = cfg.getParameter<bool>("applyAmbResolution");
320  strategyCfg_.ignoreNotPreselected = cfg.getParameter<bool>("ignoreNotPreselected");
321  strategyCfg_.ambSortingStrategy = cfg.getParameter<unsigned>("ambSortingStrategy");
322  strategyCfg_.ambClustersOverlapStrategy = cfg.getParameter<unsigned>("ambClustersOverlapStrategy");
323  strategyCfg_.ctfTracksCheck = cfg.getParameter<bool>("ctfTracksCheck");
324  strategyCfg_.PreSelectMVA = cfg.getParameter<double>("PreSelectMVA");
325  strategyCfg_.MaxElePtForOnlyMVA = cfg.getParameter<double>("MaxElePtForOnlyMVA");
326  strategyCfg_.useEcalRegression = cfg.getParameter<bool>("useEcalRegression");
327  strategyCfg_.useCombinationRegression = cfg.getParameter<bool>("useCombinationRegression");
328  strategyCfg_.fillConvVtxFitProb = cfg.getParameter<bool>("fillConvVtxFitProb");
329 
330  // hcal helpers
331  auto const& psetPreselection = cfg.getParameter<edm::ParameterSet>("preselection");
332  hcalCfg_.hOverEConeSize = psetPreselection.getParameter<double>("hOverEConeSize");
333  if (hcalCfg_.hOverEConeSize > 0) {
334  hcalCfg_.useTowers = true;
335  hcalCfg_.checkHcalStatus = cfg.getParameter<bool>("checkHcalStatus");
336  hcalCfg_.hcalTowers = consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers"));
337  hcalCfg_.hOverEPtMin = psetPreselection.getParameter<double>("hOverEPtMin");
338  }
339 
340  // Ecal rec hits configuration
342  auto const& flagnamesbarrel = cfg.getParameter<std::vector<std::string>>("recHitFlagsToBeExcludedBarrel");
343  recHitsCfg.recHitFlagsToBeExcludedBarrel = StringToEnumValue<EcalRecHit::Flags>(flagnamesbarrel);
344  auto const& flagnamesendcaps = cfg.getParameter<std::vector<std::string>>("recHitFlagsToBeExcludedEndcaps");
345  recHitsCfg.recHitFlagsToBeExcludedEndcaps = StringToEnumValue<EcalRecHit::Flags>(flagnamesendcaps);
346  auto const& severitynamesbarrel = cfg.getParameter<std::vector<std::string>>("recHitSeverityToBeExcludedBarrel");
348  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesbarrel);
349  auto const& severitynamesendcaps = cfg.getParameter<std::vector<std::string>>("recHitSeverityToBeExcludedEndcaps");
351  StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesendcaps);
352 
353  // isolation
355  .intRadiusHcal = cfg.getParameter<double>("intRadiusHcal"),
356  .etMinHcal = cfg.getParameter<double>("etMinHcal"),
357  .intRadiusEcalBarrel = cfg.getParameter<double>("intRadiusEcalBarrel"),
358  .intRadiusEcalEndcaps = cfg.getParameter<double>("intRadiusEcalEndcaps"),
359  .jurassicWidth = cfg.getParameter<double>("jurassicWidth"),
360  .etMinBarrel = cfg.getParameter<double>("etMinBarrel"),
361  .eMinBarrel = cfg.getParameter<double>("eMinBarrel"),
362  .etMinEndcaps = cfg.getParameter<double>("etMinEndcaps"),
363  .eMinEndcaps = cfg.getParameter<double>("eMinEndcaps"),
364  .vetoClustered = cfg.getParameter<bool>("vetoClustered"),
365  .useNumCrystals = cfg.getParameter<bool>("useNumCrystals")};
366 
367  const RegressionHelper::Configuration regressionCfg{
368  .ecalRegressionWeightLabels = cfg.getParameter<std::vector<std::string>>("ecalRefinedRegressionWeightLabels"),
369  .ecalWeightsFromDB = cfg.getParameter<bool>("ecalWeightsFromDB"),
370  .ecalRegressionWeightFiles = cfg.getParameter<std::vector<std::string>>("ecalRefinedRegressionWeightFiles"),
372  cfg.getParameter<std::vector<std::string>>("combinationRegressionWeightLabels"),
373  .combinationWeightsFromDB = cfg.getParameter<bool>("combinationWeightsFromDB"),
374  .combinationRegressionWeightFiles =
375  cfg.getParameter<std::vector<std::string>>("combinationRegressionWeightFile")};
376 
377  // create algo
378  algo_ = std::make_unique<GsfElectronAlgo>(
379  inputCfg_,
380  strategyCfg_,
381  cutsCfg_,
382  hcalCfg_,
383  isoCfg,
384  recHitsCfg,
385  EcalClusterFunctionFactory::get()->create(cfg.getParameter<std::string>("superClusterErrorFunction"), cfg),
386  EcalClusterFunctionFactory::get()->create(cfg.getParameter<std::string>("crackCorrectionFunction"), cfg),
387  regressionCfg,
388  cfg.getParameter<edm::ParameterSet>("trkIsol03Cfg"),
389  cfg.getParameter<edm::ParameterSet>("trkIsol04Cfg"),
390  cfg.getParameter<edm::ParameterSet>("trkIsolHEEP03Cfg"),
391  cfg.getParameter<edm::ParameterSet>("trkIsolHEEP04Cfg"),
392  consumesCollector());
393 }

References looper::cfg.

Member Function Documentation

◆ checkEcalSeedingParameters()

void GsfElectronProducer::checkEcalSeedingParameters ( edm::ParameterSet const &  pset)
private

Definition at line 395 of file GsfElectronProducer.cc.

395  {
396  if (!pset.exists("SeedConfiguration")) {
397  return;
398  }
399  edm::ParameterSet seedConfiguration = pset.getParameter<edm::ParameterSet>("SeedConfiguration");
400 
401  if (seedConfiguration.getParameter<bool>("applyHOverECut")) {
402  if ((hcalCfg_.hOverEConeSize != 0) &&
403  (hcalCfg_.hOverEConeSize != seedConfiguration.getParameter<double>("hOverEConeSize"))) {
404  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
405  << "The H/E cone size (" << hcalCfg_.hOverEConeSize << ") is different from ecal seeding ("
406  << seedConfiguration.getParameter<double>("hOverEConeSize") << ").";
407  }
408  if (cutsCfg_.maxHOverEBarrelCone < seedConfiguration.getParameter<double>("maxHOverEBarrel")) {
409  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
410  << "The max barrel cone H/E is lower than during ecal seeding.";
411  }
412  if (cutsCfg_.maxHOverEEndcapsCone < seedConfiguration.getParameter<double>("maxHOverEEndcaps")) {
413  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
414  << "The max endcaps cone H/E is lower than during ecal seeding.";
415  }
416  }
417 
418  if (cutsCfg_.minSCEtBarrel < seedConfiguration.getParameter<double>("SCEtCut")) {
419  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
420  << "The minimum super-cluster Et in barrel is lower than during ecal seeding.";
421  }
422  if (cutsCfg_.minSCEtEndcaps < seedConfiguration.getParameter<double>("SCEtCut")) {
423  edm::LogWarning("GsfElectronAlgo|InconsistentParameters")
424  << "The minimum super-cluster Et in endcaps is lower than during ecal seeding.";
425  }
426 }

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

Referenced by produce().

◆ fillDescriptions()

void GsfElectronProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 118 of file GsfElectronProducer.cc.

118  {
120  // input collections
121  desc.add<edm::InputTag>("gsfElectronCoresTag", {"ecalDrivenGsfElectronCores"});
122  desc.add<edm::InputTag>("hcalTowers", {"towerMaker"});
123  desc.add<edm::InputTag>("vtxTag", {"offlinePrimaryVertices"});
124  desc.add<edm::InputTag>("conversionsTag", {"allConversions"});
125  desc.add<edm::InputTag>("gsfPfRecTracksTag", {"pfTrackElec"});
126  desc.add<edm::InputTag>("barrelRecHitCollectionTag", {"ecalRecHit", "EcalRecHitsEB"});
127  desc.add<edm::InputTag>("endcapRecHitCollectionTag", {"ecalRecHit", "EcalRecHitsEE"});
128  desc.add<edm::InputTag>("seedsTag", {"ecalDrivenElectronSeeds"});
129  desc.add<edm::InputTag>("beamSpotTag", {"offlineBeamSpot"});
130  desc.add<edm::InputTag>("egmPFCandidatesTag", {"particleFlowEGamma"});
131  desc.add<bool>("checkHcalStatus", true);
132 
133  // steering
134  desc.add<bool>("useDefaultEnergyCorrection", true);
135  desc.add<bool>("useCombinationRegression", false);
136  desc.add<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization", true);
137  desc.add<bool>("ecalDrivenEcalErrorFromClassBasedParameterization", true);
138  desc.add<bool>("applyPreselection", false);
139  desc.add<bool>("useEcalRegression", false);
140  desc.add<bool>("applyAmbResolution", false);
141  desc.add<bool>("ignoreNotPreselected", true);
142  desc.add<bool>("useGsfPfRecTracks", true);
143  desc.add<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization", true);
144  desc.add<unsigned int>("ambSortingStrategy", 1);
145  desc.add<unsigned int>("ambClustersOverlapStrategy", 1);
146  desc.add<bool>("fillConvVtxFitProb", true);
147  desc.add<bool>("resetMvaValuesUsingPFCandidates", false);
148 
149  // Ecal rec hits configuration
150  desc.add<std::vector<std::string>>("recHitFlagsToBeExcludedBarrel");
151  desc.add<std::vector<std::string>>("recHitFlagsToBeExcludedEndcaps");
152  desc.add<std::vector<std::string>>("recHitSeverityToBeExcludedBarrel");
153  desc.add<std::vector<std::string>>("recHitSeverityToBeExcludedEndcaps");
154 
155  // Isolation algos configuration
156  desc.add("trkIsol03Cfg", EleTkIsolFromCands::pSetDescript());
157  desc.add("trkIsol04Cfg", EleTkIsolFromCands::pSetDescript());
158  desc.add("trkIsolHEEP03Cfg", EleTkIsolFromCands::pSetDescript());
159  desc.add("trkIsolHEEP04Cfg", EleTkIsolFromCands::pSetDescript());
160  desc.add<bool>("useNumCrystals", true);
161  desc.add<double>("etMinBarrel", 0.0);
162  desc.add<double>("etMinEndcaps", 0.11);
163  desc.add<double>("etMinHcal", 0.0);
164  desc.add<double>("eMinBarrel", 0.095);
165  desc.add<double>("eMinEndcaps", 0.0);
166  desc.add<double>("intRadiusEcalBarrel", 3.0);
167  desc.add<double>("intRadiusEcalEndcaps", 3.0);
168  desc.add<double>("intRadiusHcal", 0.15);
169  desc.add<double>("jurassicWidth", 1.5);
170  desc.add<bool>("vetoClustered", false);
171 
172  // backward compatibility mechanism for ctf tracks
173  desc.add<bool>("ctfTracksCheck", true);
174  desc.add<edm::InputTag>("ctfTracksTag", {"generalTracks"});
175 
176  desc.add<double>("MaxElePtForOnlyMVA", 50.0);
177  desc.add<double>("PreSelectMVA", -0.1);
178 
179  {
181  psd0.add<double>("minSCEtBarrel", 4.0);
182  psd0.add<double>("minSCEtEndcaps", 4.0);
183  psd0.add<double>("minEOverPBarrel", 0.0);
184  psd0.add<double>("minEOverPEndcaps", 0.0);
185  psd0.add<double>("maxEOverPBarrel", 999999999.0);
186  psd0.add<double>("maxEOverPEndcaps", 999999999.0);
187  psd0.add<double>("maxDeltaEtaBarrel", 0.02);
188  psd0.add<double>("maxDeltaEtaEndcaps", 0.02);
189  psd0.add<double>("maxDeltaPhiBarrel", 0.15);
190  psd0.add<double>("maxDeltaPhiEndcaps", 0.15);
191  psd0.add<double>("hOverEConeSize", 0.15);
192  psd0.add<double>("hOverEPtMin", 0.0);
193  psd0.add<double>("maxHOverEBarrelCone", 0.15);
194  psd0.add<double>("maxHOverEEndcapsCone", 0.15);
195  psd0.add<double>("maxHBarrelCone", 0.0);
196  psd0.add<double>("maxHEndcapsCone", 0.0);
197  psd0.add<double>("maxHOverEBarrelTower", 0.15);
198  psd0.add<double>("maxHOverEEndcapsTower", 0.15);
199  psd0.add<double>("maxHBarrelTower", 0.0);
200  psd0.add<double>("maxHEndcapsTower", 0.0);
201  psd0.add<double>("maxSigmaIetaIetaBarrel", 999999999.0);
202  psd0.add<double>("maxSigmaIetaIetaEndcaps", 999999999.0);
203  psd0.add<double>("maxFbremBarrel", 999999999.0);
204  psd0.add<double>("maxFbremEndcaps", 999999999.0);
205  psd0.add<bool>("isBarrel", false);
206  psd0.add<bool>("isEndcaps", false);
207  psd0.add<bool>("isFiducial", false);
208  psd0.add<bool>("seedFromTEC", true);
209  psd0.add<double>("maxTIP", 999999999.0);
210  psd0.add<double>("minMVA", -0.4);
211  psd0.add<double>("minMvaByPassForIsolated", -0.4);
212  // preselection parameters
213  desc.add<edm::ParameterSetDescription>("preselection", psd0);
214  }
215 
216  // Corrections
217  desc.add<std::string>("superClusterErrorFunction", "EcalClusterEnergyUncertaintyObjectSpecific");
218  desc.add<std::string>("crackCorrectionFunction", "EcalClusterCrackCorrection");
219 
220  desc.add<bool>("ecalWeightsFromDB", true);
221  desc.add<std::vector<std::string>>("ecalRefinedRegressionWeightFiles", {})
222  ->setComment("if not from DB. Otherwise, keep empty");
223  desc.add<bool>("combinationWeightsFromDB", true);
224  desc.add<std::vector<std::string>>("combinationRegressionWeightFile", {})
225  ->setComment("if not from DB. Otherwise, keep empty");
226 
227  // regression. The labels are needed in all cases.
228  desc.add<std::vector<std::string>>("ecalRefinedRegressionWeightLabels", {});
229  desc.add<std::vector<std::string>>("combinationRegressionWeightLabels", {});
230 
231  desc.add<std::vector<std::string>>(
232  "ElecMVAFilesString",
233  {
234  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_10_17Feb2011.weights.xml",
235  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_12_17Feb2011.weights.xml",
236  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_20_17Feb2011.weights.xml",
237  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_22_17Feb2011.weights.xml",
238  });
239  desc.add<std::vector<std::string>>(
240  "SoftElecMVAFilesString",
241  {
242  "RecoEgamma/ElectronIdentification/data/TMVA_BDTSoftElectrons_7Feb2014.weights.xml",
243  });
244 
245  descriptions.add("gsfElectronProducer", desc);
246 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), EleTkIsolFromCands::pSetDescript(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ globalEndJob()

static void GsfElectronProducer::globalEndJob ( GsfElectronAlgo::HeavyObjectCache const *  )
inlinestatic

Definition at line 86 of file GsfElectronProducer.cc.

86 {}

◆ initializeGlobalCache()

static std::unique_ptr<GsfElectronAlgo::HeavyObjectCache> GsfElectronProducer::initializeGlobalCache ( const edm::ParameterSet conf)
inlinestatic

Definition at line 82 of file GsfElectronProducer.cc.

82  {
83  return std::make_unique<GsfElectronAlgo::HeavyObjectCache>(conf);
84  }

◆ isPreselected()

bool GsfElectronProducer::isPreselected ( reco::GsfElectron const &  ele) const
private

Definition at line 530 of file GsfElectronProducer.cc.

530  {
531  bool passCutBased = ele.passingCutBasedPreselection();
532  bool passPF = ele.passingPflowPreselection();
533  // it is worth nothing for gedGsfElectrons, this does nothing as its not set
534  // till GedGsfElectron finaliser, this is always false
535  bool passmva = ele.passingMvaPreselection();
536  if (!ele.ecalDrivenSeed()) {
537  if (ele.pt() > strategyCfg_.MaxElePtForOnlyMVA)
538  return passmva && passCutBased;
539  else
540  return passmva;
541  } else {
542  return passCutBased || passPF || passmva;
543  }
544 }

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

Referenced by produce(), and setAmbiguityData().

◆ produce()

void GsfElectronProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 547 of file GsfElectronProducer.cc.

547  {
548  // check configuration
551  auto seeds = event.getHandle(inputCfg_.seedsTag);
552  if (!seeds.isValid()) {
553  edm::LogWarning("GsfElectronAlgo|UnreachableSeedsProvenance")
554  << "Cannot check consistency of parameters with ecal seeding ones,"
555  << " because the original collection of seeds is not any more available.";
556  } else {
557  checkEcalSeedingParameters(edm::parameterSet(*seeds.provenance(), event.processHistory()));
558  }
559  }
560 
561  auto electrons = algo_->completeElectrons(event, setup, globalCache());
563  const auto gsfMVAInputMap = matchWithPFCandidates(event.get(egmPFCandidateCollection_));
564  setMVAOutputs(electrons, globalCache(), event.get(inputCfg_.vtxCollectionTag));
565  for (auto& el : electrons)
566  el.setMvaInput(gsfMVAInputMap.find(el.gsfTrack())->second); // set MVA inputs
567  }
568 
569  // all electrons
570  logElectrons(electrons, event, "GsfElectronAlgo Info (before preselection)");
571  // preselection
573  electrons.erase(
574  std::remove_if(electrons.begin(), electrons.end(), [this](auto const& ele) { return !isPreselected(ele); }),
575  electrons.end());
576  logElectrons(electrons, event, "GsfElectronAlgo Info (after preselection)");
577  }
578  // ambiguity
581  electrons.erase(std::remove_if(electrons.begin(), electrons.end(), std::mem_fn(&reco::GsfElectron::ambiguous)),
582  electrons.end());
583  logElectrons(electrons, event, "GsfElectronAlgo Info (after amb. solving)");
584  }
585  // final filling
586  event.emplace(electronPutToken_, std::move(electrons));
587 }

References algo_, reco::GsfElectron::ambiguous(), GsfElectronAlgo::StrategyConfiguration::applyAmbResolution, GsfElectronAlgo::StrategyConfiguration::applyPreselection, checkEcalSeedingParameters(), ecalSeedingParametersChecked_, egmPFCandidateCollection_, electronPutToken_, pwdgSkimBPark_cfi::electrons, GsfElectronAlgo::StrategyConfiguration::ignoreNotPreselected, inputCfg_, isPreselected(), eostools::move(), edm::parameterSet(), resetMvaValuesUsingPFCandidates_, edm::second(), InitialStep_cff::seeds, GsfElectronAlgo::Tokens::seedsTag, setAmbiguityData(), singleTopDQM_cfi::setup, strategyCfg_, and GsfElectronAlgo::Tokens::vtxCollectionTag.

◆ setAmbiguityData()

void GsfElectronProducer::setAmbiguityData ( reco::GsfElectronCollection electrons,
edm::Event const &  event,
bool  ignoreNotPreselected = true 
) const
private

Definition at line 432 of file GsfElectronProducer.cc.

434  {
435  // Getting required event data
436  auto const& beamspot = event.get(inputCfg_.beamSpotTag);
437  auto gsfPfRecTracks =
439  auto const& barrelRecHits = event.get(inputCfg_.barrelRecHitCollection);
440  auto const& endcapRecHits = event.get(inputCfg_.endcapRecHitCollection);
441 
442  if (strategyCfg_.ambSortingStrategy == 0) {
443  std::sort(electrons.begin(), electrons.end(), egamma::isBetterElectron);
444  } else if (strategyCfg_.ambSortingStrategy == 1) {
445  std::sort(electrons.begin(), electrons.end(), egamma::isInnermostElectron);
446  } else {
447  throw cms::Exception("GsfElectronAlgo|UnknownAmbiguitySortingStrategy")
448  << "value of strategyCfg_.ambSortingStrategy is : " << strategyCfg_.ambSortingStrategy;
449  }
450 
451  // init
452  for (auto& electron : electrons) {
453  electron.clearAmbiguousGsfTracks();
454  electron.setAmbiguous(false);
455  }
456 
457  // get ambiguous from GsfPfRecTracks
458  if (useGsfPfRecTracks_) {
459  for (auto& e1 : electrons) {
460  bool found = false;
461  for (auto const& gsfPfRecTrack : *gsfPfRecTracks) {
462  if (gsfPfRecTrack.gsfTrackRef() == e1.gsfTrack()) {
463  if (found) {
464  edm::LogWarning("GsfElectronAlgo") << "associated gsfPfRecTrack already found";
465  } else {
466  found = true;
467  for (auto const& duplicate : gsfPfRecTrack.convBremGsfPFRecTrackRef()) {
468  e1.addAmbiguousGsfTrack(duplicate->gsfTrackRef());
469  }
470  }
471  }
472  }
473  }
474  }
475  // or search overlapping clusters
476  else {
477  for (auto e1 = electrons.begin(); e1 != electrons.end(); ++e1) {
478  if (e1->ambiguous())
479  continue;
481  continue;
482 
483  SuperClusterRef scRef1 = e1->superCluster();
484  CaloClusterPtr eleClu1 = e1->electronCluster();
485  LogDebug("GsfElectronAlgo") << "Blessing electron with E/P " << e1->eSuperClusterOverP() << ", cluster "
486  << scRef1.get() << " & track " << e1->gsfTrack().get();
487 
488  for (auto e2 = e1 + 1; e2 != electrons.end(); ++e2) {
489  if (e2->ambiguous())
490  continue;
491  if (ignoreNotPreselected && !isPreselected(*e2))
492  continue;
493 
494  SuperClusterRef scRef2 = e2->superCluster();
495  CaloClusterPtr eleClu2 = e2->electronCluster();
496 
497  // search if same cluster
498  bool sameCluster = false;
500  sameCluster = (scRef1 == scRef2);
501  } else if (strategyCfg_.ambClustersOverlapStrategy == 1) {
502  float eMin = 1.;
503  float threshold = eMin * cosh(EleRelPoint(scRef1->position(), beamspot.position()).eta());
504  using egamma::sharedEnergy;
505  sameCluster = ((sharedEnergy(*eleClu1, *eleClu2, barrelRecHits, endcapRecHits) >= threshold) ||
506  (sharedEnergy(*scRef1->seed(), *eleClu2, barrelRecHits, endcapRecHits) >= threshold) ||
507  (sharedEnergy(*eleClu1, *scRef2->seed(), barrelRecHits, endcapRecHits) >= threshold) ||
508  (sharedEnergy(*scRef1->seed(), *scRef2->seed(), barrelRecHits, endcapRecHits) >= threshold));
509  } else {
510  throw cms::Exception("GsfElectronAlgo|UnknownAmbiguityClustersOverlapStrategy")
511  << "value of strategyCfg_.ambClustersOverlapStrategy is : " << strategyCfg_.ambClustersOverlapStrategy;
512  }
513 
514  // main instructions
515  if (sameCluster) {
516  LogDebug("GsfElectronAlgo") << "Discarding electron with E/P " << e2->eSuperClusterOverP() << ", cluster "
517  << scRef2.get() << " and track " << e2->gsfTrack().get();
518  e1->addAmbiguousGsfTrack(e2->gsfTrack());
519  e2->setAmbiguous(true);
520  } else if (e1->gsfTrack() == e2->gsfTrack()) {
521  edm::LogWarning("GsfElectronAlgo") << "Forgetting electron with E/P " << e2->eSuperClusterOverP()
522  << ", cluster " << scRef2.get() << " and track " << e2->gsfTrack().get();
523  e2->setAmbiguous(true);
524  }
525  }
526  }
527  }
528 }

References GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy, GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy, GsfElectronAlgo::Tokens::barrelRecHitCollection, HLT_2018_cff::barrelRecHits, GsfElectronAlgo::Tokens::beamSpotTag, StorageManager_cfg::e1, HPSPFTauProducerPuppi_cfi::electron, pwdgSkimBPark_cfi::electrons, photonAnalyzer_cfi::eMin, GsfElectronAlgo::Tokens::endcapRecHitCollection, HLT_2018_cff::endcapRecHits, PVValHelper::eta, Exception, newFWLiteAna::found, edm::Ref< C, T, F >::get(), uncleanedOnlyElectronSequence_cff::gsfPfRecTracks, gsfPfRecTracksTag_, gsfElectrons_cfi::ignoreNotPreselected, inputCfg_, egamma::isBetterElectron(), egamma::isInnermostElectron(), isPreselected(), LogDebug, egamma::sharedEnergy(), strategyCfg_, remoteMonitoring_LED_IterMethod_cfg::threshold, and useGsfPfRecTracks_.

Referenced by produce().

Member Data Documentation

◆ algo_

std::unique_ptr<GsfElectronAlgo> GsfElectronProducer::algo_
private

Definition at line 92 of file GsfElectronProducer.cc.

Referenced by produce().

◆ cutsCfg_

const GsfElectronAlgo::CutsConfiguration GsfElectronProducer::cutsCfg_
private

Definition at line 97 of file GsfElectronProducer.cc.

Referenced by checkEcalSeedingParameters().

◆ ecalSeedingParametersChecked_

bool GsfElectronProducer::ecalSeedingParametersChecked_
private

Definition at line 106 of file GsfElectronProducer.cc.

Referenced by produce().

◆ egmPFCandidateCollection_

edm::EDGetTokenT<reco::PFCandidateCollection> GsfElectronProducer::egmPFCandidateCollection_
private

Definition at line 111 of file GsfElectronProducer.cc.

Referenced by produce().

◆ electronPutToken_

const edm::EDPutTokenT<reco::GsfElectronCollection> GsfElectronProducer::electronPutToken_
private

Definition at line 109 of file GsfElectronProducer.cc.

Referenced by produce().

◆ gsfPfRecTracksTag_

const edm::EDGetTokenT<reco::GsfPFRecTrackCollection> GsfElectronProducer::gsfPfRecTracksTag_
private

Definition at line 110 of file GsfElectronProducer.cc.

Referenced by setAmbiguityData().

◆ hcalCfg_

ElectronHcalHelper::Configuration GsfElectronProducer::hcalCfg_
private

Definition at line 98 of file GsfElectronProducer.cc.

Referenced by checkEcalSeedingParameters().

◆ inputCfg_

GsfElectronAlgo::Tokens GsfElectronProducer::inputCfg_
private

Definition at line 95 of file GsfElectronProducer.cc.

Referenced by produce(), and setAmbiguityData().

◆ resetMvaValuesUsingPFCandidates_

const bool GsfElectronProducer::resetMvaValuesUsingPFCandidates_
private

Definition at line 115 of file GsfElectronProducer.cc.

Referenced by produce().

◆ strategyCfg_

GsfElectronAlgo::StrategyConfiguration GsfElectronProducer::strategyCfg_
private

Definition at line 96 of file GsfElectronProducer.cc.

Referenced by isPreselected(), produce(), and setAmbiguityData().

◆ useGsfPfRecTracks_

const bool GsfElectronProducer::useGsfPfRecTracks_
private

Definition at line 113 of file GsfElectronProducer.cc.

Referenced by setAmbiguityData().

GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedEndcaps
std::vector< int > recHitFlagsToBeExcludedEndcaps
Definition: GsfElectronAlgo.h:155
GsfElectronAlgo::CutsConfiguration::maxHOverEBarrelCone
double maxHOverEBarrelCone
Definition: GsfElectronAlgo.h:110
GsfElectronAlgo::StrategyConfiguration::applyAmbResolution
bool applyAmbResolution
Definition: GsfElectronAlgo.h:81
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
RegressionHelper::Configuration::ecalRegressionWeightLabels
std::vector< std::string > ecalRegressionWeightLabels
Definition: RegressionHelper.h:27
GsfElectronAlgo::Tokens::gsfElectronCores
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
Definition: GsfElectronAlgo.h:59
GsfElectronAlgo::StrategyConfiguration::useCombinationRegression
bool useCombinationRegression
Definition: GsfElectronAlgo.h:92
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
GsfElectronAlgo::StrategyConfiguration::ignoreNotPreselected
bool ignoreNotPreselected
Definition: GsfElectronAlgo.h:82
GsfElectronProducer::inputCfg_
GsfElectronAlgo::Tokens inputCfg_
Definition: GsfElectronProducer.cc:95
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy
unsigned ambClustersOverlapStrategy
Definition: GsfElectronAlgo.h:84
GsfElectronProducer::cutsCfg_
const GsfElectronAlgo::CutsConfiguration cutsCfg_
Definition: GsfElectronProducer.cc:97
HLT_2018_cff.endcapRecHits
endcapRecHits
Definition: HLT_2018_cff.py:13538
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel
std::vector< int > recHitFlagsToBeExcludedBarrel
Definition: GsfElectronAlgo.h:154
GsfElectronAlgo::Tokens::seedsTag
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
Definition: GsfElectronAlgo.h:65
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
GsfElectronAlgo::CutsConfiguration::minSCEtEndcaps
double minSCEtEndcaps
Definition: GsfElectronAlgo.h:101
GsfElectronAlgo::Tokens::beamSpotTag
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
Definition: GsfElectronAlgo.h:67
GsfElectronAlgo::Tokens::barrelRecHitCollection
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
Definition: GsfElectronAlgo.h:63
GsfElectronProducer::isPreselected
bool isPreselected(reco::GsfElectron const &ele) const
Definition: GsfElectronProducer.cc:530
GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalErrorFromClassBasedParameterization
bool ecalDrivenEcalErrorFromClassBasedParameterization
Definition: GsfElectronAlgo.h:78
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
GsfElectronAlgo::CutsConfiguration::maxHOverEEndcapsCone
double maxHOverEEndcapsCone
Definition: GsfElectronAlgo.h:111
edm::Ref< SuperClusterCollection >
GsfElectronProducer::resetMvaValuesUsingPFCandidates_
const bool resetMvaValuesUsingPFCandidates_
Definition: GsfElectronProducer.cc:115
GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy
unsigned ambSortingStrategy
Definition: GsfElectronAlgo.h:83
gsfElectrons_cfi.ignoreNotPreselected
ignoreNotPreselected
Definition: gsfElectrons_cfi.py:37
uncleanedOnlyElectronSequence_cff.gsfPfRecTracks
gsfPfRecTracks
Definition: uncleanedOnlyElectronSequence_cff.py:141
GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedBarrel
std::vector< int > recHitSeverityToBeExcludedBarrel
Definition: GsfElectronAlgo.h:156
EleRelPoint
Definition: ElectronUtilities.h:25
GsfElectronAlgo::StrategyConfiguration::pureTrackerDrivenEcalErrorFromSimpleParameterization
bool pureTrackerDrivenEcalErrorFromSimpleParameterization
Definition: GsfElectronAlgo.h:79
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ElectronHcalHelper::Configuration::hcalTowers
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
Definition: ElectronHcalHelper.h:31
PVValHelper::eta
Definition: PVValidationHelpers.h:69
photonAnalyzer_cfi.eMin
eMin
Definition: photonAnalyzer_cfi.py:50
GsfElectronAlgo::CutsConfiguration::minSCEtBarrel
double minSCEtBarrel
Definition: GsfElectronAlgo.h:100
beamspot
Definition: BeamSpotWrite2Txt.h:8
ElectronHcalHelper::Configuration::hOverEConeSize
double hOverEConeSize
Definition: ElectronHcalHelper.h:25
GsfElectronAlgo::StrategyConfiguration::ctfTracksCheck
bool ctfTracksCheck
Definition: GsfElectronAlgo.h:86
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GsfElectronAlgo::Tokens::endcapRecHitCollection
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
Definition: GsfElectronAlgo.h:64
edm::LogWarning
Definition: MessageLogger.h:141
GsfElectronAlgo::StrategyConfiguration::MaxElePtForOnlyMVA
float MaxElePtForOnlyMVA
Definition: GsfElectronAlgo.h:88
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:232
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
GsfElectronProducer::algo_
std::unique_ptr< GsfElectronAlgo > algo_
Definition: GsfElectronProducer.cc:92
GsfElectronProducer::useGsfPfRecTracks_
const bool useGsfPfRecTracks_
Definition: GsfElectronProducer.cc:113
GsfElectronAlgo::Tokens::conversions
edm::EDGetTokenT< reco::ConversionCollection > conversions
Definition: GsfElectronAlgo.h:69
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
GsfElectronProducer::egmPFCandidateCollection_
edm::EDGetTokenT< reco::PFCandidateCollection > egmPFCandidateCollection_
Definition: GsfElectronProducer.cc:111
EleTkIsolFromCands::pSetDescript
static edm::ParameterSetDescription pSetDescript()
Definition: EleTkIsolFromCands.cc:47
get
#define get
electronEcalRecHitIsolationLcone_cfi.etMinBarrel
etMinBarrel
Definition: electronEcalRecHitIsolationLcone_cfi.py:19
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
GsfElectronAlgo::StrategyConfiguration::fillConvVtxFitProb
bool fillConvVtxFitProb
Definition: GsfElectronAlgo.h:95
egamma::sharedEnergy
float sharedEnergy(reco::CaloCluster const &clu1, reco::CaloCluster const &clu2, EcalRecHitCollection const &barrelRecHits, EcalRecHitCollection const &endcapRecHits)
Definition: EgAmbiguityTools.cc:140
edm::Ptr< CaloCluster >
looper.cfg
cfg
Definition: looper.py:297
GsfElectronProducer::checkEcalSeedingParameters
void checkEcalSeedingParameters(edm::ParameterSet const &)
Definition: GsfElectronProducer.cc:395
HLT_2018_cff.barrelRecHits
barrelRecHits
Definition: HLT_2018_cff.py:13541
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
GsfElectronAlgo::StrategyConfiguration::applyPreselection
bool applyPreselection
Definition: GsfElectronAlgo.h:74
eostools.move
def move(src, dest)
Definition: eostools.py:511
GsfElectronAlgo::StrategyConfiguration::PreSelectMVA
float PreSelectMVA
Definition: GsfElectronAlgo.h:87
GsfElectronProducer::electronPutToken_
const edm::EDPutTokenT< reco::GsfElectronCollection > electronPutToken_
Definition: GsfElectronProducer.cc:109
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
ElectronHcalHelper::Configuration::hOverEPtMin
double hOverEPtMin
Definition: ElectronHcalHelper.h:32
ElectronHcalHelper::Configuration::checkHcalStatus
bool checkHcalStatus
Definition: ElectronHcalHelper.h:28
Exception
Definition: hltDiff.cc:246
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
GsfElectronProducer::ecalSeedingParametersChecked_
bool ecalSeedingParametersChecked_
Definition: GsfElectronProducer.cc:106
GsfElectronAlgo::Tokens::vtxCollectionTag
edm::EDGetTokenT< reco::VertexCollection > vtxCollectionTag
Definition: GsfElectronAlgo.h:68
ElectronHcalHelper::Configuration::useTowers
bool useTowers
Definition: ElectronHcalHelper.h:28
GsfElectronProducer::hcalCfg_
ElectronHcalHelper::Configuration hcalCfg_
Definition: GsfElectronProducer.cc:98
GsfElectronAlgo::StrategyConfiguration::useDefaultEnergyCorrection
bool useDefaultEnergyCorrection
Definition: GsfElectronAlgo.h:89
egamma::isBetterElectron
bool isBetterElectron(reco::GsfElectron const &, reco::GsfElectron const &)
Definition: EgAmbiguityTools.cc:16
egamma::isInnermostElectron
bool isInnermostElectron(reco::GsfElectron const &, reco::GsfElectron const &)
Definition: EgAmbiguityTools.cc:20
GsfElectronProducer::strategyCfg_
GsfElectronAlgo::StrategyConfiguration strategyCfg_
Definition: GsfElectronProducer.cc:96
GsfElectronAlgo::Tokens::ctfTracks
edm::EDGetTokenT< reco::TrackCollection > ctfTracks
Definition: GsfElectronAlgo.h:66
GsfElectronAlgo::StrategyConfiguration::useEcalRegression
bool useEcalRegression
Definition: GsfElectronAlgo.h:91
GsfElectronAlgo::Tokens::hcalTowersTag
edm::EDGetTokenT< CaloTowerCollection > hcalTowersTag
Definition: GsfElectronAlgo.h:60
GsfElectronAlgo::IsolationConfiguration::intRadiusHcal
double intRadiusHcal
Definition: GsfElectronAlgo.h:163
GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalEnergyFromClassBasedParameterization
bool ecalDrivenEcalEnergyFromClassBasedParameterization
Definition: GsfElectronAlgo.h:77
event
Definition: event.py:1
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
GsfElectronAlgo::IsolationConfiguration
Definition: GsfElectronAlgo.h:162
gedGsfElectrons_cfi.combinationRegressionWeightLabels
combinationRegressionWeightLabels
Definition: gedGsfElectrons_cfi.py:21
reco::GsfElectron::ambiguous
bool ambiguous() const
Definition: GsfElectron.h:689
GsfElectronProducer::setAmbiguityData
void setAmbiguityData(reco::GsfElectronCollection &electrons, edm::Event const &event, bool ignoreNotPreselected=true) const
Definition: GsfElectronProducer.cc:432
edm::InputTag
Definition: InputTag.h:15
GsfElectronProducer::gsfPfRecTracksTag_
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag_
Definition: GsfElectronProducer.cc:110
RegressionHelper::Configuration
Definition: RegressionHelper.h:25
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
GsfElectronAlgo::EcalRecHitsConfiguration
Definition: GsfElectronAlgo.h:153
GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps
std::vector< int > recHitSeverityToBeExcludedEndcaps
Definition: GsfElectronAlgo.h:157
electronEcalRecHitIsolationLcone_cfi.vetoClustered
vetoClustered
Definition: electronEcalRecHitIsolationLcone_cfi.py:27