CMS 3D CMS Logo

Public Member Functions | Private Attributes

VariablePower Class Reference

#include <CachingVariable.h>

Inheritance diagram for VariablePower:
CachingVariable

List of all members.

Public Member Functions

CachingVariable::evalType eval (const edm::Event &iEvent) const
 VariablePower (CachingVariableFactoryArg arg)
 ~VariablePower ()

Private Attributes

double power_
std::string var_

Detailed Description

Definition at line 482 of file CachingVariable.h.


Constructor & Destructor Documentation

VariablePower::VariablePower ( CachingVariableFactoryArg  arg) [inline]

Definition at line 484 of file CachingVariable.h.

References CachingVariable::addDescriptionLine(), edm::ParameterSet::getParameter(), CachingVariable::CachingVariableFactoryArg::iConfig, CachingVariable::CachingVariableFactoryArg::m, CachingVariable::CachingVariableFactoryArg::n, power_, and var_.

                                               :
    CachingVariable("Power",arg.n,arg.iConfig){
    power_=arg.iConfig.getParameter<double>("power");
    var_=arg.iConfig.getParameter<std::string>("var");
    std::stringstream ss("Calculare X^Y, with X=");
    ss<<var_<<" and Y="<<power_;
    addDescriptionLine(ss.str());
    arg.m[arg.n]=this;
  }
VariablePower::~VariablePower ( ) [inline]

Definition at line 493 of file CachingVariable.h.

{}

Member Function Documentation

CachingVariable::evalType VariablePower::eval ( const edm::Event iEvent) const [virtual]

Reimplemented from CachingVariable.

Definition at line 26 of file CachingVariable.cc.

References CachingVariable::compute(), funct::exp(), iEvent, funct::log(), L1TEmulatorMonitor_cff::p, power_, v, and var_.

                                                                          {
  const CachingVariable * var=edm::Service<VariableHelperService>()->get().variable(var_);
  if (!var->compute(iEvent)) return std::make_pair(false,0);

  double v=(*var)(iEvent);
  double p=exp(power_*log(v));
  return std::make_pair(true,p);
}

Member Data Documentation

double VariablePower::power_ [private]

Definition at line 499 of file CachingVariable.h.

Referenced by eval(), and VariablePower().

std::string VariablePower::var_ [private]

Definition at line 500 of file CachingVariable.h.

Referenced by eval(), and VariablePower().