CMS 3D CMS Logo

VariablePower Class Reference

#include <PhysicsTools/UtilAlgos/interface/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_, ss, and var_.

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

VariablePower::~VariablePower (  )  [inline]

Definition at line 493 of file CachingVariable.h.

00493 {}


Member Function Documentation

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

Reimplemented from CachingVariable.

Definition at line 30 of file CachingVariable.cc.

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

00030                                                                           {
00031   const CachingVariable * var=edm::Service<VariableHelperService>()->get().variable(var_);
00032   if (!var->compute(iEvent)) return std::make_pair(false,0);
00033 
00034   double v=(*var)(iEvent);
00035   double p=exp(power_*log(v));
00036   return std::make_pair(true,p);
00037 }


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:57 2009 for CMSSW by  doxygen 1.5.4