CMS 3D CMS Logo

PhoGenericQuadraticRhoPtScaledCut.cc
Go to the documentation of this file.
7 
9 public:
11 
12  result_type operator()(const reco::PhotonPtr&) const final;
13 
15  void getEventContent(const edm::EventBase&) final;
16 
17  double value(const reco::CandidatePtr& cand) const final;
18 
20 
21 private:
23  bool lessThan_;
24  //cut value is constTerm + linearRhoTerm_*rho + linearPtTerm*pt + quadraticPtTerm*pt*pt
25  //note EBEECutValues & Effective areas are conceptually the same thing, both are eta
26  //binned constants, just Effective areas have arbitary rather than barrel/endcap binnng
31 
33 };
34 
35 DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhoGenericQuadraticRhoPtScaledCut, "PhoGenericQuadraticRhoPtScaledCut");
36 
39  varFunc_(params.getParameter<std::string>("cutVariable")),
40  lessThan_(params.getParameter<bool>("lessThan")),
41  constTerm_(params, "constTerm"),
42  rhoEA_(params.getParameter<edm::FileInPath>("effAreasConfigFile").fullPath(),
43  params.getParameter<bool>("quadEAflag")),
44  linearPtTerm_(params, "linearPtTerm"),
45  quadraticPtTerm_(params, "quadraticPtTerm") {
46  edm::InputTag rhoTag = params.getParameter<edm::InputTag>("rho");
47  contentTags_.emplace("rho", rhoTag);
48 }
49 
51  auto rho = cc.consumes<double>(contentTags_["rho"]);
52  contentTokens_.emplace("rho", rho);
53 }
54 
56  ev.getByLabel(contentTags_["rho"], rhoHandle_);
57 }
58 
60  const double rho = (*rhoHandle_);
61 
62  const float var = varFunc_(*pho);
63 
64  const float et = pho->et();
65  const float absEta = std::abs(pho->superCluster()->eta());
66  const float cutValue = constTerm_(pho) + rhoEA_.getLinearEA(absEta) * rho +
67  rhoEA_.getQuadraticEA(absEta) * rho * rho + linearPtTerm_(pho) * et +
68  quadraticPtTerm_(pho) * et * et;
69  if (lessThan_)
70  return var < cutValue;
71  else
72  return var >= cutValue;
73 }
74 
76  reco::PhotonPtr pho(cand);
77  return varFunc_(*pho);
78 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
double value(const reco::CandidatePtr &cand) const final
std::unordered_map< std::string, edm::InputTag > contentTags_
void getEventContent(const edm::EventBase &) final
void setConsumes(edm::ConsumesCollector &) final
result_type operator()(const reco::PhotonPtr &) const final
ThreadSafeFunctor< StringObjectFunction< reco::Photon > > varFunc_
const float getQuadraticEA(float eta) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
PhoGenericQuadraticRhoPtScaledCut(const edm::ParameterSet &c)
HLT enums.
#define DEFINE_EDM_PLUGIN(factory, type, name)
const float getLinearEA(float eta) const