added more docu and cleaned up code a bit
This commit is contained in:
parent
26267a8f92
commit
959c792a68
@ -62,15 +62,16 @@ using namespace std;
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <p>Destructor.
|
||||
*/
|
||||
PFitter::~PFitter()
|
||||
{
|
||||
@ -138,8 +138,9 @@ PFitter::~PFitter()
|
||||
// DoFit
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Main calling routine to invoke minuit2, i.e. fitting etc.
|
||||
*
|
||||
* <b>return:</b> 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<fCmdList.size(); i++) {
|
||||
switch (fCmdList[i]) {
|
||||
case PMN_INTERACTIVE:
|
||||
@ -262,13 +264,16 @@ Bool_t PFitter::DoFit()
|
||||
// CheckCommands
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Check the msr-file COMMAND's, fill the command queue and make sure that given parameters (if present)
|
||||
* do make any sense.
|
||||
*
|
||||
* <b>return:</b> 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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Feeds the internal minuit2 fit parameters. It also makes sure that unused parameters
|
||||
* are fixed.
|
||||
*
|
||||
* <b>return:</b> true.
|
||||
*/
|
||||
Bool_t PFitter::SetParameters()
|
||||
{
|
||||
@ -576,8 +583,9 @@ Bool_t PFitter::SetParameters()
|
||||
// ExecuteContours
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 contour command. Makes sure that a valid minuit2 minimum is present.
|
||||
*
|
||||
* <b>return:</b> 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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 hesse command.
|
||||
*
|
||||
* <b>return:</b> 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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 migrad command.
|
||||
*
|
||||
* <b>return:</b> 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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 minimize command.
|
||||
*
|
||||
* <b>return:</b> 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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 minos command.
|
||||
*
|
||||
* <b>return:</b> 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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 plot command.
|
||||
*
|
||||
* <b>return:</b> true.
|
||||
*/
|
||||
Bool_t PFitter::ExecutePlot()
|
||||
{
|
||||
@ -860,8 +873,9 @@ Bool_t PFitter::ExecutePlot()
|
||||
// ExecuteScan
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 scan command.
|
||||
*
|
||||
* <b>return:</b> true.
|
||||
*/
|
||||
Bool_t PFitter::ExecuteScan()
|
||||
{
|
||||
@ -884,8 +898,9 @@ Bool_t PFitter::ExecuteScan()
|
||||
// ExecuteSave
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the save command.
|
||||
*
|
||||
* <b>return:</b> true if the valid minuit2 state is found, otherwise returns false.
|
||||
*/
|
||||
Bool_t PFitter::ExecuteSave()
|
||||
{
|
||||
@ -1139,8 +1154,9 @@ Bool_t PFitter::ExecuteSave()
|
||||
// ExecuteSimplex
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Execute the minuit2 simplex command.
|
||||
*
|
||||
* <b>return:</b> 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
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
@ -38,10 +38,10 @@ using namespace std;
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Destructor
|
||||
*/
|
||||
PFitterFcn::~PFitterFcn()
|
||||
{
|
||||
@ -79,9 +79,9 @@ PFitterFcn::~PFitterFcn()
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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<Double_t>& par) const
|
||||
{
|
||||
|
@ -49,8 +49,14 @@ using namespace std;
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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<UInt_t>(pow(2.0, static_cast<Double_t>(fZeroPaddingPower)));
|
||||
if (noOfBins > fNoOfData)
|
||||
@ -115,9 +107,7 @@ for (UInt_t i=0; i<10; i++) {
|
||||
fNoOfBins = fNoOfData;
|
||||
}
|
||||
|
||||
//cout << endl << ">> fNoOfBins = " << fNoOfBins;
|
||||
|
||||
// calculate fourier resolution
|
||||
// calculate fourier resolution, depending on the units
|
||||
Double_t resolution = 1.0/(fTimeResolution*fNoOfBins); // in MHz
|
||||
switch (fUnitTag) {
|
||||
case FOURIER_UNIT_FIELD:
|
||||
@ -135,54 +125,47 @@ for (UInt_t i=0; i<10; i++) {
|
||||
break;
|
||||
}
|
||||
|
||||
//cout << endl << ">> fResolution = " << fResolution;
|
||||
|
||||
// allocate necessary memory
|
||||
fIn = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*fNoOfBins);
|
||||
fOut = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*fNoOfBins);
|
||||
|
||||
//cout << endl << ">> fIn = " << fIn;
|
||||
//cout << endl << ">> fOut = " << fOut;
|
||||
|
||||
// check if memory allocation has been successful
|
||||
if ((fIn == 0) || (fOut == 0)) {
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
//cout << endl << "PFourier::PFourier: fNoOfBins=" << fNoOfBins << endl;
|
||||
// get the FFTW3 plan (see FFTW3 manual)
|
||||
fFFTwPlan = fftw_plan_dft_1d(fNoOfBins, fIn, fOut, FFTW_FORWARD, FFTW_ESTIMATE);
|
||||
|
||||
// check if a valid plan has been generated
|
||||
if (!fFFTwPlan) {
|
||||
fValid = false;
|
||||
}
|
||||
|
||||
//cout << endl;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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<fData->GetNbinsX(); i++) {
|
||||
//if (i<20) cout << endl << ">> PFourier::PrepareFFTwInputData: i=" << i << ", fData->GetBinCenter(i)=" << fData->GetBinCenter(i);
|
||||
for (Int_t i=1; i<fData->GetNbinsX(); i++) {
|
||||
if (fData->GetBinCenter(i) >= 0.0) {
|
||||
t0bin = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//cout << endl << "t0bin = " << t0bin << endl;
|
||||
|
||||
// 2nd fill fIn
|
||||
UInt_t start = (UInt_t)(fStartTime/fTimeResolution) + t0bin;
|
||||
//cout << endl << "start = " << start << endl;
|
||||
for (UInt_t i=0; i<fNoOfData; i++) {
|
||||
fIn[i][0] = fData->GetBinContent(i+start);
|
||||
fIn[i][1] = 0.0;
|
||||
@ -400,26 +381,19 @@ void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
|
||||
fIn[i][1] = 0.0;
|
||||
}
|
||||
|
||||
//cout << ">> PFourier::PrepareFFTwInputData: t0bin = " << t0bin << ", start = " << start << endl;
|
||||
// 3rd apodize data (if wished)
|
||||
ApodizeData(apodizationTag);
|
||||
|
||||
/*
|
||||
cout << ">> PFourier::PrepareFFTwInputData: fNoOfData = " << fNoOfData << ", fNoOfBins = " << fNoOfBins << endl;
|
||||
for (UInt_t i=0; i<10; i++) {
|
||||
cout << endl << ">> PFourier::PrepareFFTwInputData: " << i << ": fIn[i][0] = " << fIn[i][0];
|
||||
}
|
||||
cout << endl;
|
||||
*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ApodizeData
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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) {
|
||||
|
||||
|
@ -42,29 +42,27 @@ using namespace std;
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Destructor.
|
||||
*/
|
||||
PFunction::~PFunction()
|
||||
{
|
||||
// cout << endl << "in ~PFunction ...";
|
||||
fParam.clear();
|
||||
fMap.clear();
|
||||
|
||||
@ -99,9 +96,9 @@ PFunction::~PFunction()
|
||||
// InitNode (protected)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Extracts the function number of the AST tree.
|
||||
*
|
||||
* \param i
|
||||
* <b>return:</b> 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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Stub starting the evaluation of the evaluation tree.
|
||||
*
|
||||
* <b>return:</b> the value of the function call.
|
||||
*
|
||||
* \param param fit parameter vector
|
||||
*/
|
||||
Double_t PFunction::Eval(vector<Double_t> param)
|
||||
{
|
||||
@ -408,9 +404,9 @@ Double_t PFunction::Eval(vector<Double_t> param)
|
||||
// EvalNode (protected)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <p>Stub to clean up the evaluation tree.
|
||||
*/
|
||||
void PFunction::CleanupFuncEvalTree()
|
||||
{
|
||||
@ -530,9 +525,9 @@ void PFunction::CleanupFuncEvalTree()
|
||||
// CleanupNode (protected)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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 += " * ";
|
||||
|
@ -38,29 +38,23 @@
|
||||
// Constructor
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <p>Destructor
|
||||
*/
|
||||
PFunctionHandler::~PFunctionHandler()
|
||||
{
|
||||
// cout << endl << "in ~PFunctionHandler()" << endl << endl;
|
||||
|
||||
fLines.clear();
|
||||
fFuncs.clear();
|
||||
}
|
||||
@ -69,20 +63,16 @@ PFunctionHandler::~PFunctionHandler()
|
||||
// DoParse (public)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <p>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<fLines.size(); i++) {
|
||||
// cout << endl << "fLines[" << i << "] = '" << fLines[i].fLine.Data() << "'";
|
||||
|
||||
// function line to upper case
|
||||
line = fLines[i].fLine;
|
||||
@ -91,10 +81,9 @@ Bool_t PFunctionHandler::DoParse()
|
||||
// do parsing
|
||||
tree_parse_info<> info = ast_parse(line.Data(), function, space_p);
|
||||
|
||||
if (info.full) {
|
||||
// cout << endl << "parse successful ..." << endl;
|
||||
PFunction func(info);
|
||||
fFuncs.push_back(func);
|
||||
if (info.full) { // parsing successfull
|
||||
PFunction func(info); // generate an evaluation function object based on the AST tree
|
||||
fFuncs.push_back(func); // feeds it to the functions vector
|
||||
} else {
|
||||
cerr << endl << "**ERROR**: FUNCTIONS parse failed in line " << fLines[i].fLineNo << endl;
|
||||
success = false;
|
||||
@ -116,11 +105,6 @@ Bool_t PFunctionHandler::DoParse()
|
||||
}
|
||||
}
|
||||
|
||||
// if (success) {
|
||||
// for (UInt_t i=0; i<fFuncs.size(); i++)
|
||||
// cout << endl << "func number = " << fFuncs[i].GetFuncNo();
|
||||
// }
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -128,10 +112,12 @@ Bool_t PFunctionHandler::DoParse()
|
||||
// CheckMapAndParamRange (public)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Check all functions if the map and fit parameters are within valid ranges, i.e. map < mapSize, param < paramSize.
|
||||
*
|
||||
* \param mapSize
|
||||
* \param paramSize
|
||||
* <b>return:</b> true if map and fit parameters are withing valid ranges, otherwise false.
|
||||
*
|
||||
* \param mapSize size of the map vector
|
||||
* \param paramSize size of the fit parameter vector
|
||||
*/
|
||||
Bool_t PFunctionHandler::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
|
||||
{
|
||||
@ -150,9 +136,13 @@ Bool_t PFunctionHandler::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
|
||||
// Eval (public)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Evaluate function number funNo for given map and param.
|
||||
*
|
||||
* \param funNo
|
||||
* <b>return:</b> value of the function for given map and param.
|
||||
*
|
||||
* \param funNo function number
|
||||
* \param map map vector
|
||||
* \param param fit parameter vector
|
||||
*/
|
||||
Double_t PFunctionHandler::Eval(Int_t funNo, vector<Int_t> map, vector<Double_t> param)
|
||||
{
|
||||
@ -162,9 +152,6 @@ Double_t PFunctionHandler::Eval(Int_t funNo, vector<Int_t> map, vector<Double_t>
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//cout << endl << "PFunctionHandler::Eval: GetFuncIndex("<<funNo<<") = " << GetFuncIndex(funNo);
|
||||
//cout << endl;
|
||||
|
||||
// set correct map
|
||||
fFuncs[GetFuncIndex(funNo)].SetMap(map);
|
||||
|
||||
@ -176,9 +163,9 @@ Double_t PFunctionHandler::Eval(Int_t funNo, vector<Int_t> map, vector<Double_t>
|
||||
// GetFuncNo (public)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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)
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>return the (clean and tidy) function string at index idx
|
||||
*
|
||||
* \param idx
|
||||
* \param idx index of the function
|
||||
*/
|
||||
TString* PFunctionHandler::GetFuncString(UInt_t idx)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ using namespace std;
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Holds the data which will be fitted.
|
||||
* <p>Holds the muSR data which will be fitted.
|
||||
*/
|
||||
PRunData::PRunData()
|
||||
{
|
||||
@ -81,6 +81,7 @@ PRunData::~PRunData()
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Holds non-muSR data raw data.
|
||||
*/
|
||||
PNonMusrRawRunData::PNonMusrRawRunData()
|
||||
{
|
||||
@ -132,7 +133,7 @@ PNonMusrRawRunData::PNonMusrRawRunData()
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Cleans up
|
||||
* <p>Destructor. Cleans up
|
||||
*/
|
||||
PNonMusrRawRunData::~PNonMusrRawRunData()
|
||||
{
|
||||
@ -216,7 +217,7 @@ void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval)
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Holds muSR raw run data.
|
||||
*/
|
||||
PRawRunData::PRawRunData()
|
||||
{
|
||||
@ -233,7 +234,7 @@ PRawRunData::PRawRunData()
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Destructor. Cleans up.
|
||||
*/
|
||||
PRawRunData::~PRawRunData()
|
||||
{
|
||||
@ -252,7 +253,7 @@ PRawRunData::~PRawRunData()
|
||||
// GetTemperature
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Returns a temperature
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Returns the error estimate of the temperature.
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Returns an estimated T0 value.
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>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
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
* <p>Returns a raw muSR run histogram.
|
||||
*
|
||||
* \param idx histo number index
|
||||
*/
|
||||
const PDoubleVector* PRawRunData::GetDataBin(const UInt_t idx)
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user