CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
nano_mu::EDTokenHandle< T > Class Template Reference

#include <MuNtupleUtils.h>

Public Member Functions

auto conditionalGet (const edm::Event &ev) const
 
 EDTokenHandle (const edm::ParameterSet &config, edm::ConsumesCollector &&collector, std::string name)
 Constructor. More...
 

Private Attributes

edm::InputTag m_inputTag
 
std::string m_name
 
edm::EDGetTokenT< Tm_token
 

Detailed Description

template<class T>
class nano_mu::EDTokenHandle< T >

Definition at line 36 of file MuNtupleUtils.h.

Constructor & Destructor Documentation

◆ EDTokenHandle()

template<class T>
nano_mu::EDTokenHandle< T >::EDTokenHandle ( const edm::ParameterSet config,
edm::ConsumesCollector &&  collector,
std::string  name 
)
inline

Constructor.

Definition at line 39 of file MuNtupleUtils.h.

40  : m_name{name}, m_inputTag{config.getParameter<edm::InputTag>(name)} {
41  if (m_inputTag.label() != "none") {
42  m_token = collector.template consumes<T>(m_inputTag);
43  }
44  }
Definition: config.py:1
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag m_inputTag
Definition: MuNtupleUtils.h:61
edm::EDGetTokenT< T > m_token
Definition: MuNtupleUtils.h:62

Member Function Documentation

◆ conditionalGet()

template<class T>
auto nano_mu::EDTokenHandle< T >::conditionalGet ( const edm::Event ev) const
inline

Conditional getter checks whether a token is valid and if retireving the data collection succeded

Definition at line 49 of file MuNtupleUtils.h.

Referenced by MuDTTPGThetaFlatTableProducer::fillTable(), MuDTTPGPhiFlatTableProducer::fillTable(), MuGEMMuonExtTableProducer::fillTable(), MuDTSegmentExtTableProducer::fillTable(), MuDTMuonExtTableProducer::fillTable(), and MuCSCTnPFlatTableProducer::fillTable().

49  {
51 
52  if (!m_token.isUninitialized() && !ev.getByToken(m_token, collection))
53  edm::LogError("") << "[EDTokenHandle]::conditionalGet: " << m_inputTag.label()
54  << " collection does not exist !!!";
55 
56  return collection;
57  }
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag m_inputTag
Definition: MuNtupleUtils.h:61
edm::EDGetTokenT< T > m_token
Definition: MuNtupleUtils.h:62

Member Data Documentation

◆ m_inputTag

template<class T>
edm::InputTag nano_mu::EDTokenHandle< T >::m_inputTag
private

◆ m_name

template<class T>
std::string nano_mu::EDTokenHandle< T >::m_name
private

Definition at line 60 of file MuNtupleUtils.h.

◆ m_token

template<class T>
edm::EDGetTokenT<T> nano_mu::EDTokenHandle< T >::m_token
private