musrfit
1.9.2
|
#include <PFunction.h>
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... | |
Class handling a function from the msr-file FUNCTIONS block.
Definition at line 92 of file PFunction.h.
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.
info | AST 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().
|
virtual |
Destructor.
Definition at line 85 of file PFunction.cpp.
References CleanupFuncEvalTree(), fMap, and fParam.
|
virtual |
Stub the check map and fit parameter ranges.
mapSize | size of the map vector |
paramSize | size of the parameter vector |
Definition at line 333 of file PFunction.cpp.
References fFunc, and FindAndCheckMapAndParamRange().
|
protectedvirtual |
Stub to clean up the evaluation tree.
Definition at line 551 of file PFunction.cpp.
References CleanupNode(), and fFunc.
Referenced by ~PFunction().
|
protectedvirtual |
Recursive clean up of the evaluation tree.
node | of the evaluation tree |
Definition at line 565 of file PFunction.cpp.
References func_tree_node::children.
Referenced by CleanupFuncEvalTree().
|
virtual |
Stub starting the evaluation of the evaluation tree.
return: the value of the function call.
param | fit parameter vector |
Definition at line 410 of file PFunction.cpp.
References EvalNode(), fFunc, fMetaData, and fParam.
|
protectedvirtual |
Recursive evaluation of the evaluation tree.
node | of the evaluation tree |
Definition at line 426 of file PFunction.cpp.
References func_tree_node::children, PFunctionGrammar::constEnergyID, PFunctionGrammar::constFieldID, PFunctionGrammar::constGammaMuID, PFunctionGrammar::constPiID, PFunctionGrammar::constTempID, PFunctionGrammar::expressionID, PFunctionGrammar::factorID, func_tree_node::fDvalue, PMetaData::fEnergy, PMetaData::fField, fFuncString, func_tree_node::fFunctionTag, func_tree_node::fID, func_tree_node::fIvalue, fMap, fMetaData, func_tree_node::fOperatorTag, fParam, func_tree_node::fSign, PMetaData::fTemp, FUN_ACOS, FUN_ACOSH, FUN_ASIN, FUN_ASINH, FUN_ATAN, FUN_ATANH, FUN_COS, FUN_COSH, FUN_EXP, FUN_LN, FUN_LOG, FUN_POW, FUN_SIN, FUN_SINH, FUN_SQRT, FUN_TAN, FUN_TANH, PFunctionGrammar::functionID, PFunctionGrammar::mapID, OP_ADD, OP_MUL, PFunctionGrammar::parameterID, PMUSR_UNDEFINED, PFunctionGrammar::powerID, PFunctionGrammar::realID, and PFunctionGrammar::termID.
Referenced by Eval().
|
privatevirtual |
Stub to generate the function string (clean and tidy).
info | AST tree |
Definition at line 583 of file PFunction.cpp.
References EvalTreeForStringExpression(), and fFuncString.
Referenced by PFunction().
|
privatevirtual |
Recursive generation of the function string (clean and tidy).
i | iterator of the AST tree |
Definition at line 597 of file PFunction.cpp.
References PFunctionGrammar::assignmentID, PFunctionGrammar::constEnergyID, PFunctionGrammar::constFieldID, PFunctionGrammar::constGammaMuID, PFunctionGrammar::constPiID, PFunctionGrammar::constTempID, PFunctionGrammar::expressionID, PFunctionGrammar::factorID, fFuncString, PFunctionGrammar::functionID, PFunctionGrammar::funLabelID, PFunctionGrammar::mapID, PFunctionGrammar::parameterID, PFunctionGrammar::powerID, PFunctionGrammar::realID, and PFunctionGrammar::termID.
Referenced by EvalTreeForString().
|
protectedvirtual |
Recursive generation of the evaluation tree.
i | iterator of the AST tree |
node | of the evaluation tree |
Definition at line 168 of file PFunction.cpp.
References PFunctionGrammar::assignmentID, func_tree_node::children, PFunctionGrammar::constEnergyID, PFunctionGrammar::constFieldID, PFunctionGrammar::constGammaMuID, PFunctionGrammar::constPiID, PFunctionGrammar::constTempID, PFunctionGrammar::expressionID, PFunctionGrammar::factorID, func_tree_node::fDvalue, func_tree_node::fFunctionTag, func_tree_node::fID, func_tree_node::fIvalue, func_tree_node::fOperatorTag, func_tree_node::fSign, FUN_ACOS, FUN_ACOSH, FUN_ASIN, FUN_ASINH, FUN_ATAN, FUN_ATANH, FUN_COS, FUN_COSH, FUN_EXP, FUN_LN, FUN_LOG, FUN_POW, FUN_SIN, FUN_SINH, FUN_SQRT, FUN_TAN, FUN_TANH, PFunctionGrammar::functionID, GAMMA_BAR_MUON, InitNode(), PFunctionGrammar::mapID, OP_ADD, OP_DIV, OP_MUL, OP_SUB, PFunctionGrammar::parameterID, PFunctionGrammar::powerID, PFunctionGrammar::realID, status, and PFunctionGrammar::termID.
Referenced by GenerateFuncEvalTree().
|
protectedvirtual |
Recursive checking of map and fit parameter ranges.
node | of the evaluation tree |
mapSize | size of the map vector |
paramSize | size of the fit parameter vector |
Definition at line 348 of file PFunction.cpp.
References func_tree_node::children, PFunctionGrammar::constEnergyID, PFunctionGrammar::constFieldID, PFunctionGrammar::constGammaMuID, PFunctionGrammar::constPiID, PFunctionGrammar::constTempID, PFunctionGrammar::expressionID, PFunctionGrammar::factorID, func_tree_node::fID, func_tree_node::fIvalue, PFunctionGrammar::functionID, PFunctionGrammar::mapID, PFunctionGrammar::parameterID, PFunctionGrammar::powerID, PFunctionGrammar::realID, and PFunctionGrammar::termID.
Referenced by CheckMapAndParamRange().
|
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().
|
inlinevirtual |
Definition at line 98 of file PFunction.h.
|
inlinevirtual |
Definition at line 103 of file PFunction.h.
|
protectedvirtual |
Initializes the node of the evaluation function tree.
node | to 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().
|
inlinevirtual |
Definition at line 97 of file PFunction.h.
|
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().
|
inlinevirtual |
Definition at line 101 of file PFunction.h.
|
private |
Definition at line 120 of file PFunction.h.
Referenced by CheckMapAndParamRange(), CleanupFuncEvalTree(), Eval(), and GenerateFuncEvalTree().
|
private |
function number, i.e. FUNx with x the function number
Definition at line 123 of file PFunction.h.
Referenced by PFunction(), and SetFuncNo().
|
private |
clear text representation of the function
Definition at line 127 of file PFunction.h.
Referenced by EvalNode(), EvalTreeForString(), and EvalTreeForStringExpression().
|
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().
|
private |
|
private |
keeps meta data from data files (field, energy, temperature, ...)
Definition at line 129 of file PFunction.h.
Referenced by Eval(), and EvalNode().
|
private |
parameter vector (from the msr-file Fit Parameter block)
Definition at line 118 of file PFunction.h.
Referenced by Eval(), EvalNode(), and ~PFunction().
|
private |
flag showing if the function is valid
Definition at line 122 of file PFunction.h.
Referenced by PFunction().