CMS 3D CMS Logo

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(), softMuonTagInfos_cfi::leptonId, m_leptonId, m_qualityCut, and AlCaHLTBitMon_QueryRunRegistry::string.

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
static sign option(const std::string &election)
reco::SoftLeptonProperties::Quality::Generic m_leptonId
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, jets_cff::quality, reco::SoftLeptonProperties::quality(), reco::SoftLeptonProperties::sip2dsig, reco::SoftLeptonProperties::sip3dsig, and reco::SoftLeptonProperties::Quality::undef.

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

Definition at line 43 of file LeptonSelector.cc.

References any, edm::errors::Configuration, 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:100

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().