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 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 30 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 32 of file PATObjectUserDataEmbedder.cc.

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

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 42 of file PATObjectUserDataEmbedder.cc.

42  {
43  A adder;
44  unsigned int n = ptrs.size();
46  for (const auto &pair : labelsAndTokens_) {
47  iEvent.getByToken(pair.second, handle);
48  for (unsigned int i = 0; i < n; ++i) {
49  adder.addData(out[i], pair.first, (*handle)[ptrs[i]]);
50  }
51  }
52  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
tuple handle
Definition: patZpeak.py:23
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