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&);
25  static std::map<std::string,EEA::ElectronEffectiveAreaType> EEA_type();
26  static std::map<std::string,EEA::ElectronEffectiveAreaTarget> EEA_target();
27 };
28 
29 
30 
33  : gsfElectronTag( config.getParameter<edm::InputTag>("gsfElectrons") )
34  , pfElectronTag( config.getParameter<edm::InputTag>("pfElectrons") )
35  , rhoIsoTag( config.getParameter<edm::InputTag>("rhoIso") )
36  , modeEEA( EEA_type()[ config.getParameter<std::string>("EffectiveAreaType") ] )
37  , targetEEA( EEA_target()[ config.getParameter<std::string>("EffectiveAreaTarget") ] )
38 { produces<CandDoubleMap>(); }
39 
40 
41 
44 {
45  std::auto_ptr<CandDoubleMap> product(new CandDoubleMap());
46  CandDoubleMap::Filler filler(*product);
47 
48  edm::Handle<double> rho; event.getByLabel(rhoIsoTag, rho);
51  std::vector<double> gsfCorrectionsEA,pfCorrectionsEA;
52 
53  if(gsfElectrons.isValid()) {
54  for ( reco::GsfElectronCollection::const_iterator it = gsfElectrons->begin(); it != gsfElectrons->end(); ++it)
55  gsfCorrectionsEA.push_back( (*rho) * EEA::GetElectronEffectiveArea( modeEEA, it->superCluster()->eta(), targetEEA ) );
56  filler.insert(gsfElectrons, gsfCorrectionsEA.begin(), gsfCorrectionsEA.end() );
57  }
58 
59  if(pfElectrons.isValid()) {
60  for ( reco::PFCandidateCollection::const_iterator it = pfElectrons->begin(); it != pfElectrons->end(); ++it)
61  pfCorrectionsEA.push_back( (*rho) * EEA::GetElectronEffectiveArea( modeEEA, it->gsfElectronRef()->superCluster()->eta(), targetEEA ) );
62  filler.insert( pfElectrons, pfCorrectionsEA.begin(), pfCorrectionsEA.end() );
63  }
64 
65  filler.fill();
66  event.put(product);
67  return true;
68 }
69 
70 
71 
72 
73 // These maps should really be static const members of interface/ElectronEffectiveArea.h
74 // Here mapping strings to only a subset of the enum
75 std::map<std::string,ElectronEffectiveArea::ElectronEffectiveAreaType>
77 {
78  std::map<std::string,EEA::ElectronEffectiveAreaType> m;
79  m["kEleGammaAndNeutralHadronIso03"] = EEA::kEleGammaAndNeutralHadronIso03;
80  m["kEleGammaAndNeutralHadronIso04"] = EEA::kEleGammaAndNeutralHadronIso04;
81  return m;
82 }
83 
84 std::map<std::string,ElectronEffectiveArea::ElectronEffectiveAreaTarget>
86 {
87  std::map<std::string,EEA::ElectronEffectiveAreaTarget > m;
88  m["kEleEANoCorr"] = EEA::kEleEANoCorr;
89  m["kEleEAData2011"] = EEA::kEleEAData2011;
90  m["kEleEASummer11MC"] = EEA::kEleEASummer11MC;
91  m["kEleEAFall11MC"] = EEA::kEleEAFall11MC;
92  m["kEleEAData2012"] = EEA::kEleEAData2012;
93  return m;
94 }
95 
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:53
static Double_t GetElectronEffectiveArea(ElectronEffectiveAreaType type, Double_t SCEta, ElectronEffectiveAreaTarget EffectiveAreaTarget=kEleEAData2011)
const EEA::ElectronEffectiveAreaType modeEEA
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 &)
const EEA::ElectronEffectiveAreaTarget targetEEA