musrfit  1.9.2
PFunction Class Reference

#include <PFunction.h>

Collaboration diagram for PFunction:

Public Member Functions

 PFunction (tree_parse_info<> info)
 
virtual ~PFunction ()
 
virtual Bool_t IsValid ()
 
virtual Int_t GetFuncNo ()
 
virtual Bool_t CheckMapAndParamRange (UInt_t mapSize, UInt_t paramSize)
 
virtual Double_t Eval (std::vector< Double_t > param, PMetaData metaData)
 
virtual void SetMap (std::vector< Int_t > map)
 
virtual TString * GetFuncString ()
 

Protected Member Functions

virtual void InitNode (PFuncTreeNode &node)
 
virtual Bool_t SetFuncNo ()
 
virtual Bool_t FindAndCheckMapAndParamRange (PFuncTreeNode &node, UInt_t mapSize, UInt_t paramSize)
 
virtual Bool_t GenerateFuncEvalTree ()
 
virtual void FillFuncEvalTree (iter_t const &i, PFuncTreeNode &node)
 
virtual Double_t EvalNode (PFuncTreeNode &node)
 
virtual void CleanupFuncEvalTree ()
 
virtual void CleanupNode (PFuncTreeNode &node)
 

Private Member Functions

virtual void EvalTreeForString (tree_parse_info<> info)
 
virtual void EvalTreeForStringExpression (iter_t const &i)
 

Private Attributes

tree_parse_info fInfo
 AST parse tree holding a single parsed msr-function in an ascii representation. More...
 
std::vector< Double_t > fParam
 parameter vector (from the msr-file Fit Parameter block) More...
 
std::vector< Int_t > fMap
 map vector More...
 
PFuncTreeNode fFunc
 
Bool_t fValid
 flag showing if the function is valid More...
 
Int_t fFuncNo
 function number, i.e. FUNx with x the function number More...
 
TString fFuncString
 clear text representation of the function More...
 
PMetaData fMetaData
 keeps meta data from data files (field, energy, temperature, ...) More...
 

Detailed Description

Class handling a function from the msr-file FUNCTIONS block.

Definition at line 92 of file PFunction.h.

Constructor & Destructor Documentation

◆ PFunction()

PFunction::PFunction ( tree_parse_info<>  info)

Constructor.

info is an abstract syntax tree (AST) generate by the spirit parse library (see http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/doc/trees.html). It contains a single parsed msr-function in an ascii representation. Here it takes the from

*    assignment (root node)
*     |_ 'FUNx'
*     |_ '='
*     |_ expression
*         |_ ...
* 

Since it would be inefficient to evaluate this AST directly it is transferred to a more efficient tree fFuncs here in the constructor.

Parameters
infoAST parse tree holding a single parsed msr-function in an ascii representation

Definition at line 62 of file PFunction.cpp.

References EvalTreeForString(), fFuncNo, fValid, GenerateFuncEvalTree(), and SetFuncNo().

◆ ~PFunction()

PFunction::~PFunction ( )
virtual

Destructor.

Definition at line 85 of file PFunction.cpp.

References CleanupFuncEvalTree(), fMap, and fParam.

Member Function Documentation

◆ CheckMapAndParamRange()

Bool_t PFunction::CheckMapAndParamRange ( UInt_t  mapSize,
UInt_t  paramSize 
)
virtual

Stub the check map and fit parameter ranges.

Parameters
mapSizesize of the map vector
paramSizesize of the parameter vector

Definition at line 333 of file PFunction.cpp.

References fFunc, and FindAndCheckMapAndParamRange().

◆ CleanupFuncEvalTree()

void PFunction::CleanupFuncEvalTree ( )
protectedvirtual

Stub to clean up the evaluation tree.

Definition at line 551 of file PFunction.cpp.

References CleanupNode(), and fFunc.

Referenced by ~PFunction().

◆ CleanupNode()

void PFunction::CleanupNode ( PFuncTreeNode node)
protectedvirtual

Recursive clean up of the evaluation tree.

Parameters
nodeof the evaluation tree

Definition at line 565 of file PFunction.cpp.

References func_tree_node::children.

Referenced by CleanupFuncEvalTree().

◆ Eval()

Double_t PFunction::Eval ( std::vector< Double_t >  param,
PMetaData  metaData 
)
virtual

Stub starting the evaluation of the evaluation tree.

return: the value of the function call.

Parameters
paramfit parameter vector

Definition at line 410 of file PFunction.cpp.

References EvalNode(), fFunc, fMetaData, and fParam.

◆ EvalNode()

◆ EvalTreeForString()

void PFunction::EvalTreeForString ( tree_parse_info<>  info)
privatevirtual

Stub to generate the function string (clean and tidy).

Parameters
infoAST tree

Definition at line 583 of file PFunction.cpp.

References EvalTreeForStringExpression(), and fFuncString.

Referenced by PFunction().

◆ EvalTreeForStringExpression()

◆ FillFuncEvalTree()

◆ FindAndCheckMapAndParamRange()

Bool_t PFunction::FindAndCheckMapAndParamRange ( PFuncTreeNode node,
UInt_t  mapSize,
UInt_t  paramSize 
)
protectedvirtual

◆ GenerateFuncEvalTree()

Bool_t PFunction::GenerateFuncEvalTree ( )
protectedvirtual

Stub to generate the function evaluation tree from the AST tree. Needed for an efficient evaluation.

Definition at line 151 of file PFunction.cpp.

References fFunc, FillFuncEvalTree(), fInfo, and InitNode().

Referenced by PFunction().

◆ GetFuncNo()

virtual Int_t PFunction::GetFuncNo ( )
inlinevirtual

Definition at line 98 of file PFunction.h.

◆ GetFuncString()

virtual TString* PFunction::GetFuncString ( )
inlinevirtual

Definition at line 103 of file PFunction.h.

◆ InitNode()

void PFunction::InitNode ( PFuncTreeNode node)
protectedvirtual

Initializes the node of the evaluation function tree.

Parameters
nodeto be initialized

Definition at line 101 of file PFunction.cpp.

References func_tree_node::fDvalue, func_tree_node::fFunctionTag, func_tree_node::fID, func_tree_node::fIvalue, func_tree_node::fOperatorTag, and func_tree_node::fSign.

Referenced by FillFuncEvalTree(), and GenerateFuncEvalTree().

◆ IsValid()

virtual Bool_t PFunction::IsValid ( )
inlinevirtual

Definition at line 97 of file PFunction.h.

◆ SetFuncNo()

Bool_t PFunction::SetFuncNo ( )
protectedvirtual

Extracts the function number of the AST tree.

return: true if the function number (of FUNx, x being a number) could be extracted, otherwise false.

Definition at line 119 of file PFunction.cpp.

References fFuncNo, fInfo, and status.

Referenced by PFunction().

◆ SetMap()

virtual void PFunction::SetMap ( std::vector< Int_t >  map)
inlinevirtual

Definition at line 101 of file PFunction.h.

Member Data Documentation

◆ fFunc

PFuncTreeNode PFunction::fFunc
private

◆ fFuncNo

Int_t PFunction::fFuncNo
private

function number, i.e. FUNx with x the function number

Definition at line 123 of file PFunction.h.

Referenced by PFunction(), and SetFuncNo().

◆ fFuncString

TString PFunction::fFuncString
private

clear text representation of the function

Definition at line 127 of file PFunction.h.

Referenced by EvalNode(), EvalTreeForString(), and EvalTreeForStringExpression().

◆ fInfo

tree_parse_info PFunction::fInfo
private

AST parse tree holding a single parsed msr-function in an ascii representation.

Definition at line 117 of file PFunction.h.

Referenced by GenerateFuncEvalTree(), and SetFuncNo().

◆ fMap

std::vector<Int_t> PFunction::fMap
private

map vector

Definition at line 119 of file PFunction.h.

Referenced by EvalNode(), and ~PFunction().

◆ fMetaData

PMetaData PFunction::fMetaData
private

keeps meta data from data files (field, energy, temperature, ...)

Definition at line 129 of file PFunction.h.

Referenced by Eval(), and EvalNode().

◆ fParam

std::vector<Double_t> PFunction::fParam
private

parameter vector (from the msr-file Fit Parameter block)

Definition at line 118 of file PFunction.h.

Referenced by Eval(), EvalNode(), and ~PFunction().

◆ fValid

Bool_t PFunction::fValid
private

flag showing if the function is valid

Definition at line 122 of file PFunction.h.

Referenced by PFunction().


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