CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GsfElectronBaseProducer.cc
Go to the documentation of this file.
1 
3 
5 
14 
15 
23 
24 #include <iostream>
25 
26 using namespace reco;
27 
29  {
30  // input collections
31  desc.add<edm::InputTag>("previousGsfElectronsTag",edm::InputTag("ecalDrivenGsfElectrons")) ;
32  desc.add<edm::InputTag>("pflowGsfElectronsTag",edm::InputTag("pflowGsfElectrons")) ;
33  desc.add<edm::InputTag>("gsfElectronCoresTag",edm::InputTag("gsfElectronCores")) ;
34  desc.add<edm::InputTag>("hcalTowers",edm::InputTag("towerMaker")) ;
35  desc.add<edm::InputTag>("barrelRecHitCollectionTag",edm::InputTag("ecalRecHit","EcalRecHitsEB")) ;
36  desc.add<edm::InputTag>("endcapRecHitCollectionTag",edm::InputTag("ecalRecHit","EcalRecHitsEE")) ;
37  //desc.add<edm::InputTag>("pfMvaTag",edm::InputTag("pfElectronTranslator:pf")) ;
38  desc.add<edm::InputTag>("seedsTag",edm::InputTag("ecalDrivenElectronSeeds")) ;
39  desc.add<edm::InputTag>("beamSpotTag",edm::InputTag("offlineBeamSpot")) ;
40  desc.add<edm::InputTag>("gsfPfRecTracksTag",edm::InputTag("pfTrackElec")) ;
41  //desc.add<std::vector<std::string>>("SoftElecMVAFilesString",std::vector<std::string> ("SoftElecMVAFile"));
42 
43 
44  // backward compatibility mechanism for ctf tracks
45  desc.add<bool>("ctfTracksCheck",true) ;
46  desc.add<edm::InputTag>("ctfTracksTag",edm::InputTag("generalTracks")) ;
47 
48  desc.add<bool>("gedElectronMode",true) ;
49  desc.add<double>("PreSelectMVA",-0.1) ;
50  desc.add<double>("MaxElePtForOnlyMVA",50.0) ;
51 
52  // steering
53  desc.add<bool>("useGsfPfRecTracks",true) ;
54  desc.add<bool>("applyPreselection",false) ;
55  desc.add<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization",false) ;
56  desc.add<bool>("ecalDrivenEcalErrorFromClassBasedParameterization",false) ;
57  desc.add<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization",false) ;
58  desc.add<bool>("applyAmbResolution",false) ;
59  desc.add<unsigned>("ambSortingStrategy",1) ;
60  desc.add<unsigned>("ambClustersOverlapStrategy",1) ;
61  //desc.add<bool>("addPflowElectrons",true) ;
62 
63 // // preselection parameters (ecal driven electrons)
64 // desc.add<bool>("seedFromTEC",true) ;
65 // desc.add<double>("minSCEtBarrel",4.0) ;
66 // desc.add<double>("minSCEtEndcaps",4.0) ;
67 // desc.add<double>("minEOverPBarrel",0.0) ;
68 // desc.add<double>("maxEOverPBarrel",999999999.) ;
69 // desc.add<double>("minEOverPEndcaps",0.0) ;
70 // desc.add<double>("maxEOverPEndcaps",999999999.) ;
71 // desc.add<double>("maxDeltaEtaBarrel",0.02) ;
72 // desc.add<double>("maxDeltaEtaEndcaps",0.02) ;
73 // desc.add<double>("maxDeltaPhiBarrel",0.15) ;
74 // desc.add<double>("maxDeltaPhiEndcaps",0.15) ;
75 // desc.add<double>("hOverEConeSize",0.15) ;
76 // desc.add<double>("hOverEPtMin",0.) ;
77 // desc.add<double>("maxHOverEBarrel",0.15) ;
78 // desc.add<double>("maxHOverEEndcaps",0.15) ;
79 // desc.add<double>("maxHBarrel",0.0) ;
80 // desc.add<double>("maxHEndcaps",0.0) ;
81 // desc.add<double>("maxSigmaIetaIetaBarrel",999999999.) ;
82 // desc.add<double>("maxSigmaIetaIetaEndcaps",999999999.) ;
83 // desc.add<double>("maxFbremBarrel",999999999.) ;
84 // desc.add<double>("maxFbremEndcaps",999999999.) ;
85 // desc.add<bool>("isBarrel",false) ;
86 // desc.add<bool>("isEndcaps",false) ;
87 // desc.add<bool>("isFiducial",false) ;
88 // desc.add<double>("maxTIP",999999999.) ;
89 // desc.add<double>("minMVA",-0.4) ;
90 //
91 // // preselection parameters (tracker driven only electrons)
92 // desc.add<double>("minSCEtBarrelPflow",0.0) ;
93 // desc.add<double>("minSCEtEndcapsPflow",0.0) ;
94 // desc.add<double>("minEOverPBarrelPflow",0.0) ;
95 // desc.add<double>("maxEOverPBarrelPflow",999999999.) ;
96 // desc.add<double>("minEOverPEndcapsPflow",0.0) ;
97 // desc.add<double>("maxEOverPEndcapsPflow",999999999.) ;
98 // desc.add<double>("maxDeltaEtaBarrelPflow",999999999.) ;
99 // desc.add<double>("maxDeltaEtaEndcapsPflow",999999999.) ;
100 // desc.add<double>("maxDeltaPhiBarrelPflow",999999999.) ;
101 // desc.add<double>("maxDeltaPhiEndcapsPflow",999999999.) ;
102 // desc.add<double>("hOverEConeSizePflow",0.15) ;
103 // desc.add<double>("hOverEPtMinPflow",0.) ;
104 // desc.add<double>("maxHOverEBarrelPflow",999999999.) ;
105 // desc.add<double>("maxHOverEEndcapsPflow",999999999.) ;
106 // desc.add<double>("maxHBarrelPflow",0.0) ;
107 // desc.add<double>("maxHEndcapsPflow",0.0) ;
108 // desc.add<double>("maxSigmaIetaIetaBarrelPflow",999999999.) ;
109 // desc.add<double>("maxSigmaIetaIetaEndcapsPflow",999999999.) ;
110 // desc.add<double>("maxFbremBarrelPflow",999999999.) ;
111 // desc.add<double>("maxFbremEndcapsPflow",999999999.) ;
112 // desc.add<bool>("isBarrelPflow",false) ;
113 // desc.add<bool>("isEndcapsPflow",false) ;
114 // desc.add<bool>("isFiducialPflow",false) ;
115 // desc.add<double>("maxTIPPflow",999999999.) ;
116 // desc.add<double>("minMVAPflow",-0.4) ;
117 
118  // Ecal rec hits configuration
119  desc.add<std::vector<int> >("recHitFlagsToBeExcludedBarrel") ;
120  desc.add<std::vector<int> >("recHitFlagsToBeExcludedEndcaps") ;
121  desc.add<std::vector<int> >("recHitSeverityToBeExcludedBarrel") ;
122  desc.add<std::vector<int> >("recHitSeverityToBeExcludedEndcaps") ;
123  //desc.add<int>("severityLevelCut",4) ;
124 
125  // Isolation algos configuration
126  desc.add<double>("intRadiusBarrelTk",0.015) ;
127  desc.add<double>("intRadiusEndcapTk",0.015) ;
128  desc.add<double>("stripBarrelTk",0.015) ;
129  desc.add<double>("stripEndcapTk",0.015) ;
130  desc.add<double>("ptMinTk",0.7) ;
131  desc.add<double>("maxVtxDistTk",0.2) ;
132  desc.add<double>("maxDrbTk",999999999.) ;
133  desc.add<double>("intRadiusHcal",0.15) ;
134  desc.add<double>("etMinHcal",0.0) ;
135  desc.add<double>("intRadiusEcalBarrel",3.0) ;
136  desc.add<double>("intRadiusEcalEndcaps",3.0) ;
137  desc.add<double>("jurassicWidth",1.5) ;
138  desc.add<double>("etMinBarrel",0.0) ;
139  desc.add<double>("eMinBarrel",0.08) ;
140  desc.add<double>("etMinEndcaps",0.1) ;
141  desc.add<double>("eMinEndcaps",0.0) ;
142  desc.add<bool>("vetoClustered",false) ;
143  desc.add<bool>("useNumCrystals",true) ;
144 
145  edm::ParameterSetDescription descNested ;
146  descNested.add<std::string>("propagatorAlongTISE","PropagatorWithMaterial") ;
147  descNested.add<std::string>("propagatorOppositeTISE","PropagatorWithMaterialOpposite") ;
148  desc.add<edm::ParameterSetDescription>("TransientInitialStateEstimatorParameters",descNested) ;
149 
150  // Corrections
151  desc.add<std::string>("superClusterErrorFunction","EcalClusterEnergyUncertaintyObjectSpecific") ;
152  desc.add<std::string>("crackCorrectionFunction","EcalClusterCrackCorrection") ;
153  }
154 
156  : ecalSeedingParametersChecked_(false)
157  {
158  produces<GsfElectronCollection>();
159 
160  inputCfg_.previousGsfElectrons = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("previousGsfElectronsTag"));
161  inputCfg_.pflowGsfElectronsTag = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("pflowGsfElectronsTag"));
162  inputCfg_.gsfElectronCores = consumes<reco::GsfElectronCoreCollection>(cfg.getParameter<edm::InputTag>("gsfElectronCoresTag"));
163  inputCfg_.hcalTowersTag = consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers"));
164  //inputCfg_.tracks_ = cfg.getParameter<edm::InputTag>("tracks");
165  inputCfg_.barrelRecHitCollection = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("barrelRecHitCollectionTag"));
166  inputCfg_.endcapRecHitCollection = consumes<EcalRecHitCollection>(cfg.getParameter<edm::InputTag>("endcapRecHitCollectionTag"));
167  inputCfg_.pfMVA = consumes<edm::ValueMap<float> >(cfg.getParameter<edm::InputTag>("pfMvaTag"));
168  inputCfg_.ctfTracks = consumes<reco::TrackCollection>(cfg.getParameter<edm::InputTag>("ctfTracksTag"));
169  inputCfg_.seedsTag = consumes<reco::ElectronSeedCollection>(cfg.getParameter<edm::InputTag>("seedsTag")); // used to check config consistency with seeding
170  inputCfg_.beamSpotTag = consumes<reco::BeamSpot>(cfg.getParameter<edm::InputTag>("beamSpotTag"));
171  inputCfg_.gsfPfRecTracksTag = consumes<reco::GsfPFRecTrackCollection>(cfg.getParameter<edm::InputTag>("gsfPfRecTracksTag"));
172  inputCfg_.vtxCollectionTag = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("vtxTag"));
173 
174  bool useIsolationValues = cfg.getParameter<bool>("useIsolationValues") ;
175  if ( useIsolationValues ) {
176  if( ! cfg.exists("pfIsolationValues") ) {
177  throw cms::Exception("GsfElectronBaseProducer|InternalError")
178  <<"Missing ParameterSet pfIsolationValues" ;
179  } else {
181  cfg.getParameter<edm::ParameterSet> ("pfIsolationValues");
182  std::vector<std::string> isoNames =
184  for(const std::string& name : isoNames) {
185  edm::InputTag tag =
187  mayConsume<edm::ValueMap<double> >(tag);
188  }
189  }
190 
191  if ( ! cfg.exists("edIsolationValues") ) {
192  throw cms::Exception("GsfElectronBaseProducer|InternalError")
193  <<"Missing ParameterSet edIsolationValues" ;
194  } else {
196  cfg.getParameter<edm::ParameterSet> ("edIsolationValues");
197  std::vector<std::string> isoNames =
199  for(const std::string& name : isoNames) {
200  edm::InputTag tag =
202  mayConsume<edm::ValueMap<double> >(tag);
203  }
204  }
205  }
206 
207  strategyCfg_.useGsfPfRecTracks = cfg.getParameter<bool>("useGsfPfRecTracks") ;
208  strategyCfg_.applyPreselection = cfg.getParameter<bool>("applyPreselection") ;
209  strategyCfg_.ecalDrivenEcalEnergyFromClassBasedParameterization = cfg.getParameter<bool>("ecalDrivenEcalEnergyFromClassBasedParameterization") ;
210  strategyCfg_.ecalDrivenEcalErrorFromClassBasedParameterization = cfg.getParameter<bool>("ecalDrivenEcalErrorFromClassBasedParameterization") ;
211  strategyCfg_.pureTrackerDrivenEcalErrorFromSimpleParameterization = cfg.getParameter<bool>("pureTrackerDrivenEcalErrorFromSimpleParameterization") ;
212  strategyCfg_.applyAmbResolution = cfg.getParameter<bool>("applyAmbResolution") ;
213  strategyCfg_.ambSortingStrategy = cfg.getParameter<unsigned>("ambSortingStrategy") ;
214  strategyCfg_.ambClustersOverlapStrategy = cfg.getParameter<unsigned>("ambClustersOverlapStrategy") ;
215  strategyCfg_.addPflowElectrons = cfg.getParameter<bool>("addPflowElectrons") ;
216  strategyCfg_.ctfTracksCheck = cfg.getParameter<bool>("ctfTracksCheck");
217  strategyCfg_.gedElectronMode = cfg.getParameter<bool>("gedElectronMode");
218  strategyCfg_.PreSelectMVA = cfg.getParameter<double>("PreSelectMVA");
219  strategyCfg_.MaxElePtForOnlyMVA = cfg.getParameter<double>("MaxElePtForOnlyMVA");
220  strategyCfg_.useEcalRegression = cfg.getParameter<bool>("useEcalRegression");
221  strategyCfg_.useCombinationRegression = cfg.getParameter<bool>("useCombinationRegression");
222 
223  cutsCfg_.minSCEtBarrel = cfg.getParameter<double>("minSCEtBarrel") ;
224  cutsCfg_.minSCEtEndcaps = cfg.getParameter<double>("minSCEtEndcaps") ;
225  cutsCfg_.maxEOverPBarrel = cfg.getParameter<double>("maxEOverPBarrel") ;
226  cutsCfg_.maxEOverPEndcaps = cfg.getParameter<double>("maxEOverPEndcaps") ;
227  cutsCfg_.minEOverPBarrel = cfg.getParameter<double>("minEOverPBarrel") ;
228  cutsCfg_.minEOverPEndcaps = cfg.getParameter<double>("minEOverPEndcaps") ;
229 
230  // H/E
231  cutsCfg_.maxHOverEBarrel = cfg.getParameter<double>("maxHOverEBarrel") ;
232  cutsCfg_.maxHOverEEndcaps = cfg.getParameter<double>("maxHOverEEndcaps") ;
233  cutsCfg_.maxHBarrel = cfg.getParameter<double>("maxHBarrel") ;
234  cutsCfg_.maxHEndcaps = cfg.getParameter<double>("maxHEndcaps") ;
235 
236  cutsCfg_.maxDeltaEtaBarrel = cfg.getParameter<double>("maxDeltaEtaBarrel") ;
237  cutsCfg_.maxDeltaEtaEndcaps = cfg.getParameter<double>("maxDeltaEtaEndcaps") ;
238  cutsCfg_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrel") ;
239  cutsCfg_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcaps") ;
240  cutsCfg_.maxSigmaIetaIetaBarrel = cfg.getParameter<double>("maxSigmaIetaIetaBarrel") ;
241  cutsCfg_.maxSigmaIetaIetaEndcaps = cfg.getParameter<double>("maxSigmaIetaIetaEndcaps") ;
242  cutsCfg_.maxFbremBarrel = cfg.getParameter<double>("maxFbremBarrel") ;
243  cutsCfg_.maxFbremEndcaps = cfg.getParameter<double>("maxFbremEndcaps") ;
244  cutsCfg_.isBarrel = cfg.getParameter<bool>("isBarrel") ;
245  cutsCfg_.isEndcaps = cfg.getParameter<bool>("isEndcaps") ;
246  cutsCfg_.isFiducial = cfg.getParameter<bool>("isFiducial") ;
247  cutsCfg_.minMVA = cfg.getParameter<double>("minMVA") ;
248  cutsCfg_.minMvaByPassForIsolated = cfg.getParameter<double>("minMvaByPassForIsolated") ;
249  cutsCfg_.maxTIP = cfg.getParameter<double>("maxTIP") ;
250  cutsCfg_.seedFromTEC = cfg.getParameter<bool>("seedFromTEC") ;
251 
252  cutsCfgPflow_.minSCEtBarrel = cfg.getParameter<double>("minSCEtBarrelPflow") ;
253  cutsCfgPflow_.minSCEtEndcaps = cfg.getParameter<double>("minSCEtEndcapsPflow") ;
254  cutsCfgPflow_.maxEOverPBarrel = cfg.getParameter<double>("maxEOverPBarrelPflow") ;
255  cutsCfgPflow_.maxEOverPEndcaps = cfg.getParameter<double>("maxEOverPEndcapsPflow") ;
256  cutsCfgPflow_.minEOverPBarrel = cfg.getParameter<double>("minEOverPBarrelPflow") ;
257  cutsCfgPflow_.minEOverPEndcaps = cfg.getParameter<double>("minEOverPEndcapsPflow") ;
258 
259  // H/E
260  cutsCfgPflow_.maxHOverEBarrel = cfg.getParameter<double>("maxHOverEBarrelPflow") ;
261  cutsCfgPflow_.maxHOverEEndcaps = cfg.getParameter<double>("maxHOverEEndcapsPflow") ;
262  cutsCfgPflow_.maxHBarrel = cfg.getParameter<double>("maxHBarrelPflow") ;
263  cutsCfgPflow_.maxHEndcaps = cfg.getParameter<double>("maxHEndcapsPflow") ;
264 
265  cutsCfgPflow_.maxDeltaEtaBarrel = cfg.getParameter<double>("maxDeltaEtaBarrelPflow") ;
266  cutsCfgPflow_.maxDeltaEtaEndcaps = cfg.getParameter<double>("maxDeltaEtaEndcapsPflow") ;
267  cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
268  cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
269  cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
270  cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
271  cutsCfgPflow_.maxDeltaPhiBarrel = cfg.getParameter<double>("maxDeltaPhiBarrelPflow") ;
272  cutsCfgPflow_.maxDeltaPhiEndcaps = cfg.getParameter<double>("maxDeltaPhiEndcapsPflow") ;
273  cutsCfgPflow_.maxSigmaIetaIetaBarrel = cfg.getParameter<double>("maxSigmaIetaIetaBarrelPflow") ;
274  cutsCfgPflow_.maxSigmaIetaIetaEndcaps = cfg.getParameter<double>("maxSigmaIetaIetaEndcapsPflow") ;
275  cutsCfgPflow_.maxFbremBarrel = cfg.getParameter<double>("maxFbremBarrelPflow") ;
276  cutsCfgPflow_.maxFbremEndcaps = cfg.getParameter<double>("maxFbremEndcapsPflow") ;
277  cutsCfgPflow_.isBarrel = cfg.getParameter<bool>("isBarrelPflow") ;
278  cutsCfgPflow_.isEndcaps = cfg.getParameter<bool>("isEndcapsPflow") ;
279  cutsCfgPflow_.isFiducial = cfg.getParameter<bool>("isFiducialPflow") ;
280  cutsCfgPflow_.minMVA = cfg.getParameter<double>("minMVAPflow") ;
281  cutsCfgPflow_.minMvaByPassForIsolated = cfg.getParameter<double>("minMvaByPassForIsolatedPflow") ;
282  cutsCfgPflow_.maxTIP = cfg.getParameter<double>("maxTIPPflow") ;
283  cutsCfgPflow_.seedFromTEC = true ; // not applied for pflow
284 
285  // hcal helpers
286  hcalCfg_.hOverEConeSize = cfg.getParameter<double>("hOverEConeSize") ;
287  if (hcalCfg_.hOverEConeSize>0)
288  {
291  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
292  hcalCfg_.hOverEPtMin = cfg.getParameter<double>("hOverEPtMin") ;
293  }
294  hcalCfgPflow_.hOverEConeSize = cfg.getParameter<double>("hOverEConeSizePflow") ;
296  {
299  consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("hcalTowers")) ;
300  hcalCfgPflow_.hOverEPtMin = cfg.getParameter<double>("hOverEPtMinPflow") ;
301  }
302 
303  // Ecal rec hits configuration
305  const std::vector<std::string> flagnamesbarrel = cfg.getParameter<std::vector<std::string> >("recHitFlagsToBeExcludedBarrel");
306  recHitsCfg.recHitFlagsToBeExcludedBarrel = StringToEnumValue<EcalRecHit::Flags>(flagnamesbarrel);
307  const std::vector<std::string> flagnamesendcaps = cfg.getParameter<std::vector<std::string> >("recHitFlagsToBeExcludedEndcaps");
308  recHitsCfg.recHitFlagsToBeExcludedEndcaps = StringToEnumValue<EcalRecHit::Flags>(flagnamesendcaps);
309  const std::vector<std::string> severitynamesbarrel = cfg.getParameter<std::vector<std::string> >("recHitSeverityToBeExcludedBarrel");
310  recHitsCfg.recHitSeverityToBeExcludedBarrel = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesbarrel);
311  const std::vector<std::string> severitynamesendcaps = cfg.getParameter<std::vector<std::string> >("recHitSeverityToBeExcludedEndcaps");
312  recHitsCfg.recHitSeverityToBeExcludedEndcaps = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesendcaps);
313  //recHitsCfg.severityLevelCut = cfg.getParameter<int>("severityLevelCut") ;
314 
315  // isolation
317  isoCfg.intRadiusBarrelTk = cfg.getParameter<double>("intRadiusBarrelTk") ;
318  isoCfg.intRadiusEndcapTk = cfg.getParameter<double>("intRadiusEndcapTk") ;
319  isoCfg.stripBarrelTk = cfg.getParameter<double>("stripBarrelTk") ;
320  isoCfg.stripEndcapTk = cfg.getParameter<double>("stripEndcapTk") ;
321  isoCfg.ptMinTk = cfg.getParameter<double>("ptMinTk") ;
322  isoCfg.maxVtxDistTk = cfg.getParameter<double>("maxVtxDistTk") ;
323  isoCfg.maxDrbTk = cfg.getParameter<double>("maxDrbTk") ;
324  isoCfg.intRadiusHcal = cfg.getParameter<double>("intRadiusHcal") ;
325  isoCfg.etMinHcal = cfg.getParameter<double>("etMinHcal") ;
326  isoCfg.intRadiusEcalBarrel = cfg.getParameter<double>("intRadiusEcalBarrel") ;
327  isoCfg.intRadiusEcalEndcaps = cfg.getParameter<double>("intRadiusEcalEndcaps") ;
328  isoCfg.jurassicWidth = cfg.getParameter<double>("jurassicWidth") ;
329  isoCfg.etMinBarrel = cfg.getParameter<double>("etMinBarrel") ;
330  isoCfg.eMinBarrel = cfg.getParameter<double>("eMinBarrel") ;
331  isoCfg.etMinEndcaps = cfg.getParameter<double>("etMinEndcaps") ;
332  isoCfg.eMinEndcaps = cfg.getParameter<double>("eMinEndcaps") ;
333  isoCfg.vetoClustered = cfg.getParameter<bool>("vetoClustered") ;
334  isoCfg.useNumCrystals = cfg.getParameter<bool>("useNumCrystals") ;
335 
336 
337  RegressionHelper::Configuration regressionCfg ;
338  regressionCfg.ecalRegressionWeightLabels = cfg.getParameter<std::vector<std::string> >("ecalRefinedRegressionWeightLabels");
339  regressionCfg.combinationRegressionWeightLabels = cfg.getParameter<std::vector<std::string> >("combinationRegressionWeightLabels");
340  regressionCfg.ecalRegressionWeightFiles = cfg.getParameter<std::vector<std::string> >("ecalRefinedRegressionWeightFiles");
341  regressionCfg.combinationRegressionWeightFiles = cfg.getParameter<std::vector<std::string> >("combinationRegressionWeightFile");
342  regressionCfg.ecalWeightsFromDB = cfg.getParameter<bool>("ecalWeightsFromDB");
343  regressionCfg.combinationWeightsFromDB = cfg.getParameter<bool>("combinationWeightsFromDB");
344  // functions for corrector
345  EcalClusterFunctionBaseClass * superClusterErrorFunction = 0 ;
346  std::string superClusterErrorFunctionName
347  = cfg.getParameter<std::string>("superClusterErrorFunction") ;
348  if (superClusterErrorFunctionName!="")
349  {
350  superClusterErrorFunction
351  = EcalClusterFunctionFactory::get()->create(superClusterErrorFunctionName,cfg) ;
352  }
353  else
354  {
355  superClusterErrorFunction
356  = EcalClusterFunctionFactory::get()->create("EcalClusterEnergyUncertaintyObjectSpecific",cfg) ;
357  }
358  EcalClusterFunctionBaseClass * crackCorrectionFunction = 0 ;
359  std::string crackCorrectionFunctionName
360  = cfg.getParameter<std::string>("crackCorrectionFunction") ;
361  if (crackCorrectionFunctionName!="")
362  {
363  crackCorrectionFunction
364  = EcalClusterFunctionFactory::get()->create(crackCorrectionFunctionName,cfg) ;
365  }
366 
367 
368  mva_NIso_Cfg_.vweightsfiles = cfg.getParameter<std::vector<std::string>>("SoftElecMVAFilesString");
369  mva_NIso_Cfg_.vtxCollection = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("vtxTag"));
370  mva_Iso_Cfg_.vweightsfiles = cfg.getParameter<std::vector<std::string>>("ElecMVAFilesString");
371  // create algo
372  algo_ = new GsfElectronAlgo
376  isoCfg,recHitsCfg,
377  superClusterErrorFunction,
378  crackCorrectionFunction,
380  mva_Iso_Cfg_,
381  regressionCfg
382  ) ;
383 
384 
385  }
386 
388  { delete algo_ ; }
389 
391  {
392  // check configuration
394  {
397  event.getByToken(inputCfg_.seedsTag,seeds) ;
398  if (!seeds.isValid())
399  {
400  edm::LogWarning("GsfElectronAlgo|UnreachableSeedsProvenance")
401  <<"Cannot check consistency of parameters with ecal seeding ones,"
402  <<" because the original collection of seeds is not any more available." ;
403  }
404  else
405  {
407  }
408  }
409 
410  // init the algo
411  algo_->checkSetup(setup) ;
412  algo_->beginEvent(event) ;
413  }
414 
416  {
417  // all electrons
418  algo_->displayInternalElectrons("GsfElectronAlgo Info (before preselection)") ;
419  // preselection
421  {
423  algo_->displayInternalElectrons("GsfElectronAlgo Info (after preselection)") ;
424  }
425  // ambiguity
428  {
430  algo_->displayInternalElectrons("GsfElectronAlgo Info (after amb. solving)") ;
431  }
432  // final filling
433  std::auto_ptr<GsfElectronCollection> finalCollection( new GsfElectronCollection ) ;
434  algo_->copyElectrons(*finalCollection) ;
435  orphanHandle_ = event.put(finalCollection) ;
436 }
437 
439  {
440  algo_->endEvent() ;
441  }
442 
444  {
445  edm::ParameterSet seedConfiguration = pset.getParameter<edm::ParameterSet>("SeedConfiguration") ;
446  //edm::ParameterSet orderedHitsFactoryPSet = seedConfiguration.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet") ;
447  //edm::ParameterSet seedParameters = seedConfiguration.getParameter<edm::ParameterSet>("ecalDrivenElectronSeedsParameters") ;
448 
449  if (seedConfiguration.getParameter<bool>("applyHOverECut"))
450  {
451  if ((hcalCfg_.hOverEConeSize!=0)&&(hcalCfg_.hOverEConeSize!=seedConfiguration.getParameter<double>("hOverEConeSize")))
452  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The H/E cone size ("<<hcalCfg_.hOverEConeSize<<") is different from ecal seeding ("<<seedConfiguration.getParameter<double>("hOverEConeSize")<<")." ; }
453  if (cutsCfg_.maxHOverEBarrel<seedConfiguration.getParameter<double>("maxHOverEBarrel"))
454  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The max barrel H/E is lower than during ecal seeding." ; }
455  if (cutsCfg_.maxHOverEEndcaps<seedConfiguration.getParameter<double>("maxHOverEEndcaps"))
456  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The max endcaps H/E is lower than during ecal seeding." ; }
457  }
458 
459  if (cutsCfg_.minSCEtBarrel<seedConfiguration.getParameter<double>("SCEtCut"))
460  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The minimum super-cluster Et in barrel is lower than during ecal seeding." ; }
461  if (cutsCfg_.minSCEtEndcaps<seedConfiguration.getParameter<double>("SCEtCut"))
462  { edm::LogWarning("GsfElectronAlgo|InconsistentParameters") <<"The minimum super-cluster Et in endcaps is lower than during ecal seeding." ; }
463  }
464 
465 
T getParameter(std::string const &) const
tuple cfg
Definition: looper.py:259
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
GsfElectronBaseProducer(const edm::ParameterSet &)
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
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_
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsTag
ParameterDescriptionBase * add(U const &iLabel, T const &value)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
edm::EDGetTokenT< edm::ValueMap< float > > pfMVA
bool isValid() const
Definition: HandleBase.h:75
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
void removeAmbiguousElectrons()
void displayInternalElectrons(const std::string &title) const
void removeNotPreselectedElectrons()
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
void copyElectrons(reco::GsfElectronCollection &)
volatile std::atomic< bool > shutdown_flag false
edm::EDGetTokenT< reco::VertexCollection > vtxCollection
void setAmbiguityData(bool ignoreNotPreselected=true)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
T get(const Candidate &c)
Definition: component.h:55
GsfElectronAlgo::CutsConfiguration cutsCfgPflow_
edm::OrphanHandle< reco::GsfElectronCollection > orphanHandle_
Provenance const * provenance() const
Definition: HandleBase.h:84
void checkSetup(const edm::EventSetup &)