CMS 3D CMS Logo

Public Member Functions | Protected Attributes

VariableComputer Class Reference

#include <CachingVariable.h>

Inheritance diagram for VariableComputer:
HLTBitComputer L1BitComputer VariableComputerTest

List of all members.

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::CachingVariableFactoryArgarg_
std::map< std::string,const
ComputedVariable * > 
iCompute_
std::string method_
std::string name_
std::string separator_

Detailed Description

Definition at line 106 of file CachingVariable.h.


Constructor & Destructor Documentation

VariableComputer::VariableComputer ( CachingVariable::CachingVariableFactoryArg  arg)
virtual VariableComputer::~VariableComputer ( ) [inline, virtual]

Definition at line 109 of file CachingVariable.h.

{}

Member Function Documentation

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]
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().

                                           {
  for ( std::map<std::string ,const ComputedVariable *>::const_iterator it=iCompute_.begin(); it!=iCompute_.end();++it)
    it->second->setNotCompute();
}
const std::string& VariableComputer::name ( ) const [inline]

Definition at line 112 of file CachingVariable.h.

References name_.

Referenced by ComputedVariable::eval().

{ return name_;}

Member Data Documentation

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().