test
CMS 3D CMS Logo

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

#include <CachingVariable.h>

Inheritance diagram for CachingVariable:
ComputedVariable ExpressionVariable< Object, label > HLTBitVariable RazorBox SimpleValueVariable< TYPE > SimpleValueVectorVariable< TYPE > Splitter TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator > VariablePower

Classes

struct  CachingVariableFactoryArg
 

Public Types

typedef std::pair< bool,
valueType
evalType
 
typedef double valueType
 
typedef std::map< std::string,
const CachingVariable * > 
vMap
 

Public Member Functions

void addDescriptionLine (const std::string &s)
 
 CachingVariable (std::string m, std::string n, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
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 ()
 

Protected Member Functions

evalTypebaseEval (const edm::Event &iEvent) const
 
virtual evalType eval (const edm::Event &iEvent) const
 
bool notSeenThisEventAlready (const edm::Event &iEvent) const
 
void setCache (valueType &v) const
 
void setNotCompute () const
 

Protected Attributes

evalType cache_
 
edm::ParameterSet conf_
 
Description d_
 
edm::Event::CacheIdentifier_t eventCacheID_ =0
 
std::string holderName_
 
std::string method_
 
std::string name_
 

Friends

class VariableComputer
 

Detailed Description

Definition at line 39 of file CachingVariable.h.

Member Typedef Documentation

typedef std::pair<bool, valueType> CachingVariable::evalType

Definition at line 43 of file CachingVariable.h.

Definition at line 42 of file CachingVariable.h.

typedef std::map<std::string, const CachingVariable*> CachingVariable::vMap

Definition at line 44 of file CachingVariable.h.

Constructor & Destructor Documentation

CachingVariable::CachingVariable ( std::string  m,
std::string  n,
const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline

Definition at line 53 of file CachingVariable.h.

53  :
54  cache_(std::make_pair(false,0)),method_(m),
55  name_(n),conf_(iConfig) {}
std::string method_
edm::ParameterSet conf_
std::string name_
virtual CachingVariable::~CachingVariable ( )
inlinevirtual

Definition at line 57 of file CachingVariable.h.

57 {}

Member Function Documentation

void CachingVariable::addDescriptionLine ( const std::string &  s)
inline
evalType& CachingVariable::baseEval ( const edm::Event iEvent) const
inlineprotected

Definition at line 88 of file CachingVariable.h.

References cache_, eval(), holderName_, LogDebug, name_, and notSeenThisEventAlready().

Referenced by compute(), and operator()().

88  {
89  if(notSeenThisEventAlready(iEvent)) {
90  LogDebug("CachingVariable")<<name_+":"+holderName_<<" is checking once";
91  cache_=eval(iEvent);
92  }
93  return cache_;
94  }
#define LogDebug(id)
std::string holderName_
std::string name_
virtual evalType eval(const edm::Event &iEvent) const
bool notSeenThisEventAlready(const edm::Event &iEvent) const
bool CachingVariable::compute ( const edm::Event iEvent) const
inline

Definition at line 60 of file CachingVariable.h.

References baseEval().

Referenced by VarSplitter::eval(), VariablePower::eval(), ConfigurableHisto::fill(), SplittingConfigurableHisto::fill(), VariableFormulaEventSelector::select(), and VariableEventSelector::select().

60 { return baseEval(iEvent).first; }
evalType & baseEval(const edm::Event &iEvent) const
const Description& CachingVariable::description ( ) const
inline

Definition at line 67 of file CachingVariable.h.

References d_.

Referenced by print().

67 { return d_;}
virtual evalType CachingVariable::eval ( const edm::Event iEvent) const
inlineprotectedvirtual
const std::string& CachingVariable::holderName ( ) const
inline

Definition at line 69 of file CachingVariable.h.

References holderName_.

69 { return holderName_;}
std::string holderName_
const std::string& CachingVariable::method ( ) const
inline

Definition at line 66 of file CachingVariable.h.

References method_.

Referenced by ExpressionVariable< Object, label >::eval().

66 { return method_;}
std::string method_
const std::string& CachingVariable::name ( void  ) const
inline
bool CachingVariable::notSeenThisEventAlready ( const edm::Event iEvent) const
inlineprotected

Definition at line 95 of file CachingVariable.h.

References edm::Event::cacheIdentifier(), eventCacheID_, and bookConverter::max.

Referenced by baseEval().

95  {
97  eventCacheID_ != iEvent.cacheIdentifier());
98  if(retValue) {
100  }
101  return retValue;
102  }
edm::Event::CacheIdentifier_t eventCacheID_
CacheIdentifier_t cacheIdentifier() const
Definition: Event.cc:32
valueType CachingVariable::operator() ( const edm::Event iEvent) const
inline

Definition at line 63 of file CachingVariable.h.

References baseEval().

63 { return baseEval(iEvent).second; }
evalType & baseEval(const edm::Event &iEvent) const
void CachingVariable::print ( void  ) const
inline

Definition at line 72 of file CachingVariable.h.

References description(), name(), and Description::text().

72  {
73  edm::LogVerbatim("CachingVariable")<<name()
74  <<"\n"<<description().text();
75  }
const Description & description() const
std::string text() const
const std::string & name() const
void CachingVariable::setCache ( valueType v) const
inlineprotected

Definition at line 84 of file CachingVariable.h.

References cache_, and findQualityFiles::v.

84  {
85  cache_.first=true; cache_.second = v;}
void CachingVariable::setHolder ( std::string  hn) const
inline

Definition at line 70 of file CachingVariable.h.

References holderName_.

70 { holderName_=hn;}
std::string holderName_
void CachingVariable::setNotCompute ( ) const
inlineprotected

Definition at line 86 of file CachingVariable.h.

References cache_.

86  {
87  cache_.first=false; cache_.second = 0;}

Friends And Related Function Documentation

friend class VariableComputer
friend

Definition at line 109 of file CachingVariable.h.

Member Data Documentation

evalType CachingVariable::cache_
mutableprotected

Definition at line 78 of file CachingVariable.h.

Referenced by baseEval(), ComputedVariable::eval(), setCache(), and setNotCompute().

edm::ParameterSet CachingVariable::conf_
protected
Description CachingVariable::d_
protected

Definition at line 105 of file CachingVariable.h.

Referenced by addDescriptionLine(), and description().

edm::Event::CacheIdentifier_t CachingVariable::eventCacheID_ =0
mutableprotected

Definition at line 79 of file CachingVariable.h.

Referenced by notSeenThisEventAlready().

std::string CachingVariable::holderName_
mutableprotected

Definition at line 83 of file CachingVariable.h.

Referenced by baseEval(), holderName(), and setHolder().

std::string CachingVariable::method_
protected

Definition at line 81 of file CachingVariable.h.

Referenced by method().

std::string CachingVariable::name_
protected

Definition at line 82 of file CachingVariable.h.

Referenced by baseEval(), and name().