CMS 3D CMS Logo

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 
29 {
30  float sipsig = use3d ? properties.sip3dsig : properties.sip2dsig;
31  if ((isPositive() && sipsig <= 0.0) ||
32  (isNegative() && sipsig >= 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
float quality(Quality::Generic qual, bool throwIfUndefined=true) const
selection
main part
Definition: corrVsCorr.py:100
bool exists(std::string const &parameterName) const
checks if a parameter exists
sign
optionally select leptons based on their impact parameter sign
Definition: Matching.h:10
bool isPositive() const
LeptonSelector(const edm::ParameterSet &params)
static sign option(const std::string &election)
bool isNegative() const
bool operator()(const reco::SoftLeptonProperties &properties, bool use3d=true) const
reco::SoftLeptonProperties::Quality::Generic m_leptonId
fixed size matrix