33 LogTrace(
"GsfElectronAlgo") <<
"========== " << title <<
" ==========";
34 LogTrace(
"GsfElectronAlgo") <<
"Event: " <<
event.id();
35 LogTrace(
"GsfElectronAlgo") <<
"Number of electrons: " << electrons.size();
36 for (
auto const& ele : electrons) {
37 LogTrace(
"GsfElectronAlgo") <<
"Electron with charge, pt, eta, phi: " << ele.charge() <<
" , " << ele.pt()
38 <<
" , " << ele.eta() <<
" , " << ele.phi();
40 LogTrace(
"GsfElectronAlgo") <<
"=================================================";
65 desc.
add<
bool>(
"checkHcalStatus",
true);
68 desc.
add<
bool>(
"gedElectronMode",
true);
69 desc.
add<
bool>(
"useCombinationRegression",
true);
70 desc.
add<
bool>(
"ecalDrivenEcalEnergyFromClassBasedParameterization",
false);
71 desc.
add<
bool>(
"ecalDrivenEcalErrorFromClassBasedParameterization",
false);
72 desc.
add<
bool>(
"applyPreselection",
true);
73 desc.
add<
bool>(
"useEcalRegression",
true);
74 desc.
add<
bool>(
"applyAmbResolution",
false);
75 desc.
add<
bool>(
"useGsfPfRecTracks",
true);
76 desc.
add<
bool>(
"pureTrackerDrivenEcalErrorFromSimpleParameterization",
true);
77 desc.
add<
unsigned int>(
"ambSortingStrategy", 1);
78 desc.
add<
unsigned int>(
"ambClustersOverlapStrategy", 1);
79 desc.
add<
bool>(
"addPflowElectrons",
true);
80 desc.
add<
bool>(
"fillConvVtxFitProb",
true);
83 desc.
add<std::vector<std::string>>(
"recHitFlagsToBeExcludedBarrel");
84 desc.
add<std::vector<std::string>>(
"recHitFlagsToBeExcludedEndcaps");
85 desc.
add<std::vector<std::string>>(
"recHitSeverityToBeExcludedBarrel");
86 desc.
add<std::vector<std::string>>(
"recHitSeverityToBeExcludedEndcaps");
93 desc.
add<
bool>(
"useNumCrystals",
true);
94 desc.
add<
double>(
"etMinBarrel", 0.0);
95 desc.
add<
double>(
"etMinEndcaps", 0.11);
96 desc.
add<
double>(
"etMinHcal", 0.0);
97 desc.
add<
double>(
"eMinBarrel", 0.095);
98 desc.
add<
double>(
"eMinEndcaps", 0.0);
99 desc.
add<
double>(
"intRadiusEcalBarrel", 3.0);
100 desc.
add<
double>(
"intRadiusEcalEndcaps", 3.0);
101 desc.
add<
double>(
"intRadiusHcal", 0.15);
102 desc.
add<
double>(
"jurassicWidth", 1.5);
103 desc.
add<
bool>(
"vetoClustered",
false);
106 psd0.
add<
std::string>(
"propagatorAlongTISE",
"PropagatorWithMaterial");
107 psd0.
add<
std::string>(
"propagatorOppositeTISE",
"PropagatorWithMaterialOpposite");
112 desc.
add<
bool>(
"ctfTracksCheck",
true);
115 desc.
add<
double>(
"MaxElePtForOnlyMVA",50.0);
116 desc.
add<
double>(
"PreSelectMVA", -0.1);
120 psd0.
add<
double>(
"minSCEtBarrel", 0.0);
121 psd0.
add<
double>(
"minSCEtEndcaps", 0.0);
122 psd0.
add<
double>(
"minEOverPBarrel", 0.0);
123 psd0.
add<
double>(
"minEOverPEndcaps", 0.0);
124 psd0.
add<
double>(
"maxEOverPBarrel", 999999999.0);
125 psd0.
add<
double>(
"maxEOverPEndcaps", 999999999.0);
126 psd0.
add<
double>(
"maxDeltaEtaBarrel", 999999999.0);
127 psd0.
add<
double>(
"maxDeltaEtaEndcaps", 999999999.0);
128 psd0.
add<
double>(
"maxDeltaPhiBarrel", 999999999.0);
129 psd0.
add<
double>(
"maxDeltaPhiEndcaps", 999999999.0);
130 psd0.
add<
double>(
"hOverEConeSize", 0.15);
131 psd0.
add<
double>(
"hOverEPtMin", 0.0);
132 psd0.
add<
double>(
"maxHOverEBarrelCone", 999999999.0);
133 psd0.
add<
double>(
"maxHOverEEndcapsCone", 999999999.0);
134 psd0.
add<
double>(
"maxHBarrelCone", 0.0);
135 psd0.
add<
double>(
"maxHEndcapsCone", 0.0);
136 psd0.
add<
double>(
"maxHOverEBarrelTower", 999999999.0);
137 psd0.
add<
double>(
"maxHOverEEndcapsTower", 999999999.0);
138 psd0.
add<
double>(
"maxHBarrelTower", 0.0);
139 psd0.
add<
double>(
"maxHEndcapsTower", 0.0);
140 psd0.
add<
double>(
"maxSigmaIetaIetaBarrel", 999999999.0);
141 psd0.
add<
double>(
"maxSigmaIetaIetaEndcaps", 999999999.0);
142 psd0.
add<
double>(
"maxFbremBarrel", 999999999.0);
143 psd0.
add<
double>(
"maxFbremEndcaps", 999999999.0);
144 psd0.
add<
bool>(
"isBarrel",
false);
145 psd0.
add<
bool>(
"isEndcaps",
false);
146 psd0.
add<
bool>(
"isFiducial",
false);
147 psd0.
add<
bool>(
"seedFromTEC",
true);
148 psd0.
add<
double>(
"maxTIP", 999999999.0);
149 psd0.
add<
double>(
"minMVA", -0.4);
150 psd0.
add<
double>(
"minMvaByPassForIsolated", -0.4);
158 desc.
add<
std::string>(
"superClusterErrorFunction",
"EcalClusterEnergyUncertaintyObjectSpecific");
159 desc.
add<
std::string>(
"crackCorrectionFunction",
"EcalClusterCrackCorrection");
161 desc.
add<
bool>(
"ecalWeightsFromDB",
true);
162 desc.
add<std::vector<std::string>>(
"ecalRefinedRegressionWeightFiles", {})->setComment(
163 "if not from DB. Otherwise, keep empty");
164 desc.
add<
bool>(
"combinationWeightsFromDB",
true);
165 desc.
add<std::vector<std::string>>(
"combinationRegressionWeightFile", {})->setComment(
166 "if not from DB. Otherwise, keep empty");
169 desc.
add<std::vector<std::string>>(
"ecalRefinedRegressionWeightLabels", {});
170 desc.
add<std::vector<std::string>>(
"combinationRegressionWeightLabels", {});
173 desc.
add<
bool>(
"useIsolationValues",
false);
190 desc.
add<std::vector<std::string>>(
"ElecMVAFilesString", {
191 "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_10_17Feb2011.weights.xml",
192 "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_12_17Feb2011.weights.xml",
193 "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_20_17Feb2011.weights.xml",
194 "RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_22_17Feb2011.weights.xml",
196 desc.
add<std::vector<std::string>>(
"SoftElecMVAFilesString", {
197 "RecoEgamma/ElectronIdentification/data/TMVA_BDTSoftElectrons_7Feb2014.weights.xml",
209 .maxEOverPBarrel = pset.
getParameter<
double>(
"maxEOverPBarrel"),
211 .minEOverPBarrel = pset.
getParameter<
double>(
"minEOverPBarrel"),
212 .minEOverPEndcaps = pset.
getParameter<
double>(
"minEOverPEndcaps"),
213 .maxHOverEBarrelCone = pset.
getParameter<
double>(
"maxHOverEBarrelCone"),
215 .maxHBarrelCone = pset.
getParameter<
double>(
"maxHBarrelCone"),
216 .maxHEndcapsCone = pset.
getParameter<
double>(
"maxHEndcapsCone"),
217 .maxHOverEBarrelTower = pset.
getParameter<
double>(
"maxHOverEBarrelTower"),
219 .maxHBarrelTower = pset.
getParameter<
double>(
"maxHBarrelTower"),
220 .maxHEndcapsTower = pset.
getParameter<
double>(
"maxHEndcapsTower"),
221 .maxDeltaEtaBarrel = pset.
getParameter<
double>(
"maxDeltaEtaBarrel"),
223 .maxDeltaPhiBarrel = pset.
getParameter<
double>(
"maxDeltaPhiBarrel"),
225 .maxSigmaIetaIetaBarrel = pset.
getParameter<
double>(
"maxSigmaIetaIetaBarrel"),
226 .maxSigmaIetaIetaEndcaps = pset.
getParameter<
double>(
"maxSigmaIetaIetaEndcaps"),
227 .maxFbremBarrel = pset.
getParameter<
double>(
"maxFbremBarrel"),
228 .maxFbremEndcaps = pset.
getParameter<
double>(
"maxFbremEndcaps"),
233 .minMvaByPassForIsolated = pset.
getParameter<
double>(
"minMvaByPassForIsolated"),
241 : cutsCfg_(makeCutsConfiguration(cfg.getParameter<
edm::
ParameterSet>(
"preselection")))
242 , cutsCfgPflow_(makeCutsConfiguration(cfg.getParameter<
edm::
ParameterSet>(
"preselectionPflow")))
243 , ecalSeedingParametersChecked_(
false)
264 mayConsume<edm::ValueMap<double> >(
tag);
270 mayConsume<edm::ValueMap<double> >(
tag);
313 const std::vector<std::string> flagnamesbarrel = cfg.
getParameter<std::vector<std::string> >(
"recHitFlagsToBeExcludedBarrel");
314 recHitsCfg.recHitFlagsToBeExcludedBarrel = StringToEnumValue<EcalRecHit::Flags>(flagnamesbarrel);
315 const std::vector<std::string> flagnamesendcaps = cfg.
getParameter<std::vector<std::string> >(
"recHitFlagsToBeExcludedEndcaps");
316 recHitsCfg.recHitFlagsToBeExcludedEndcaps = StringToEnumValue<EcalRecHit::Flags>(flagnamesendcaps);
317 const std::vector<std::string> severitynamesbarrel = cfg.
getParameter<std::vector<std::string> >(
"recHitSeverityToBeExcludedBarrel");
318 recHitsCfg.recHitSeverityToBeExcludedBarrel = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesbarrel);
319 const std::vector<std::string> severitynamesendcaps = cfg.
getParameter<std::vector<std::string> >(
"recHitSeverityToBeExcludedEndcaps");
320 recHitsCfg.recHitSeverityToBeExcludedEndcaps = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesendcaps);
327 .intRadiusEcalBarrel = cfg.
getParameter<
double>(
"intRadiusEcalBarrel"),
328 .intRadiusEcalEndcaps = cfg.
getParameter<
double>(
"intRadiusEcalEndcaps"),
329 .jurassicWidth = cfg.
getParameter<
double>(
"jurassicWidth"),
332 .etMinEndcaps = cfg.
getParameter<
double>(
"etMinEndcaps"),
335 .useNumCrystals = cfg.
getParameter<
bool>(
"useNumCrystals")
340 .ecalWeightsFromDB = cfg.
getParameter<
bool>(
"ecalWeightsFromDB"),
341 .ecalRegressionWeightFiles = cfg.
getParameter<std::vector<std::string> >(
"ecalRefinedRegressionWeightFiles"),
343 .combinationWeightsFromDB = cfg.
getParameter<
bool>(
"combinationWeightsFromDB"),
344 .combinationRegressionWeightFiles = cfg.
getParameter<std::vector<std::string> >(
"combinationRegressionWeightFile")
359 superClusterErrorFunction,
360 crackCorrectionFunction,
382 <<
"Cannot check consistency of parameters with ecal seeding ones," 383 <<
" because the original collection of seeds is not any more available." ;
395 logElectrons(electrons, event,
"GsfElectronAlgo Info (before preselection)") ;
399 electrons.erase( std::remove_if(electrons.begin(), electrons.end(),
400 [
this](
auto const& ele){
return !
isPreselected(ele); }), electrons.end() );
401 logElectrons(electrons, event,
"GsfElectronAlgo Info (after preselection)") ;
407 electrons.erase( std::remove_if(electrons.begin(), electrons.end(),
409 logElectrons(electrons, event,
"GsfElectronAlgo Info (after amb. solving)") ;
418 if ( !pset.
exists(
"SeedConfiguration") ) {
return; }
421 if (seedConfiguration.
getParameter<
bool>(
"applyHOverECut"))
426 {
edm::LogWarning(
"GsfElectronAlgo|InconsistentParameters") <<
"The max barrel cone H/E is lower than during ecal seeding." ; }
428 {
edm::LogWarning(
"GsfElectronAlgo|InconsistentParameters") <<
"The max endcaps cone H/E is lower than during ecal seeding." ; }
432 {
edm::LogWarning(
"GsfElectronAlgo|InconsistentParameters") <<
"The minimum super-cluster Et in barrel is lower than during ecal seeding." ; }
434 {
edm::LogWarning(
"GsfElectronAlgo|InconsistentParameters") <<
"The minimum super-cluster Et in endcaps is lower than during ecal seeding." ; }
443 bool ignoreNotPreselected)
const 457 throw cms::Exception(
"GsfElectronAlgo|UnknownAmbiguitySortingStrategy")
462 for (
auto e1 = electrons.begin(); e1 != electrons.end(); ++e1) {
463 e1->clearAmbiguousGsfTracks();
464 e1->setAmbiguous(
false);
469 for (
auto& e1 : electrons) {
472 if (gsfPfRecTrack.gsfTrackRef() == e1.gsfTrack()) {
474 edm::LogWarning(
"GsfElectronAlgo") <<
"associated gsfPfRecTrack already found";
477 for (
auto const& duplicate : gsfPfRecTrack.convBremGsfPFRecTrackRef()) {
478 e1.addAmbiguousGsfTrack(duplicate->gsfTrackRef());
487 for (
auto e1 = electrons.begin(); e1 != electrons.end(); ++e1) {
495 LogDebug(
"GsfElectronAlgo") <<
"Blessing electron with E/P " << e1->eSuperClusterOverP() <<
", cluster " 496 << scRef1.
get() <<
" & track " << e1->gsfTrack().get();
498 for (
auto e2 = e1 + 1; e2 != electrons.end(); ++e2) {
508 bool sameCluster =
false;
510 sameCluster = (scRef1 == scRef2);
521 throw cms::Exception(
"GsfElectronAlgo|UnknownAmbiguityClustersOverlapStrategy")
527 LogDebug(
"GsfElectronAlgo") <<
"Discarding electron with E/P " << e2->eSuperClusterOverP() <<
", cluster " 528 << scRef2.
get() <<
" and track " << e2->gsfTrack().get();
529 e1->addAmbiguousGsfTrack(e2->gsfTrack());
530 e2->setAmbiguous(
true);
531 }
else if (e1->gsfTrack() == e2->gsfTrack()) {
532 edm::LogWarning(
"GsfElectronAlgo") <<
"Forgetting electron with E/P " << e2->eSuperClusterOverP()
533 <<
", cluster " << scRef2.
get() <<
" and track " << e2->gsfTrack().get();
534 e2->setAmbiguous(
true);
552 return passmva && passCutBased;
556 return (passCutBased || passPF || passmva);
558 return passCutBased || passPF;
T getParameter(std::string const &) const
void setAmbiguityData(reco::GsfElectronCollection &electrons, edm::Event const &event, bool ignoreNotPreselected=true) const
unsigned ambClustersOverlapStrategy
std::vector< std::string > ecalRegressionWeightLabels
void checkEcalSeedingParameters(edm::ParameterSet const &)
bool ecalDrivenEcalErrorFromClassBasedParameterization
unsigned ambSortingStrategy
bool useCombinationRegression
bool exists(std::string const ¶meterName) const
checks if a parameter exists
def setup(process, global_tag, zero_tesla=False)
double pt() const final
transverse momentum
bool passingCutBasedPreselection() const
bool passingMvaPreselection() const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
static void fillDescriptions(edm::ConfigurationDescriptions &)
void fillEvent(reco::GsfElectronCollection &electrons, edm::Event &event)
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
GsfElectronAlgo::InputTagsConfiguration inputCfg_
double maxHOverEBarrelCone
void addDefault(ParameterSetDescription const &psetDescription)
combinationRegressionWeightLabels
bool pureTrackerDrivenEcalErrorFromSimpleParameterization
static edm::ParameterSetDescription pSetDescript()
T const * get() const
Returns C++ pointer to the item.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
ElectronHcalHelper::Configuration hcalCfg_
ElectronHcalHelper::Configuration hcalCfgPflow_
~GsfElectronBaseProducer() override
bool ecalSeedingParametersChecked_
bool ecalDrivenEcalEnergyFromClassBasedParameterization
GsfElectronAlgo::StrategyConfiguration strategyCfg_
void beginEvent(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< edm::ValueMap< float > > pfMVA_
const edm::EDPutTokenT< reco::GsfElectronCollection > electronPutToken_
GsfElectronBaseProducer(const edm::ParameterSet &, const gsfAlgoHelpers::HeavyObjectCache *)
bool isPreselected(reco::GsfElectron const &ele) const
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
double maxHOverEEndcapsCone
const GsfElectronAlgo::CutsConfiguration cutsCfgPflow_
ParameterSet const & parameterSet(Provenance const &provenance)
T get(const Candidate &c)
edm::OrphanHandle< reco::GsfElectronCollection > orphanHandle_
Provenance const * provenance() const
const GsfElectronAlgo::CutsConfiguration cutsCfg_
bool ecalDrivenSeed() const
bool passingPflowPreselection() const