35#include "Minuit2/MnUserParameters.h"
36#include "Minuit2/FunctionMinimum.h"
62#define PMN_INTERACTIVE 0
68#define PMN_FIT_RANGE 3
74#define PMN_MACHINE_PRECISION 6
94#define PMN_STRATEGY 16
96#define PMN_USER_COVARIANCE 17
98#define PMN_USER_PARAM_STATE 18
149 void SetChisq(Double_t chisq, UInt_t idx);
167 void SetNDF(UInt_t ndf, UInt_t idx);
203 UInt_t
GetNDF(UInt_t idx);
317 std::unique_ptr<ROOT::Minuit2::FunctionMinimum>
fFcnMin;
std::vector< UInt_t > PUIntVector
std::vector< PMsrLineStructure > PMsrLines
std::vector< PDoublePair > PDoublePairVector
std::vector< Int_t > PIntVector
std::vector< PMsrParamStructure > PMsrParamList
std::vector< PIntPair > PIntPairVector
std::vector< TString > PStringVector
std::vector< Double_t > PDoubleVector
Bool_t ExecuteContours()
Executes CONTOURS command (2D error contours).
Bool_t ExecutePlot()
Executes PLOT command (visualize scan/contour results).
PDoublePairVector fOriginalFitRange
Original fit ranges per run (saved for FIT_RANGE command)
UInt_t fScanNoPoints
Number of scan/contour evaluation points (default=41)
UInt_t fStrategy
Minuit2 strategy: 0=fast/low-accuracy, 1=default, 2=careful/high-accuracy.
Double_t fScanHigh
Scan upper bound: 0.0 = auto (2σ above current value)
Bool_t fIsValid
Overall validity flag: true if fitter initialized successfully.
Bool_t ExecutePrintLevel(UInt_t lineNo)
Executes PRINT command (set verbosity level).
PStringVector fElapsedTime
Timing information for each fit command.
PIntPairVector fCmdList
Parsed commands: first=command ID, second=line number.
Double_t MilliTime()
Returns current time in milliseconds.
UInt_t fScanParameter[2]
Parameter indices: [0]=primary scan/contour, [1]=secondary (contours only)
Bool_t DoFit()
Main entry point for executing the fit.
PIntVector GetParFromFun(const TString funStr)
Extracts parameter numbers from a FUNCTIONS block entry.
Bool_t fSectorFlag
SECTOR command present flag.
Bool_t fYamlOut
Output flag: true to generate YAML output file (MINUIT2.OUTPUT → yaml)
Bool_t ExecuteScan()
Executes SCAN command (1D parameter space scan).
UInt_t fPrintLevel
Verbosity level: 0=quiet, 1=normal, 2=verbose (Minuit output)
Bool_t ExecuteSave(Bool_t first)
Executes SAVE command (store current parameters).
PDoubleVector ParamRound(const PDoubleVector &par, const PDoubleVector &err, Bool_t &ok)
Rounds parameters for output with appropriate precision.
Bool_t fScanAll
Multi-parameter scan flag: false=1D scan, true=2D scan (not fully implemented)
Bool_t fIsScanOnly
Scan mode flag: true if only parameter scans requested (no minimization)
virtual ~PFitter()
Destructor - Cleans up dynamically allocated resources.
PRunListCollection * fRunListCollection
Pointer to preprocessed run data collection.
Bool_t ExecuteSimplex()
Executes SIMPLEX command (non-gradient minimization).
PMsrLines fCmdLines
Raw command lines from MSR COMMANDS block.
std::vector< PSectorChisq > fSector
Sector analysis results (χ² vs. time windows)
Bool_t SetParameters()
Transfers MSR parameters to Minuit2 parameter state.
Bool_t ExecuteSector(std::ofstream &fout)
Executes SECTOR command (time-dependent χ² analysis).
void GetPhaseParams()
Identifies which parameters represent phase angles.
Double_t fScanLow
Scan lower bound: 0.0 = auto (2σ below current value)
PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only=false, Bool_t yaml_out=false)
Constructor for the fitting engine.
Bool_t ExecuteHesse()
Executes HESSE command (calculate error matrix).
PMsrParamList fParams
Copy of parameter list from MSR file.
PMsrHandler * fRunInfo
Pointer to MSR file handler (parameters, theory, commands)
Bool_t ExecuteRelease(UInt_t lineNo)
Executes RELEASE command (unfreeze parameters).
Bool_t ExecuteMinos()
Executes MINOS command (asymmetric error analysis).
PIntVector GetParFromMap(const TString mapStr)
Extracts parameter numbers from a map reference.
PDoublePairVector fScanData
Scan results: (parameter_value, χ²) pairs.
Bool_t ExecuteMinimize()
Executes MINIMIZE command (automatic algorithm selection).
ROOT::Minuit2::MnUserParameters fMnUserParams
Minuit2 parameter state (values, errors, limits)
Bool_t ExecuteMigrad()
Executes MIGRAD command (gradient descent minimization).
std::unique_ptr< ROOT::Minuit2::FunctionMinimum > fFcnMin
Minuit2 function minimum result.
Bool_t ExecuteRestore()
Executes RESTORE command (reload saved parameters).
Bool_t CheckCommands()
Validates COMMANDS block syntax and builds execution queue.
Bool_t fConverged
Convergence flag: true if fit converged to a valid minimum.
Bool_t fChisqOnly
Evaluation-only flag: true to calculate χ² without fitting.
Bool_t ExecuteFitRange(UInt_t lineNo)
Executes FIT_RANGE command (optimal time-window search).
Bool_t ExecuteFix(UInt_t lineNo)
Executes FIX command (freeze parameters).
std::vector< bool > fPhase
Phase parameter flags: true if parameter is a phase angle.
void PrepareSector(PDoubleVector ¶m, PDoubleVector &error)
Prepares sector χ² analysis data structures.
std::unique_ptr< PFitterFcn > fFitterFcn
Objective function for Minuit2 minimization.
Bool_t fUseChi2
Fit mode: true = χ² minimization, false = log-max-likelihood.
MSR file parser and manager for the musrfit framework.
Manager class for all processed μSR run data during fitting.
void SetChisq(Double_t chisq)
Double_t GetExpectedChisq()
Double_t fLast
requested time stamp
PDoubleVector fFirst
time stamp for fgb for a given run
Double_t GetTimeRangeLast()
void SetExpectedChisq(Double_t expChisq)
PUIntVector fNDFRun
NDF for the sector and run.
Double_t fChisq
chisq or maxLH for the sector
void SetSectorTime(Double_t last)
UInt_t fNDF
NDF for the sector.
Double_t GetTimeRangeFirst(UInt_t idx)
PSectorChisq(UInt_t noOfRuns)
PDoubleVector fChisqRun
chisq or maxLH for the sector and run
Double_t fExpectedChisq
keep the expected chisq or maxLH for the sector
PDoubleVector fExpectedChisqRun
expected chisq or maxLH for the sector and run
void SetRunFirstTime(Double_t first, UInt_t idx)
UInt_t fNoOfRuns
number of runs presesent