CMS 3D CMS Logo

GsfElectronBaseProducer.cc
Go to the documentation of this file.
1 
3 
6 
15 
16 
24 
25 #include <iostream>
26 
27 using namespace reco;
28 
30  {
31  // input collections
32  desc.add<edm::InputTag>("previousGsfElectronsTag",edm::InputTag("ecalDrivenGsfElectrons")) ;
33  desc.add<edm::InputTag>("pflowGsfElectronsTag",edm::InputTag("pflowGsfElectrons")) ;
34  desc.add<edm::InputTag>("gsfElectronCoresTag",edm::InputTag("gsfElectronCores")) ;
35  desc.add<edm::InputTag>("hcalTowers",edm::InputTag("towerMaker")) ;
36  desc.add<edm::InputTag>("barrelRecHitCollectionTag",edm::InputTag("ecalRecHit","EcalRecHitsEB")) ;
37  desc.add<edm::InputTag>("endcapRecHitCollectionTag",edm::InputTag("ecalRecHit","EcalRecHitsEE")) ;
38  //desc.add<edm::InputTag>("pfMvaTag",edm::InputTag("pfElectronTranslator:pf")) ;
39  desc.add<edm::InputTag>("seedsTag",edm::InputTag("ecalDrivenElectronSeeds")) ;
40  desc.add<edm::InputTag>("beamSpotTag",edm::InputTag("offlineBeamSpot")) ;
41  desc.add<edm::InputTag>("gsfPfRecTracksTag",edm::InputTag("pfTrackElec")) ;
42  //desc.add<std::vector<std::string>>("SoftElecMVAFilesString",std::vector<std::string> ("SoftElecMVAFile"));
43 
44 
45  // backward compatibility mechanism for ctf tracks
46  desc.add<bool>("ctfTracksCheck",true) ;
47  desc.add<edm::InputTag>("ctfTracksTag",edm::InputTag("generalTracks")) ;
48 
49  desc.add<bool>("gedElectronMode",true) ;
50  desc.add<double>("PreSelectMVA",-0.1) ;
51  desc.add<double>("MaxElePtForOnlyMVA",50.0) ;
52 
53  // steering
54  desc.add<bool>("useGsfPfRecTracks",true) ;
55  desc.add<bool>("applyPreselection",false) ;
56  desc.add<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization",false) ;
57  desc.add<bool>("ecalDrivenEcalErrorFromClassBasedParameterization",false) ;
58  desc.add<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization",false) ;
59  desc.add<bool>("applyAmbResolution",false) ;
60  desc.add<unsigned>("ambSortingStrategy",1) ;
61  desc.add<unsigned>("ambClustersOverlapStrategy",1) ;
62  //desc.add<bool>("addPflowElectrons",true) ;
63 
64 // // preselection parameters (ecal driven electrons)
65 // desc.add<bool>("seedFromTEC",true) ;
66 // desc.add<double>("minSCEtBarrel",4.0) ;
67 // desc.add<double>("minSCEtEndcaps",4.0) ;
68 // desc.add<double>("minEOverPBarrel",0.0) ;
69 // desc.add<double>("maxEOverPBarrel",999999999.) ;
70 // desc.add<double>("minEOverPEndcaps",0.0) ;
71 // desc.add<double>("maxEOverPEndcaps",999999999.) ;
72 // desc.add<double>("maxDeltaEtaBarrel",0.02) ;
73 // desc.add<double>("maxDeltaEtaEndcaps",0.02) ;
74 // desc.add<double>("maxDeltaPhiBarrel",0.15) ;
75 // desc.add<double>("maxDeltaPhiEndcaps",0.15) ;
76 // desc.add<double>("hOverEConeSize",0.15) ;
77 // desc.add<double>("hOverEPtMin",0.) ;
78 // desc.add<double>("maxHOverEBarrel",0.15) ;
79 // desc.add<double>("maxHOverEEndcaps",0.15) ;
80 // desc.add<double>("maxHBarrel",0.0) ;
81 // desc.add<double>("maxHEndcaps",0.0) ;
82 // desc.add<double>("maxSigmaIetaIetaBarrel",999999999.) ;
83 // desc.add<double>("maxSigmaIetaIetaEndcaps",999999999.) ;
84 // desc.add<double>("maxFbremBarrel",999999999.) ;
85 // desc.add<double>("maxFbremEndcaps",999999999.) ;
86 // desc.add<bool>("isBarrel",false) ;
87 // desc.add<bool>("isEndcaps",false) ;
88 // desc.add<bool>("isFiducial",false) ;
89 // desc.add<double>("maxTIP",999999999.) ;
90 // desc.add<double>("minMVA",-0.4) ;
91 //
92 // // preselection parameters (tracker driven only electrons)
93 // desc.add<double>("minSCEtBarrelPflow",0.0) ;
94 // desc.add<double>("minSCEtEndcapsPflow",0.0) ;
95 // desc.add<double>("minEOverPBarrelPflow",0.0) ;
96 // desc.add<double>("maxEOverPBarrelPflow",999999999.) ;
97 // desc.add<double>("minEOverPEndcapsPflow",0.0) ;
98 // desc.add<double>("maxEOverPEndcapsPflow",999999999.) ;
99 // desc.add<double>("maxDeltaEtaBarrelPflow",999999999.) ;
100 // desc.add<double>("maxDeltaEtaEndcapsPflow",999999999.) ;
101 // desc.add<double>("maxDeltaPhiBarrelPflow",999999999.) ;
102 // desc.add<double>("maxDeltaPhiEndcapsPflow",999999999.) ;
103 // desc.add<double>("hOverEConeSizePflow",0.15) ;
104 // desc.add<double>("hOverEPtMinPflow",0.) ;
105 // desc.add<double>("maxHOverEBarrelPflow",999999999.) ;
106 // desc.add<double>("maxHOverEEndcapsPflow",999999999.) ;
107 // desc.add<double>("maxHBarrelPflow",0.0) ;
108 // desc.add<double>("maxHEndcapsPflow",0.0) ;
109 // desc.add<double>("maxSigmaIetaIetaBarrelPflow",999999999.) ;
110 // desc.add<double>("maxSigmaIetaIetaEndcapsPflow",999999999.) ;
111 // desc.add<double>("maxFbremBarrelPflow",999999999.) ;
112 // desc.add<double>("maxFbremEndcapsPflow",999999999.) ;
113 // desc.add<bool>("isBarrelPflow",false) ;
114 // desc.add<bool>("isEndcapsPflow",false) ;
115 // desc.add<bool>("isFiducialPflow",false) ;
116 // desc.add<double>("maxTIPPflow",999999999.) ;
117 // desc.add<double>("minMVAPflow",-0.4) ;
118 
119  // Ecal rec hits configuration
120  desc.add<std::vector<int> >("recHitFlagsToBeExcludedBarrel") ;
121  desc.add<std::vector<int> >("recHitFlagsToBeExcludedEndcaps") ;
122  desc.add<std::vector<int> >("recHitSeverityToBeExcludedBarrel") ;
123  desc.add<std::vector<int> >("recHitSeverityToBeExcludedEndcaps") ;
124  //desc.add<int>("severityLevelCut",4) ;
125 
126  // Isolation algos configuration
127  desc.add("trkIsol03Cfg",EleTkIsolFromCands::pSetDescript());
128  desc.add("trkIsol04Cfg",EleTkIsolFromCands::pSetDescript());
129  desc.add<double>("intRadiusHcal",0.15) ;
130  desc.add<double>("etMinHcal",0.0) ;
131  desc.add<double>("intRadiusEcalBarrel",3.0) ;
132  desc.add<double>("intRadiusEcalEndcaps",3.0) ;
133  desc.add<double>("jurassicWidth",1.5) ;
134  desc.add<double>("etMinBarrel",0.0) ;
135  desc.add<double>("eMinBarrel",0.08) ;
136  desc.add<double>("etMinEndcaps",0.1) ;
137  desc.add<double>("eMinEndcaps",0.0) ;
138  desc.add<bool>("vetoClustered",false) ;
139  desc.add<bool>("useNumCrystals",true) ;
140 
141  edm::ParameterSetDescription descNested ;
142  descNested.add<std::string>("propagatorAlongTISE","PropagatorWithMaterial") ;
143  descNested.add<std::string>("propagatorOppositeTISE","PropagatorWithMaterialOpposite") ;
144  desc.add<edm::ParameterSetDescription>("TransientInitialStateEstimatorParameters",descNested) ;
145 
146  // Corrections
147  desc.add<std::string>("superClusterErrorFunction","EcalClusterEnergyUncertaintyObjectSpecific") ;
148  desc.add<std::string>("crackCorrectionFunction","EcalClusterCrackCorrection") ;
149  }
150 
152  : ecalSeedingParametersChecked_(false)
153  {
154  produces<GsfElectronCollection>();
155 
156  inputCfg_.previousGsfElectrons = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("previousGsfElectronsTag"));
157  inputCfg_.pflowGsfElectronsTag = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("pflowGsfElectronsTag"));
158  inputCfg_.gsfElectronCores = consumes<reco::GsfElectronCoreCollection>(cfg.getParameter<edm::InputTag>("gsfElectronCoresTag"));
159  inputCfg_.hcalTowersTag = consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers"));
160  //inputCfg_.tracks_ = cfg.getParameter<edm::InputTag>("tracks");
161  inputCfg_.barrelRecHitCollection = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("barrelRecHitCollectionTag"));
162  inputCfg_.endcapRecHitCollection = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("endcapRecHitCollectionTag"));
163  inputCfg_.pfMVA = consumes<edm::ValueMap<float> >(cfg.getParameter<edm::InputTag>("pfMvaTag"));
164  inputCfg_.ctfTracks = consumes<reco::TrackCollection>(cfg.getParameter<edm::InputTag>("ctfTracksTag"));
165  inputCfg_.seedsTag = consumes<reco::ElectronSeedCollection>(cfg.getParameter<edm::InputTag>("seedsTag")); // used to check config consistency with seeding
166  inputCfg_.beamSpotTag = consumes<reco::BeamSpot>(cfg.getParameter<edm::InputTag>("beamSpotTag"));
167  inputCfg_.gsfPfRecTracksTag = consumes<reco::GsfPFRecTrackCollection>(cfg.getParameter<edm::InputTag>("gsfPfRecTracksTag"));
168  inputCfg_.vtxCollectionTag = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("vtxTag"));
169 
170  bool useIsolationValues = cfg.getParameter<bool>("useIsolationValues") ;
171  if ( useIsolationValues ) {
172  if( ! cfg.exists("pfIsolationValues") ) {
173  throw cms::Exception("GsfElectronBaseProducer|InternalError")
174  <<"Missing ParameterSet pfIsolationValues" ;
175  } else {
177  cfg.getParameter<edm::ParameterSet> ("pfIsolationValues");
178  std::vector<std::string> isoNames =
180  for(const std::string& name : isoNames) {
181  edm::InputTag tag =
183  mayConsume<edm::ValueMap<double> >(tag);
184  }
185  }
186 
187  if ( ! cfg.exists("edIsolationValues") ) {
188  throw cms::Exception("GsfElectronBaseProducer|InternalError")
189  <<"Missing ParameterSet edIsolationValues" ;
190  } else {
192  cfg.getParameter<edm::ParameterSet> ("edIsolationValues");
193  std::vector<std::string> isoNames =
195  for(const std::string& name : isoNames) {
196  edm::InputTag tag =
198  mayConsume<edm::ValueMap<double> >(tag);
199  }
200  }
201  }
202 
203  strategyCfg_.useGsfPfRecTracks = cfg.getParameter<bool>("useGsfPfRecTracks") ;
204  strategyCfg_.applyPreselection = cfg.getParameter<bool>("applyPreselection") ;
205  strategyCfg_.ecalDrivenEcalEnergyFromClassBasedParameterization = cfg.getParameter<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization") ;
206  strategyCfg_.ecalDrivenEcalErrorFromClassBasedParameterization = cfg.getParameter<bool>("ecalDrivenEcalErrorFromClassBasedParameterization") ;
207  strategyCfg_.pureTrackerDrivenEcalErrorFromSimpleParameterization = cfg.getParameter<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization") ;
208  strategyCfg_.applyAmbResolution = cfg.getParameter<bool>("applyAmbResolution") ;
209  strategyCfg_.ambSortingStrategy = cfg.getParameter<unsigned>("ambSortingStrategy") ;
210  strategyCfg_.ambClustersOverlapStrategy = cfg.getParameter<unsigned>("ambClustersOverlapStrategy") ;
211  strategyCfg_.addPflowElectrons = cfg.getParameter<bool>("addPflowElectrons") ;
212  strategyCfg_.ctfTracksCheck = cfg.getParameter<bool>("ctfTracksCheck");
213  strategyCfg_.gedElectronMode = cfg.getParameter<bool>("gedElectronMode");
214  strategyCfg_.PreSelectMVA = cfg.getParameter<double>("PreSelectMVA");
215  strategyCfg_.MaxElePtForOnlyMVA = cfg.getParameter<double>("MaxElePtForOnlyMVA");
216  strategyCfg_.useEcalRegression = cfg.getParameter<bool>("useEcalRegression");
217  strategyCfg_.useCombinationRegression = cfg.getParameter<bool>("useCombinationRegression");
218 
219  cutsCfg_.minSCEtBarrel = cfg.getParameter<double>("minSCEtBarrel") ;
220  cutsCfg_.minSCEtEndcaps = cfg.getParameter<double>("minSCEtEndcaps") ;
221  cutsCfg_.maxEOverPBarrel = cfg.getParameter<double>("maxEOverPBarrel") ;
222  cutsCfg_.maxEOverPEndcaps = cfg.getParameter<double>("maxEOverPEndcaps") ;
223  cutsCfg_.minEOverPBarrel = cfg.getParameter<double>("minEOverPBarrel") ;
224  cutsCfg_.minEOverPEndcaps = cfg.getParameter<double>("minEOverPEndcaps") ;
225 
226  // H/E
227  cutsCfg_.maxHOverEBarrel = cfg.getParameter<double>("maxHOverEBarrel") ;
228  cutsCfg_.maxHOverEEndcaps = cfg.getParameter<double>("maxHOverEEndcaps") ;
229  cutsCfg_.maxHBarrel = cfg.getParameter<double>("maxHBarrel") ;
230  cutsCfg_.maxHEndcaps = cfg.getParameter<double>("maxHEndcaps") ;
231 
232  cutsCfg_.maxDeltaEtaBarrel = cfg.getParameter<double>("maxDeltaEtaBarrel") ;
233  cutsCfg_.maxDeltaEtaEndcaps = cfg.getParameter<double>("maxDeltaEtaEndcaps") ;
234  cutsCfg_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrel") ;
235  cutsCfg_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcaps") ;
236  cutsCfg_.maxSigmaIetaIetaBarrel = cfg.getParameter<double>("maxSigmaIetaIetaBarrel") ;
237  cutsCfg_.maxSigmaIetaIetaEndcaps = cfg.getParameter<double>("maxSigmaIetaIetaEndcaps") ;
238  cutsCfg_.maxFbremBarrel = cfg.getParameter<double>("maxFbremBarrel") ;
239  cutsCfg_.maxFbremEndcaps = cfg.getParameter<double>("maxFbremEndcaps") ;
240  cutsCfg_.isBarrel = cfg.getParameter<bool>("isBarrel") ;
241  cutsCfg_.isEndcaps = cfg.getParameter<bool>("isEndcaps") ;
242  cutsCfg_.isFiducial = cfg.getParameter<bool>("isFiducial") ;
243  cutsCfg_.minMVA = cfg.getParameter<double>("minMVA") ;
244  cutsCfg_.minMvaByPassForIsolated = cfg.getParameter<double>("minMvaByPassForIsolated") ;
245  cutsCfg_.maxTIP = cfg.getParameter<double>("maxTIP") ;
246  cutsCfg_.seedFromTEC = cfg.getParameter<bool>("seedFromTEC") ;
247 
248  cutsCfgPflow_.minSCEtBarrel = cfg.getParameter<double>("minSCEtBarrelPflow") ;
249  cutsCfgPflow_.minSCEtEndcaps = cfg.getParameter<double>("minSCEtEndcapsPflow") ;
250  cutsCfgPflow_.maxEOverPBarrel = cfg.getParameter<double>("maxEOverPBarrelPflow") ;
251  cutsCfgPflow_.maxEOverPEndcaps = cfg.getParameter<double>("maxEOverPEndcapsPflow") ;
252  cutsCfgPflow_.minEOverPBarrel = cfg.getParameter<double>("minEOverPBarrelPflow") ;
253  cutsCfgPflow_.minEOverPEndcaps = cfg.getParameter<double>("minEOverPEndcapsPflow") ;
254 
255  // H/E
256  cutsCfgPflow_.maxHOverEBarrel = cfg.getParameter<double>("maxHOverEBarrelPflow") ;
257  cutsCfgPflow_.maxHOverEEndcaps = cfg.getParameter<double>("maxHOverEEndcapsPflow") ;
258  cutsCfgPflow_.maxHBarrel = cfg.getParameter<double>("maxHBarrelPflow") ;
259  cutsCfgPflow_.maxHEndcaps = cfg.getParameter<double>("maxHEndcapsPflow") ;
260 
261  cutsCfgPflow_.maxDeltaEtaBarrel = cfg.getParameter<double>("maxDeltaEtaBarrelPflow") ;
262  cutsCfgPflow_.maxDeltaEtaEndcaps = cfg.getParameter<double>("maxDeltaEtaEndcapsPflow") ;
263  cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
264  cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
265  cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
266  cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
267  cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
268  cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
269  cutsCfgPflow_.maxSigmaIetaIetaBarrel = cfg.getParameter<double>("maxSigmaIetaIetaBarrelPflow") ;
270  cutsCfgPflow_.maxSigmaIetaIetaEndcaps = cfg.getParameter<double>("maxSigmaIetaIetaEndcapsPflow") ;
271  cutsCfgPflow_.maxFbremBarrel = cfg.getParameter<double>("maxFbremBarrelPflow") ;
272  cutsCfgPflow_.maxFbremEndcaps = cfg.getParameter<double>("maxFbremEndcapsPflow") ;
273  cutsCfgPflow_.isBarrel = cfg.getParameter<bool>("isBarrelPflow") ;
274  cutsCfgPflow_.isEndcaps = cfg.getParameter<bool>("isEndcapsPflow") ;
275  cutsCfgPflow_.isFiducial = cfg.getParameter<bool>("isFiducialPflow") ;
276  cutsCfgPflow_.minMVA = cfg.getParameter<double>("minMVAPflow") ;
277  cutsCfgPflow_.minMvaByPassForIsolated = cfg.getParameter<double>("minMvaByPassForIsolatedPflow") ;
278  cutsCfgPflow_.maxTIP = cfg.getParameter<double>("maxTIPPflow") ;
279  cutsCfgPflow_.seedFromTEC = true ; // not applied for pflow
280 
281  // hcal helpers
282  hcalCfg_.hOverEConeSize = cfg.getParameter<double>("hOverEConeSize") ;
283  if (hcalCfg_.hOverEConeSize>0)
284  {
286  hcalCfg_.checkHcalStatus = cfg.getParameter<bool>("checkHcalStatus") ;
288  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
289  hcalCfg_.hOverEPtMin = cfg.getParameter<double>("hOverEPtMin") ;
290  }
291  hcalCfgPflow_.hOverEConeSize = cfg.getParameter<double>("hOverEConeSizePflow") ;
293  {
295  hcalCfgPflow_.checkHcalStatus = cfg.getParameter<bool>("checkHcalStatus") ;
297  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
298  hcalCfgPflow_.hOverEPtMin = cfg.getParameter<double>("hOverEPtMinPflow") ;
299  }
300 
301  // Ecal rec hits configuration
303  const std::vector<std::string> flagnamesbarrel = cfg.getParameter<std::vector<std::string> >("recHitFlagsToBeExcludedBarrel");
304  recHitsCfg.recHitFlagsToBeExcludedBarrel = StringToEnumValue<EcalRecHit::Flags>(flagnamesbarrel);
305  const std::vector<std::string> flagnamesendcaps = cfg.getParameter<std::vector<std::string> >("recHitFlagsToBeExcludedEndcaps");
306  recHitsCfg.recHitFlagsToBeExcludedEndcaps = StringToEnumValue<EcalRecHit::Flags>(flagnamesendcaps);
307  const std::vector<std::string> severitynamesbarrel = cfg.getParameter<std::vector<std::string> >("recHitSeverityToBeExcludedBarrel");
308  recHitsCfg.recHitSeverityToBeExcludedBarrel = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesbarrel);
309  const std::vector<std::string> severitynamesendcaps = cfg.getParameter<std::vector<std::string> >("recHitSeverityToBeExcludedEndcaps");
310  recHitsCfg.recHitSeverityToBeExcludedEndcaps = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesendcaps);
311  //recHitsCfg.severityLevelCut = cfg.getParameter<int>("severityLevelCut") ;
312 
313  // isolation
315  isoCfg.intRadiusHcal = cfg.getParameter<double>("intRadiusHcal") ;
316  isoCfg.etMinHcal = cfg.getParameter<double>("etMinHcal") ;
317  isoCfg.intRadiusEcalBarrel = cfg.getParameter<double>("intRadiusEcalBarrel") ;
318  isoCfg.intRadiusEcalEndcaps = cfg.getParameter<double>("intRadiusEcalEndcaps") ;
319  isoCfg.jurassicWidth = cfg.getParameter<double>("jurassicWidth") ;
320  isoCfg.etMinBarrel = cfg.getParameter<double>("etMinBarrel") ;
321  isoCfg.eMinBarrel = cfg.getParameter<double>("eMinBarrel") ;
322  isoCfg.etMinEndcaps = cfg.getParameter<double>("etMinEndcaps") ;
323  isoCfg.eMinEndcaps = cfg.getParameter<double>("eMinEndcaps") ;
324  isoCfg.vetoClustered = cfg.getParameter<bool>("vetoClustered") ;
325  isoCfg.useNumCrystals = cfg.getParameter<bool>("useNumCrystals") ;
326 
327 
328  RegressionHelper::Configuration regressionCfg ;
329  regressionCfg.ecalRegressionWeightLabels = cfg.getParameter<std::vector<std::string> >("ecalRefinedRegressionWeightLabels");
330  regressionCfg.combinationRegressionWeightLabels = cfg.getParameter<std::vector<std::string> >("combinationRegressionWeightLabels");
331  regressionCfg.ecalRegressionWeightFiles = cfg.getParameter<std::vector<std::string> >("ecalRefinedRegressionWeightFiles");
332  regressionCfg.combinationRegressionWeightFiles = cfg.getParameter<std::vector<std::string> >("combinationRegressionWeightFile");
333  regressionCfg.ecalWeightsFromDB = cfg.getParameter<bool>("ecalWeightsFromDB");
334  regressionCfg.combinationWeightsFromDB = cfg.getParameter<bool>("combinationWeightsFromDB");
335  // functions for corrector
337  std::string superClusterErrorFunctionName
338  = cfg.getParameter<std::string>("superClusterErrorFunction") ;
339  if (!superClusterErrorFunctionName.empty())
340  {
341  superClusterErrorFunction
342  = EcalClusterFunctionFactory::get()->create(superClusterErrorFunctionName,cfg) ;
343  }
344  else
345  {
346  superClusterErrorFunction
347  = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyUncertaintyObjectSpecific",cfg) ;
348  }
350  std::string crackCorrectionFunctionName
351  = cfg.getParameter<std::string>("crackCorrectionFunction") ;
352  if (!crackCorrectionFunctionName.empty())
353  {
354  crackCorrectionFunction
355  = EcalClusterFunctionFactory::get()->create(crackCorrectionFunctionName,cfg) ;
356  }
357 
358 
359  mva_NIso_Cfg_.vweightsfiles = cfg.getParameter<std::vector<std::string>>("SoftElecMVAFilesString");
360  mva_Iso_Cfg_.vweightsfiles = cfg.getParameter<std::vector<std::string>>("ElecMVAFilesString");
361  // create algo
362  algo_ = new GsfElectronAlgo
366  isoCfg,recHitsCfg,
367  superClusterErrorFunction,
368  crackCorrectionFunction,
370  mva_Iso_Cfg_,
371  regressionCfg,
372  cfg.getParameter<edm::ParameterSet>("trkIsol03Cfg"),
373  cfg.getParameter<edm::ParameterSet>("trkIsol04Cfg")
374 
375  ) ;
376 
377 
378  }
379 
381  { delete algo_ ; }
382 
384  {
385  // check configuration
387  {
390  event.getByToken(inputCfg_.seedsTag,seeds) ;
391  if (!seeds.isValid())
392  {
393  edm::LogWarning("GsfElectronAlgo|UnreachableSeedsProvenance")
394  <<"Cannot check consistency of parameters with ecal seeding ones,"
395  <<" because the original collection of seeds is not any more available." ;
396  }
397  else
398  {
400  }
401  }
402 
403  // init the algo
404  algo_->checkSetup(setup) ;
405  algo_->beginEvent(event) ;
406  }
407 
409  {
410  // all electrons
411  algo_->displayInternalElectrons("GsfElectronAlgo Info (before preselection)") ;
412  // preselection
414  {
416  algo_->displayInternalElectrons("GsfElectronAlgo Info (after preselection)") ;
417  }
418  // ambiguity
421  {
423  algo_->displayInternalElectrons("GsfElectronAlgo Info (after amb. solving)") ;
424  }
425  // final filling
426  auto finalCollection = std::make_unique<GsfElectronCollection>();
427  algo_->copyElectrons(*finalCollection) ;
428  orphanHandle_ = event.put(std::move(finalCollection));
429 }
430 
432  {
433  algo_->endEvent() ;
434  }
435 
437  {
438  edm::ParameterSet seedConfiguration = pset.getParameter<edm::ParameterSet>("SeedConfiguration") ;
439  //edm::ParameterSet orderedHitsFactoryPSet = seedConfiguration.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet") ;
440  //edm::ParameterSet seedParameters = seedConfiguration.getParameter<edm::ParameterSet>("ecalDrivenElectronSeedsParameters") ;
441 
442  if (seedConfiguration.getParameter<bool>("applyHOverECut"))
443  {
444  if ((hcalCfg_.hOverEConeSize!=0)&&(hcalCfg_.hOverEConeSize!=seedConfiguration.getParameter<double>("hOverEConeSize")))
445  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The H/E cone size ("<<hcalCfg_.hOverEConeSize<<") is different from ecal seeding ("<<seedConfiguration.getParameter<double>("hOverEConeSize")<<")." ; }
446  if (cutsCfg_.maxHOverEBarrel<seedConfiguration.getParameter<double>("maxHOverEBarrel"))
447  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The max barrel H/E is lower than during ecal seeding." ; }
448  if (cutsCfg_.maxHOverEEndcaps<seedConfiguration.getParameter<double>("maxHOverEEndcaps"))
449  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The max endcaps H/E is lower than during ecal seeding." ; }
450  }
451 
452  if (cutsCfg_.minSCEtBarrel<seedConfiguration.getParameter<double>("SCEtCut"))
453  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The minimum super-cluster Et in barrel is lower than during ecal seeding." ; }
454  if (cutsCfg_.minSCEtEndcaps<seedConfiguration.getParameter<double>("SCEtCut"))
455  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The minimum super-cluster Et in endcaps is lower than during ecal seeding." ; }
456  }
457 
458 
T getParameter(std::string const &) const
ElectronMVAEstimator::Configuration mva_Iso_Cfg_
edm::EDGetTokenT< reco::GsfElectronCoreCollection > gsfElectronCores
std::vector< std::string > ecalRegressionWeightLabels
void checkEcalSeedingParameters(edm::ParameterSet const &)
static void fillDescription(edm::ParameterSetDescription &)
edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons
edm::EDGetTokenT< reco::VertexCollection > vtxCollectionTag
void beginEvent(edm::Event &)
bool exists(std::string const &parameterName) const
checks if a parameter exists
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
#define nullptr
edm::EDGetTokenT< reco::GsfElectronCollection > pflowGsfElectronsTag
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollection
edm::EDGetTokenT< reco::GsfPFRecTrackCollection > gsfPfRecTracksTag
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:193
GsfElectronAlgo::InputTagsConfiguration inputCfg_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag
SoftElectronMVAEstimator::Configuration mva_NIso_Cfg_
GsfElectronAlgo::CutsConfiguration cutsCfg_
static edm::ParameterSetDescription pSetDescript()
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::ValueMap< float > > pfMVA
bool isValid() const
Definition: HandleBase.h:74
ElectronHcalHelper::Configuration hcalCfg_
edm::EDGetTokenT< CaloTowerCollection > hcalTowersTag
ElectronHcalHelper::Configuration hcalCfgPflow_
edm::EDGetTokenT< reco::TrackCollection > ctfTracks
GsfElectronAlgo::StrategyConfiguration strategyCfg_
void beginEvent(edm::Event &, const edm::EventSetup &)
std::vector< std::string > vweightsfiles
fixed size matrix
GsfElectronBaseProducer(const edm::ParameterSet &, const gsfAlgoHelpers::HeavyObjectCache *)
void removeAmbiguousElectrons()
void displayInternalElectrons(const std::string &title) const
void removeNotPreselectedElectrons()
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
void copyElectrons(reco::GsfElectronCollection &)
void setAmbiguityData(bool ignoreNotPreselected=true)
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
def move(src, dest)
Definition: eostools.py:511
T get(const Candidate &c)
Definition: component.h:55
GsfElectronAlgo::CutsConfiguration cutsCfgPflow_
edm::OrphanHandle< reco::GsfElectronCollection > orphanHandle_
Definition: event.py:1
Provenance const * provenance() const
Definition: HandleBase.h:83
void checkSetup(const edm::EventSetup &)