some more docu

This commit is contained in:
nemu
2010-06-04 19:51:20 +00:00
parent e4fa408420
commit 5386342cf4
17 changed files with 249 additions and 695 deletions

View File

@ -41,7 +41,7 @@ using namespace std;
* <p>Constructor.
*
* \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.
* \param useChi2 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)
{

View File

@ -144,7 +144,7 @@ Bool_t PFunctionHandler::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
* \param map map vector
* \param param fit parameter vector
*/
Double_t PFunctionHandler::Eval(Int_t funNo, vector<Int_t> map, vector<Double_t> param)
Double_t PFunctionHandler::Eval(Int_t funNo, vector<Int_t> map, vector<double> param)
{
if (GetFuncIndex(funNo) == -1) {
cerr << endl << "**ERROR**: Couldn't find FUN" << funNo << " for evaluation";

View File

@ -1154,7 +1154,6 @@ void PMusrCanvas::InitFourier()
/**
* <p>Initialize the class, and sets up the necessary objects.
*
* \param number The plot number of the msr-file PLOT block
* \param title Title to be displayed
* \param wtopx top x coordinate (in pixels) to place the canvas.
* \param wtopy top y coordinate (in pixels) to place the canvas.
@ -2352,7 +2351,7 @@ void PMusrCanvas::CleanupFourierDifference()
* \param y y-value of the data
* \param theo theory histogram
*/
double PMusrCanvas::CalculateDiff(const double x, const double y, TH1F *theo)
double PMusrCanvas::CalculateDiff(const Double_t x, const Double_t y, TH1F *theo)
{
Int_t bin = theo->FindBin(x);
@ -2372,7 +2371,7 @@ double PMusrCanvas::CalculateDiff(const double x, const double y, TH1F *theo)
* \param y y-value of the data
* \param theo theory error graphs
*/
double PMusrCanvas::CalculateDiff(const double x, const double y, TGraphErrors *theo)
double PMusrCanvas::CalculateDiff(const Double_t x, const Double_t y, TGraphErrors *theo)
{
Int_t bin = 0;
Double_t xVal, yVal;
@ -2396,7 +2395,7 @@ double PMusrCanvas::CalculateDiff(const double x, const double y, TGraphErrors *
* \param x x-value of the data
* \param graph TGraphErrors which should be searched
*/
Int_t PMusrCanvas::FindBin(const double x, TGraphErrors *graph)
Int_t PMusrCanvas::FindBin(const Double_t x, TGraphErrors *graph)
{
Int_t i, bin = 0;
Double_t *xTheo = graph->GetX();

View File

@ -628,7 +628,7 @@ void PMusrT0::Done(Int_t status)
*
* \param event event type
* \param x keyboard event: character key; mouse event: x-position
* \param mouse event: y-position
* \param y mouse event: y-position
* \param selected not used
*/
void PMusrT0::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)

View File

@ -412,6 +412,7 @@ void PStartupHandler::OnFatalError(const Char_t *str)
* <p>Not used.
*
* \param str not used
* \param len not used
*/
void PStartupHandler::OnCdataBlock(const Char_t *str, Int_t len)
{

View File

@ -56,10 +56,15 @@ PUserFcn::~PUserFcn()
//------------------------------------------------------
/**
* <p>
* <p> user function example: polynome of 3rd order
*
* <b>return:</b>
* \f[ = \sum_{k=0}^3 c_k t^k \f]
*
* <b>meaning of paramValues:</b> \f$c_0\f$, \f$c_1\f$, \f$c_2\f$, \f$c_3\f$
*
* <b>return:</b> function value
*
* \param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* \param param parameter vector
*/
Double_t PUserFcn::operator()(Double_t t, const std::vector<Double_t> &param) const

View File

@ -75,7 +75,7 @@ class PRunDataHandler
virtual Bool_t ReadDBFile();
virtual Bool_t StripWhitespace(TString &str);
virtual Bool_t IsWhitespace(const char *str);
virtual Bool_t IsWhitespace(const Char_t *str);
virtual Double_t ToDouble(TString &str, Bool_t &ok);
virtual Int_t ToInt(TString &str, Bool_t &ok);
virtual Int_t GetDataTagIndex(TString &str, const PStringVector* fLabels);

View File

@ -41,8 +41,13 @@ using namespace boost::algorithm;
//--------------------------------------------------------------------------
/**
* <p>
* std::string
* <p>Checks is a string is a number
*
* <b>return:</b>
* - true if s is a number string
* - false otherwise
*
* \param s
*/
bool isNumber(const string &s)
{
@ -59,7 +64,7 @@ bool isNumber(const string &s)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Sends the usage description to the standard output.
*/
void msr2data_syntax()
{
@ -97,9 +102,14 @@ void msr2data_syntax()
//--------------------------------------------------------------------------
/**
* <p>
* std::vector of std::string
* bool (DB file ore not)
* <p>filters out the output file name from at argument string
*
* <b>return:</b>
* - output file name is present in the argument list
* - otherwise 'out.db' (db==true), 'out.dat' (db==false)
*
* \param arg argument string list from the msr2data call
* \param db true if output file is a db-file
*/
string msr2data_outputfile(vector<string> &arg, bool db = true)
{
@ -140,9 +150,14 @@ string msr2data_outputfile(vector<string> &arg, bool db = true)
//--------------------------------------------------------------------------
/**
* <p>
* std::vector of std::string
* string
* <p>Checks if option string is present in the argument input list
*
* <b>return:</b>
* - true if option is <b>not</b> present
* - false otherwise
*
* \param arg list of arguments
* \param s option string
*/
bool msr2data_useOption(vector<string> &arg, const string &s)
{
@ -160,9 +175,16 @@ bool msr2data_useOption(vector<string> &arg, const string &s)
//--------------------------------------------------------------------------
/**
* <p>
* std::vector of std::string
* bool
* <p>Filters out the template run number (if present) and check at the
* same time if only already existing msr-files shall be fitted (no template).
*
* <b>return:</b>
* - template runNo if everything is OK
* - -1 : tag: fit only, do not prepare input files
* - -2 : fatal error - another fit-&lt;temp&gt; option is specified
*
* \param arg list of arguments
* \param chainfit if true
*/
int msr2data_doFitting(vector<string> &arg, bool &chainfit)
{
@ -172,15 +194,15 @@ int msr2data_doFitting(vector<string> &arg, bool &chainfit)
istringstream iss;
vector<string>::iterator iter(arg.begin());
while (iter != arg.end()) {
if (!iter->compare("fit")) {
if (temp) {
if (!iter->compare("fit")) { // fit found
if (temp) { // temp already found previously
return -2; // fatal error - another fit-<temp> option is specified
}
temp = -1;
temp = -1; // fit only, do not prepare input files
chainfit = false;
iter = arg.erase(iter);
}
else if (!iter->substr(0,4).compare("fit-")) {
else if (!iter->substr(0,4).compare("fit-")) { // 'fit-' found
if (temp) {
return -2; // fatal error - another fit option is specified
}
@ -203,9 +225,14 @@ int msr2data_doFitting(vector<string> &arg, bool &chainfit)
//--------------------------------------------------------------------------
/**
* <p>
* std::vector of std::string
* bool
* <p>Filters out the template run number from which the new msr-files should be created.
*
* <b>return:</b>
* - template run number, or
* - 0 if the string after 'msr-' is not a number
*
* \param arg list of arguments
* \param inputOnly flag, if true create msr-files only (no fitting)
*/
unsigned int msr2data_doInputCreation(vector<string> &arg, bool &inputOnly)
{
@ -229,10 +256,15 @@ unsigned int msr2data_doInputCreation(vector<string> &arg, bool &inputOnly)
//--------------------------------------------------------------------------
/**
* <p>
* <p>msr2data is used to generate msr-files based on template msr-files, automatically fitting these new msr-files,
* collection fitting parameters, etc. For a detailed description see
* \htmlonly <a href="https://intranet.psi.ch/MUSR/Msr2Data">musr2data online help</a>
* \endhtmlonly
* \latexonly msr2data online help: \texttt{https://intranet.psi.ch/MUSR/Msr2Data}
* \endlatexonly
*
* \param argc
* \param argv
* \param argc number of arguments
* \param argv list of arguments
*/
int main(int argc, char *argv[])
{

View File

@ -60,7 +60,7 @@ using namespace std;
//--------------------------------------------------------------------------
/**
* <p>
* <p>Sends the usage description to the standard output.
*/
void msr2msr_syntax()
{
@ -74,9 +74,13 @@ void msr2msr_syntax()
//--------------------------------------------------------------------------
/**
* <p>
* <p>If the msr-file line is the RUN line, change it to the new format.
*
* \param str
* <b>return:</b>
* - true if everything went smooth
* - false otherwise
*
* \param str msr-file line
*/
bool msr2msr_run(char *str)
{
@ -143,11 +147,16 @@ bool msr2msr_run(char *str)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Changes the fit parameter lines to the new msr-file format. In the new msr-file
* format there is an additional column "Pos_Error". Before a fit takes place the value
* is set to "none".
*
* \param str
* <b>return:</b>
* - true if everything went smooth
* - false otherwise
*
* \param str msr-file fit parameter line
*/
//void msr2msr_param(char *str, int &tag)
bool msr2msr_param(char *str)
{
// check for comment header which needs to be replaced
@ -247,26 +256,21 @@ bool msr2msr_param(char *str)
tokens = 0;
}
/*
// check if the end of the parameter block is reached
unsigned int i;
for (i=0; i<strlen(str); i++) {
if (!isblank(str[i]) || !iscntrl(str[i]))
break;
}
if (i == strlen(str)) // end reached
tag = MSR_TAG_NO_BLOCK;
*/
return true;
}
//--------------------------------------------------------------------------
/**
* <p>
* <p>In the theory the table functions needs to be replaced by the numerical ones, and some
* functions have new a different parameterization.
*
* \param str
* \param tag
* \param noOfAddionalParams
* <b>return:</b>
* - true if everything went smooth
* - false otherwise
*
* \param str msr-file theory line
* \param tag if a function has new some additional parameters, this flag will be set, such that these new parameters can be added to the fit parameter block
* \param noOfAddionalParams counts the number of additional parameters needed.
*/
bool msr2msr_theory(char *str, int &tag, int &noOfAddionalParams)
{
@ -412,9 +416,13 @@ bool msr2msr_theory(char *str, int &tag, int &noOfAddionalParams)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Checks if a msr-line is a comment line
*
* \param str
* <b>return:</b>
* - true if line is a comment line
* - false otherwise
*
* \param str msr-file line
*/
bool msr2msr_is_comment(char *str)
{
@ -437,9 +445,13 @@ bool msr2msr_is_comment(char *str)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Checks if a msr-line consists only out of whitespaces.
*
* \param str
* <b>return:</b>
* - true if line is a whitespace
* - false otherwise
*
* \param str msr-file line
*/
bool msr2msr_is_whitespace(char *str)
{
@ -459,10 +471,10 @@ bool msr2msr_is_whitespace(char *str)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Replaces temporarily set labels by the proper parameter number.
*
* \param str
* \param paramNo
* \param str msr-file line
* \param paramNo parameter number
*/
void msr2msr_replace(char *str, int paramNo)
{
@ -491,11 +503,12 @@ void msr2msr_replace(char *str, int paramNo)
//--------------------------------------------------------------------------
/**
* <p>
* <p>If a theory function was found which has newly a different number of parameters,
* this function will finalize the msr-file, i.e. replacing all temporarily set tags.
*
* \param fln in/out file name
* \param tag
* \param noOfAddionalParams
* \param fln file name
* \param theoryTag theory tag if the changed function
* \param noOfAddionalParams number of additional fit parameters
*/
bool msr2msr_finalize_theory(char *fln, int theoryTag, int noOfAddionalParams)
{
@ -574,10 +587,11 @@ bool msr2msr_finalize_theory(char *fln, int theoryTag, int noOfAddionalParams)
//--------------------------------------------------------------------------
/**
* <p>
* <p>msr2msr is needed to convert old WKM msr-files to musrfit msr-files. Eventhough the syntax is <b>very</b>
* close, there are some shortcomings in the WKM msr-files, which forced me to slightly change the file format.
*
* \param argc
* \param argv
* \param argc number of arguments
* \param argv list of arguments
*/
int main(int argc, char *argv[])
{

View File

@ -52,8 +52,7 @@ using namespace std;
//--------------------------------------------------------------------------
/**
* <p>
*
* <p>Sends the usage description to the standard output.
*/
void musrfit_syntax()
{
@ -83,21 +82,19 @@ void musrfit_syntax()
//--------------------------------------------------------------------------
/**
* <p>
* <p>Writes the fitted data- and theory-set in ascii format to disc.
*
* \param fln
* \param data
* \param runCounter
* \param fln output file name
* \param data processed-data handler
* \param runCounter msr-file run counter needed to form the output file name
*/
void musrfit_write_ascii(TString fln, PRunData *data, int runCounter)
{
// generate dump file name
TString fileName = fln.Copy();
TString count("_");
count += runCounter;
Ssiz_t index = fln.Index(".");
fln.Insert(index, count);
//cout << endl << "fln = " << fln.Data();
ofstream f;
@ -124,9 +121,12 @@ void musrfit_write_ascii(TString fln, PRunData *data, int runCounter)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Go through all msr-file runs and write each of them in ascii-format to disc
* (used for diagnostics). Be aware that this output is <b>different</b> to what
* you will get when using musrview!
*
* \param fileName
* \param fileName file name
* \param runList run list collection handler
*/
void musrfit_dump_ascii(char *fileName, PRunListCollection *runList)
{
@ -193,12 +193,12 @@ void musrfit_dump_ascii(char *fileName, PRunListCollection *runList)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Writes the fitted data- and theory-set in root format to disc.
*
* \param f
* \param fln
* \param data
* \param runCounter
* \param f root file object
* \param fln file name
* \param data processed-data handler
* \param runCounter msr-file run counter needed to form the output file name
*/
void musrfit_write_root(TFile &f, TString fln, PRunData *data, int runCounter)
{
@ -252,9 +252,12 @@ void musrfit_write_root(TFile &f, TString fln, PRunData *data, int runCounter)
//--------------------------------------------------------------------------
/**
* <p>
* <p>Go through all msr-file runs and write each of them in root format to disc
* (used for diagnostics). Be aware that this output is <b>different</b> to what
* you will get when using musrview!
*
* \param fileName
* \param fileName file name
* \param runList run list connection handler
*/
void musrfit_dump_root(char *fileName, PRunListCollection *runList)
{
@ -324,6 +327,22 @@ void musrfit_dump_root(char *fileName, PRunListCollection *runList)
}
//--------------------------------------------------------------------------
/**
* <p>The musrfit program is used to fit muSR data.
* For a detailed description/usage of the program, please see
* \htmlonly <a href="https://intranet.psi.ch/MUSR/MusrFit">musrfit online help</a>
* \endhtmlonly
* \latexonly musrfit online help: \texttt{https://intranet.psi.ch/MUSR/MusrFit}
* \endlatexonly
*
* <b>return:</b>
* - PMUSR_SUCCESS if everthing went smooth
* - PMUSR_WRONG_STARTUP_SYNTAX if syntax error is encountered
* - line number if an error in the msr-file was encountered which cannot be handled.
*
* \param argc number of input arguments
* \param argv list of input arguments
*/
int main(int argc, char *argv[])
{
bool show_syntax = false;

View File

@ -38,6 +38,10 @@ using namespace std;
#include <TObjArray.h>
#include <TObjString.h>
//--------------------------------------------------------------------------
/**
* <p>Sends the usage description to the standard output.
*/
void musrparam_syntax()
{
cout << endl << "usage: musrparam <input-filename> <output-filename>";
@ -57,6 +61,18 @@ void musrparam_syntax()
cout << endl << endl;
}
//--------------------------------------------------------------------------
/**
* <p>Used to extract fit parameters from msr-files. msr2data is much more flexible and not much effort
* will go into supporting musrparam anymore (only bug fixing).
*
* <b>return:</b>
* - 0 if everything went smooth
* - negative number otherwise
*
* \param argc number of arguments
* \param argv list of arguments
*/
int main(int argc, char *argv[])
{
if (argc != 3) {

View File

@ -49,8 +49,7 @@ using namespace std;
//--------------------------------------------------------------------------
/**
* <p>
*
* <p>Sends the usage description to the standard output.
*/
void musrt0_syntax()
{
@ -64,18 +63,23 @@ void musrt0_syntax()
//--------------------------------------------------------------------------
/**
* <p>
* <p>This routine sets up a raw single histogram canvas to graphically enter t0, data- and background-range
* (depending on some given input flags).
*
* \param app
* \param msrHandler
* \param data
* <b>return:</b>
* - true, if everthing went smooth
* - false, otherwise
*
* \param app main root application handler
* \param msrHandler msr-file handler
* \param data musrT0 data set handler
* \param idx index to filter out the proper msr-file run
*/
Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data, UInt_t idx)
{
//cout << endl << "debug> &app=" << &app << ", msrHandler=" << msrHandler << ", &data=" << &data << endl;
PMusrT0 *musrT0 = new PMusrT0(data);
// check if the musrT0 object could be invoked
if (musrT0 == 0) {
cerr << endl << ">> **ERROR** Couldn't invoke musrT0 ...";
cerr << endl << ">> run name " << data.GetRawRunData(idx)->GetRunName()->Data();
@ -83,20 +87,26 @@ Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data
return false;
}
// check if the musrT0 object is valid
if (!musrT0->IsValid()) {
cerr << endl << ">> **ERROR** invalid item found! (idx=" << idx << ")";
cerr << endl;
return false;
}
// set the msr-file handler. The handler cannot be transfered at construction time since rootcint is not able to handle the PMsrHandler class
musrT0->SetMsrHandler(msrHandler);
// check if only t0, data-, and bkg-range is wished, if not, only initialize t0 at this point
if (data.GetCmdTag() != PMUSRT0_GET_DATA_AND_BKG_RANGE)
musrT0->InitT0();
// check if only t0 is wished, if not, initialize data- and bkg-ranges
if (data.GetCmdTag() != PMUSRT0_GET_T0)
musrT0->InitDataAndBkg();
// connect SIGNAL 'Done' of musrT0 with the SLOT 'Terminate' of app. This will terminate the main application if
// the local musrT0 object emits 'Done'
musrT0->Connect("Done(Int_t)", "TApplication", &app, "Terminate(Int_t)");
app.Run(true); // true needed that Run will return after quit
@ -106,8 +116,10 @@ Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data
else
result = true;
// disconnect all SIGNALS and SLOTS connected t0 musrT0
musrT0->Disconnect(musrT0);
// cleanup
delete musrT0;
musrT0 = 0;
@ -116,8 +128,12 @@ Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data
//--------------------------------------------------------------------------
/**
* <p>
* <p>This routine cleans up the handlers.
*
* \param saxParser XML SAX parser
* \param startupHandler startup handler
* \param msrHandler msr-file handler
* \param dataHandler raw run data handler
*/
void musrt0_cleanup(TSAXParser *saxParser, PStartupHandler *startupHandler, PMsrHandler *msrHandler, PRunDataHandler *dataHandler)
{
@ -140,6 +156,22 @@ void musrt0_cleanup(TSAXParser *saxParser, PStartupHandler *startupHandler, PMsr
}
//--------------------------------------------------------------------------
/**
* <p>The musrt0 program is used to set graphically t0's, data- and background-ranges.
* For a detailed description/usage of the program, please see
* \htmlonly <a href="https://intranet.psi.ch/MUSR/MusrFit">musrt0 online help</a>
* \endhtmlonly
* \latexonly musrt0 online help: \texttt{https://intranet.psi.ch/MUSR/MusrFit}
* \endlatexonly
*
* <b>return:</b>
* - PMUSR_SUCCESS if everthing went smooth
* - PMUSR_WRONG_STARTUP_SYNTAX if syntax error is encountered
* - line number if an error in the msr-file was encountered which cannot be handled.
*
* \param argc number of input arguments
* \param argv list of input arguments
*/
Int_t main(Int_t argc, Char_t *argv[])
{
Bool_t show_syntax = false;
@ -622,5 +654,5 @@ Int_t main(Int_t argc, Char_t *argv[])
// clean up
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
return 0;
return PMUSR_SUCCESS;
}

View File

@ -50,8 +50,7 @@ using namespace std;
//--------------------------------------------------------------------------
/**
* <p>
*
* <p>Sends the usage description to the standard output.
*/
void musrview_syntax()
{
@ -71,6 +70,23 @@ void musrview_syntax()
}
//--------------------------------------------------------------------------
/**
* <p>The musrview program is used to show muSR fit results in graphical form.
* From it also Fourier transforms, difference between data an theory can be formed.
* For a detailed description/usage of the program, please see
* \htmlonly <a href="https://intranet.psi.ch/MUSR/MusrFit">musrview online help</a>
* \endhtmlonly
* \latexonly musrview online help: \texttt{https://intranet.psi.ch/MUSR/MusrFit}
* \endlatexonly
*
* <b>return:</b>
* - PMUSR_SUCCESS if everthing went smooth
* - PMUSR_WRONG_STARTUP_SYNTAX if syntax error is encountered
* - line number if an error in the msr-file was encountered which cannot be handled.
*
* \param argc number of input arguments
* \param argv list of input arguments
*/
int main(int argc, char *argv[])
{
bool show_syntax = false;
@ -214,13 +230,6 @@ int main(int argc, char *argv[])
}
}
}
/*
cout << endl << ">> plotList:" << endl;
for(unsigned int i=0; i<plotList.size(); i++){
cout << plotList[i] << ", ";
}
cout << endl;
*/
// read all the necessary runs (raw data)
PRunDataHandler *dataHandler;
@ -249,7 +258,6 @@ cout << endl;
}
}
if (runPresent) {
//cout << endl << ">> Will add run " << i << endl;
success = runListCollection->Add(i, kView);
if (!success) {
cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
@ -358,5 +366,5 @@ cout << endl;
runListCollection = 0;
}
return 0;
return PMUSR_SUCCESS;
}