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

92  : Variable(aname, cfg),
93  func_(cfg.getParameter<std::string>("expr"), true),
94  precisionFunc_(cfg.existsAs<std::string>("precision") ? cfg.getParameter<std::string>("precision") : "23",
95  true) {}

◆ ~FuncVariable()

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

Definition at line 96 of file SimpleFlatTableProducer.h.

96 {}

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

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

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:115
SimpleFlatTableProducerBase::FuncVariable::precisionFunc_
StringFunctor precisionFunc_
Definition: SimpleFlatTableProducer.h:116
SimpleFlatTableProducerBase::Variable::Variable
Variable(const std::string &aname, const edm::ParameterSet &cfg)
Definition: SimpleFlatTableProducer.h:84
MiniFloatConverter::reduceMantissaToNbitsRounding
static float reduceMantissaToNbitsRounding(const float &f)
Definition: libminifloat.h:102
SimpleFlatTableProducerBase::VariableBase::name_
std::string name_
Definition: SimpleFlatTableProducer.h:78
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
SimpleFlatTableProducerBase::VariableBase::precision_
int precision_
Definition: SimpleFlatTableProducer.h:79
SimpleFlatTableProducerBase::VariableBase::doc_
std::string doc_
Definition: SimpleFlatTableProducer.h:78
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31