CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
MuonDzCut Class Reference
Inheritance diagram for MuonDzCut:
CutApplicatorWithEventContentBase CutApplicatorBase candidate_functions::CandidateCut

Public Member Functions

CandidateType candidateType () const final
 
void getEventContent (const edm::EventBase &) final
 
 MuonDzCut (const edm::ParameterSet &c)
 
result_type operator() (const reco::MuonPtr &) const final
 
void setConsumes (edm::ConsumesCollector &) final
 
double value (const reco::CandidatePtr &) const final
 
- Public Member Functions inherited from CutApplicatorWithEventContentBase
 CutApplicatorWithEventContentBase ()
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
 CutApplicatorWithEventContentBase (const edm::ParameterSet &c)
 
CutApplicatorWithEventContentBaseoperator= (const CutApplicatorWithEventContentBase &)=delete
 
 ~CutApplicatorWithEventContentBase () override
 Destructor. More...
 
- Public Member Functions inherited from CutApplicatorBase
virtual result_type asCandidate (const argument_type &) const
 
 CutApplicatorBase ()
 
 CutApplicatorBase (const CutApplicatorBase &)=delete
 
 CutApplicatorBase (const edm::ParameterSet &c)
 
const std::string & name () const override
 
result_type operator() (const argument_type &) const final
 
virtual result_type operator() (const pat::ElectronPtr &) const
 
virtual result_type operator() (const pat::MuonPtr &) const
 
virtual result_type operator() (const pat::PhotonPtr &) const
 
virtual result_type operator() (const pat::TauPtr &) const
 
virtual result_type operator() (const reco::GsfElectronPtr &) const
 
virtual result_type operator() (const reco::PFTauPtr &) const
 
virtual result_type operator() (const reco::PhotonPtr &) const
 
CutApplicatorBaseoperator= (const CutApplicatorBase &)=delete
 
 ~CutApplicatorBase () override
 Destructor. More...
 
- Public Member Functions inherited from candidate_functions::CandidateCut
 CandidateCut ()
 
virtual ~CandidateCut ()
 

Private Types

enum  BestTrackType { INNERTRACK, MUONBESTTRACK, NONE }
 

Private Attributes

const double maxDz_
 
enum MuonDzCut::BestTrackType trackType_
 
edm::Handle< reco::VertexCollectionvtxs_
 

Additional Inherited Members

- Public Types inherited from CutApplicatorBase
enum  CandidateType {
  NONE, ELECTRON, MUON, PHOTON,
  TAU, PATELECTRON, PATMUON, PATPHOTON,
  PATTAU
}
 
- Public Types inherited from candidate_functions::CandidateCut
using argument_type = reco::CandidatePtr
 
using result_type = bool
 
- Protected Attributes inherited from CutApplicatorWithEventContentBase
std::unordered_map< std::string, edm::InputTagcontentTags_
 
std::unordered_map< std::string, edm::EDGetTokencontentTokens_
 

Detailed Description

Definition at line 6 of file MuonDzCut.cc.

Member Enumeration Documentation

◆ BestTrackType

Enumerator
INNERTRACK 
MUONBESTTRACK 
NONE 

Definition at line 20 of file MuonDzCut.cc.

Constructor & Destructor Documentation

◆ MuonDzCut()

MuonDzCut::MuonDzCut ( const edm::ParameterSet c)

Definition at line 25 of file MuonDzCut.cc.

26  : CutApplicatorWithEventContentBase(c), maxDz_(c.getParameter<double>("maxDz")) {
27  const std::string trackTypeName = c.getParameter<std::string>("trackType");
28  trackType_ = NONE;
29  if (trackTypeName == "muonBestTrack")
31  else if (trackTypeName == "innerTrack")
33  else {
34  edm::LogError("MuonDzCut") << "Wrong cut id name, " << trackTypeName
35  << "Choose among \"muonBestTrack\", \"innerTrack\"";
36  trackType_ = NONE;
37  }
38 
39  contentTags_.emplace("vertices", c.getParameter<edm::InputTag>("vertexSrc"));
40  contentTags_.emplace("verticesMiniAOD", c.getParameter<edm::InputTag>("vertexSrcMiniAOD"));
41 }

References HltBtagPostValidation_cff::c, CutApplicatorWithEventContentBase::contentTags_, INNERTRACK, MUONBESTTRACK, NONE, AlCaHLTBitMon_QueryRunRegistry::string, and trackType_.

Member Function Documentation

◆ candidateType()

CandidateType MuonDzCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 11 of file MuonDzCut.cc.

11 { return MUON; }

References CutApplicatorBase::MUON.

◆ getEventContent()

void MuonDzCut::getEventContent ( const edm::EventBase ev)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 48 of file MuonDzCut.cc.

48  {
49  ev.getByLabel(contentTags_["vertices"], vtxs_);
50  if (!vtxs_.isValid())
51  ev.getByLabel(contentTags_["verticesMiniAOD"], vtxs_);
52 }

References CutApplicatorWithEventContentBase::contentTags_, ev, edm::HandleBase::isValid(), and vtxs_.

◆ operator()()

CutApplicatorBase::result_type MuonDzCut::operator() ( const reco::MuonPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 55 of file MuonDzCut.cc.

55  {
56  const auto& vtxPos = vtxs_->at(0).position();
57 
58  reco::TrackRef trackRef;
59  if (trackType_ == INNERTRACK)
60  trackRef = cand->innerTrack();
61  else if (trackType_ == MUONBESTTRACK)
62  trackRef = cand->muonBestTrack();
63 
64  return trackRef.isNonnull() and std::abs(trackRef->dz(vtxPos)) <= maxDz_;
65 }

References funct::abs(), INNERTRACK, edm::Ref< C, T, F >::isNonnull(), maxDz_, MUONBESTTRACK, trackType_, and vtxs_.

◆ setConsumes()

void MuonDzCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 43 of file MuonDzCut.cc.

43  {
44  contentTokens_.emplace("vertices", cc.consumes<reco::VertexCollection>(contentTags_["vertices"]));
45  contentTokens_.emplace("verticesMiniAOD", cc.consumes<reco::VertexCollection>(contentTags_["verticesMiniAOD"]));
46 }

References CutApplicatorWithEventContentBase::contentTags_, and CutApplicatorWithEventContentBase::contentTokens_.

◆ value()

double MuonDzCut::value ( const reco::CandidatePtr cand) const
finalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 67 of file MuonDzCut.cc.

67  {
68  const reco::MuonPtr muon(cand);
69  reco::TrackRef trackRef;
70  if (trackType_ == INNERTRACK)
71  trackRef = muon->innerTrack();
72  else if (trackType_ == MUONBESTTRACK)
73  trackRef = muon->muonBestTrack();
74  if (trackRef.isNull())
75  return -1;
76 
77  const auto& vtxPos = vtxs_->at(0).position();
78  return std::abs(trackRef->dz(vtxPos));
79 }

References funct::abs(), INNERTRACK, edm::Ref< C, T, F >::isNull(), HLT_FULL_cff::muon, MUONBESTTRACK, trackType_, and vtxs_.

Member Data Documentation

◆ maxDz_

const double MuonDzCut::maxDz_
private

Definition at line 19 of file MuonDzCut.cc.

Referenced by operator()().

◆ trackType_

enum MuonDzCut::BestTrackType MuonDzCut::trackType_
private

Referenced by MuonDzCut(), operator()(), and value().

◆ vtxs_

edm::Handle<reco::VertexCollection> MuonDzCut::vtxs_
private

Definition at line 18 of file MuonDzCut.cc.

Referenced by getEventContent(), operator()(), and value().

MuonDzCut::MUONBESTTRACK
Definition: MuonDzCut.cc:20
MuonDzCut::trackType_
enum MuonDzCut::BestTrackType trackType_
muon
Definition: MuonCocktails.h:17
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::Ref< TrackCollection >
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition: CutApplicatorWithEventContentBase.h:35
MuonDzCut::maxDz_
const double maxDz_
Definition: MuonDzCut.cc:19
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11710
MuonDzCut::vtxs_
edm::Handle< reco::VertexCollection > vtxs_
Definition: MuonDzCut.cc:18
CutApplicatorBase::MUON
Definition: CutApplicatorBase.h:47
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CutApplicatorWithEventContentBase::CutApplicatorWithEventContentBase
CutApplicatorWithEventContentBase()
Definition: CutApplicatorWithEventContentBase.h:21
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
cand
Definition: decayParser.h:32
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cc
edm::Ptr< reco::Muon >
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition: CutApplicatorWithEventContentBase.h:40
MuonDzCut::NONE
Definition: MuonDzCut.cc:20
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
MuonDzCut::INNERTRACK
Definition: MuonDzCut.cc:20
edm::InputTag
Definition: InputTag.h:15