CMS 3D CMS Logo

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

#include <CachingVariable.h>

Inheritance diagram for VariablePower:
CachingVariable

Public Member Functions

CachingVariable::evalType eval (const edm::Event &iEvent) const override
 
 VariablePower (const CachingVariableFactoryArg &arg, edm::ConsumesCollector &iC)
 
 ~VariablePower () 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

double power_
 
std::string var_
 

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 528 of file CachingVariable.h.

Constructor & Destructor Documentation

◆ VariablePower()

VariablePower::VariablePower ( const CachingVariableFactoryArg arg,
edm::ConsumesCollector iC 
)
inline

Definition at line 530 of file CachingVariable.h.

531  : CachingVariable("Power", arg.n, arg.iConfig, iC) {
532  power_ = arg.iConfig.getParameter<double>("power");
533  var_ = arg.iConfig.getParameter<std::string>("var");
534  std::stringstream ss("Calculare X^Y, with X=");
535  ss << var_ << " and Y=" << power_;
536  addDescriptionLine(ss.str());
537  arg.m[arg.n] = this;
538  }

References CachingVariable::addDescriptionLine(), power_, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and var_.

◆ ~VariablePower()

VariablePower::~VariablePower ( )
inlineoverride

Definition at line 539 of file CachingVariable.h.

539 {}

Member Function Documentation

◆ eval()

CachingVariable::evalType VariablePower::eval ( const edm::Event iEvent) const
overridevirtual

Reimplemented from CachingVariable.

Definition at line 34 of file CachingVariable.cc.

34  {
35  const CachingVariable* var = edm::Service<VariableHelperService>()->get().variable(var_);
36  if (!var->compute(iEvent))
37  return std::make_pair(false, 0);
38 
39  double v = (*var)(iEvent);
40  double p = exp(power_ * log(v));
41  return std::make_pair(true, p);
42 }

References JetChargeProducer_cfi::exp, iEvent, dqm-mbProfile::log, AlCaHLTBitMon_ParallelJobs::p, power_, findQualityFiles::v, trigObjTnPSource_cfi::var, and var_.

Member Data Documentation

◆ power_

double VariablePower::power_
private

Definition at line 545 of file CachingVariable.h.

Referenced by eval(), and VariablePower().

◆ var_

std::string VariablePower::var_
private

Definition at line 546 of file CachingVariable.h.

Referenced by eval(), and VariablePower().

CachingVariable::addDescriptionLine
void addDescriptionLine(const std::string &s)
Definition: CachingVariable.h:69
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CachingVariable
Definition: CachingVariable.h:40
findQualityFiles.v
v
Definition: findQualityFiles.py:179
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CachingVariable::CachingVariable
CachingVariable(std::string m, std::string n, const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
Definition: CachingVariable.h:55
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
VariablePower::var_
std::string var_
Definition: CachingVariable.h:546
VariablePower::power_
double power_
Definition: CachingVariable.h:545
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
funct::arg
A arg
Definition: Factorize.h:36
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6