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  if (params.exists("leptonId") || params.exists("qualityCut")) {
17  std::string leptonId = params.getParameter<std::string>("leptonId");
18  m_leptonId =
19  reco::SoftLeptonProperties::Quality::byName<reco::SoftLeptonProperties::Quality::Generic>(leptonId.c_str());
20  m_qualityCut = params.getParameter<double>("qualityCut");
21  }
22 }
23 
25 
26 bool LeptonSelector::operator()(const reco::SoftLeptonProperties &properties, bool use3d) const {
27  float sipsig = use3d ? properties.sip3dsig : properties.sip2dsig;
28  if ((isPositive() && sipsig <= 0.0) || (isNegative() && sipsig >= 0.0))
29  return false;
30 
32  float quality = properties.quality(m_leptonId, !candSelection);
34  return true; // for backwards compatibility
35 
36  return quality > m_qualityCut;
37 }
38 
40  if (selection == "any")
41  return any;
42  else if (selection == "negative")
43  return negative;
44  else if (selection == "positive")
45  return positive;
46  else
47  throw edm::Exception(edm::errors::Configuration) << "invalid parameter specified for soft lepton selection";
48 }
bool operator()(const reco::SoftLeptonProperties &properties, bool use3d=true) const
selection
main part
Definition: corrVsCorr.py:100
sign
optionally select leptons based on their impact parameter sign
Definition: Matching.h:10
LeptonSelector(const edm::ParameterSet &params)
static sign option(const std::string &election)
float quality(Quality::Generic qual, bool throwIfUndefined=true) const
bool isNegative() const
reco::SoftLeptonProperties::Quality::Generic m_leptonId
fixed size matrix
bool isPositive() const
string quality