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, const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc, bool skipNonExistingSrc=false)
 
- Public Member Functions inherited from SimpleFlatTableProducer< T >::ExtVariable
 ExtVariable (const std::string &aname, 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 206 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ ValueMapVariable()

template<typename T >
template<typename TIn , typename ValType = TIn>
SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::ValueMapVariable ( const std::string &  aname,
const edm::ParameterSet cfg,
edm::ConsumesCollector &&  cc,
bool  skipNonExistingSrc = false 
)
inline

Definition at line 208 of file SimpleFlatTableProducer.h.

212  : ExtVariable(aname, cfg),
214  token_(skipNonExistingSrc_ ? cc.mayConsume<edm::ValueMap<TIn>>(cfg.getParameter<edm::InputTag>("src"))
215  : cc.consumes<edm::ValueMap<TIn>>(cfg.getParameter<edm::InputTag>("src"))) {}

Member Function Documentation

◆ fill()

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 216 of file SimpleFlatTableProducer.h.

216  {
218  iEvent.getByToken(token_, vmap);
219  std::vector<ValType> vals;
220  if (vmap.isValid() || !skipNonExistingSrc_) {
221  vals.resize(selptrs.size());
222  for (unsigned int i = 0, n = vals.size(); i < n; ++i) {
223  vals[i] = (*vmap)[selptrs[i]];
224  }
225  }
226  out.template addColumn<ValType>(this->name_, vals, this->doc_, this->precision_);
227  }

References SimpleFlatTableProducerBase< T, edm::View< T > >::doc_, mps_fire::i, iEvent, edm::HandleBase::isValid(), dqmiodumpmetadata::n, SimpleFlatTableProducerBase< T, edm::View< T > >::name_, MillePedeFileConverter_cfg::out, SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::skipNonExistingSrc_, and SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::token_.

Member Data Documentation

◆ skipNonExistingSrc_

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

◆ token_

template<typename T >
template<typename TIn , typename ValType = TIn>
edm::EDGetTokenT<edm::ValueMap<TIn> > SimpleFlatTableProducer< T >::ValueMapVariable< TIn, ValType >::token_
protected
SimpleFlatTableProducer::ExtVariable::ExtVariable
ExtVariable(const std::string &aname, const edm::ParameterSet &cfg)
Definition: SimpleFlatTableProducer.h:202
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
SimpleFlatTableProducer::ValueMapVariable::token_
edm::EDGetTokenT< edm::ValueMap< TIn > > token_
Definition: SimpleFlatTableProducer.h:231
edm::Handle
Definition: AssociativeIterator.h:50
SimpleFlatTableProducerBase< T, edm::View< T > >::name_
const std::string name_
Definition: SimpleFlatTableProducer.h:61
protons_cff.skipNonExistingSrc
skipNonExistingSrc
Definition: protons_cff.py:29
iEvent
int iEvent
Definition: GenABIO.cc:224
cc
looper.cfg
cfg
Definition: looper.py:296
edm::ValueMap
Definition: ValueMap.h:107
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
SimpleFlatTableProducerBase< T, edm::View< T > >::doc_
const std::string doc_
Definition: SimpleFlatTableProducer.h:62
edm::InputTag
Definition: InputTag.h:15
SimpleFlatTableProducer::ValueMapVariable::skipNonExistingSrc_
const bool skipNonExistingSrc_
Definition: SimpleFlatTableProducer.h:230