CMS 3D CMS Logo

GsfElectronProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaElectronProducers
4 // Class: GsfElectronProducer
5 //
14 #include "GsfElectronProducer.h"
15 
24 
33 
34 
35 #include <iostream>
36 
37 using namespace reco;
38 
39 /* void GsfElectronProducer::fillDescriptions( edm::ConfigurationDescriptions & descriptions )
40  {
41  edm::ParameterSetDescription desc ;
42  GsfElectronBaseProducer::fillDescription(desc) ;
43 
44  // input collections
45  desc.add<edm::InputTag>("gsfElectronCoresTag",edm::InputTag("gsfElectronCores")) ;
46  desc.add<edm::InputTag>("ecalDrivenGsfElectronsTag",edm::InputTag("ecalDrivenGsfElectrons")) ;
47  desc.add<edm::InputTag>("pfMvaTag",edm::InputTag("pfElectronTranslator:pf")) ;
48 
49  // steering
50  desc.add<bool>("addPflowElectrons",true) ;
51 
52  // preselection parameters (tracker driven only electrons)
53  desc.add<double>("minSCEtBarrelPflow",0.0) ;
54  desc.add<double>("minSCEtEndcapsPflow",0.0) ;
55  desc.add<double>("minEOverPBarrelPflow",0.0) ;
56  desc.add<double>("maxEOverPBarrelPflow",999999999.) ;
57  desc.add<double>("minEOverPEndcapsPflow",0.0) ;
58  desc.add<double>("maxEOverPEndcapsPflow",999999999.) ;
59  desc.add<double>("maxDeltaEtaBarrelPflow",999999999.) ;
60  desc.add<double>("maxDeltaEtaEndcapsPflow",999999999.) ;
61  desc.add<double>("maxDeltaPhiBarrelPflow",999999999.) ;
62  desc.add<double>("maxDeltaPhiEndcapsPflow",999999999.) ;
63  desc.add<double>("hOverEConeSizePflow",0.15) ;
64  desc.add<double>("hOverEPtMinPflow",0.) ;
65  desc.add<double>("maxHOverEBarrelPflow",999999999.) ;
66  desc.add<double>("maxHOverEEndcapsPflow",999999999.) ;
67  desc.add<double>("maxHBarrelPflow",0.0) ;
68  desc.add<double>("maxHEndcapsPflow",0.0) ;
69  desc.add<double>("maxSigmaIetaIetaBarrelPflow",999999999.) ;
70  desc.add<double>("maxSigmaIetaIetaEndcapsPflow",999999999.) ;
71  desc.add<double>("maxFbremBarrelPflow",999999999.) ;
72  desc.add<double>("maxFbremEndcapsPflow",999999999.) ;
73  desc.add<bool>("isBarrelPflow",false) ;
74  desc.add<bool>("isEndcapsPflow",false) ;
75  desc.add<bool>("isFiducialPflow",false) ;
76  desc.add<double>("maxTIPPflow",999999999.) ;
77  desc.add<double>("minMVAPflow",-0.4) ;
78 
79  descriptions.add("produceGsfElectrons",desc) ;
80  }
81  */
83  : GsfElectronBaseProducer(cfg,hoc), pfTranslatorParametersChecked_(false)
84  {}
85 
87  {}
88 
90  {
91  beginEvent(event,setup) ;
93  // don't add pflow only electrons if one so wish
95  { algo_->completeElectrons(globalCache()) ; }
96  algo_->addPflowInfo() ;
97  fillEvent(event) ;
98  endEvent() ;
99  }
100 
102  {
103  // extra configuration checks
105  {
108  event.getByToken(inputCfg_.pfMVA,pfMva) ;
110  }
111 
112  // call to base class
114  }
115 
117  {
118  edm::ParameterSet mvaBlock = pset.getParameter<edm::ParameterSet>("MVACutBlock") ;
119  double pfTranslatorMinMva = mvaBlock.getParameter<double>("MVACut") ;
120  double pfTranslatorUndefined = -99. ;
121  if (strategyCfg_.applyPreselection&&(cutsCfgPflow_.minMVA<pfTranslatorMinMva))
122  {
123  // For pure tracker seeded electrons, if MVA is under translatorMinMva, there is no supercluster
124  // of any kind available, so GsfElectronCoreProducer has already discarded the electron.
125  edm::LogWarning("GsfElectronAlgo|MvaCutTooLow")
126  <<"Parameter minMVAPflow ("<<cutsCfgPflow_.minMVA<<") will have no effect on purely tracker seeded electrons."
127  <<" It is inferior to the cut already applied by PFlow translator ("<<pfTranslatorMinMva<<")." ;
128  }
129  if (strategyCfg_.applyPreselection&&(cutsCfg_.minMVA<pfTranslatorMinMva))
130  {
131  // For ecal seeded electrons, there is a cluster and GsfElectronCoreProducer has kept all electrons,
132  // but when MVA is under translatorMinMva, the translator has not stored the supercluster and
133  // forced the MVA value to translatorUndefined
134  if (cutsCfg_.minMVA>pfTranslatorUndefined)
135  {
136  edm::LogWarning("GsfElectronAlgo|IncompletePflowInformation")
137  <<"Parameter minMVA ("<<cutsCfg_.minMVA<<")is inferior to the cut applied by PFlow translator ("<<pfTranslatorMinMva<<")."
138  <<" Some ecal (and eventually tracker) seeded electrons may lack their MVA value and PFlow supercluster." ;
139  }
140  else
141  {
142  // the MVA value has been forced to translatorUndefined, inferior minMVAPflow
143  // so the cut actually applied is the PFlow one
144  throw cms::Exception("GsfElectronAlgo|BadMvaCut")
145  <<"Parameter minMVA is inferior to the lowest possible value."
146  <<" Every electron will be blessed whatever other criteria." ;
147  }
148  }
149  }
150 
151 
GsfElectronProducer(const edm::ParameterSet &, const gsfAlgoHelpers::HeavyObjectCache *)
T getParameter(std::string const &) const
void clonePreviousElectrons()
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
void completeElectrons(const gsfAlgoHelpers::HeavyObjectCache *)
void checkPfTranslatorParameters(edm::ParameterSet const &)
GsfElectronAlgo::InputTagsConfiguration inputCfg_
GsfElectronAlgo::CutsConfiguration cutsCfg_
edm::EDGetTokenT< edm::ValueMap< float > > pfMVA
GsfElectronAlgo::StrategyConfiguration strategyCfg_
void beginEvent(edm::Event &, const edm::EventSetup &)
void beginEvent(edm::Event &, const edm::EventSetup &)
fixed size matrix
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
GsfElectronAlgo::CutsConfiguration cutsCfgPflow_
Definition: event.py:1
Provenance const * provenance() const
Definition: HandleBase.h:83
void produce(edm::Event &, const edm::EventSetup &) override