CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
FuncVariable< ObjType, StringFunctor, ValType > Class Template Reference

#include <SimpleFlatTableProducer.h>

Inheritance diagram for FuncVariable< ObjType, StringFunctor, ValType >:
Variable< ObjType > VariableBase

Public Member Functions

void fill (std::vector< const ObjType *> &selobjs, nanoaod::FlatTable &out) const override
 
 FuncVariable (const std::string &aname, const edm::ParameterSet &cfg)
 
 ~FuncVariable () override
 
- Public Member Functions inherited from Variable< ObjType >
 Variable (const std::string &aname, const edm::ParameterSet &cfg)
 
- Public Member Functions inherited from 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 VariableBase
std::string doc_
 
std::string name_
 
int precision_
 

Detailed Description

template<typename ObjType, typename StringFunctor, typename ValType>
class FuncVariable< ObjType, StringFunctor, ValType >

Definition at line 46 of file SimpleFlatTableProducer.h.

Constructor & Destructor Documentation

◆ FuncVariable()

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

Definition at line 48 of file SimpleFlatTableProducer.h.

49  : Variable<ObjType>(aname, cfg),
50  func_(cfg.getParameter<std::string>("expr"), cfg.getUntrackedParameter<bool>("lazyEval")),
51  precisionFunc_(cfg.existsAs<std::string>("precision") ? cfg.getParameter<std::string>("precision") : "23",
52  cfg.getUntrackedParameter<bool>("lazyEval")) {}
StringFunctor precisionFunc_

◆ ~FuncVariable()

template<typename ObjType, typename StringFunctor, typename ValType>
FuncVariable< ObjType, StringFunctor, ValType >::~FuncVariable ( )
inlineoverride

Definition at line 53 of file SimpleFlatTableProducer.h.

53 {}

Member Function Documentation

◆ fill()

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

Implements Variable< ObjType >.

Definition at line 55 of file SimpleFlatTableProducer.h.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), VariableBase::doc_, FuncVariable< ObjType, StringFunctor, ValType >::func_, mps_fire::i, dqmiodumpmetadata::n, VariableBase::name_, MillePedeFileConverter_cfg::out, VariableBase::precision_, FuncVariable< ObjType, StringFunctor, ValType >::precisionFunc_, and MiniFloatConverter::reduceMantissaToNbitsRounding().

55  {
56  std::vector<ValType> vals(selobjs.size());
57  for (unsigned int i = 0, n = vals.size(); i < n; ++i) {
58  vals[i] = func_(*selobjs[i]);
59  if constexpr (std::is_same<ValType, float>()) {
60  if (this->precision_ == -2) {
61  auto prec = precisionFunc_(*selobjs[i]);
62  if (prec > 0) {
64  }
65  }
66  }
67  }
68  out.template addColumn<ValType>(this->name_, vals, this->doc_, this->precision_);
69  }
StringFunctor precisionFunc_
static float reduceMantissaToNbitsRounding(const float &f)
Definition: libminifloat.h:79

Member Data Documentation

◆ func_

template<typename ObjType, typename StringFunctor, typename ValType>
StringFunctor FuncVariable< ObjType, StringFunctor, ValType >::func_
protected

◆ precisionFunc_

template<typename ObjType, typename StringFunctor, typename ValType>
StringFunctor FuncVariable< ObjType, StringFunctor, ValType >::precisionFunc_
protected