CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType > Class Template Reference

#include <SimpleFlatTableProducer.h>

Inheritance diagram for SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >:
SimpleFlatTableProducerBase< T, TProd >::Variable SimpleFlatTableProducerBase< T, TProd >::VariableBase

Public Member Functions

void fill (std::vector< const T * > selobjs, nanoaod::FlatTable &out) const override
 
 FuncVariable (const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)
 
 ~FuncVariable () override
 
- Public Member Functions inherited from SimpleFlatTableProducerBase< T, TProd >::Variable
 Variable (const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)
 
- Public Member Functions inherited from SimpleFlatTableProducerBase< T, TProd >::VariableBase
const std::string & name () const
 
const nanoaod::FlatTable::ColumnTypetype () const
 
 VariableBase (const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)
 
virtual ~VariableBase ()
 

Protected Attributes

StringFunctor func_
 
StringFunctor precisionFunc_
 
- Protected Attributes inherited from SimpleFlatTableProducerBase< T, TProd >::VariableBase
std::string doc_
 
std::string name_
 
int precision_
 
nanoaod::FlatTable::ColumnType type_
 

Detailed Description

template<typename T, typename TProd>
template<typename StringFunctor, typename ValType>
class SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >

Definition at line 87 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

template<typename T, typename TProd>
template<typename StringFunctor , typename ValType >
SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::FuncVariable ( const std::string &  aname,
nanoaod::FlatTable::ColumnType  atype,
const edm::ParameterSet cfg 
)
inline

Definition at line 89 of file SimpleFlatTableProducer.h.

90  : Variable(aname, atype, cfg),
91  func_(cfg.getParameter<std::string>("expr"), true),
92  precisionFunc_(cfg.existsAs<std::string>("precision") ? cfg.getParameter<std::string>("precision") : "23",
93  true) {}
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
Variable(const std::string &aname, nanoaod::FlatTable::ColumnType atype, const edm::ParameterSet &cfg)
template<typename T, typename TProd>
template<typename StringFunctor , typename ValType >
SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::~FuncVariable ( )
inlineoverride

Definition at line 94 of file SimpleFlatTableProducer.h.

94 {}

Member Function Documentation

template<typename T, typename TProd>
template<typename StringFunctor , typename ValType >
void SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::fill ( std::vector< const T * >  selobjs,
nanoaod::FlatTable out 
) const
inlineoverridevirtual

Implements SimpleFlatTableProducerBase< T, TProd >::Variable.

Definition at line 95 of file SimpleFlatTableProducer.h.

References SimpleFlatTableProducerBase< T, TProd >::VariableBase::doc_, mps_fire::i, dqmiodumpmetadata::n, SimpleFlatTableProducerBase< T, TProd >::VariableBase::name_, SimpleFlatTableProducerBase< T, TProd >::VariableBase::precision_, MiniFloatConverter::reduceMantissaToNbitsRounding(), and SimpleFlatTableProducerBase< T, TProd >::VariableBase::type_.

95  {
96  std::vector<ValType> vals(selobjs.size());
97  for (unsigned int i = 0, n = vals.size(); i < n; ++i) {
98  if (this->precision_ == -2) {
100  } else
101  vals[i] = func_(*selobjs[i]);
102  }
103  out.template addColumn<ValType>(this->name_, vals, this->doc_, this->type_, this->precision_);
104  }
static float reduceMantissaToNbitsRounding(const float &f)
Definition: libminifloat.h:102

Member Data Documentation

template<typename T, typename TProd>
template<typename StringFunctor , typename ValType >
StringFunctor SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::func_
protected

Definition at line 107 of file SimpleFlatTableProducer.h.

template<typename T, typename TProd>
template<typename StringFunctor , typename ValType >
StringFunctor SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::precisionFunc_
protected

Definition at line 108 of file SimpleFlatTableProducer.h.