#include <CachingVariable.h>
Public Member Functions | |
void | assign (std::string var, double &value) const |
virtual void | compute (const edm::Event &iEvent) const =0 |
void | declare (std::string var) |
void | doesNotCompute (std::string var) const |
void | doesNotCompute () const |
const std::string & | name () const |
VariableComputer (CachingVariable::CachingVariableFactoryArg arg) | |
virtual | ~VariableComputer () |
Protected Attributes | |
CachingVariable::CachingVariableFactoryArg & | arg_ |
std::map< std::string,const ComputedVariable * > | iCompute_ |
std::string | method_ |
std::string | name_ |
std::string | separator_ |
Definition at line 106 of file CachingVariable.h.
VariableComputer::VariableComputer | ( | CachingVariable::CachingVariableFactoryArg | arg | ) |
Definition at line 35 of file CachingVariable.cc.
References arg_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), CachingVariable::CachingVariableFactoryArg::iConfig, method_, CachingVariable::CachingVariableFactoryArg::n, name_, and separator_.
: arg_(arg) { if (arg_.iConfig.exists("separator")) separator_ = arg_.iConfig.getParameter<std::string>("separator"); else separator_ ="_"; name_=arg_.n; method_ = arg_.iConfig.getParameter<std::string>("computer"); }
virtual VariableComputer::~VariableComputer | ( | ) | [inline, virtual] |
Definition at line 109 of file CachingVariable.h.
{}
void VariableComputer::assign | ( | std::string | var, |
double & | value | ||
) | const |
Definition at line 54 of file CachingVariable.cc.
References iCompute_.
Referenced by L1BitComputer::compute(), VariableComputerTest::compute(), and HLTBitComputer::compute().
{ std::map<std::string ,const ComputedVariable *>::const_iterator it=iCompute_.find(var); if (it == iCompute_.end()){ std::stringstream ss; ss<<"cannot assign: "<<var<<". List of variable declared:\n"; for ( std::map<std::string ,const ComputedVariable *>::const_iterator it=iCompute_.begin(); it!=iCompute_.end();++it) ss<<it->first<<std::endl; edm::LogError("VariableComputer")<<ss.str(); } else it->second->setCache(value); }
virtual void VariableComputer::compute | ( | const edm::Event & | iEvent | ) | const [pure virtual] |
Implemented in L1BitComputer, HLTBitComputer, and VariableComputerTest.
Referenced by ComputedVariable::eval().
void VariableComputer::declare | ( | std::string | var | ) |
Definition at line 43 of file CachingVariable.cc.
References arg_, iCompute_, CachingVariable::CachingVariableFactoryArg::iConfig, CachingVariable::CachingVariableFactoryArg::m, method_, name_, and separator_.
Referenced by HLTBitComputer::HLTBitComputer(), L1BitComputer::L1BitComputer(), and VariableComputerTest::VariableComputerTest().
{ std::string aName = name_+separator_+var; ComputedVariable * newVar = new ComputedVariable(method_,aName,arg_.iConfig,this); if (iCompute_.find(var) != iCompute_.end()){ edm::LogError("VariableComputer")<<"redeclaring: "<<var<<" skipping."; delete newVar; return; } iCompute_[var] = newVar; arg_.m.insert(std::make_pair(aName,newVar)); }
void VariableComputer::doesNotCompute | ( | std::string | var | ) | const |
Definition at line 71 of file CachingVariable.cc.
References iCompute_.
{ std::map<std::string ,const ComputedVariable *>::const_iterator it=iCompute_.find(var); if (it == iCompute_.end()){ std::stringstream ss; ss<<"cannot act on: "<<var<<". List of variable declared:\n"; for ( std::map<std::string ,const ComputedVariable *>::const_iterator it=iCompute_.begin(); it!=iCompute_.end();++it) ss<<it->first<<std::endl; edm::LogError("VariableComputer")<<ss.str(); } else it->second->setNotCompute(); }
void VariableComputer::doesNotCompute | ( | ) | const |
Definition at line 67 of file CachingVariable.cc.
References iCompute_.
Referenced by L1BitComputer::compute(), VariableComputerTest::compute(), and HLTBitComputer::compute().
const std::string& VariableComputer::name | ( | ) | const [inline] |
Definition at line 112 of file CachingVariable.h.
References name_.
Referenced by ComputedVariable::eval().
{ return name_;}
Definition at line 119 of file CachingVariable.h.
Referenced by declare(), and VariableComputer().
std::map<std::string ,const ComputedVariable *> VariableComputer::iCompute_ [mutable, protected] |
Definition at line 122 of file CachingVariable.h.
Referenced by assign(), declare(), and doesNotCompute().
std::string VariableComputer::method_ [protected] |
Definition at line 121 of file CachingVariable.h.
Referenced by declare(), and VariableComputer().
std::string VariableComputer::name_ [protected] |
Definition at line 120 of file CachingVariable.h.
Referenced by declare(), name(), and VariableComputer().
std::string VariableComputer::separator_ [protected] |
Definition at line 123 of file CachingVariable.h.
Referenced by declare(), and VariableComputer().