added more docu and cleaned up code a bit
This commit is contained in:
@@ -40,10 +40,6 @@
|
||||
#include "PRunListCollection.h"
|
||||
#include "PFitterFcn.h"
|
||||
|
||||
/*
|
||||
Will handle all the possible minuit commands and actually do things ...
|
||||
*/
|
||||
|
||||
#define PMN_INTERACTIVE 0
|
||||
#define PMN_CONTOURS 1
|
||||
#define PMN_EIGEN 2
|
||||
@@ -61,6 +57,9 @@ Will handle all the possible minuit commands and actually do things ...
|
||||
#define PMN_USER_PARAM_STATE 15
|
||||
#define PMN_PRINT 16
|
||||
|
||||
/**
|
||||
* <p>Interface class to minuit2.
|
||||
*/
|
||||
class PFitter
|
||||
{
|
||||
public:
|
||||
@@ -73,33 +72,33 @@ class PFitter
|
||||
Bool_t DoFit();
|
||||
|
||||
private:
|
||||
Bool_t fIsValid;
|
||||
Bool_t fIsScanOnly;
|
||||
Bool_t fConverged;
|
||||
Bool_t fChisqOnly;
|
||||
Bool_t fUseChi2;
|
||||
Bool_t fIsValid; ///< flag. true: the fit is valid.
|
||||
Bool_t fIsScanOnly; ///< flag. true: scan along some parameters (no fitting).
|
||||
Bool_t fConverged; ///< flag. true: the fit has converged.
|
||||
Bool_t fChisqOnly; ///< flag. true: calculate chi^2 only (no fitting).
|
||||
Bool_t fUseChi2; ///< flag. true: chi^2 fit. false: log-max-likelihood
|
||||
|
||||
UInt_t fStrategy;
|
||||
UInt_t fStrategy; ///< fitting strategy (see minuit2 manual).
|
||||
|
||||
PMsrHandler *fRunInfo;
|
||||
PMsrHandler *fRunInfo; ///< pointer to the msr-file handler
|
||||
|
||||
PMsrParamList fParams; ///< msr-file parameters
|
||||
|
||||
PMsrLines fCmdLines; ///< all the Minuit commands from the msr-file
|
||||
PIntVector fCmdList; ///< command list
|
||||
|
||||
PFitterFcn *fFitterFcn;
|
||||
PFitterFcn *fFitterFcn; ///< pointer to the fitter function object
|
||||
ROOT::Minuit2::MnUserParameters fMnUserParams; ///< minuit2 input parameter list
|
||||
ROOT::Minuit2::FunctionMinimum *fFcnMin; ///< function minimum object
|
||||
ROOT::Minuit2::MnUserParameterState *fMnUserParamState; ///< keeps the current user parameter state
|
||||
|
||||
// minuit2 scan/contours command relate variables (see MnScan/MnContours in the minuit2 user manual)
|
||||
Bool_t fScanAll;
|
||||
UInt_t fScanParameter[2];
|
||||
UInt_t fScanNoPoints;
|
||||
Double_t fScanLow;
|
||||
Double_t fScanHigh;
|
||||
PDoublePairVector fScanData;
|
||||
Bool_t fScanAll; ///< flag. false: single parameter scan, true: not implemented yet (see MnScan/MnContours in the minuit2 user manual)
|
||||
UInt_t fScanParameter[2]; ///< scan parameter. idx=0: used for scan and contour, idx=1: used for contour (see MnScan/MnContours in the minuit2 user manual)
|
||||
UInt_t fScanNoPoints; ///< number of points in a scan/contour (see MnScan/MnContours in the minuit2 user manual)
|
||||
Double_t fScanLow; ///< scan range low. default=0.0 which means 2 std dev. (see MnScan/MnContours in the minuit2 user manual)
|
||||
Double_t fScanHigh; ///< scan range high. default=0.0 which means 2 std dev. (see MnScan/MnContours in the minuit2 user manual)
|
||||
PDoublePairVector fScanData; ///< keeps the scan/contour data
|
||||
|
||||
// commands
|
||||
Bool_t CheckCommands();
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
|
||||
#include "PRunListCollection.h"
|
||||
|
||||
/**
|
||||
* <p>This is the minuit2 interface function class porviding the function to be optimized (chisq or log max-likelihood).
|
||||
*/
|
||||
class PFitterFcn : public ROOT::Minuit2::FCNBase
|
||||
{
|
||||
public:
|
||||
@@ -50,9 +53,9 @@ class PFitterFcn : public ROOT::Minuit2::FCNBase
|
||||
UInt_t GetTotalNoOfFittedBins() { return fRunListCollection->GetTotalNoOfBinsFitted(); }
|
||||
|
||||
private:
|
||||
Double_t fUp;
|
||||
Bool_t fUseChi2;
|
||||
PRunListCollection *fRunListCollection;
|
||||
Double_t fUp; ///< for chisq == 1.0, i.e. errors are 1 std. deviation errors. for log max-likelihood == 0.5, i.e. errors are 1 std. deviation errors (for details see the minuit2 user manual).
|
||||
Bool_t fUseChi2; ///< true = chisq fit, false = log max-likelihood fit
|
||||
PRunListCollection *fRunListCollection; ///< pre-processed data to be fitted
|
||||
};
|
||||
|
||||
#endif // _PFITTERFCN_H_
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
// gamma_muon / (2 pi) = 1.355342e-2 (MHz/G)
|
||||
#define F_GAMMA_BAR_MUON 1.355342e-2
|
||||
|
||||
/**
|
||||
* muSR Fourier class.
|
||||
*/
|
||||
class PFourier
|
||||
{
|
||||
public:
|
||||
@@ -61,24 +64,24 @@ class PFourier
|
||||
virtual Bool_t IsValid() { return fValid; }
|
||||
|
||||
private:
|
||||
TH1F *fData;
|
||||
TH1F *fData; ///< data histogram to be Fourier transformed.
|
||||
|
||||
Bool_t fValid;
|
||||
Bool_t fValid; ///< true = all boundary conditions fullfilled and hence a Fourier transform can be performed.
|
||||
Int_t fUnitTag; ///< 1=Field Units (G), 2=Frequency Units (MHz), 3=Angular Frequency Units (Mc/s)
|
||||
|
||||
Int_t fApodization; ///< 0=none, 1=weak, 2=medium, 3=strong
|
||||
|
||||
Double_t fTimeResolution;
|
||||
Double_t fStartTime;
|
||||
Double_t fEndTime;
|
||||
UInt_t fZeroPaddingPower;
|
||||
Double_t fResolution;
|
||||
Double_t fTimeResolution; ///< time resolution of the data histogram
|
||||
Double_t fStartTime; ///< start time of the data histogram
|
||||
Double_t fEndTime; ///< end time of the data histogram
|
||||
UInt_t fZeroPaddingPower; ///< power for zero padding, if set < 0 no zero padding will be done
|
||||
Double_t fResolution; ///< Fourier resolution (field, frequency, or angular frequency)
|
||||
|
||||
UInt_t fNoOfData;
|
||||
UInt_t fNoOfBins;
|
||||
fftw_plan fFFTwPlan;
|
||||
fftw_complex *fIn;
|
||||
fftw_complex *fOut;
|
||||
UInt_t fNoOfData; ///< number of bins in the time interval between fStartTime and fStopTime
|
||||
UInt_t fNoOfBins; ///< number of bins to be Fourier transformed. Might be different to fNoOfData due to zero padding
|
||||
fftw_plan fFFTwPlan; ///< fftw plan (see FFTW3 User Manual)
|
||||
fftw_complex *fIn; ///< real part of the Fourier transform
|
||||
fftw_complex *fOut; ///< imaginary part of the Fourier transform
|
||||
|
||||
virtual void PrepareFFTwInputData(UInt_t apodizationTag);
|
||||
virtual void ApodizeData(Int_t apodizationTag);
|
||||
|
||||
@@ -73,6 +73,9 @@
|
||||
#define FUN_POW 16
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Structure needed to evaluate a function tree (see FUNCTIONS block of an msr-file).
|
||||
*/
|
||||
typedef struct func_tree_node {
|
||||
Int_t fID; ///< tag showing what tree element this is
|
||||
Int_t fOperatorTag; ///< tag for '+', '-', '*', '/'
|
||||
@@ -84,6 +87,9 @@ typedef struct func_tree_node {
|
||||
} PFuncTreeNode;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Class handling a function from the msr-file FUNCTIONS block.
|
||||
*/
|
||||
class PFunction {
|
||||
public:
|
||||
PFunction(tree_parse_info<> info);
|
||||
@@ -109,9 +115,9 @@ class PFunction {
|
||||
virtual void CleanupNode(PFuncTreeNode &node);
|
||||
|
||||
private:
|
||||
tree_parse_info<> fInfo;
|
||||
vector<Double_t> fParam;
|
||||
vector<Int_t> fMap;
|
||||
tree_parse_info<> fInfo; ///< AST parse tree holding a single parsed msr-function in an ascii representation
|
||||
vector<Double_t> fParam; ///< parameter vector (from the msr-file Fit Parameter block)
|
||||
vector<Int_t> fMap; ///< map vector
|
||||
PFuncTreeNode fFunc;
|
||||
|
||||
Bool_t fValid; ///< flag showing if the function is valid
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef parse_tree_match_t::tree_iterator iter_t;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
*
|
||||
* <p>EBNF like grammar definition of a function entry in the msr-file FUNCTION block.
|
||||
*/
|
||||
struct PFunctionGrammar : public grammar<PFunctionGrammar>
|
||||
{
|
||||
|
||||
@@ -42,6 +42,9 @@ using namespace std;
|
||||
#include "PFunctionGrammar.h"
|
||||
#include "PFunction.h"
|
||||
|
||||
/**
|
||||
* <p>Handler of <em>all</em> functions in a msr-file FUNCTIONS block.
|
||||
*/
|
||||
class PFunctionHandler
|
||||
{
|
||||
public:
|
||||
@@ -58,10 +61,10 @@ class PFunctionHandler
|
||||
virtual TString* GetFuncString(UInt_t idx);
|
||||
|
||||
private:
|
||||
Bool_t fValid;
|
||||
Bool_t fValid; ///< true = function handler has valid functions
|
||||
|
||||
PMsrLines fLines;
|
||||
vector<PFunction> fFuncs;
|
||||
PMsrLines fLines; ///< stores the msr-file FUNCTIONS block as clear text.
|
||||
vector<PFunction> fFuncs; ///< vector of all evaluatable functions
|
||||
};
|
||||
|
||||
#endif // _PFUNCTIONHANDLER_H_
|
||||
|
||||
@@ -125,55 +125,55 @@ using namespace std;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p> typedef to make to code more readable.
|
||||
* <p> typedef to make to code more readable. Definition of a bool vector.
|
||||
*/
|
||||
typedef vector<Bool_t> PBoolVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p> typedef to make to code more readable.
|
||||
* <p> typedef to make to code more readable. Definition of an unsigned int vector
|
||||
*/
|
||||
typedef vector<UInt_t> PUIntVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p> typedef to make to code more readable.
|
||||
* <p> typedef to make to code more readable. Definition of an int vector
|
||||
*/
|
||||
typedef vector<Int_t> PIntVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p> typedef to make to code more readable. Definition of an int pair
|
||||
*/
|
||||
typedef pair<Int_t, Int_t> PIntPair;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p> typedef to make to code more readable. Definition of an int pair vector
|
||||
*/
|
||||
typedef vector<PIntPair> PIntPairVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p> typedef to make to code more readable. Definition of a double vector
|
||||
*/
|
||||
typedef vector<Double_t> PDoubleVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p> typedef to make to code more readable. Definition of a double pair
|
||||
*/
|
||||
typedef pair<Double_t, Double_t> PDoublePair;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p> typedef to make to code more readable. Definition of a double pair vector
|
||||
*/
|
||||
typedef vector<PDoublePair> PDoublePairVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p> typedef to make to code more readable.
|
||||
* <p> typedef to make to code more readable. Definition of a string vector
|
||||
*/
|
||||
typedef vector<TString> PStringVector;
|
||||
|
||||
@@ -219,16 +219,16 @@ class PRunData {
|
||||
|
||||
private:
|
||||
// data related info
|
||||
Double_t fDataTimeStart;
|
||||
Double_t fDataTimeStep;
|
||||
PDoubleVector fX; // only used for non-muSR
|
||||
PDoubleVector fValue;
|
||||
PDoubleVector fError;
|
||||
Double_t fDataTimeStart; ///< start time for the data set
|
||||
Double_t fDataTimeStep; ///< time step for the data set, i.e. the time length of a bin
|
||||
PDoubleVector fX; ///< x-axis vector. Only used for non-muSR
|
||||
PDoubleVector fValue; ///< data vector
|
||||
PDoubleVector fError; ///< data error vector
|
||||
// theory related info
|
||||
Double_t fTheoryTimeStart;
|
||||
Double_t fTheoryTimeStep;
|
||||
PDoubleVector fXTheory; // only used for non-muSR
|
||||
PDoubleVector fTheory;
|
||||
Double_t fTheoryTimeStart; ///< start time of the theory
|
||||
Double_t fTheoryTimeStep; ///< time step of the theory, i.e. the time length of a bin
|
||||
PDoubleVector fXTheory; ///< x-axis vector. Only used for non-muSR
|
||||
PDoubleVector fTheory; ///< theory vector
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------
|
||||
@@ -335,7 +335,7 @@ class PRawRunData {
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p> typedef to make to code more readable. A vector of a raw musr run.
|
||||
*/
|
||||
typedef vector<PRawRunData> PRawRunDataList;
|
||||
|
||||
@@ -535,8 +535,8 @@ typedef vector<PMsrPlotStructure> PMsrPlotList;
|
||||
* <p>
|
||||
*/
|
||||
typedef struct {
|
||||
Bool_t fValid;
|
||||
PMsrLines fStatLines;
|
||||
Bool_t fValid; ///< flag showing if the statistics block is valid, i.e. a fit took place which converged
|
||||
PMsrLines fStatLines; ///< statistics block in msr-file clear text
|
||||
TString fDate; ///< string holding fitting date and time
|
||||
Bool_t fChisq; ///< flag telling if min = chi2 or min = max.likelyhood
|
||||
Double_t fMin; ///< chi2 or max. likelyhood
|
||||
|
||||
Reference in New Issue
Block a user