CMS 3D CMS Logo

Public Member Functions | Private Types | Static Private Member Functions | Private Attributes

btag::LeptonSelector Class Reference

#include <LeptonSelector.h>

List of all members.

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.

              {
      negative = -1,
      any      =  0,
      positive =  1
    };

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.

                                                            :
  m_sign(option(params.getParameter<std::string>("ipSign"))),
  m_leptonId(reco::SoftLeptonProperties::quality::btagLeptonCands),
  m_qualityCut(0.5)
{
  if (params.exists("leptonId") || params.exists("reco::SoftLeptonProperties::qualityCut")) {
    std::string leptonId = params.getParameter<std::string>("leptonId");
    m_leptonId = reco::SoftLeptonProperties::quality::byName<reco::SoftLeptonProperties::quality::Generic>(leptonId.c_str());
    m_qualityCut = params.getParameter<double>("reco::SoftLeptonProperties::qualityCut");
  }
}
LeptonSelector::~LeptonSelector ( )

Definition at line 24 of file LeptonSelector.cc.

{
}

Member Function Documentation

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

Definition at line 19 of file LeptonSelector.h.

References any, and m_sign.

{ return m_sign == any; }
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()().

{ return m_sign == positive; }
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.

{
  float sip = use3d ? properties.sip3d : properties.sip2d;
  if ((isPositive() && sip <= 0.0) ||
      (isNegative() && sip >= 0.0))
    return false;

  bool candSelection = (m_leptonId == reco::SoftLeptonProperties::quality::btagLeptonCands);
  float quality = properties.quality(m_leptonId, !candSelection);
  if (candSelection && quality == reco::SoftLeptonProperties::quality::undef)
   return true;         // for backwards compatibility

  return quality > m_qualityCut;
}
LeptonSelector::sign LeptonSelector::option ( const std::string &  election) [static, private]

Definition at line 43 of file LeptonSelector.cc.

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

{
  if (selection == "any")
    return any;
  else if (selection == "negative")
    return negative;
  else if (selection == "positive")
    return positive;
  else 
    throw edm::Exception( edm::errors::Configuration ) << "invalid parameter specified for soft lepton selection";
}

Member Data Documentation

Definition at line 35 of file LeptonSelector.h.

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

Definition at line 36 of file LeptonSelector.h.

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

Definition at line 34 of file LeptonSelector.h.

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