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 final;
11 
13  void getEventContent(const edm::EventBase&) final;
14 
15  double value(const reco::CandidatePtr& cand) const final;
16 
17  CandidateType candidateType() const 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
void setConsumes(edm::ConsumesCollector &) final
edm::Handle< edm::ValueMap< float > > valueHandle_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
CandidateType candidateType() const final
bool ev
double value(const reco::CandidatePtr &cand) const final
std::unordered_map< std::string, edm::InputTag > contentTags_
double et() const final
transverse energy
edm::Handle< double > rhoHandle_
et
define resolution functions of each parameter
void getEventContent(const edm::EventBase &) final
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:94
result_type operator()(const reco::GsfElectronPtr &) const final
#define DEFINE_EDM_PLUGIN(factory, type, name)
float getRhoCorr(const reco::GsfElectronPtr &cand) const
GsfEleValueMapIsoRhoCut(const edm::ParameterSet &c)