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 }
btag::LeptonSelector::isNegative
bool isNegative() const
Definition: LeptonSelector.h:21
reco::SoftLeptonProperties::Quality::btagLeptonCands
Definition: TemplatedSoftLeptonTagInfo.h:53
reco::SoftLeptonProperties
Definition: TemplatedSoftLeptonTagInfo.h:15
SoftLeptonTagInfo.h
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
btag::LeptonSelector::~LeptonSelector
~LeptonSelector()
Definition: LeptonSelector.cc:24
btag::LeptonSelector::m_leptonId
reco::SoftLeptonProperties::Quality::Generic m_leptonId
Definition: LeptonSelector.h:31
reco::SoftLeptonProperties::sip2dsig
float sip2dsig
Definition: TemplatedSoftLeptonTagInfo.h:31
reco::SoftLeptonProperties::quality
float quality(Quality::Generic qual, bool throwIfUndefined=true) const
Definition: TemplatedSoftLeptonTagInfo.h:81
btag::LeptonSelector::option
static sign option(const std::string &election)
Definition: LeptonSelector.cc:39
reco::SoftLeptonProperties::sip3dsig
float sip3dsig
Definition: TemplatedSoftLeptonTagInfo.h:32
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::SoftLeptonProperties::Quality::undef
static const float undef
Definition: TemplatedSoftLeptonTagInfo.h:48
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
EDMException.h
btag::LeptonSelector::isPositive
bool isPositive() const
Definition: LeptonSelector.h:20
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
LeptonSelector.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.use3d
use3d
Definition: HLT_2018_cff.py:5240
edm::ParameterSet
Definition: ParameterSet.h:36
btag::LeptonSelector::m_qualityCut
float m_qualityCut
Definition: LeptonSelector.h:32
btag::LeptonSelector::sign
sign
optionally select leptons based on their impact parameter sign
Definition: LeptonSelector.h:26
std
Definition: JetResolutionObject.h:76
btag::LeptonSelector::negative
Definition: LeptonSelector.h:26
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
btag::LeptonSelector::positive
Definition: LeptonSelector.h:26
Exception
Definition: hltDiff.cc:246
btag::LeptonSelector::operator()
bool operator()(const reco::SoftLeptonProperties &properties, bool use3d=true) const
Definition: LeptonSelector.cc:26
ParameterSet.h
HLT_2018_cff.leptonId
leptonId
Definition: HLT_2018_cff.py:51511
edm::errors::Configuration
Definition: EDMException.h:36
btag::LeptonSelector::LeptonSelector
LeptonSelector(const edm::ParameterSet &params)
Definition: LeptonSelector.cc:12
btag
Definition: Matching.h:10
btag::LeptonSelector::any
Definition: LeptonSelector.h:26
ecaldqm::Quality
Quality
Definition: DBWriterWorkers.cc:55