diff --git a/src/classes/PFitter.cpp b/src/classes/PFitter.cpp index 96679cb9..cd1b98a6 100644 --- a/src/classes/PFitter.cpp +++ b/src/classes/PFitter.cpp @@ -62,15 +62,16 @@ using namespace std; // Constructor //-------------------------------------------------------------------------- /** - *
+ *
Constructor. * - * \param runInfo - * \param runListCollection - * \param chisq_only + * \param runInfo pointer of the msr-file handler + * \param runListCollection pointer of the run list collection (pre-processed historgrams) + * \param chisq_only flag: true=calculate chisq only (no fitting) */ PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only) : fChisqOnly(chisq_only), fRunInfo(runInfo) { + // initialize variables fIsScanOnly = true; fConverged = false; fUseChi2 = true; // chi^2 is the default @@ -109,8 +110,7 @@ PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bo // Destructor //-------------------------------------------------------------------------- /** - *
- * + *
Destructor. */ PFitter::~PFitter() { @@ -138,8 +138,9 @@ PFitter::~PFitter() // DoFit //-------------------------------------------------------------------------- /** - *
+ *
Main calling routine to invoke minuit2, i.e. fitting etc.
*
+ * return: true if all commands could be executed successfully, otherwise returns false.
*/
Bool_t PFitter::DoFit()
{
@@ -178,6 +179,7 @@ Bool_t PFitter::DoFit()
fRunInfo->SetMsrParamPosErrorPresent(i, false);
}
+ // walk through the command list and execute them
for (UInt_t i=0; i Check the msr-file COMMAND's, fill the command queue and make sure that given parameters (if present)
+ * do make any sense.
*
+ * return: true if the commands are valid, otherwise returns false.
*/
Bool_t PFitter::CheckCommands()
{
fIsValid = true;
+ // walk through the msr-file COMMAND block
PMsrLines::iterator it;
for (it = fCmdLines.begin(); it != fCmdLines.end(); ++it) {
it->fLine.ToUpper();
@@ -524,8 +529,10 @@ Bool_t PFitter::CheckCommands()
// SetParameters
//--------------------------------------------------------------------------
/**
- *
+ * Feeds the internal minuit2 fit parameters. It also makes sure that unused parameters
+ * are fixed.
*
+ * return: true.
*/
Bool_t PFitter::SetParameters()
{
@@ -576,8 +583,9 @@ Bool_t PFitter::SetParameters()
// ExecuteContours
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 contour command. Makes sure that a valid minuit2 minimum is present.
*
+ * return: true if the contour command could be executed successfully, otherwise returns false.
*/
Bool_t PFitter::ExecuteContours()
{
@@ -608,8 +616,9 @@ Bool_t PFitter::ExecuteContours()
// ExecuteHesse
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 hesse command.
*
+ * return: true if the hesse command could be executed successfully, otherwise returns false.
*/
Bool_t PFitter::ExecuteHesse()
{
@@ -653,8 +662,9 @@ Bool_t PFitter::ExecuteHesse()
// ExecuteMigrad
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 migrad command.
*
+ * return: true if the migrad command could be executed successfully, otherwise returns false.
*/
Bool_t PFitter::ExecuteMigrad()
{
@@ -722,8 +732,9 @@ Bool_t PFitter::ExecuteMigrad()
// ExecuteMinimize
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 minimize command.
*
+ * return: true if the minimize command could be executed successfully, otherwise returns false.
*/
Bool_t PFitter::ExecuteMinimize()
{
@@ -792,8 +803,9 @@ Bool_t PFitter::ExecuteMinimize()
// ExecuteMinos
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 minos command.
*
+ * return: true if the minos command could be executed successfully, otherwise returns false.
*/
Bool_t PFitter::ExecuteMinos()
{
@@ -843,8 +855,9 @@ Bool_t PFitter::ExecuteMinos()
// ExecutePlot
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 plot command.
*
+ * return: true.
*/
Bool_t PFitter::ExecutePlot()
{
@@ -860,8 +873,9 @@ Bool_t PFitter::ExecutePlot()
// ExecuteScan
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 scan command.
*
+ * return: true.
*/
Bool_t PFitter::ExecuteScan()
{
@@ -884,8 +898,9 @@ Bool_t PFitter::ExecuteScan()
// ExecuteSave
//--------------------------------------------------------------------------
/**
- *
+ * Execute the save command.
*
+ * return: true if the valid minuit2 state is found, otherwise returns false.
*/
Bool_t PFitter::ExecuteSave()
{
@@ -1139,8 +1154,9 @@ Bool_t PFitter::ExecuteSave()
// ExecuteSimplex
//--------------------------------------------------------------------------
/**
- *
+ * Execute the minuit2 simplex command.
*
+ * return: true if the simplex command could be executed successfully, otherwise returns false.
*/
Bool_t PFitter::ExecuteSimplex()
{
@@ -1197,3 +1213,7 @@ Bool_t PFitter::ExecuteSimplex()
return true;
}
+
+//-------------------------------------------------------------------------------------------------
+// end
+//-------------------------------------------------------------------------------------------------
diff --git a/src/classes/PFitterFcn.cpp b/src/classes/PFitterFcn.cpp
index 06ae4ec8..67276851 100644
--- a/src/classes/PFitterFcn.cpp
+++ b/src/classes/PFitterFcn.cpp
@@ -38,10 +38,10 @@ using namespace std;
// Constructor
//--------------------------------------------------------------------------
/**
- *
+ * Constructor.
*
- * \param runList
- * \param fitType
+ * \param runList run list collection
+ * \param fitType if true, a chisq fit will be performed, otherwise a log max-likelihood fit will be carried out.
*/
PFitterFcn::PFitterFcn(PRunListCollection *runList, Bool_t useChi2)
{
@@ -71,7 +71,7 @@ PFitterFcn::PFitterFcn(PRunListCollection *runList, Bool_t useChi2)
// Destructor
//--------------------------------------------------------------------------
/**
- *
+ * Destructor
*/
PFitterFcn::~PFitterFcn()
{
@@ -79,9 +79,9 @@ PFitterFcn::~PFitterFcn()
//--------------------------------------------------------------------------
/**
- *
+ * Minuit2 interface function call routine. This is the function which should be minimized.
*
- * \param par
+ * \param par a vector with all the parameters of the function
*/
Double_t PFitterFcn::operator()(const std::vector
+ * Constructor.
*
+ * \param data data histogram
+ * \param unitTag tag telling in which units the Fourier transform shall be represented. Possible tags are:
+ * FOURIER_UNIT_FIELD, FOURIER_UNIT_FREQ, FOURIER_UNIT_CYCLES
+ * \param startTime start time of the data time window
+ * \param endTime end time of the data time window
+ * \param zeroPaddingPower if set to values > 0, there will be zero padding up to 2^zeroPaddingPower
*/
PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTime, UInt_t zeroPaddingPower) :
fData(data), fUnitTag(unitTag), fStartTime(startTime), fEndTime(endTime),
@@ -63,14 +69,6 @@ PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTi
return;
}
-//cout << endl << "PFourier::PFourier: fData = " << fData;
-/*
-for (UInt_t i=0; i<10; i++) {
- cout << endl << "PFourier::PFourier: i=" << i << ", t=" << fData->GetBinCenter(i) << ", value=" << fData->GetBinContent(i);
-}
-*/
-//cout << endl;
-
fValid = true;
fIn = 0;
fOut = 0;
@@ -79,13 +77,11 @@ for (UInt_t i=0; i<10; i++) {
// calculate time resolution in (us)
fTimeResolution = fData->GetBinWidth(1);
-//cout << endl << ">> fTimeResolution = " << fTimeResolution;
// if endTime == 0 set it to the last time slot
if (fEndTime == 0.0) {
Int_t last = fData->GetNbinsX()-1;
fEndTime = fData->GetBinCenter(last);
-//cout << endl << ">> fEndTime = " << fEndTime;
}
// swap start and end time if necessary
@@ -95,16 +91,12 @@ for (UInt_t i=0; i<10; i++) {
fEndTime = keep;
}
-//cout << endl << "start time = " << fStartTime << endl;
-
// calculate start and end bin
UInt_t start = (UInt_t)(fStartTime/fTimeResolution);
UInt_t end = (UInt_t)(fEndTime/fTimeResolution);
fNoOfData = end-start;
-//cout << endl << ">> fNoOfData = " << fNoOfData;
-
-// check if zero padding is whished
+ // check if zero padding is whished
if (fZeroPaddingPower > 0) {
UInt_t noOfBins = static_cast
- *
+ * Destructor
*/
PFourier::~PFourier()
{
-//cout << endl << "in ~PFourier() ..." << endl;
- if (fValid) {
+ if (fFFTwPlan)
fftw_destroy_plan(fFFTwPlan);
+ if (fIn)
fftw_free(fIn);
+ if (fOut)
fftw_free(fOut);
- }
}
//--------------------------------------------------------------------------
// Transform
//--------------------------------------------------------------------------
/**
- *
+ * Carries out the Fourier transform. It is assumed that fStartTime is the time zero
+ * for the Fourier frame. Hence if fStartTime != 0.0 the phase shift will be corrected.
*
* \param apodizationTag 0=no apod., 1=weak apod., 2=medium apod., 3=strong apod.
*/
@@ -210,9 +193,9 @@ void PFourier::Transform(UInt_t apodizationTag)
// GetRealFourier
//--------------------------------------------------------------------------
/**
- *
+ * returns the real part Fourier as a histogram.
*
- * \param scale
+ * \param scale normalisation factor
*/
TH1F* PFourier::GetRealFourier(const Double_t scale)
{
@@ -238,7 +221,6 @@ TH1F* PFourier::GetRealFourier(const Double_t scale)
realFourier->SetBinContent(i+1, scale*fOut[i][0]);
realFourier->SetBinError(i+1, 0.0);
}
-//cout << endl << ">> realFourier = " << realFourier;
return realFourier;
}
@@ -246,9 +228,9 @@ TH1F* PFourier::GetRealFourier(const Double_t scale)
// GetImaginaryFourier
//--------------------------------------------------------------------------
/**
- *
+ * returns the imaginary part Fourier as a histogram.
*
- * \param scale
+ * \param scale normalisation factor
*/
TH1F* PFourier::GetImaginaryFourier(const Double_t scale)
{
@@ -282,9 +264,9 @@ TH1F* PFourier::GetImaginaryFourier(const Double_t scale)
// GetPowerFourier
//--------------------------------------------------------------------------
/**
- *
+ * returns the Fourier power spectrum as a histogram.
*
- * \param scale
+ * \param scale normalisation factor
*/
TH1F* PFourier::GetPowerFourier(const Double_t scale)
{
@@ -318,9 +300,9 @@ TH1F* PFourier::GetPowerFourier(const Double_t scale)
// GetPhaseFourier
//--------------------------------------------------------------------------
/**
- *
+ * returns the Fourier phase spectrum as a histogram.
*
- * \param scale
+ * \param scale normalisation factor
*/
TH1F* PFourier::GetPhaseFourier(const Double_t scale)
{
@@ -371,26 +353,25 @@ TH1F* PFourier::GetPhaseFourier(const Double_t scale)
// PrepareFFTwInputData
//--------------------------------------------------------------------------
/**
- *
+ * Feeds the Fourier data and apply the apodization.
*
+ * \param apodizationTag apodization tag. Possible are currently: F_APODIZATION_NONE = no apodization,
+ * F_APODIZATION_WEAK = weak apodization, F_APODIZATION_MEDIUM = intermediate apodization,
+ * F_APODIZATION_STRONG = strong apodization
*/
void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
{
// 1st find t==0. fData start at times t<0!!
Int_t t0bin = -1;
-//cout << ">> PFourier::PrepareFFTwInputData: fData=" << fData << ", fData->GetNbinsX() = " << fData->GetNbinsX();
- for (Int_t i=1; i
+ * Carries out the appodization of the data.
*
- * \param apodizationTag
+ * \param apodizationTag apodization tag. Possible are currently: F_APODIZATION_NONE = no apodization,
+ * F_APODIZATION_WEAK = weak apodization, F_APODIZATION_MEDIUM = intermediate apodization,
+ * F_APODIZATION_STRONG = strong apodization
*/
void PFourier::ApodizeData(Int_t apodizationTag) {
diff --git a/src/classes/PFunction.cpp b/src/classes/PFunction.cpp
index 1534f52a..58434ef6 100644
--- a/src/classes/PFunction.cpp
+++ b/src/classes/PFunction.cpp
@@ -42,29 +42,27 @@ using namespace std;
// Constructor
//--------------------------------------------------------------------------
/**
- *
+ * 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
+ * \verbatim
* assignment (root node)
* |_ 'FUNx'
* |_ '='
* |_ expression
* |_ ...
+ * \endverbatim
*
- * Since it would be inefficient to evaluate this AST directly it is transferred to
+ * Since it would be inefficient to evaluate this AST directly it is transferred to
* a more efficient tree fFuncs here in the constructor.
*
* \param info AST parse tree holding a single parsed msr-function in an ascii representation
*/
-PFunction::PFunction(tree_parse_info<> info)
+PFunction::PFunction(tree_parse_info<> info) : fInfo(info)
{
-// cout << endl << "in PFunction ...";
-
- fInfo = info;
-
// init class variables
fValid = true;
fFuncNo = -1;
@@ -84,11 +82,10 @@ PFunction::PFunction(tree_parse_info<> info)
// Destructor
//--------------------------------------------------------------------------
/**
- *
+ * Destructor.
*/
PFunction::~PFunction()
{
-// cout << endl << "in ~PFunction ...";
fParam.clear();
fMap.clear();
@@ -99,9 +96,9 @@ PFunction::~PFunction()
// InitNode (protected)
//--------------------------------------------------------------------------
/**
- *
+ * Initializes the node of the evaluation function tree.
*
- * \param node
+ * \param node to be initialized
*/
void PFunction::InitNode(PFuncTreeNode &node)
{
@@ -117,9 +114,9 @@ void PFunction::InitNode(PFuncTreeNode &node)
// SetFuncNo (protected)
//-------------------------------------------------------------
/**
- *
+ * Extracts the function number of the AST tree.
*
- * \param i
+ * return: true if the function number (of FUNx, x being a number) could be extracted, otherwise false.
*/
Bool_t PFunction::SetFuncNo()
{
@@ -137,7 +134,6 @@ Bool_t PFunction::SetFuncNo()
// extract function number from string
status = sscanf(str.c_str(), "FUN%d", &funNo);
-//cout << endl << "SetFuncNo: status = " << status << ", funNo = " << funNo;
if (status == 1) { // found 1 Int_t
fFuncNo = funNo;
} else { // wrong string
@@ -151,8 +147,8 @@ Bool_t PFunction::SetFuncNo()
// GenerateFuncEvalTree (protected)
//-------------------------------------------------------------
/**
- *
- *
+ * Stub to generate the function evaluation tree from the AST tree. Needed for an efficient
+ * evaluation.
*/
Bool_t PFunction::GenerateFuncEvalTree()
{
@@ -166,8 +162,10 @@ Bool_t PFunction::GenerateFuncEvalTree()
// FillFuncEvalTree (protected)
//-------------------------------------------------------------
/**
- *
+ * Recursive generation of the evaluation tree.
*
+ * \param i iterator of the AST tree
+ * \param node of the evaluation tree
*/
void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
{
@@ -185,7 +183,6 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
status = sscanf(str.c_str(), "%lf", &dvalue); // convert string to Double_t
node.fID = PFunctionGrammar::realID; // keep the ID
node.fDvalue = dvalue; // keep the value
-// cout << endl << ">> realID: value = " << dvalue;
} else if (i->value.id() == PFunctionGrammar::constPiID) { // handle constant pi
node.fID = PFunctionGrammar::constPiID; // keep the ID
node.fDvalue = 3.14159265358979323846; // keep the value
@@ -203,20 +200,17 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
}
node.fID = PFunctionGrammar::parameterID; // keep the ID
node.fIvalue = ivalue; // keep the value
-// cout << endl << ">> parameterID: value = " << ivalue;
} else if (i->value.id() == PFunctionGrammar::mapID) { // handle map number
str = string(i->value.begin(), i->value.end()); // get string
boost::algorithm::trim(str);
status = sscanf(str.c_str(), "MAP%d", &ivalue); // convert string to map number
node.fID = PFunctionGrammar::mapID; // keep the ID
node.fIvalue = ivalue; // keep the value
-// cout << endl << ">> mapID: value = " << ivalue;
} else if (i->value.id() == PFunctionGrammar::functionID) { // handle function like cos ...
// keep the id
node.fID = PFunctionGrammar::functionID;
// keep function tag
str = string(i->value.begin(), i->value.end()); // get string
-// cout << endl << ">> functionID: value = " << str;
if (!strcmp(str.c_str(), "COS"))
node.fFunctionTag = FUN_COS;
else if (!strcmp(str.c_str(), "SIN"))
@@ -279,7 +273,6 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
node.children.push_back(child);
FillFuncEvalTree(i->children.begin()+3, node.children[1]); // exponent
} else if (i->value.id() == PFunctionGrammar::factorID) {
-// cout << endl << ">> factorID";
// keep the id
node.fID = PFunctionGrammar::factorID;
// add child lhs
@@ -324,10 +317,10 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
// CheckMapAndParamRange (public)
//-------------------------------------------------------------
/**
- *
+ * Stub the check map and fit parameter ranges.
*
- * \param mapSize
- * \param paramSize
+ * \param mapSize size of the map vector
+ * \param paramSize size of the parameter vector
*/
Bool_t PFunction::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
{
@@ -338,11 +331,11 @@ Bool_t PFunction::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
// FindAndCheckMapAndParamRange (protected)
//-------------------------------------------------------------
/**
- *
+ * Recursive checking of map and fit parameter ranges.
*
- * \param i
- * \param mapSize
- * \param paramSize
+ * \param node of the evaluation tree
+ * \param mapSize size of the map vector
+ * \param paramSize size of the fit parameter vector
*/
Bool_t PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, UInt_t mapSize, UInt_t paramSize)
{
@@ -394,8 +387,11 @@ Bool_t PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, UInt_t mapSi
// Eval (public)
//-------------------------------------------------------------
/**
- *
+ * Stub starting the evaluation of the evaluation tree.
*
+ * return: the value of the function call.
+ *
+ * \param param fit parameter vector
*/
Double_t PFunction::Eval(vector
+ * Recursive evaluation of the evaluation tree.
*
- * \param node
+ * \param node of the evaluation tree
*/
Double_t PFunction::EvalNode(PFuncTreeNode &node)
{
@@ -517,8 +513,7 @@ Double_t PFunction::EvalNode(PFuncTreeNode &node)
// CleanupFuncEvalTree (protected)
//-------------------------------------------------------------
/**
- *
- *
+ * Stub to clean up the evaluation tree.
*/
void PFunction::CleanupFuncEvalTree()
{
@@ -530,9 +525,9 @@ void PFunction::CleanupFuncEvalTree()
// CleanupNode (protected)
//-------------------------------------------------------------
/**
- *
+ * Recursive clean up of the evaluation tree.
*
- * \param node
+ * \param node of the evaluation tree
*/
void PFunction::CleanupNode(PFuncTreeNode &node)
{
@@ -548,9 +543,9 @@ void PFunction::CleanupNode(PFuncTreeNode &node)
// EvalTreeForString (private)
//-------------------------------------------------------------
/**
- *
+ * Stub to generate the function string (clean and tidy).
*
- * \param info
+ * \param info AST tree
*/
void PFunction::EvalTreeForString(tree_parse_info<> info)
{
@@ -562,9 +557,9 @@ void PFunction::EvalTreeForString(tree_parse_info<> info)
// EvalTreeForStringExpression (private)
//-------------------------------------------------------------
/**
- *
+ * Recursive generation of the function string (clean and tidy).
*
- * \param i
+ * \param i iterator of the AST tree
*/
void PFunction::EvalTreeForStringExpression(iter_t const& i)
{
@@ -612,7 +607,6 @@ void PFunction::EvalTreeForStringExpression(iter_t const& i)
} else if (i->value.id() == PFunctionGrammar::termID) {
termOp++;
if (*i->value.begin() == '*') {
-//cout << endl << ">> i->children.size() = " << i->children.size() << endl;
assert(i->children.size() == 2);
EvalTreeForStringExpression(i->children.begin());
fFuncString += " * ";
diff --git a/src/classes/PFunctionHandler.cpp b/src/classes/PFunctionHandler.cpp
index 67892942..358bb92f 100644
--- a/src/classes/PFunctionHandler.cpp
+++ b/src/classes/PFunctionHandler.cpp
@@ -38,29 +38,23 @@
// Constructor
//-------------------------------------------------------------
/**
- *
+ * Constructor
*
- * \param lines
+ * \param lines msr-file FUNCTIONS block in clear text.
*/
-PFunctionHandler::PFunctionHandler(PMsrLines lines)
+PFunctionHandler::PFunctionHandler(PMsrLines lines) : fLines(lines)
{
fValid = true;
- fLines = lines;
-
-// cout << endl << "in PFunctionHandler(PMsrLines lines)";
}
//-------------------------------------------------------------
// Destructor
//-------------------------------------------------------------
/**
- *
- *
+ * Destructor
*/
PFunctionHandler::~PFunctionHandler()
{
-// cout << endl << "in ~PFunctionHandler()" << endl << endl;
-
fLines.clear();
fFuncs.clear();
}
@@ -69,20 +63,16 @@ PFunctionHandler::~PFunctionHandler()
// DoParse (public)
//-------------------------------------------------------------
/**
- *
- *
+ * Calls the function parser.
*/
Bool_t PFunctionHandler::DoParse()
{
-// cout << endl << "in PFunctionHandler::DoParse() ...";
-
Bool_t success = true;
PFunctionGrammar function;
TString line;
// feed the function block into the parser. Start with i=1, since i=0 is FUNCTIONS
for (UInt_t i=1; i
+ * returns the function number
*
- * \param idx
+ * \param idx index of the function
*/
Int_t PFunctionHandler::GetFuncNo(UInt_t idx)
{
@@ -192,9 +179,9 @@ Int_t PFunctionHandler::GetFuncNo(UInt_t idx)
// GetFuncIndex (public)
//-------------------------------------------------------------
/**
- *
+ * return function index for a given function number
*
- * \param funcNo
+ * \param funcNo function number
*/
Int_t PFunctionHandler::GetFuncIndex(Int_t funcNo)
{
@@ -214,9 +201,9 @@ Int_t PFunctionHandler::GetFuncIndex(Int_t funcNo)
// GetFuncString (public)
//-------------------------------------------------------------
/**
- *
+ * return the (clean and tidy) function string at index idx
*
- * \param idx
+ * \param idx index of the function
*/
TString* PFunctionHandler::GetFuncString(UInt_t idx)
{
diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp
index b02214b1..75445470 100644
--- a/src/classes/PMusr.cpp
+++ b/src/classes/PMusr.cpp
@@ -44,7 +44,7 @@ using namespace std;
// Constructor
//--------------------------------------------------------------------------
/**
- * Holds the data which will be fitted.
+ * Holds the muSR data which will be fitted.
*/
PRunData::PRunData()
{
@@ -81,6 +81,7 @@ PRunData::~PRunData()
* Sets a value of the theory vector
*
* \param idx index of the theory vector
+ * \param dval value to be set.
*/
void PRunData::SetTheoryValue(UInt_t idx, Double_t dval)
{
@@ -111,7 +112,7 @@ void PRunData::ReplaceTheory(const PDoubleVector &theo)
// Constructor
//--------------------------------------------------------------------------
/**
- *
+ * Holds non-muSR data raw data.
*/
PNonMusrRawRunData::PNonMusrRawRunData()
{
@@ -132,7 +133,7 @@ PNonMusrRawRunData::PNonMusrRawRunData()
// Destructor
//--------------------------------------------------------------------------
/**
- * Cleans up
+ * Destructor. Cleans up
*/
PNonMusrRawRunData::~PNonMusrRawRunData()
{
@@ -216,7 +217,7 @@ void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval)
// Constructor
//--------------------------------------------------------------------------
/**
- *
+ * Holds muSR raw run data.
*/
PRawRunData::PRawRunData()
{
@@ -233,7 +234,7 @@ PRawRunData::PRawRunData()
// Destructor
//--------------------------------------------------------------------------
/**
- *
+ * Destructor. Cleans up.
*/
PRawRunData::~PRawRunData()
{
@@ -252,7 +253,7 @@ PRawRunData::~PRawRunData()
// GetTemperature
//--------------------------------------------------------------------------
/**
- * Returns a temperature
+ * Returns the temperature of a muSR run.
*
* \param idx index of the temperature whished
*/
@@ -270,7 +271,7 @@ const Double_t PRawRunData::GetTemperature(const UInt_t idx)
// GetTempError
//--------------------------------------------------------------------------
/**
- * Returns the error estimate of the temperature.
+ * Returns the error estimate of the temperature of a muSR run.
*
* \param idx index of the temperature whished
*/
@@ -324,7 +325,7 @@ const Int_t PRawRunData::GetT0(const UInt_t idx)
// GetT0Estimated
//--------------------------------------------------------------------------
/**
- * Returns an estimated T0 value.
+ * Returns an estimated T0 value.
*
* \param idx index of the T0 value whished
*/
@@ -342,7 +343,10 @@ const Int_t PRawRunData::GetT0Estimated(const UInt_t idx)
// GetBkgBin
//--------------------------------------------------------------------------
/**
- *
+ * Returns the background bin range (start, stop) from the data file.
+ * Currently only used in mud-files.
+ *
+ * \param idx index of the background range.
*/
const PIntPair PRawRunData::GetBkgBin(const UInt_t idx)
{
@@ -364,7 +368,10 @@ const PIntPair PRawRunData::GetBkgBin(const UInt_t idx)
// GetGoodDataBin
//--------------------------------------------------------------------------
/**
- *
+ * Returns the data range (first good bin, last good bin) from the data file.
+ * Currently only used in mud-files.
+ *
+ * \param idx index of the data range
*/
const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
{
@@ -386,7 +393,9 @@ const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
// GetDataBin
//--------------------------------------------------------------------------
/**
- *
+ * Returns a raw muSR run histogram.
+ *
+ * \param idx histo number index
*/
const PDoubleVector* PRawRunData::GetDataBin(const UInt_t idx)
{
diff --git a/src/include/PFitter.h b/src/include/PFitter.h
index e64675f2..e4493af1 100644
--- a/src/include/PFitter.h
+++ b/src/include/PFitter.h
@@ -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
+/**
+ * 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();
diff --git a/src/include/PFitterFcn.h b/src/include/PFitterFcn.h
index ebcb8057..b6d9e876 100644
--- a/src/include/PFitterFcn.h
+++ b/src/include/PFitterFcn.h
@@ -38,6 +38,9 @@
#include "PRunListCollection.h"
+/**
+ * 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_
diff --git a/src/include/PFourier.h b/src/include/PFourier.h
index 2ba55306..9328f693 100644
--- a/src/include/PFourier.h
+++ b/src/include/PFourier.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);
diff --git a/src/include/PFunction.h b/src/include/PFunction.h
index 0d522c56..ea8a47ad 100644
--- a/src/include/PFunction.h
+++ b/src/include/PFunction.h
@@ -73,6 +73,9 @@
#define FUN_POW 16
//----------------------------------------------------------------------------
+/**
+ * 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;
//----------------------------------------------------------------------------
+/**
+ * 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 EBNF like grammar definition of a function entry in the msr-file FUNCTION block.
*/
struct PFunctionGrammar : public grammar Handler of all 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 typedef to make to code more readable.
+ * typedef to make to code more readable. Definition of a bool vector.
*/
typedef vector typedef to make to code more readable.
+ * typedef to make to code more readable. Definition of an unsigned int vector
*/
typedef vector typedef to make to code more readable.
+ * typedef to make to code more readable. Definition of an int vector
*/
typedef vector
+ * typedef to make to code more readable. Definition of an int pair
*/
typedef pair
+ * typedef to make to code more readable. Definition of an int pair vector
*/
typedef vector
+ * typedef to make to code more readable. Definition of a double vector
*/
typedef vector
+ * typedef to make to code more readable. Definition of a double pair
*/
typedef pair
+ * typedef to make to code more readable. Definition of a double pair vector
*/
typedef vector typedef to make to code more readable.
+ * typedef to make to code more readable. Definition of a string vector
*/
typedef vector
+ * typedef to make to code more readable. A vector of a raw musr run.
*/
typedef vector
*/
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