eic-smear  1.0.3
A collection of ROOT classes for Monte Carlo events and a fast-smearing code simulating detector effects for the Electron-Ion Collider task force
Smear::FormulaString Class Reference

#include <FormulaString.h>

Inheritance diagram for Smear::FormulaString:

Public Member Functions

virtual ~FormulaString ()
 
 FormulaString ()
 
 FormulaString (const std::string &)
 
virtual double Eval (const std::vector< double > &) const
 
virtual std::vector
< Smear::KinType > 
Variables () const
 
virtual std::string GetString () const
 
virtual std::string GetInputString () const
 

Static Public Member Functions

static std::string GetKinName (KinType)
 
static KinType GetKinType (const std::string &)
 

Protected Member Functions

std::string Parse (const std::string &)
 

Protected Attributes

TFormula * mFormula
 
std::string mInput
 Original formula (before parsing)
 
std::vector< Smear::KinType > mVariables
 

Detailed Description

A formula described by a string with up to four variables.

Definition at line 27 of file FormulaString.h.

Constructor & Destructor Documentation

Smear::FormulaString::~FormulaString ( )
virtual

Destructor.

Definition at line 68 of file FormulaString.cxx.

Smear::FormulaString::FormulaString ( )

Default construtor. Only present to meet ROOT requirements for objects to have a default constructor. Always evaluates to zero.

Definition at line 75 of file FormulaString.cxx.

Smear::FormulaString::FormulaString ( const std::string &  formula)
explicit

Initialise with a string describing the formula. Formula syntax is as for ROOT::TFormula. Valid variable names are:

  • "E"
  • "P"
  • "theta"
  • "phi"
  • "pZ"
  • "pT"

Variable names ARE case sensitive. Energy (momentum) are in GeV(/c), angles are in radians. e.g. for the function p/sin(theta) Smear::FormulaString("P/sin(theta)");

Definition at line 79 of file FormulaString.cxx.

Member Function Documentation

double Smear::FormulaString::Eval ( const std::vector< double > &  args) const
virtual

Evaluate the formula with the provided arguments. Arguments should be listed in the order they were named in the constructor string. e.g. if the input function was "P/sin(theta)" pass a vector with element 0 == 0.5 and element 1 == 3 to evaluate at P == 0.5 and theta == 3.

Definition at line 86 of file FormulaString.cxx.

std::string Smear::FormulaString::GetInputString ( ) const
virtual

Returns the unprocessed input formula string.

Definition at line 141 of file FormulaString.cxx.

std::string Smear::FormulaString::GetKinName ( KinType  type)
static

Returns the name corresponding the a Smear::KinType.

Definition at line 153 of file FormulaString.cxx.

KinType Smear::FormulaString::GetKinType ( const std::string &  name)
static

Returns the KinType corresponding to the variable name, or kInvalidKinType if the name is invalid.

Definition at line 145 of file FormulaString.cxx.

std::string Smear::FormulaString::GetString ( ) const
virtual

Returns the processed formula string with variables substituted.

Definition at line 133 of file FormulaString.cxx.

std::string Smear::FormulaString::Parse ( const std::string &  formula)
protected

Process the input string, containing "P", "theta" etc into a version with "x", "y", "z", "t" substituted, compatible with TFormula.

Definition at line 102 of file FormulaString.cxx.

std::vector< KinType > Smear::FormulaString::Variables ( ) const
virtual

Returns a vector of Smear::KinType corresponding to the variables named in the constructor string. e.g. If initialised with "P/sin(theta)", would result in a vector with two elements: kP, kTheta.

Definition at line 98 of file FormulaString.cxx.


The documentation for this class was generated from the following files: