35#include <boost/version.hpp>
36#include <boost/variant/static_visitor.hpp>
37#include <boost/variant/apply_visitor.hpp>
42#include "PFunctionAst.h"
77 PFunction(
const musrfit::ast::assignment& assignment);
119 virtual Double_t
Eval(std::vector<Double_t> param,
PMetaData metaData);
151 UInt_t mapSize, UInt_t paramSize);
160 virtual TString
GenerateString(
const musrfit::ast::expression& expr);
183 const std::vector<Double_t>& param,
187 Double_t
operator()(
const musrfit::ast::leer&)
const;
189 Double_t
operator()(
const musrfit::ast::constant& c)
const;
190 Double_t
operator()(
const musrfit::ast::parameter& p)
const;
191 Double_t
operator()(
const musrfit::ast::map_ref& m)
const;
192 Double_t
operator()(
const musrfit::ast::function_call& f)
const;
193 Double_t
operator()(
const musrfit::ast::power_call& p)
const;
194 Double_t
operator()(
const musrfit::ast::expression& expr)
const;
197 const std::vector<Int_t>&
fMap;
const PMetaData & fMetaData
Double_t operator()(const musrfit::ast::leer &) const
Evaluates a leer (empty) AST node.
const std::vector< Double_t > & fParam
const std::vector< Int_t > & fMap
EvalVisitor(const std::vector< Int_t > &map, const std::vector< Double_t > ¶m, const PMetaData &metaData)
virtual TString * GetFuncString()
Returns the human-readable string representation of the function.
PMetaData fMetaData
Metadata from experimental data (field, energy, temperature, etc.)
virtual Bool_t IsValid()
Checks if the function was successfully parsed and initialized.
Int_t fFuncNo
Function number extracted from label (x in FUNx)
virtual Int_t GetFuncNo()
Returns the function number extracted from the function label.
Bool_t fValid
Validity flag: true if function parsed and initialized successfully.
musrfit::ast::expression fAst
Abstract syntax tree for the expression.
virtual Bool_t CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
Validates that all parameter and map references are within valid ranges.
virtual Bool_t FindAndCheckMapAndParamRange(const musrfit::ast::operand &operand, UInt_t mapSize, UInt_t paramSize)
Recursively validates parameter and map references in the AST.
virtual TString GenerateString(const musrfit::ast::expression &expr)
Generates a human-readable string representation of the AST.
virtual TString GenerateStringOperand(const musrfit::ast::operand &operand)
Generates a string representation of an operand.
TString fFuncString
Formatted, human-readable function representation.
virtual void SetMap(std::vector< Int_t > map)
Sets the map vector for parameter indirection.
PFunction(const musrfit::ast::assignment &assignment)
Constructor that parses and prepares a function for evaluation.
virtual ~PFunction()
Destructor that cleans up resources.
std::vector< Double_t > fParam
Current fit parameter values for evaluation.
virtual Double_t Eval(std::vector< Double_t > param, PMetaData metaData)
Evaluates the function with given parameters and metadata.
std::vector< Int_t > fMap
Map vector for indirect parameter references.