CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
VariableComputer Class Referenceabstract

#include <CachingVariable.h>

Inheritance diagram for VariableComputer:
HLTBitComputer L1BitComputer RazorComputer VariableComputerTest

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, edm::ConsumesCollector &iC)
 
void doesNotCompute () const
 
void doesNotCompute (std::string var) const
 
const std::string & name () const
 
bool notSeenThisEventAlready (const edm::Event &iEvent) const
 
 VariableComputer (const CachingVariable::CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
 
virtual ~VariableComputer ()
 

Protected Attributes

const CachingVariable::CachingVariableFactoryArgarg_
 
edm::Event::CacheIdentifier_t eventCacheID_ = 0
 
std::map< std::string, const ComputedVariable * > iCompute_
 
std::string method_
 
std::string name_
 
std::string separator_
 

Detailed Description

Definition at line 115 of file CachingVariable.h.

Constructor & Destructor Documentation

◆ VariableComputer()

VariableComputer::VariableComputer ( const CachingVariable::CachingVariableFactoryArg arg,
edm::ConsumesCollector iC 
)

◆ ~VariableComputer()

virtual VariableComputer::~VariableComputer ( )
inlinevirtual

Definition at line 118 of file CachingVariable.h.

118 {}

Member Function Documentation

◆ assign()

void VariableComputer::assign ( std::string  var,
double &  value 
) const

Definition at line 66 of file CachingVariable.cc.

66  {
67  std::map<std::string, const ComputedVariable*>::const_iterator it = iCompute_.find(var);
68  if (it == iCompute_.end()) {
69  std::stringstream ss;
70  ss << "cannot assign: " << var << ". List of variable declared:\n";
71  for (std::map<std::string, const ComputedVariable*>::const_iterator it = iCompute_.begin(); it != iCompute_.end();
72  ++it)
73  ss << it->first << std::endl;
74  edm::LogError("VariableComputer") << ss.str();
75  } else
76  it->second->setCache(value);
77 }

References iCompute_, contentValuesCheck::ss, and trigObjTnPSource_cfi::var.

Referenced by RazorComputer::compute(), L1BitComputer::compute(), HLTBitComputer::compute(), and VariableComputerTest::compute().

◆ compute()

virtual void VariableComputer::compute ( const edm::Event iEvent) const
pure virtual

◆ declare()

void VariableComputer::declare ( std::string  var,
edm::ConsumesCollector iC 
)

Definition at line 55 of file CachingVariable.cc.

55  {
56  std::string aName = name_ + separator_ + var;
57  ComputedVariable* newVar = new ComputedVariable(method_, aName, arg_.iConfig, this, iC);
58  if (iCompute_.find(var) != iCompute_.end()) {
59  edm::LogError("VariableComputer") << "redeclaring: " << var << " skipping.";
60  delete newVar;
61  return;
62  }
63  iCompute_[var] = newVar;
64  arg_.m.insert(std::make_pair(aName, newVar));
65 }

References arg_, iCompute_, CachingVariable::CachingVariableFactoryArg::iConfig, CachingVariable::CachingVariableFactoryArg::m, method_, name_, separator_, AlCaHLTBitMon_QueryRunRegistry::string, and trigObjTnPSource_cfi::var.

Referenced by HLTBitComputer::HLTBitComputer(), L1BitComputer::L1BitComputer(), RazorComputer::RazorComputer(), and VariableComputerTest::VariableComputerTest().

◆ doesNotCompute() [1/2]

void VariableComputer::doesNotCompute ( ) const

Definition at line 79 of file CachingVariable.cc.

79  {
80  for (std::map<std::string, const ComputedVariable*>::const_iterator it = iCompute_.begin(); it != iCompute_.end();
81  ++it)
82  it->second->setNotCompute();
83 }

References iCompute_.

Referenced by L1BitComputer::compute(), HLTBitComputer::compute(), and VariableComputerTest::compute().

◆ doesNotCompute() [2/2]

void VariableComputer::doesNotCompute ( std::string  var) const

Definition at line 84 of file CachingVariable.cc.

84  {
85  std::map<std::string, const ComputedVariable*>::const_iterator it = iCompute_.find(var);
86  if (it == iCompute_.end()) {
87  std::stringstream ss;
88  ss << "cannot act on: " << var << ". List of variable declared:\n";
89  for (std::map<std::string, const ComputedVariable*>::const_iterator it = iCompute_.begin(); it != iCompute_.end();
90  ++it)
91  ss << it->first << std::endl;
92  edm::LogError("VariableComputer") << ss.str();
93  } else
94  it->second->setNotCompute();
95 }

References iCompute_, contentValuesCheck::ss, and trigObjTnPSource_cfi::var.

◆ name()

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

Definition at line 121 of file CachingVariable.h.

121 { return name_; }

References name_.

Referenced by config.CFG::__str__(), and validation.Sample::digest().

◆ notSeenThisEventAlready()

bool VariableComputer::notSeenThisEventAlready ( const edm::Event iEvent) const
inline

Definition at line 127 of file CachingVariable.h.

127  {
129  eventCacheID_ != iEvent.cacheIdentifier());
130  if (retValue) {
131  eventCacheID_ = iEvent.cacheIdentifier();
132  }
133  return retValue;
134  }

References eventCacheID_, iEvent, and SiStripPI::max.

Member Data Documentation

◆ arg_

const CachingVariable::CachingVariableFactoryArg& VariableComputer::arg_
protected

Definition at line 137 of file CachingVariable.h.

Referenced by declare(), and VariableComputer().

◆ eventCacheID_

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

Definition at line 143 of file CachingVariable.h.

Referenced by notSeenThisEventAlready().

◆ iCompute_

std::map<std::string, const ComputedVariable*> VariableComputer::iCompute_
mutableprotected

Definition at line 140 of file CachingVariable.h.

Referenced by assign(), declare(), and doesNotCompute().

◆ method_

std::string VariableComputer::method_
protected

Definition at line 139 of file CachingVariable.h.

Referenced by declare(), and VariableComputer().

◆ name_

std::string VariableComputer::name_
protected

Definition at line 138 of file CachingVariable.h.

Referenced by declare(), name(), and VariableComputer().

◆ separator_

std::string VariableComputer::separator_
protected

Definition at line 141 of file CachingVariable.h.

Referenced by declare(), and VariableComputer().

VariableComputer::method_
std::string method_
Definition: CachingVariable.h:139
VariableComputer::separator_
std::string separator_
Definition: CachingVariable.h:141
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
VariableComputer::iCompute_
std::map< std::string, const ComputedVariable * > iCompute_
Definition: CachingVariable.h:140
CachingVariable::CachingVariableFactoryArg::m
CachingVariable::vMap & m
Definition: CachingVariable.h:51
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
VariableComputer::name_
std::string name_
Definition: CachingVariable.h:138
VariableComputer::arg_
const CachingVariable::CachingVariableFactoryArg & arg_
Definition: CachingVariable.h:137
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ComputedVariable
Definition: CachingVariable.h:156
funct::arg
A arg
Definition: Factorize.h:31
CachingVariable::CachingVariableFactoryArg::n
std::string & n
Definition: CachingVariable.h:50
CachingVariable::CachingVariableFactoryArg::iConfig
edm::ParameterSet & iConfig
Definition: CachingVariable.h:52
edm::Log
Definition: MessageLogger.h:70
VariableComputer::eventCacheID_
edm::Event::CacheIdentifier_t eventCacheID_
Definition: CachingVariable.h:143