CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GsfEleValueMapIsoRhoCut.cc
Go to the documentation of this file.
5 
7 public:
9 
10  result_type operator()(const reco::GsfElectronPtr&) const final;
11 
13  void getEventContent(const edm::EventBase&) final;
14 
15  double value(const reco::CandidatePtr& cand) const final;
16 
18 
19 private:
20  float getRhoCorr(const reco::GsfElectronPtr& cand) const;
21 
27 
28  bool useRho_;
29 
32 };
33 
35 
38  slopeTerm_(params, "slopeTerm"),
39  slopeStart_(params, "slopeStart"),
40  constTerm_(params, "constTerm"),
41  rhoEtStart_(params, "rhoEtStart"),
42  rhoEA_(params, "rhoEA") {
43  auto rho = params.getParameter<edm::InputTag>("rho");
44  if (!rho.label().empty()) {
45  useRho_ = true;
46  contentTags_.emplace("rho", rho);
47  } else
48  useRho_ = false;
49 
50  contentTags_.emplace("value", params.getParameter<edm::InputTag>("value"));
51 }
52 
54  if (useRho_)
55  contentTokens_.emplace("rho", cc.consumes<double>(contentTags_["rho"]));
56  contentTokens_.emplace("value", cc.consumes<edm::ValueMap<float> >(contentTags_["value"]));
57 }
58 
60  if (useRho_)
62  ev.getByLabel(contentTags_["value"], valueHandle_);
63 }
64 
66  const float val = (*valueHandle_)[cand];
67 
68  const float et = cand->et();
69  const float cutValue =
70  et > slopeStart_(cand) ? slopeTerm_(cand) * (et - slopeStart_(cand)) + constTerm_(cand) : constTerm_(cand);
71  const float rhoCutValue = getRhoCorr(cand);
72 
73  return val < cutValue + rhoCutValue;
74 }
75 
77  reco::GsfElectronPtr ele(cand);
78  return (*valueHandle_)[cand];
79 }
80 
82  if (!useRho_)
83  return 0.;
84  else {
85  const double rho = (*rhoHandle_);
86  return cand->et() >= rhoEtStart_(cand) ? rhoEA_(cand) * rho : 0.;
87  }
88 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void setConsumes(edm::ConsumesCollector &) final
const edm::EventSetup & c
edm::Handle< edm::ValueMap< float > > valueHandle_
std::unordered_map< std::string, edm::InputTag > contentTags_
result_type operator()(const reco::GsfElectronPtr &) const final
double value(const reco::CandidatePtr &cand) const final
bool ev
edm::Handle< double > rhoHandle_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void getEventContent(const edm::EventBase &) final
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
CandidateType candidateType() const final
#define DEFINE_EDM_PLUGIN(factory, type, name)
float getRhoCorr(const reco::GsfElectronPtr &cand) const
GsfEleValueMapIsoRhoCut(const edm::ParameterSet &c)