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

Constructor & Destructor Documentation

◆ NamedUserDataLoader()

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  }

Member Function Documentation

◆ addData()

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  }

Member Data Documentation

◆ labelsAndTokens_

template<typename A>
std::vector<std::pair<std::string, edm::EDGetTokenT<typename A::product_type> > > pat::helper::NamedUserDataLoader< A >::labelsAndTokens_
private
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::Handle
Definition: AssociativeIterator.h:50
pat::helper::NamedUserDataLoader::labelsAndTokens_
std::vector< std::pair< std::string, edm::EDGetTokenT< typename A::product_type > > > labelsAndTokens_
Definition: PATObjectUserDataEmbedder.cc:55
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
A
edm::ParameterSet::getParameterNamesForType
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
iEvent
int iEvent
Definition: GenABIO.cc:224
cc
main
Definition: main.py:1
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
magneticFieldFilterJSON.main
def main(argv=None)
Definition: magneticFieldFilterJSON.py:22