CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ComputedVariable Class Reference

#include <CachingVariable.h>

Inheritance diagram for ComputedVariable:
CachingVariable

Public Member Functions

 ComputedVariable (const CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
 
 ComputedVariable (const std::string &M, std::string &N, edm::ParameterSet &P, const VariableComputer *c, edm::ConsumesCollector &iC)
 
evalType eval (const edm::Event &iEvent) const override
 
 ~ComputedVariable () override
 
- Public Member Functions inherited from CachingVariable
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 ()
 

Private Attributes

std::unique_ptr< const VariableComputermyComputer
 

Additional Inherited Members

- Public Types inherited from CachingVariable
typedef std::pair< bool, valueTypeevalType
 
typedef double valueType
 
typedef std::map< std::string, const CachingVariable * > vMap
 
- Protected Member Functions inherited from CachingVariable
evalTypebaseEval (const edm::Event &iEvent) const
 
bool notSeenThisEventAlready (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_
 
edm::Event::CacheIdentifier_t eventCacheID_ = 0
 
std::string holderName_
 
std::string method_
 
std::string name_
 

Detailed Description

Definition at line 156 of file CachingVariable.h.

Constructor & Destructor Documentation

◆ ComputedVariable() [1/2]

ComputedVariable::ComputedVariable ( const CachingVariableFactoryArg arg,
edm::ConsumesCollector iC 
)

Definition at line 97 of file CachingVariable.cc.

98  : CachingVariable("ComputedVariable", arg.n, arg.iConfig, iC),
99  myComputer{VariableComputerFactory::get()->create(arg.iConfig.getParameter<std::string>("computer"), arg, iC)} {}

References get, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ComputedVariable() [2/2]

ComputedVariable::ComputedVariable ( const std::string &  M,
std::string &  N,
edm::ParameterSet P,
const VariableComputer c,
edm::ConsumesCollector iC 
)
inline

Definition at line 159 of file CachingVariable.h.

161  : CachingVariable(M, N, P, iC), myComputer(c) {}

◆ ~ComputedVariable()

ComputedVariable::~ComputedVariable ( )
inlineoverride

Definition at line 162 of file CachingVariable.h.

162 {};

Member Function Documentation

◆ eval()

evalType ComputedVariable::eval ( const edm::Event iEvent) const
inlineoverridevirtual

Reimplemented from CachingVariable.

Definition at line 164 of file CachingVariable.h.

164  {
165  if (myComputer->notSeenThisEventAlready(iEvent))
166  myComputer->compute(iEvent);
167  return cache_;
168  }

References CachingVariable::cache_, iEvent, and myComputer.

Member Data Documentation

◆ myComputer

std::unique_ptr<const VariableComputer> ComputedVariable::myComputer
private

Definition at line 171 of file CachingVariable.h.

Referenced by eval().

CachingVariable::cache_
evalType cache_
Definition: CachingVariable.h:76
N
#define N
Definition: blowfish.cc:9
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ComputedVariable::myComputer
std::unique_ptr< const VariableComputer > myComputer
Definition: CachingVariable.h:171
CachingVariable::CachingVariable
CachingVariable(std::string m, std::string n, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
Definition: CachingVariable.h:55
iEvent
int iEvent
Definition: GenABIO.cc:224
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
funct::arg
A arg
Definition: Factorize.h:31
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202