CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes
btag::LeptonSelector Class Reference

#include <LeptonSelector.h>

Public Member Functions

bool isAny () const
 
bool isNegative () const
 
bool isPositive () const
 
 LeptonSelector (const edm::ParameterSet &params)
 
bool operator() (const reco::SoftLeptonProperties &properties, bool use3d=true) const
 
 ~LeptonSelector ()
 

Private Types

enum  sign { negative = -1, any = 0, positive = 1 }
 optionally select leptons based on their impact parameter sign More...
 

Static Private Member Functions

static sign option (const std::string &election)
 

Private Attributes

reco::SoftLeptonProperties::quality::Generic m_leptonId
 
float m_qualityCut
 
sign m_sign
 

Detailed Description

Definition at line 12 of file LeptonSelector.h.

Member Enumeration Documentation

optionally select leptons based on their impact parameter sign

Enumerator
negative 
any 
positive 

Definition at line 26 of file LeptonSelector.h.

Constructor & Destructor Documentation

LeptonSelector::LeptonSelector ( const edm::ParameterSet params)

Definition at line 12 of file LeptonSelector.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), m_leptonId, and m_qualityCut.

12  :
13  m_sign(option(params.getParameter<std::string>("ipSign"))),
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 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
reco::SoftLeptonProperties::quality::Generic m_leptonId
static sign option(const std::string &election)
LeptonSelector::~LeptonSelector ( )

Definition at line 24 of file LeptonSelector.cc.

25 {
26 }

Member Function Documentation

bool btag::LeptonSelector::isAny ( ) const
inline

Definition at line 19 of file LeptonSelector.h.

References any, and m_sign.

bool btag::LeptonSelector::isNegative ( ) const
inline
bool btag::LeptonSelector::isPositive ( ) const
inline

Definition at line 20 of file LeptonSelector.h.

References m_sign, and positive.

Referenced by operator()().

bool LeptonSelector::operator() ( const reco::SoftLeptonProperties properties,
bool  use3d = true 
) const

Definition at line 28 of file LeptonSelector.cc.

References reco::SoftLeptonProperties::quality::btagLeptonCands, isNegative(), isPositive(), m_leptonId, m_qualityCut, reco::SoftLeptonProperties::quality(), sip, reco::SoftLeptonProperties::sip2d, reco::SoftLeptonProperties::sip3d, and reco::SoftLeptonProperties::quality::undef.

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 }
float quality(quality::Generic qual, bool throwIfUndefined=true) const
bool isPositive() const
reco::SoftLeptonProperties::quality::Generic m_leptonId
bool isNegative() const
LeptonSelector::sign LeptonSelector::option ( const std::string &  election)
staticprivate

Definition at line 43 of file LeptonSelector.cc.

References any, edm::errors::Configuration, edm::hlt::Exception, negative, and positive.

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 }
selection
main part
Definition: corrVsCorr.py:98

Member Data Documentation

reco::SoftLeptonProperties::quality::Generic btag::LeptonSelector::m_leptonId
private

Definition at line 35 of file LeptonSelector.h.

Referenced by LeptonSelector(), and operator()().

float btag::LeptonSelector::m_qualityCut
private

Definition at line 36 of file LeptonSelector.h.

Referenced by LeptonSelector(), and operator()().

sign btag::LeptonSelector::m_sign
private

Definition at line 34 of file LeptonSelector.h.

Referenced by isAny(), isNegative(), and isPositive().