CMS 3D CMS Logo

GsfEleValueMapIsoRhoCut.cc
Go to the documentation of this file.
5 
7 public:
9 
10  result_type operator()(const reco::GsfElectronPtr&) const override final;
11 
12  void setConsumes(edm::ConsumesCollector&) override final;
13  void getEventContent(const edm::EventBase&) override final;
14 
15  double value(const reco::CandidatePtr& cand) const override final;
16 
17  CandidateType candidateType() const override final {
18  return ELECTRON;
19  }
20 
21 private:
22  float getRhoCorr(const reco::GsfElectronPtr& cand)const;
23 
29 
30  bool useRho_;
31 
34 };
35 
38  "GsfEleValueMapIsoRhoCut");
39 
42  slopeTerm_(params,"slopeTerm"),
43  slopeStart_(params,"slopeStart"),
44  constTerm_(params,"constTerm"),
45  rhoEtStart_(params,"rhoEtStart"),
46  rhoEA_(params,"rhoEA")
47 {
48  auto rho = params.getParameter<edm::InputTag>("rho");
49  if(!rho.label().empty()){
50  useRho_=true;
51  contentTags_.emplace("rho",rho);
52  }else useRho_=false;
53 
54  contentTags_.emplace("value",params.getParameter<edm::InputTag>("value"));
55 
56 }
57 
59  if(useRho_) contentTokens_.emplace("rho",cc.consumes<double>(contentTags_["rho"]));
60  contentTokens_.emplace("value",cc.consumes<edm::ValueMap<float> >(contentTags_["value"]));
61 }
62 
66 }
67 
68 CutApplicatorBase::result_type
71 
72  const float val = (*valueHandle_)[cand];
73 
74  const float et = cand->et();
75  const float cutValue = et > slopeStart_(cand) ? slopeTerm_(cand)*(et-slopeStart_(cand)) + constTerm_(cand) : constTerm_(cand);
76  const float rhoCutValue = getRhoCorr(cand);
77 
78  return val < cutValue+rhoCutValue;
79 }
80 
81 
83 value(const reco::CandidatePtr& cand) const {
84  reco::GsfElectronPtr ele(cand);
85  return (*valueHandle_)[cand];
86 }
87 
89  if(!useRho_) return 0.;
90  else{
91  const double rho = (*rhoHandle_);
92  return cand->et() >= rhoEtStart_(cand) ? rhoEA_(cand)*rho : 0.;
93  }
94 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::Handle< edm::ValueMap< float > > valueHandle_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
void setConsumes(edm::ConsumesCollector &) override final
bool ev
std::unordered_map< std::string, edm::InputTag > contentTags_
virtual double et() const final
transverse energy
double value(const reco::CandidatePtr &cand) const override final
void getEventContent(const edm::EventBase &) override final
edm::Handle< double > rhoHandle_
result_type operator()(const reco::GsfElectronPtr &) const override final
et
define resolution functions of each parameter
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:89
#define DEFINE_EDM_PLUGIN(factory, type, name)
float getRhoCorr(const reco::GsfElectronPtr &cand) const
CandidateType candidateType() const override final
GsfEleValueMapIsoRhoCut(const edm::ParameterSet &c)