|
musrfit 1.10.0
|
Abstract base class for user-defined theory functions in musrfit. More...
#include <PUserFcnBase.h>


Public Member Functions | |
| PUserFcnBase () | |
| Default constructor. | |
| virtual | ~PUserFcnBase () |
| Virtual destructor. | |
| virtual Bool_t | NeedGlobalPart () const |
| virtual void | SetGlobalPart (std::vector< void * > &globalPart, UInt_t idx) |
| virtual Bool_t | GlobalPartIsValid () const |
| virtual Double_t | operator() (Double_t t, const std::vector< Double_t > ¶m) const =0 |
Abstract base class for user-defined theory functions in musrfit.
PUserFcnBase enables extending musrfit with custom theory functions beyond the 34 built-in functions. Users create derived classes implementing specific physics models, compile them into shared libraries, and load them dynamically at runtime via ROOT's plugin mechanism.
User functions are valuable for:
Step 1: Create header file (MyUserFcn.h)
Step 2: Implement source file (MyUserFcn.cpp)
Step 3: Create LinkDef file (MyUserFcnLinkDef.h)
Step 4: Build shared library
Step 5: Use in MSR file
For functions requiring expensive one-time setup (lookup tables, matrix decompositions, file loading), implement the global part interface:
In the MSR file THEORY block:
Parameters can be:
1, 2 → parameter indices from FITPARAMETER blockmap1, map2 → via RUN block mapfun1, fun2 → evaluated FUNCTIONSConvention: The last parameter is typically a time shift.
Definition at line 169 of file PUserFcnBase.h.
|
inline |
|
inlinevirtual |
Virtual destructor.
Definition at line 176 of file PUserFcnBase.h.
|
inlinevirtual |
Checks if the global part initialized correctly.
Override to validate your global data structure after SetGlobalPart().
Definition at line 207 of file PUserFcnBase.h.
|
inlinevirtual |
Indicates if this function requires global initialization.
Override to return true if your function needs expensive one-time setup (e.g., calculating lookup tables, loading external data). The global part is computed once and reused across fit iterations.
Definition at line 187 of file PUserFcnBase.h.
|
pure virtual |
Evaluates the user function at time t (pure virtual).
This is the core evaluation method called for each data point during fitting. Must be implemented by derived classes.
Parameter convention: The last parameter is typically the time shift. Earlier parameters are model-specific (rates, amplitudes, exponents, etc.).
| t | Time in microseconds (μs) |
| param | Vector of function parameters (from MSR file + maps) |
Implemented in PUserFcn.
References PUserFcnBase().
|
inlinevirtual |
Sets up the global part of the user function.
Called once during initialization if NeedGlobalPart() returns true. Use this to allocate and initialize shared data structures.
| globalPart | Vector of global objects (one per run) |
| idx | Index of this run's global object in the vector |
Definition at line 198 of file PUserFcnBase.h.