CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LeptonSelector.cc
Go to the documentation of this file.
1 #include <string>
2 
5 
7 
9 
10 using namespace btag;
11 
13  m_sign(option(params.getParameter<std::string>("ipSign"))),
14  m_leptonId(reco::SoftLeptonProperties::quality::btagLeptonCands),
15  m_qualityCut(0.5)
16 {
17  if (params.exists("leptonId") || params.exists("qualityCut")) {
18  std::string leptonId = params.getParameter<std::string>("leptonId");
19  m_leptonId = reco::SoftLeptonProperties::quality::byName<reco::SoftLeptonProperties::quality::Generic>(leptonId.c_str());
20  m_qualityCut = params.getParameter<double>("qualityCut");
21  }
22 }
23 
25 {
26 }
27 
28 bool LeptonSelector::operator() (const reco::SoftLeptonProperties &properties, bool use3d) const
29 {
30  float sip = use3d ? properties.sip3d : properties.sip2d;
31  if ((isPositive() && sip <= 0.0) ||
32  (isNegative() && sip >= 0.0))
33  return false;
34 
36  float quality = properties.quality(m_leptonId, !candSelection);
37  if (candSelection && quality == reco::SoftLeptonProperties::quality::undef)
38  return true; // for backwards compatibility
39 
40  return quality > m_qualityCut;
41 }
42 
44 {
45  if (selection == "any")
46  return any;
47  else if (selection == "negative")
48  return negative;
49  else if (selection == "positive")
50  return positive;
51  else
52  throw edm::Exception( edm::errors::Configuration ) << "invalid parameter specified for soft lepton selection";
53 }
T getParameter(std::string const &) const
selection
main part
Definition: corrVsCorr.py:98
bool exists(std::string const &parameterName) const
checks if a parameter exists
float quality(quality::Generic qual, bool throwIfUndefined=true) const
sign
optionally select leptons based on their impact parameter sign
bool isPositive() const
LeptonSelector(const edm::ParameterSet &params)
reco::SoftLeptonProperties::quality::Generic m_leptonId
static sign option(const std::string &election)
bool isNegative() const
bool operator()(const reco::SoftLeptonProperties &properties, bool use3d=true) const