CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::helper::NamedUserDataLoader< A > Class Template Reference

Public Member Functions

template<typename T >
void addData (const edm::Event &iEvent, const std::vector< edm::Ptr< T >> &ptrs, std::vector< T > &out) const
 
 NamedUserDataLoader (const edm::ParameterSet &iConfig, const std::string &main, edm::ConsumesCollector &&cc)
 

Private Attributes

std::vector< std::pair< std::string, edm::EDGetTokenT< typename A::product_type > > > labelsAndTokens_
 

Detailed Description

template<typename A>
class pat::helper::NamedUserDataLoader< A >

Definition at line 28 of file PATObjectUserDataEmbedder.cc.

Constructor & Destructor Documentation

template<typename A>
pat::helper::NamedUserDataLoader< A >::NamedUserDataLoader ( const edm::ParameterSet iConfig,
const std::string &  main,
edm::ConsumesCollector &&  cc 
)
inline

Definition at line 30 of file PATObjectUserDataEmbedder.cc.

30  {
31  if (iConfig.existsAs<edm::ParameterSet>(main)) {
32  edm::ParameterSet const & srcPSet = iConfig.getParameter<edm::ParameterSet>(main);
33  for (const std::string & label : srcPSet.getParameterNamesForType<edm::InputTag>()) {
34  labelsAndTokens_.emplace_back(label, cc.consumes<typename A::product_type>(srcPSet.getParameter<edm::InputTag>(label)));
35  }
36  }
37  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
std::vector< std::pair< std::string, edm::EDGetTokenT< typename A::product_type > > > labelsAndTokens_
Definition: main.py:1

Member Function Documentation

template<typename A>
template<typename T >
void pat::helper::NamedUserDataLoader< A >::addData ( const edm::Event iEvent,
const std::vector< edm::Ptr< T >> &  ptrs,
std::vector< T > &  out 
) const
inline

Definition at line 39 of file PATObjectUserDataEmbedder.cc.

39  {
40  A adder;
41  unsigned int n = ptrs.size();
43  for (const auto & pair : labelsAndTokens_) {
44  iEvent.getByToken(pair.second, handle);
45  for (unsigned int i = 0; i < n; ++i) {
46  adder.addData(out[i], pair.first, (*handle)[ptrs[i]]);
47  }
48  }
49  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
std::vector< std::pair< std::string, edm::EDGetTokenT< typename A::product_type > > > labelsAndTokens_

Member Data Documentation

template<typename A>
std::vector<std::pair<std::string,edm::EDGetTokenT<typename A::product_type> > > pat::helper::NamedUserDataLoader< A >::labelsAndTokens_
private

Definition at line 51 of file PATObjectUserDataEmbedder.cc.