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, bool skipNonExistingSrc=false)
 
- Public Member Functions inherited from SimpleFlatTableProducer< T >::ExtVariable
 ExtVariable (const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)
 

Protected Attributes

const bool skipNonExistingSrc_
 
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 176 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,
bool  skipNonExistingSrc = false 
)
inline

Definition at line 178 of file SimpleFlatTableProducer.h.

178  :
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
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 180 of file SimpleFlatTableProducer.h.

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

180  {
182  iEvent.getByToken(token_, vmap);
183  std::vector<ValType> vals;
184  if (vmap.isValid() || !skipNonExistingSrc_) {
185  vals.resize(selptrs.size());
186  for (unsigned int i = 0, n = vals.size(); i < n; ++i) {
187  vals[i] = (*vmap)[selptrs[i]];
188  }
189  }
190  out.template addColumn<ValType>(this->name_, vals, this->doc_, this->type_, this->precision_);
191  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< edm::ValueMap< TIn > > token_
bool isValid() const
Definition: HandleBase.h:74

Member Data Documentation

template<typename T >
template<typename TIn , typename ValType = TIn>
const bool SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::skipNonExistingSrc_
protected

Definition at line 193 of file SimpleFlatTableProducer.h.

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

Definition at line 194 of file SimpleFlatTableProducer.h.