CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 edm::ParameterSet &c)
 
 CutApplicatorWithEventContentBase (const CutApplicatorWithEventContentBase &)=delete
 
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 edm::ParameterSet &c)
 
 CutApplicatorBase (const CutApplicatorBase &)=delete
 
const std::string & name () const override
 
result_type operator() (const argument_type &) const final
 
virtual result_type operator() (const reco::GsfElectronPtr &) const
 
virtual result_type operator() (const pat::ElectronPtr &) const
 
virtual result_type operator() (const reco::PhotonPtr &) const
 
virtual result_type operator() (const pat::PhotonPtr &) const
 
virtual result_type operator() (const pat::MuonPtr &) const
 
virtual result_type operator() (const reco::PFTauPtr &) const
 
virtual result_type operator() (const pat::TauPtr &) 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::VertexCollection
vtxs_
 

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::InputTag
contentTags_
 
std::unordered_map
< std::string, edm::EDGetToken
contentTokens_
 

Detailed Description

Definition at line 7 of file MuonDzCut.cc.

Member Enumeration Documentation

Enumerator
INNERTRACK 
MUONBESTTRACK 
NONE 

Definition at line 21 of file MuonDzCut.cc.

Constructor & Destructor Documentation

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

Definition at line 26 of file MuonDzCut.cc.

References CutApplicatorWithEventContentBase::contentTags_, edm::ParameterSet::getParameter(), INNERTRACK, MUONBESTTRACK, NONE, AlCaHLTBitMon_QueryRunRegistry::string, and trackType_.

27  : CutApplicatorWithEventContentBase(c), maxDz_(c.getParameter<double>("maxDz")) {
28  const std::string trackTypeName = c.getParameter<std::string>("trackType");
29  trackType_ = NONE;
30  if (trackTypeName == "muonBestTrack")
31  trackType_ = MUONBESTTRACK;
32  else if (trackTypeName == "innerTrack")
33  trackType_ = INNERTRACK;
34  else {
35  edm::LogError("MuonDzCut") << "Wrong cut id name, " << trackTypeName
36  << "Choose among \"muonBestTrack\", \"innerTrack\"";
37  trackType_ = NONE;
38  }
39 
40  contentTags_.emplace("vertices", c.getParameter<edm::InputTag>("vertexSrc"));
41  contentTags_.emplace("verticesMiniAOD", c.getParameter<edm::InputTag>("vertexSrcMiniAOD"));
42 }
std::unordered_map< std::string, edm::InputTag > contentTags_
enum MuonDzCut::BestTrackType trackType_
Log< level::Error, false > LogError
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const double maxDz_
Definition: MuonDzCut.cc:20

Member Function Documentation

CandidateType MuonDzCut::candidateType ( ) const
inlinefinalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 12 of file MuonDzCut.cc.

References CutApplicatorBase::MUON.

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

Implements CutApplicatorWithEventContentBase.

Definition at line 49 of file MuonDzCut.cc.

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

49  {
50  ev.getByLabel(contentTags_["vertices"], vtxs_);
51  if (!vtxs_.isValid())
52  ev.getByLabel(contentTags_["verticesMiniAOD"], vtxs_);
53 }
std::unordered_map< std::string, edm::InputTag > contentTags_
edm::Handle< reco::VertexCollection > vtxs_
Definition: MuonDzCut.cc:19
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
CutApplicatorBase::result_type MuonDzCut::operator() ( const reco::MuonPtr cand) const
finalvirtual

Reimplemented from CutApplicatorBase.

Definition at line 56 of file MuonDzCut.cc.

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

56  {
57  const auto& vtxPos = vtxs_->at(0).position();
58 
59  reco::TrackRef trackRef;
60  if (trackType_ == INNERTRACK)
61  trackRef = cand->innerTrack();
62  else if (trackType_ == MUONBESTTRACK)
63  trackRef = cand->muonBestTrack();
64 
65  return trackRef.isNonnull() and std::abs(trackRef->dz(vtxPos)) <= maxDz_;
66 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
enum MuonDzCut::BestTrackType trackType_
edm::Handle< reco::VertexCollection > vtxs_
Definition: MuonDzCut.cc:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const double maxDz_
Definition: MuonDzCut.cc:20
void MuonDzCut::setConsumes ( edm::ConsumesCollector cc)
finalvirtual

Implements CutApplicatorWithEventContentBase.

Definition at line 44 of file MuonDzCut.cc.

References edm::ConsumesCollector::consumes(), CutApplicatorWithEventContentBase::contentTags_, and CutApplicatorWithEventContentBase::contentTokens_.

44  {
45  contentTokens_.emplace("vertices", cc.consumes<reco::VertexCollection>(contentTags_["vertices"]));
46  contentTokens_.emplace("verticesMiniAOD", cc.consumes<reco::VertexCollection>(contentTags_["verticesMiniAOD"]));
47 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::unordered_map< std::string, edm::InputTag > contentTags_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
double MuonDzCut::value ( const reco::CandidatePtr cand) const
finalvirtual

Implements candidate_functions::CandidateCut.

Definition at line 68 of file MuonDzCut.cc.

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

Referenced by Types.int32::__nonzero__(), Types.uint32::__nonzero__(), Types.int64::__nonzero__(), Types.uint64::__nonzero__(), Types.double::__nonzero__(), Types.bool::__nonzero__(), Types.string::__nonzero__(), Types.string::configValue(), Types.FileInPath::configValue(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.FileInPath::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), and Types.vstring::insertInto().

68  {
69  const reco::MuonPtr muon(cand);
70  reco::TrackRef trackRef;
71  if (trackType_ == INNERTRACK)
72  trackRef = muon->innerTrack();
73  else if (trackType_ == MUONBESTTRACK)
74  trackRef = muon->muonBestTrack();
75  if (trackRef.isNull())
76  return -1;
77 
78  const auto& vtxPos = vtxs_->at(0).position();
79  return std::abs(trackRef->dz(vtxPos));
80 }
enum MuonDzCut::BestTrackType trackType_
edm::Handle< reco::VertexCollection > vtxs_
Definition: MuonDzCut.cc:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isNull() const
Checks for null.
Definition: Ref.h:235

Member Data Documentation

const double MuonDzCut::maxDz_
private

Definition at line 20 of file MuonDzCut.cc.

Referenced by operator()().

enum MuonDzCut::BestTrackType MuonDzCut::trackType_
private

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

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

Definition at line 19 of file MuonDzCut.cc.

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