CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ComputedVariable Class Reference

#include <CachingVariable.h>

Inheritance diagram for ComputedVariable:
CachingVariable

Public Member Functions

 ComputedVariable (CachingVariableFactoryArg arg)
 
 ComputedVariable (const std::string &M, std::string &N, edm::ParameterSet &P, const VariableComputer *c)
 
virtual evalType eval (const edm::Event &iEvent) const
 
virtual ~ComputedVariable ()
 
- Public Member Functions inherited from CachingVariable
void addDescriptionLine (const std::string &s)
 
 CachingVariable (std::string m, std::string n, const edm::ParameterSet &iConfig)
 
bool compute (const edm::Event &iEvent) const
 
const Descriptiondescription () const
 
const std::string & holderName () const
 
const std::string & method () const
 
const std::string & name () const
 
valueType operator() (const edm::Event &iEvent) const
 
void print () const
 
void setHolder (std::string hn) const
 
virtual ~CachingVariable ()
 

Private Attributes

const VariableComputermyComputer
 

Additional Inherited Members

- Public Types inherited from CachingVariable
typedef std::pair< bool,
valueType
evalType
 
typedef double valueType
 
typedef std::map< std::string,
const CachingVariable * > 
vMap
 
- Protected Member Functions inherited from CachingVariable
evalTypebaseEval (const edm::Event &iEvent) const
 
void setCache (valueType &v) const
 
void setNotCompute () const
 
- Protected Attributes inherited from CachingVariable
evalType cache_
 
edm::ParameterSet conf_
 
Description d_
 
std::string holderName_
 
std::string method_
 
std::string name_
 

Detailed Description

Definition at line 133 of file CachingVariable.h.

Constructor & Destructor Documentation

ComputedVariable::ComputedVariable ( CachingVariableFactoryArg  arg)

Definition at line 85 of file CachingVariable.cc.

References reco::get(), edm::ParameterSet::getParameter(), CachingVariable::CachingVariableFactoryArg::iConfig, and myComputer.

85  :
86  CachingVariable("ComputedVariable",arg.n,arg.iConfig){
87  // instanciate the computer
88  std::string computerType = arg.iConfig.getParameter<std::string>("computer");
89  myComputer = VariableComputerFactory::get()->create(computerType,arg);
90  //there is a memory leak here, because the object we are in is not register anywhere. since it happens once per job, this is not a big deal.
91 }
const VariableComputer * myComputer
A arg
Definition: Factorize.h:36
CachingVariable(std::string m, std::string n, const edm::ParameterSet &iConfig)
T get(const Candidate &c)
Definition: component.h:56
ComputedVariable::ComputedVariable ( const std::string &  M,
std::string &  N,
edm::ParameterSet P,
const VariableComputer c 
)
inline

Definition at line 136 of file CachingVariable.h.

136  :
137  CachingVariable(M,N,P), myComputer(c){}
const VariableComputer * myComputer
CachingVariable(std::string m, std::string n, const edm::ParameterSet &iConfig)
virtual ComputedVariable::~ComputedVariable ( )
inlinevirtual

Definition at line 138 of file CachingVariable.h.

138 {};

Member Function Documentation

virtual evalType ComputedVariable::eval ( const edm::Event iEvent) const
inlinevirtual

Reimplemented from CachingVariable.

Definition at line 140 of file CachingVariable.h.

References CachingVariable::cache_, VariableComputer::compute(), CachingVariable::holderName_, myComputer, and VariableComputer::name().

140  {
141  if (edm::Service<UpdaterService>()->checkOnce(myComputer->name()+":"+holderName_))
142  myComputer->compute(iEvent);
143  return cache_;
144  }
std::string holderName_
const VariableComputer * myComputer
virtual void compute(const edm::Event &iEvent) const =0
const std::string & name() const

Member Data Documentation

const VariableComputer* ComputedVariable::myComputer
private

Definition at line 146 of file CachingVariable.h.

Referenced by ComputedVariable(), and eval().