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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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 280 of file GsfElectronProducer.cc.

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

References looper::cfg.

Member Function Documentation

◆ checkEcalSeedingParameters()

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

Definition at line 388 of file GsfElectronProducer.cc.

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

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  // preselection parameters
211  desc.add<edm::ParameterSetDescription>("preselection", psd0);
212  }
213 
214  // Corrections
215  desc.add<std::string>("superClusterErrorFunction", "EcalClusterEnergyUncertaintyObjectSpecific");
216  desc.add<std::string>("crackCorrectionFunction", "EcalClusterCrackCorrection");
217 
218  desc.add<bool>("ecalWeightsFromDB", true);
219  desc.add<std::vector<std::string>>("ecalRefinedRegressionWeightFiles", {})
220  ->setComment("if not from DB. Otherwise, keep empty");
221  desc.add<bool>("combinationWeightsFromDB", true);
222  desc.add<std::vector<std::string>>("combinationRegressionWeightFile", {})
223  ->setComment("if not from DB. Otherwise, keep empty");
224 
225  // regression. The labels are needed in all cases.
226  desc.add<std::vector<std::string>>("ecalRefinedRegressionWeightLabels", {});
227  desc.add<std::vector<std::string>>("combinationRegressionWeightLabels", {});
228 
229  desc.add<std::vector<std::string>>(
230  "ElecMVAFilesString",
231  {
232  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_10_17Feb2011.weights.xml",
233  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_12_17Feb2011.weights.xml",
234  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_20_17Feb2011.weights.xml",
235  "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_22_17Feb2011.weights.xml",
236  });
237  desc.add<std::vector<std::string>>(
238  "SoftElecMVAFilesString",
239  {
240  "RecoEgamma/ElectronIdentification/data/TMVA_BDTSoftElectrons_7Feb2014.weights.xml",
241  });
242 
243  descriptions.add("gsfElectronProducer", desc);
244 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, 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 523 of file GsfElectronProducer.cc.

523  {
524  bool passCutBased = ele.passingCutBasedPreselection();
525  bool passPF = ele.passingPflowPreselection();
526  // it is worth nothing for gedGsfElectrons, this does nothing as its not set
527  // till GedGsfElectron finaliser, this is always false
528  bool passmva = ele.passingMvaPreselection();
529  if (!ele.ecalDrivenSeed()) {
530  if (ele.pt() > strategyCfg_.MaxElePtForOnlyMVA)
531  return passmva && passCutBased;
532  else
533  return passmva;
534  } else {
535  return passCutBased || passPF || passmva;
536  }
537 }

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

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

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

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

References GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy, GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy, GsfElectronAlgo::Tokens::barrelRecHitCollection, HLT_FULL_cff::barrelRecHits, GsfElectronAlgo::Tokens::beamSpotTag, StorageManager_cfg::e1, metsig::electron, pwdgSkimBPark_cfi::electrons, photonAnalyzer_cfi::eMin, GsfElectronAlgo::Tokens::endcapRecHitCollection, HLT_FULL_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:152
GsfElectronAlgo::CutsConfiguration::maxHOverEBarrelCone
double maxHOverEBarrelCone
Definition: GsfElectronAlgo.h:111
GsfElectronAlgo::StrategyConfiguration::applyAmbResolution
bool applyAmbResolution
Definition: GsfElectronAlgo.h:82
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:29
HLT_FULL_cff.endcapRecHits
endcapRecHits
Definition: HLT_FULL_cff.py:14981
GsfElectronAlgo::Tokens::gsfElectronCores
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
Definition: GsfElectronAlgo.h:60
GsfElectronAlgo::StrategyConfiguration::useCombinationRegression
bool useCombinationRegression
Definition: GsfElectronAlgo.h:93
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLT_FULL_cff.barrelRecHits
barrelRecHits
Definition: HLT_FULL_cff.py:14984
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:83
GsfElectronProducer::inputCfg_
GsfElectronAlgo::Tokens inputCfg_
Definition: GsfElectronProducer.cc:95
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
GsfElectronAlgo::StrategyConfiguration::ambClustersOverlapStrategy
unsigned ambClustersOverlapStrategy
Definition: GsfElectronAlgo.h:85
GsfElectronProducer::cutsCfg_
const GsfElectronAlgo::CutsConfiguration cutsCfg_
Definition: GsfElectronProducer.cc:97
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
GsfElectronAlgo::EcalRecHitsConfiguration::recHitFlagsToBeExcludedBarrel
std::vector< int > recHitFlagsToBeExcludedBarrel
Definition: GsfElectronAlgo.h:151
GsfElectronAlgo::Tokens::seedsTag
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
Definition: GsfElectronAlgo.h:66
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
GsfElectronAlgo::CutsConfiguration::minSCEtEndcaps
double minSCEtEndcaps
Definition: GsfElectronAlgo.h:102
GsfElectronAlgo::Tokens::beamSpotTag
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
Definition: GsfElectronAlgo.h:68
GsfElectronAlgo::Tokens::barrelRecHitCollection
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
Definition: GsfElectronAlgo.h:64
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
GsfElectronProducer::isPreselected
bool isPreselected(reco::GsfElectron const &ele) const
Definition: GsfElectronProducer.cc:523
GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalErrorFromClassBasedParameterization
bool ecalDrivenEcalErrorFromClassBasedParameterization
Definition: GsfElectronAlgo.h:79
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
GsfElectronAlgo::CutsConfiguration::maxHOverEEndcapsCone
double maxHOverEEndcapsCone
Definition: GsfElectronAlgo.h:112
edm::Ref< SuperClusterCollection >
GsfElectronProducer::resetMvaValuesUsingPFCandidates_
const bool resetMvaValuesUsingPFCandidates_
Definition: GsfElectronProducer.cc:115
GsfElectronAlgo::StrategyConfiguration::ambSortingStrategy
unsigned ambSortingStrategy
Definition: GsfElectronAlgo.h:84
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:153
EleRelPoint
Definition: ElectronUtilities.h:25
GsfElectronAlgo::StrategyConfiguration::pureTrackerDrivenEcalErrorFromSimpleParameterization
bool pureTrackerDrivenEcalErrorFromSimpleParameterization
Definition: GsfElectronAlgo.h:80
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:33
PVValHelper::eta
Definition: PVValidationHelpers.h:69
photonAnalyzer_cfi.eMin
eMin
Definition: photonAnalyzer_cfi.py:50
metsig::electron
Definition: SignAlgoResolutions.h:48
GsfElectronAlgo::CutsConfiguration::minSCEtBarrel
double minSCEtBarrel
Definition: GsfElectronAlgo.h:101
beamspot
Definition: BeamSpotWrite2Txt.h:8
ElectronHcalHelper::Configuration::hOverEConeSize
double hOverEConeSize
Definition: ElectronHcalHelper.h:27
GsfElectronAlgo::StrategyConfiguration::ctfTracksCheck
bool ctfTracksCheck
Definition: GsfElectronAlgo.h:87
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GsfElectronAlgo::Tokens::endcapRecHitCollection
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
Definition: GsfElectronAlgo.h:65
GsfElectronAlgo::StrategyConfiguration::MaxElePtForOnlyMVA
float MaxElePtForOnlyMVA
Definition: GsfElectronAlgo.h:89
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:230
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
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:70
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:43
get
#define get
electronEcalRecHitIsolationLcone_cfi.etMinBarrel
etMinBarrel
Definition: electronEcalRecHitIsolationLcone_cfi.py:19
GsfElectronAlgo::StrategyConfiguration::fillConvVtxFitProb
bool fillConvVtxFitProb
Definition: GsfElectronAlgo.h:96
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:388
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
GsfElectronAlgo::StrategyConfiguration::applyPreselection
bool applyPreselection
Definition: GsfElectronAlgo.h:75
eostools.move
def move(src, dest)
Definition: eostools.py:511
GsfElectronAlgo::StrategyConfiguration::PreSelectMVA
float PreSelectMVA
Definition: GsfElectronAlgo.h:88
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:34
ElectronHcalHelper::Configuration::checkHcalStatus
bool checkHcalStatus
Definition: ElectronHcalHelper.h:30
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:69
ElectronHcalHelper::Configuration::useTowers
bool useTowers
Definition: ElectronHcalHelper.h:30
GsfElectronProducer::hcalCfg_
ElectronHcalHelper::Configuration hcalCfg_
Definition: GsfElectronProducer.cc:98
GsfElectronAlgo::StrategyConfiguration::useDefaultEnergyCorrection
bool useDefaultEnergyCorrection
Definition: GsfElectronAlgo.h:90
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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:67
GsfElectronAlgo::StrategyConfiguration::useEcalRegression
bool useEcalRegression
Definition: GsfElectronAlgo.h:92
GsfElectronAlgo::Tokens::hcalTowersTag
edm::EDGetTokenT< CaloTowerCollection > hcalTowersTag
Definition: GsfElectronAlgo.h:61
GsfElectronAlgo::IsolationConfiguration::intRadiusHcal
double intRadiusHcal
Definition: GsfElectronAlgo.h:160
GsfElectronAlgo::StrategyConfiguration::ecalDrivenEcalEnergyFromClassBasedParameterization
bool ecalDrivenEcalEnergyFromClassBasedParameterization
Definition: GsfElectronAlgo.h:78
event
Definition: event.py:1
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
GsfElectronAlgo::IsolationConfiguration
Definition: GsfElectronAlgo.h:159
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:425
edm::InputTag
Definition: InputTag.h:15
GsfElectronProducer::gsfPfRecTracksTag_
const edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag_
Definition: GsfElectronProducer.cc:110
RegressionHelper::Configuration
Definition: RegressionHelper.h:27
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
GsfElectronAlgo::EcalRecHitsConfiguration
Definition: GsfElectronAlgo.h:150
GsfElectronAlgo::EcalRecHitsConfiguration::recHitSeverityToBeExcludedEndcaps
std::vector< int > recHitSeverityToBeExcludedEndcaps
Definition: GsfElectronAlgo.h:154
electronEcalRecHitIsolationLcone_cfi.vetoClustered
vetoClustered
Definition: electronEcalRecHitIsolationLcone_cfi.py:27