EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Smear::FormulaString Class Reference

#include <eic-smear/blob/master/include/eicsmear/smear/FormulaString.h>

+ Inheritance diagram for Smear::FormulaString:
+ Collaboration 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::KinTypemVariables
 

Detailed Description

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

Definition at line 27 of file FormulaString.h.

View newest version in sPHENIX GitHub at line 27 of file FormulaString.h

Constructor & Destructor Documentation

Smear::FormulaString::~FormulaString ( )
virtual

Destructor.

Definition at line 68 of file FormulaString.cxx.

View newest version in sPHENIX GitHub at line 68 of file FormulaString.cxx

References mFormula.

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.

View newest version in sPHENIX GitHub 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.

View newest version in sPHENIX GitHub at line 79 of file FormulaString.cxx

References Detector::AsString(), mFormula, and Parse().

+ Here is the call graph for this function:

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.

View newest version in sPHENIX GitHub at line 86 of file FormulaString.cxx

References mFormula, and mVariables.

Referenced by Smear::Device::Smear().

+ Here is the caller graph for this function:

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

Returns the unprocessed input formula string.

Definition at line 143 of file FormulaString.cxx.

View newest version in sPHENIX GitHub at line 143 of file FormulaString.cxx

References mInput.

Referenced by Smear::Device::Print().

+ Here is the caller graph for this function:

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

Returns the name corresponding the a Smear::KinType.

Definition at line 155 of file FormulaString.cxx.

View newest version in sPHENIX GitHub at line 155 of file FormulaString.cxx

References name.

Referenced by Smear::Device::Device(), and Smear::Device::Print().

+ Here is the caller graph for this function:

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 147 of file FormulaString.cxx.

View newest version in sPHENIX GitHub at line 147 of file FormulaString.cxx

References Smear::kInvalidKinType, and name.

Referenced by Parse().

+ Here is the caller graph for this function:

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

Returns the processed formula string with variables substituted.

Definition at line 135 of file FormulaString.cxx.

View newest version in sPHENIX GitHub at line 135 of file FormulaString.cxx

References mFormula.

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.

TODO: kk Implicitly limits the number of variables in a formula to 4. TODO: kk Needs documentation and graceful handling.

Definition at line 104 of file FormulaString.cxx.

View newest version in sPHENIX GitHub at line 104 of file FormulaString.cxx

References charm_jet_coverage::args, GetKinType(), mVariables, Acts::VectorHelpers::position(), Acts::UnitConstants::s, and vector().

Referenced by FormulaString().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

View newest version in sPHENIX GitHub at line 98 of file FormulaString.cxx

References mVariables.

Referenced by Smear::Device::Smear().

+ Here is the caller graph for this function:

Member Data Documentation

TFormula* Smear::FormulaString::mFormula
protected

Definition at line 107 of file FormulaString.h.

View newest version in sPHENIX GitHub at line 107 of file FormulaString.h

Referenced by Eval(), FormulaString(), GetString(), and ~FormulaString().

std::string Smear::FormulaString::mInput
protected

Original formula (before parsing)

Definition at line 108 of file FormulaString.h.

View newest version in sPHENIX GitHub at line 108 of file FormulaString.h

Referenced by GetInputString().

std::vector<Smear::KinType> Smear::FormulaString::mVariables
protected

Definition at line 109 of file FormulaString.h.

View newest version in sPHENIX GitHub at line 109 of file FormulaString.h

Referenced by Eval(), Parse(), and Variables().


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