test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ElectronIsolatorFromEffectiveArea.cc
Go to the documentation of this file.
6 
10 
12 
14 
15  public:
19 
20  private:
21  virtual bool filter(edm::Event&, const edm::EventSetup&);
27  static std::map<std::string,EEA::ElectronEffectiveAreaType> EEA_type();
28  static std::map<std::string,EEA::ElectronEffectiveAreaTarget> EEA_target();
29 };
30 
31 
32 
35  : gsfElectronToken( consumes<reco::GsfElectronCollection>( config.getParameter<edm::InputTag>("gsfElectrons") ) )
36  , pfElectronToken( consumes<reco::PFCandidateCollection>( config.getParameter<edm::InputTag>("pfElectrons") ) )
37  , rhoIsoToken( consumes<double>( config.getParameter<edm::InputTag>("rhoIso") ) )
38  , modeEEA( EEA_type()[ config.getParameter<std::string>("EffectiveAreaType") ] )
39  , targetEEA( EEA_target()[ config.getParameter<std::string>("EffectiveAreaTarget") ] )
40 { produces<CandDoubleMap>(); }
41 
42 
43 
46 {
47  std::auto_ptr<CandDoubleMap> product(new CandDoubleMap());
48  CandDoubleMap::Filler filler(*product);
49 
50  edm::Handle<double> rho; event.getByToken(rhoIsoToken, rho);
53  std::vector<double> gsfCorrectionsEA,pfCorrectionsEA;
54 
55  if(gsfElectrons.isValid()) {
56  for ( reco::GsfElectronCollection::const_iterator it = gsfElectrons->begin(); it != gsfElectrons->end(); ++it)
57  gsfCorrectionsEA.push_back( (*rho) * EEA::GetElectronEffectiveArea( modeEEA, it->superCluster()->eta(), targetEEA ) );
58  filler.insert(gsfElectrons, gsfCorrectionsEA.begin(), gsfCorrectionsEA.end() );
59  }
60 
61  if(pfElectrons.isValid()) {
62  for ( reco::PFCandidateCollection::const_iterator it = pfElectrons->begin(); it != pfElectrons->end(); ++it)
63  pfCorrectionsEA.push_back( (*rho) * EEA::GetElectronEffectiveArea( modeEEA, it->gsfElectronRef()->superCluster()->eta(), targetEEA ) );
64  filler.insert( pfElectrons, pfCorrectionsEA.begin(), pfCorrectionsEA.end() );
65  }
66 
67  filler.fill();
68  event.put(product);
69  return true;
70 }
71 
72 
73 
74 
75 // These maps should really be static const members of interface/ElectronEffectiveArea.h
76 // Here mapping strings to only a subset of the enum
77 std::map<std::string,ElectronEffectiveArea::ElectronEffectiveAreaType>
79 {
80  std::map<std::string,EEA::ElectronEffectiveAreaType> m;
81  m["kEleGammaAndNeutralHadronIso03"] = EEA::kEleGammaAndNeutralHadronIso03;
82  m["kEleGammaAndNeutralHadronIso04"] = EEA::kEleGammaAndNeutralHadronIso04;
83  return m;
84 }
85 
86 std::map<std::string,ElectronEffectiveArea::ElectronEffectiveAreaTarget>
88 {
89  std::map<std::string,EEA::ElectronEffectiveAreaTarget > m;
90  m["kEleEANoCorr"] = EEA::kEleEANoCorr;
91  m["kEleEAData2011"] = EEA::kEleEAData2011;
92  m["kEleEASummer11MC"] = EEA::kEleEASummer11MC;
93  m["kEleEAFall11MC"] = EEA::kEleEAFall11MC;
94  m["kEleEAData2012"] = EEA::kEleEAData2012;
95  return m;
96 }
97 
static std::map< std::string, EEA::ElectronEffectiveAreaTarget > EEA_target()
static std::map< std::string, EEA::ElectronEffectiveAreaType > EEA_type()
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Definition: DDAxes.h:10
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
static Double_t GetElectronEffectiveArea(ElectronEffectiveAreaType type, Double_t SCEta, ElectronEffectiveAreaTarget EffectiveAreaTarget=kEleEAData2011)
const EEA::ElectronEffectiveAreaType modeEEA
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
virtual bool filter(edm::Event &, const edm::EventSetup &)
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
bool isValid() const
Definition: HandleBase.h:76
ElectronIsolatorFromEffectiveArea(const edm::ParameterSet &)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::EDGetTokenT< reco::PFCandidateCollection > pfElectronToken
const EEA::ElectronEffectiveAreaTarget targetEEA
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElectronToken