CMS 3D CMS Logo

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, valueTypeevalType
 
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 40 of file CachingVariable.h.

Member Typedef Documentation

◆ evalType

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

Definition at line 44 of file CachingVariable.h.

◆ valueType

Definition at line 43 of file CachingVariable.h.

◆ vMap

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

Definition at line 45 of file CachingVariable.h.

Constructor & Destructor Documentation

◆ CachingVariable()

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

Definition at line 55 of file CachingVariable.h.

56  : cache_(std::make_pair(false, 0)), method_(m), name_(n), conf_(iConfig) {}

◆ ~CachingVariable()

virtual CachingVariable::~CachingVariable ( )
inlinevirtual

Definition at line 58 of file CachingVariable.h.

58 {}

Member Function Documentation

◆ addDescriptionLine()

void CachingVariable::addDescriptionLine ( const std::string &  s)
inline

◆ baseEval()

evalType& CachingVariable::baseEval ( const edm::Event iEvent) const
inlineprotected

Definition at line 90 of file CachingVariable.h.

90  {
92  LogDebug("CachingVariable") << name_ + ":" + holderName_ << " is checking once";
93  cache_ = eval(iEvent);
94  }
95  return cache_;
96  }

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

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

◆ compute()

bool CachingVariable::compute ( const edm::Event iEvent) const
inline

Definition at line 61 of file CachingVariable.h.

61 { return baseEval(iEvent).first; }

References baseEval(), and iEvent.

Referenced by ConfigurableHisto::fill(), and SplittingConfigurableHisto::fill().

◆ description()

const Description& CachingVariable::description ( ) const
inline

Definition at line 68 of file CachingVariable.h.

68 { return d_; }

References d_.

Referenced by print().

◆ eval()

virtual evalType CachingVariable::eval ( const edm::Event iEvent) const
inlineprotectedvirtual

◆ holderName()

const std::string& CachingVariable::holderName ( ) const
inline

Definition at line 70 of file CachingVariable.h.

70 { return holderName_; }

References holderName_.

◆ method()

const std::string& CachingVariable::method ( ) const
inline

Definition at line 67 of file CachingVariable.h.

67 { return method_; }

References method_.

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

◆ name()

const std::string& CachingVariable::name ( void  ) const
inline

◆ notSeenThisEventAlready()

bool CachingVariable::notSeenThisEventAlready ( const edm::Event iEvent) const
inlineprotected

Definition at line 97 of file CachingVariable.h.

97  {
99  eventCacheID_ != iEvent.cacheIdentifier());
100  if (retValue) {
101  eventCacheID_ = iEvent.cacheIdentifier();
102  }
103  return retValue;
104  }

References eventCacheID_, iEvent, and SiStripPI::max.

Referenced by baseEval().

◆ operator()()

valueType CachingVariable::operator() ( const edm::Event iEvent) const
inline

Definition at line 64 of file CachingVariable.h.

64 { return baseEval(iEvent).second; }

References baseEval(), and iEvent.

◆ print()

void CachingVariable::print ( void  ) const
inline

Definition at line 73 of file CachingVariable.h.

73 { edm::LogVerbatim("CachingVariable") << name() << "\n" << description().text(); }

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

◆ setCache()

void CachingVariable::setCache ( valueType v) const
inlineprotected

Definition at line 82 of file CachingVariable.h.

82  {
83  cache_.first = true;
84  cache_.second = v;
85  }

References cache_, and findQualityFiles::v.

◆ setHolder()

void CachingVariable::setHolder ( std::string  hn) const
inline

Definition at line 71 of file CachingVariable.h.

71 { holderName_ = hn; }

References holderName_.

◆ setNotCompute()

void CachingVariable::setNotCompute ( ) const
inlineprotected

Definition at line 86 of file CachingVariable.h.

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

References cache_.

Friends And Related Function Documentation

◆ VariableComputer

friend class VariableComputer
friend

Definition at line 111 of file CachingVariable.h.

Member Data Documentation

◆ cache_

evalType CachingVariable::cache_
mutableprotected

Definition at line 76 of file CachingVariable.h.

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

◆ conf_

edm::ParameterSet CachingVariable::conf_
protected

◆ d_

Description CachingVariable::d_
protected

Definition at line 107 of file CachingVariable.h.

Referenced by addDescriptionLine(), and description().

◆ eventCacheID_

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

Definition at line 77 of file CachingVariable.h.

Referenced by notSeenThisEventAlready().

◆ holderName_

std::string CachingVariable::holderName_
mutableprotected

Definition at line 81 of file CachingVariable.h.

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

◆ method_

std::string CachingVariable::method_
protected

Definition at line 79 of file CachingVariable.h.

Referenced by method().

◆ name_

std::string CachingVariable::name_
protected

Definition at line 80 of file CachingVariable.h.

Referenced by baseEval(), and name().

CachingVariable::conf_
edm::ParameterSet conf_
Definition: CachingVariable.h:110
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
CachingVariable::eval
virtual evalType eval(const edm::Event &iEvent) const
Definition: CachingVariable.h:107
CachingVariable::method_
std::string method_
Definition: CachingVariable.h:79
Description::text
std::string text() const
Definition: CachingVariable.h:25
findQualityFiles.v
v
Definition: findQualityFiles.py:179
CachingVariable::cache_
evalType cache_
Definition: CachingVariable.h:76
CachingVariable::d_
Description d_
Definition: CachingVariable.h:107
CachingVariable::name_
std::string name_
Definition: CachingVariable.h:80
alignCSCRings.s
s
Definition: alignCSCRings.py:92
CachingVariable::description
const Description & description() const
Definition: CachingVariable.h:68
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
CachingVariable::notSeenThisEventAlready
bool notSeenThisEventAlready(const edm::Event &iEvent) const
Definition: CachingVariable.h:97
Description::addLine
void addLine(const std::string &l)
Definition: CachingVariable.h:32
CachingVariable::name
const std::string & name() const
Definition: CachingVariable.h:66
CachingVariable::baseEval
evalType & baseEval(const edm::Event &iEvent) const
Definition: CachingVariable.h:90
CachingVariable::holderName_
std::string holderName_
Definition: CachingVariable.h:81
CachingVariable::eventCacheID_
edm::Event::CacheIdentifier_t eventCacheID_
Definition: CachingVariable.h:77