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, const edm::ParameterSet &cfg)
 
 ~FuncVariable () override
 
- Public Member Functions inherited from SimpleFlatTableProducerBase< T, TProd >::Variable
 Variable (const std::string &aname, const edm::ParameterSet &cfg)
 
- Public Member Functions inherited from SimpleFlatTableProducerBase< T, TProd >::VariableBase
const std::string & name () const
 
 VariableBase (const std::string &aname, 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_
 

Detailed Description

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

Definition at line 85 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ FuncVariable()

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

Definition at line 87 of file SimpleFlatTableProducer.h.

88  : Variable(aname, cfg),
89  func_(cfg.getParameter<std::string>("expr"), true),
90  precisionFunc_(cfg.existsAs<std::string>("precision") ? cfg.getParameter<std::string>("precision") : "23",
91  true) {}

◆ ~FuncVariable()

template<typename T, typename TProd>
template<typename StringFunctor , typename ValType >
SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::~FuncVariable ( )
inlineoverride

Definition at line 92 of file SimpleFlatTableProducer.h.

92 {}

Member Function Documentation

◆ fill()

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

93  {
94  std::vector<ValType> vals(selobjs.size());
95  for (unsigned int i = 0, n = vals.size(); i < n; ++i) {
96  if constexpr (std::is_same<ValType, float>()) {
97  if (this->precision_ == -2) {
98  vals[i] =
100  } else {
101  vals[i] = func_(*selobjs[i]);
102  }
103  } else {
104  vals[i] = func_(*selobjs[i]);
105  }
106  }
107  out.template addColumn<ValType>(this->name_, vals, this->doc_, this->precision_);
108  }

References SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::func_, mps_fire::i, dqmiodumpmetadata::n, MillePedeFileConverter_cfg::out, SimpleFlatTableProducerBase< T, TProd >::VariableBase::precision_, SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::precisionFunc_, and MiniFloatConverter::reduceMantissaToNbitsRounding().

Member Data Documentation

◆ func_

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

◆ precisionFunc_

template<typename T, typename TProd>
template<typename StringFunctor , typename ValType >
StringFunctor SimpleFlatTableProducerBase< T, TProd >::FuncVariable< StringFunctor, ValType >::precisionFunc_
protected
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
SimpleFlatTableProducerBase::FuncVariable::func_
StringFunctor func_
Definition: SimpleFlatTableProducer.h:111
SimpleFlatTableProducerBase::FuncVariable::precisionFunc_
StringFunctor precisionFunc_
Definition: SimpleFlatTableProducer.h:112
SimpleFlatTableProducerBase::Variable::Variable
Variable(const std::string &aname, const edm::ParameterSet &cfg)
Definition: SimpleFlatTableProducer.h:80
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MiniFloatConverter::reduceMantissaToNbitsRounding
static float reduceMantissaToNbitsRounding(const float &f)
Definition: libminifloat.h:102
SimpleFlatTableProducerBase::VariableBase::name_
std::string name_
Definition: SimpleFlatTableProducer.h:74
looper.cfg
cfg
Definition: looper.py:297
SimpleFlatTableProducerBase::VariableBase::precision_
int precision_
Definition: SimpleFlatTableProducer.h:75
SimpleFlatTableProducerBase::VariableBase::doc_
std::string doc_
Definition: SimpleFlatTableProducer.h:74
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31