CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType > Class Template Reference

#include <SimpleFlatTableProducer.h>

Inheritance diagram for SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >:
SimpleFlatTableProducer< T >::ExtVariable

Public Member Functions

void fill (const edm::Event &iEvent, std::vector< edm::Ptr< T >> selptrs, nanoaod::FlatTable &out) const override
 
 ValueMapVariable (const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc)
 
- Public Member Functions inherited from SimpleFlatTableProducer< T >::ExtVariable
 ExtVariable (const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)
 

Protected Attributes

edm::EDGetTokenT< edm::ValueMap< TIn > > token_
 

Detailed Description

template<typename T>
template<typename TIn, typename ValType = TIn>
class SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >

Definition at line 172 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

template<typename T >
template<typename TIn , typename ValType = TIn>
SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::ValueMapVariable ( const std::string &  aname,
nanoaod::FlatTable::ColumnType  atype,
const edm::ParameterSet cfg,
edm::ConsumesCollector &&  cc 
)
inline

Definition at line 174 of file SimpleFlatTableProducer.h.

174  :
175  ExtVariable(aname, atype, cfg), token_(cc.consumes<edm::ValueMap<TIn>>(cfg.getParameter<edm::InputTag>("src"))) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< TIn > > token_
ExtVariable(const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)

Member Function Documentation

template<typename T >
template<typename TIn , typename ValType = TIn>
void SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::fill ( const edm::Event iEvent,
std::vector< edm::Ptr< T >>  selptrs,
nanoaod::FlatTable out 
) const
inlineoverridevirtual

Implements SimpleFlatTableProducer< T >::ExtVariable.

Definition at line 176 of file SimpleFlatTableProducer.h.

References SimpleFlatTableProducerBase< T, TProd >::VariableBase::doc_, edm::Event::getByToken(), mps_fire::i, gen::n, SimpleFlatTableProducerBase< T, TProd >::VariableBase::name_, SimpleFlatTableProducerBase< T, TProd >::VariableBase::precision_, SimpleFlatTableProducerBase< T, TProd >::VariableBase::type_, and create_public_pileup_plots::vals.

176  {
178  iEvent.getByToken(token_, vmap);
179  std::vector<ValType> vals(selptrs.size());
180  for (unsigned int i = 0, n = vals.size(); i < n; ++i) {
181  vals[i] = (*vmap)[selptrs[i]];
182  }
183  out.template addColumn<ValType>(this->name_, vals, this->doc_, this->type_, this->precision_);
184  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< edm::ValueMap< TIn > > token_

Member Data Documentation

template<typename T >
template<typename TIn , typename ValType = TIn>
edm::EDGetTokenT<edm::ValueMap<TIn> > SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::token_
protected

Definition at line 186 of file SimpleFlatTableProducer.h.