From 5d124b3d79c9cd42b82138e3665f97ff55cb1208 Mon Sep 17 00:00:00 2001 From: nemu Date: Mon, 31 May 2010 08:25:57 +0000 Subject: [PATCH] added more docu --- doc/musrfit_dox.cfg | 19 ++- src/classes/PMsrHandler.cpp | 283 +++++++++++++++++++--------------- src/classes/PMusr.cpp | 108 +++++++++++-- src/classes/PMusrCanvas.cpp | 252 ++++++++++++++---------------- src/classes/PMusrT0.cpp | 138 ++++++++++------- src/classes/PRunAsymmetry.cpp | 104 ++++++++----- src/include/PMsrHandler.h | 2 +- src/include/PMusr.h | 52 +++---- src/include/PMusrCanvas.h | 152 +++++++++--------- src/include/PMusrT0.h | 53 ++++--- src/include/PRunAsymmetry.h | 14 +- 11 files changed, 669 insertions(+), 508 deletions(-) diff --git a/doc/musrfit_dox.cfg b/doc/musrfit_dox.cfg index 6d1abbc2..a44f06e9 100644 --- a/doc/musrfit_dox.cfg +++ b/doc/musrfit_dox.cfg @@ -461,19 +461,23 @@ WARN_LOGFILE = INPUT = ../src/include/PFitterFcn.h \ ../src/include/PFitter.h \ + ../src/include/PFourier.h \ ../src/include/PFunctionGrammar.h \ ../src/include/PFunction.h \ ../src/include/PFunctionHandler.h \ + ../src/include/PMsr2Data.h \ ../src/include/PMsrHandler.h \ ../src/include/PMusrCanvas.h \ ../src/include/PMusrCanvasLinkDef.h \ ../src/include/PMusr.h \ + ../src/include/PMusrT0.h \ + ../src/include/PMusrT0LinkDef.h \ ../src/include/PRunAsymmetry.h \ ../src/include/PRunBase.h \ ../src/include/PRunDataHandler.h \ ../src/include/PRunListCollection.h \ + ../src/include/PRunMuMinus.h \ ../src/include/PRunNonMusr.h \ - ../src/include/PRunRRF.h \ ../src/include/PRunSingleHisto.h \ ../src/include/PStartupHandler.h \ ../src/include/PStartupHandlerLinkDef.h \ @@ -481,28 +485,33 @@ INPUT = ../src/include/PFitterFcn.h \ ../src/include/PUserFcnBase.h \ ../src/include/PUserFcnBaseLinkDef.h \ ../src/include/PUserFcn.h \ - ../src/include/PUserFcnLinkDef.h \ ../src/classes/PFitter.cpp \ ../src/classes/PFitterFcn.cpp \ + ../src/classes/PFourier.cpp \ ../src/classes/PFunction.cpp \ ../src/classes/PFunctionHandler.cpp \ + ../src/classes/PMsr2Data.cpp \ ../src/classes/PMsrHandler.cpp \ ../src/classes/PMusrCanvas.cpp \ + ../src/classes/PMusr.cpp \ + ../src/classes/PMusrT0.cpp \ ../src/classes/PRunAsymmetry.cpp \ ../src/classes/PRunBase.cpp \ ../src/classes/PRunDataHandler.cpp \ ../src/classes/PRunListCollection.cpp \ + ../src/classes/PRunMuMinus.cpp \ ../src/classes/PRunNonMusr.cpp \ - ../src/classes/PRunRRF.cpp \ ../src/classes/PRunSingleHisto.cpp \ ../src/classes/PStartupHandler.cpp \ ../src/classes/PTheory.cpp \ ../src/classes/PUserFcnBase.cpp \ ../src/classes/PUserFcn.cpp \ + ../src/msr2data.cpp \ + ../src/msr2msr.cpp \ ../src/musrfit.cpp \ - ../src/musrview.cpp \ ../src/musrparam.cpp \ - ../src/msr2msr.cpp + ../src/musrt0.cpp \ + ../src/musrview.cpp # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 5f661f83..6f766b34 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -48,9 +48,9 @@ using namespace std; // Constructor //-------------------------------------------------------------------------- /** - *

+ *

Constructor * - * \param fileName + * \param fileName name of a msr-file. */ PMsrHandler::PMsrHandler(const Char_t *fileName) : fFileName(fileName) { @@ -67,6 +67,7 @@ PMsrHandler::PMsrHandler(const Char_t *fileName) : fFileName(fileName) fFuncHandler = 0; + // check if the file name given is a path-file-name, and if yes, split it into path and file name. if (fFileName.Contains("/")) { Int_t idx = -1; while (fFileName.Index("/", idx+1) != -1) { @@ -83,7 +84,7 @@ PMsrHandler::PMsrHandler(const Char_t *fileName) : fFileName(fileName) // Destructor //-------------------------------------------------------------------------- /** - *

+ *

Destructor */ PMsrHandler::~PMsrHandler() { @@ -106,12 +107,11 @@ PMsrHandler::~PMsrHandler() // ReadMsrFile (public) //-------------------------------------------------------------------------- /** - *

+ *

Reads and parses a msr-file. * *

return: * - PMUSR_SUCCESS if everything is OK * - line number if an error in the MSR file was encountered which cannot be handled. - * */ Int_t PMsrHandler::ReadMsrFile() { @@ -303,7 +303,15 @@ Int_t PMsrHandler::ReadMsrFile() // WriteMsrLogFile (public) //-------------------------------------------------------------------------- /** - *

+ *

Writes a mlog-file. + * + *

return: + * - PMUSR_SUCCESS everything is OK + * - PMUSR_MSR_LOG_FILE_WRITE_ERROR msr-/mlog-file couldn't be opened + * - PMUSR_MSR_SYNTAX_ERROR a syntax error has been encountered + * + * \param messages if true some additional messages concerning the statistic block are written. + * When using musrt0, messages will be set to false. */ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) { @@ -1095,20 +1103,24 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) // SetMsrParamValue (public) //-------------------------------------------------------------------------- /** - *

+ *

Sets the fit parameter value at position idx. * - * \param i - * \param value + *

return: + * - true if idx is within range + * - false if idx is larger than the fit parameter vector. + * + * \param idx index of the fit parameter value. + * \param value fit parameter value to be set. */ -Bool_t PMsrHandler::SetMsrParamValue(UInt_t i, Double_t value) +Bool_t PMsrHandler::SetMsrParamValue(UInt_t idx, Double_t value) { - if (i > fParam.size()) { - cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); + if (idx >= fParam.size()) { + cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is >= than the number of fit parameters " << fParam.size(); cerr << endl; return false; } - fParam[i].fValue = value; + fParam[idx].fValue = value; return true; } @@ -1117,20 +1129,25 @@ Bool_t PMsrHandler::SetMsrParamValue(UInt_t i, Double_t value) // SetMsrParamStep (public) //-------------------------------------------------------------------------- /** - *

+ *

Sets the fit parameter step value (initial step size for minuit2) at positon idx. + * After a successful fit, the negative error will be writen. * - * \param i - * \param value + *

return: + * - true if idx is within range + * - false if idx is larger than the fit parameter vector. + * + * \param idx index fo the fit parameter step value + * \param value fit parameter step value to be set. */ -Bool_t PMsrHandler::SetMsrParamStep(UInt_t i, Double_t value) +Bool_t PMsrHandler::SetMsrParamStep(UInt_t idx, Double_t value) { - if (i > fParam.size()) { - cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); + if (idx >= fParam.size()) { + cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); cerr << endl; return false; } - fParam[i].fStep = value; + fParam[idx].fStep = value; return true; } @@ -1139,20 +1156,24 @@ Bool_t PMsrHandler::SetMsrParamStep(UInt_t i, Double_t value) // SetMsrParamPosErrorPresent (public) //-------------------------------------------------------------------------- /** - *

+ *

Sets the flag whether the fit parameter positive error value is persent. This at positon idx. * - * \param i - * \param value + *

return: + * - true if idx is within range + * - false if idx is larger than the fit parameter vector. + * + * \param idx index fo the fit parameter positive error value + * \param value fit parameter positive error value present. */ -Bool_t PMsrHandler::SetMsrParamPosErrorPresent(UInt_t i, Bool_t value) +Bool_t PMsrHandler::SetMsrParamPosErrorPresent(UInt_t idx, Bool_t value) { - if (i > fParam.size()) { - cerr << endl << "PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); + if (idx >= fParam.size()) { + cerr << endl << "PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); cerr << endl; return false; } - fParam[i].fPosErrorPresent = value; + fParam[idx].fPosErrorPresent = value; return true; } @@ -1161,21 +1182,25 @@ Bool_t PMsrHandler::SetMsrParamPosErrorPresent(UInt_t i, Bool_t value) // SetMsrParamPosError (public) //-------------------------------------------------------------------------- /** - *

+ *

Sets the fit parameter positive error value at positon idx. * - * \param i - * \param value + *

return: + * - true if idx is within range + * - false if idx is larger than the fit parameter vector. + * + * \param idx index fo the fit parameter positive error value + * \param value fit parameter positive error value to be set. */ -Bool_t PMsrHandler::SetMsrParamPosError(UInt_t i, Double_t value) +Bool_t PMsrHandler::SetMsrParamPosError(UInt_t idx, Double_t value) { - if (i > fParam.size()) { - cerr << endl << "PMsrHandler::SetMsrParamPosError(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); + if (idx >= fParam.size()) { + cerr << endl << "PMsrHandler::SetMsrParamPosError(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); cerr << endl; return false; } - fParam[i].fPosErrorPresent = true; - fParam[i].fPosError = value; + fParam[idx].fPosErrorPresent = true; + fParam[idx].fPosError = value; return true; } @@ -1184,11 +1209,11 @@ Bool_t PMsrHandler::SetMsrParamPosError(UInt_t i, Double_t value) // SetMsrT0Entry (public) //-------------------------------------------------------------------------- /** - *

+ *

Sets the t0 entries for a given runNo and a given histogram index idx. * - * \param runNo - * \param idx - * \param bin + * \param runNo msr-file run number + * \param idx msr-file histogram index + * \param bin t0 bin value */ void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin) { @@ -1216,7 +1241,7 @@ void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin) * \param runNo msr-file run number * \param addRunIdx msr-file addrun index, e.g. if 2 addruns are present addRunIdx can take the values 0 or 1. * \param histoIdx msr-file histogram index for an addrun. - * \param bin histogram t0 value. + * \param bin t0 bin value. */ void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Int_t bin) { @@ -1245,15 +1270,15 @@ void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoI // SetMsrDataRangeEntry (public) //-------------------------------------------------------------------------- /** - *

+ *

Sets the data range entries for a given runNo and a given histogram index idx. * - * \param runNo - * \param idx - * \param bin + * \param runNo msr-file run number + * \param idx 0=start bin index, 1=end bin index + * \param bin data range bin value */ void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) { - if (runNo > fRuns.size()) { // error + if (runNo >= fRuns.size()) { // error cerr << endl << "PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); cerr << endl; return; @@ -1266,15 +1291,15 @@ void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) // SetMsrBkgRangeEntry (public) //-------------------------------------------------------------------------- /** - *

+ *

Sets the background range entries for a given runNo and a given histogram index idx. * - * \param runNo - * \param idx - * \param bin + * \param runNo msr-file run number + * \param idx 0=start bin index, 1=end bin index + * \param bin background range bin value */ void PMsrHandler::SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) { - if (runNo > fRuns.size()) { // error + if (runNo >= fRuns.size()) { // error cerr << endl << "PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); cerr << endl; return; @@ -1292,12 +1317,16 @@ void PMsrHandler::SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) * parameter is NOT used at all. This is stupid! Hence one has to check * if the parameter is used at all and if not, it has to be fixed. * - * \param paramNo + *

return: + * - 0 if the parameter is not used. + * - a value > 0 if the parameter is used. + * + * \param paramNo parameter number */ Int_t PMsrHandler::ParameterInUse(UInt_t paramNo) { // check that paramNo is within acceptable range - if ((paramNo < 0) || (paramNo > fParam.size())) + if ((paramNo < 0) || (paramNo >= fParam.size())) return -1; return fParamInUse[paramNo]; @@ -1321,6 +1350,10 @@ Int_t PMsrHandler::ParameterInUse(UInt_t paramNo) * when starting * \endcode * + * return: + * - true is fit parameter lines are OK. + * - false otherwise + * * \param lines is a list of lines containing the fitparameter block */ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) @@ -1524,9 +1557,12 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) // HandleTheoryEntry (private) //-------------------------------------------------------------------------- /** - *

+ *

Just stores the THEORY block lines. * - * \param lines is a list of lines containing the fitparameter block + * return: + * - true always + * + * \param lines is a list of lines containing the theory block */ Bool_t PMsrHandler::HandleTheoryEntry(PMsrLines &lines) { @@ -1540,9 +1576,13 @@ Bool_t PMsrHandler::HandleTheoryEntry(PMsrLines &lines) // HandleFunctionsEntry (private) //-------------------------------------------------------------------------- /** - *

+ *

Parses the FUNCTIONS block of the msr-file. * - * \param lines is a list of lines containing the fitparameter block + * return: + * - true if the parsing was successful. + * - false otherwise + * + * \param lines is a list of lines containing the functions block */ Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines) { @@ -1576,9 +1616,13 @@ Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines) // HandleRunEntry (private) //-------------------------------------------------------------------------- /** - *

+ *

Parses the RUN blocks of the msr-file. * - * \param lines is a list of lines containing the fitparameter block + * return: + * - true if successful + * - false otherwise + * + * \param lines is a list of lines containing the run blocks */ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) { @@ -2121,6 +2165,10 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) * It is used to filter strings like: map1 or fun4. At the moment only * the filter strings 'map', 'fun', and 'par' are supported. * + * return: + * - true if successful + * - false otherwise + * * \param str input string * \param filter filter string * \param offset it is used to offset to found number, e.g. strX -> no = X+offset @@ -2158,10 +2206,12 @@ Bool_t PMsrHandler::FilterNumber(TString str, const Char_t *filter, Int_t offset // HandleCommandsEntry (private) //-------------------------------------------------------------------------- /** - *

In the command block there shall be a new command which can be used - * to switch between chi2 and maximum_likelihood!! + *

Just copies the COMMAND block lines. * - * \param lines is a list of lines containing the fitparameter block + * return: + * - true + * + * \param lines is a list of lines containing the command block */ Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines) { @@ -2184,7 +2234,7 @@ Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines) // InitFourierParameterStructure (private) //-------------------------------------------------------------------------- /** - *

+ *

Initializes the Fourier parameter structure. * * \param fourier fourier parameters */ @@ -2207,7 +2257,11 @@ void PMsrHandler::InitFourierParameterStructure(PMsrFourierStructure &fourier) // HandleFourierEntry (private) //-------------------------------------------------------------------------- /** - *

+ *

Parses the Fourier block of a msr-file. + * + * return: + * - true if successful + * - false otherwise * * \param lines is a list of lines containing the fourier parameter block */ @@ -2448,9 +2502,13 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) // HandlePlotEntry (private) //-------------------------------------------------------------------------- /** - *

+ *

Parses the PLOT block of a msr-file. * - * \param lines is a list of lines containing the fitparameter block + * return: + * - true if successful + * - false otherwise + * + * \param lines is a list of lines containing the plot block */ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) { @@ -2968,9 +3026,13 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // HandleStatisticEntry (private) //-------------------------------------------------------------------------- /** - *

+ *

Handles the STATISTIC block of a msr-file. * - * \param lines is a list of lines containing the fitparameter block + * return: + * - true if successful + * - false otherwise + * + * \param lines is a list of lines containing the statistic block */ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines) { @@ -3057,16 +3119,6 @@ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines) fStatistic.fStatLines.push_back(lines[i]); } -// cout << endl << "Statistic:"; -// cout << endl << " Date & Time: " << fStatistic.fDate.Data(); -// if (fStatistic.fChisq) { // chisq -// cout << endl << " chisq = " << fStatistic.fMin; -// cout << endl << " NDF = " << fStatistic.fNdf; -// } else { // maximum likelihood -// cout << endl << " maxLH = " << fStatistic.fMin; -// cout << endl << " NDF = " << fStatistic.fNdf; -// } - return true; } @@ -3074,11 +3126,12 @@ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines) // FillParameterInUse (private) //-------------------------------------------------------------------------- /** - *

+ *

Fills the fParamInUse vector. An element of the vector will be 0 if the fit parameter + * is not used at all, otherwise it will be > 0. * - * \param theory - * \param funcs - * \param run + * \param theory msr-file THEROY block lines + * \param funcs msr-file FUNCTIONS block lines + * \param run msr-file RUN blocks lines */ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLines &run) { @@ -3095,7 +3148,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi fParamInUse.push_back(0); // go through all the theory lines ------------------------------------ -//cout << endl << ">> theory block check ..."; for (iter = theory.begin(); iter != theory.end(); ++iter) { // remove potential comments str = iter->fLine; @@ -3118,13 +3170,11 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi ival = str.Atoi(); if ((ival > 0) && (ival < (Int_t)fParam.size()+1)) { fParamInUse[ival-1]++; -//cout << endl << ">>>> theo: param no : " << ival; } } else if (str.Contains("map")) { // map if (FilterNumber(str, "map", MSR_PARAM_MAP_OFFSET, ival)) map.push_back(ival-MSR_PARAM_MAP_OFFSET); } else if (str.Contains("fun")) { // fun -//cout << endl << "theo:fun: " << str.Data(); if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, ival)) fun.push_back(ival-MSR_PARAM_FUN_OFFSET); } @@ -3138,7 +3188,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi } // go through all the function lines: 1st time ----------------------------- -//cout << endl << ">> function block check (1st time) ..."; for (iter = funcs.begin(); iter != funcs.end(); ++iter) { // remove potential comments str = iter->fLine; @@ -3148,9 +3197,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // everything to lower case str.ToLower(); -// cout << endl << "-----------------------"; -// cout << endl << ">> " << str.Data(); - tokens = str.Tokenize(" /t"); if (!tokens) continue; @@ -3164,9 +3210,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // check if fun number is used, and if yes, filter parameter numbers and maps TString sstr; -//cout << endl << ">> fun.size() = " << fun.size(); for (UInt_t i=0; i> funNo: " << fun[i] << ", funNo: " << funNo; if (fun[i] == funNo) { // function number found // filter for parX sstr = iter->fLine; @@ -3174,14 +3218,12 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi while (sstr.Index("par") != -1) { memset(sval, 0, sizeof(sval)); sstr = &sstr[sstr.Index("par")+3]; // trunc sstr -//cout << endl << ">> par:sstr: " << sstr.Data(); for (Int_t j=0; j>>> parX from func 1st, X = " << ival; fParamInUse[ival-1]++; } @@ -3190,14 +3232,12 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi while (sstr.Index("map") != -1) { memset(sval, 0, sizeof(sval)); sstr = &sstr[sstr.Index("map")+3]; // trunc sstr -//cout << endl << ">> map:sstr: " << sstr.Data(); for (Int_t j=0; j>>> mapX from func 1st, X = " << ival; // check if map value already in map, otherwise add it if (ival > 0) { UInt_t pos; @@ -3222,7 +3262,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi } // go through all the run block lines ------------------------------------- -//cout << endl << ">> run block check (1st time) ..."; for (iter = run.begin(); iter != run.end(); ++iter) { // remove potential comments str = iter->fLine; @@ -3250,13 +3289,11 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi if (str.IsDigit()) { ival = str.Atoi(); fParamInUse[ival-1]++; -//cout << endl << ">>>> run : parameter no : " << ival; } // check if fun if (str.Contains("fun")) { if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, ival)) { fun.push_back(ival-MSR_PARAM_FUN_OFFSET); -//cout << endl << ">>>> run : fun no : " << ival-MSR_PARAM_FUN_OFFSET; } } @@ -3269,14 +3306,12 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // handle the maps if (str.Contains("map")) { -//cout << endl << ">> " << str.Data(); // tokenize string tokens = str.Tokenize(" \t"); if (!tokens) continue; // get the parameter number via map -//cout << endl << ">> map.size() = " << map.size(); for (UInt_t i=0; i 0) { fParamInUse[ival-1]++; // this is OK since map is ranging from 1 .. -//cout << endl << ">>>> param no : " << ival << ", via map no : " << map[i]; } } } @@ -3302,7 +3336,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi } // go through all the function lines: 2nd time ----------------------------- -//cout << endl << ">> function block check (2nd time) ..."; for (iter = funcs.begin(); iter != funcs.end(); ++iter) { // remove potential comments str = iter->fLine; @@ -3312,9 +3345,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // everything to lower case str.ToLower(); -// cout << endl << "==========================="; -// cout << endl << ">> " << str.Data(); - tokens = str.Tokenize(" /t"); if (!tokens) continue; @@ -3329,7 +3359,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // check if fun number is used, and if yes, filter parameter numbers and maps TString sstr; for (UInt_t i=0; i> funNo: " << fun[i] << ", funNo: " << funNo; if (fun[i] == funNo) { // function number found // filter for parX sstr = iter->fLine; @@ -3344,7 +3373,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi } sscanf(sval, "%d", &ival); fParamInUse[ival-1]++; -//cout << endl << ">>>> parX from func 2nd, X = " << ival; } // filter for mapX @@ -3358,7 +3386,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi sval[j] = sstr[j]; } sscanf(sval, "%d", &ival); -//cout << endl << ">>>> mapX from func 2nd, X = " << ival; // check if map value already in map, otherwise add it if (ival > 0) { UInt_t pos; @@ -3382,7 +3409,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi } // go through all the run block lines 2nd time to filter remaining maps -//cout << endl << ">> run block check (2nd time) ..."; for (iter = run.begin(); iter != run.end(); ++iter) { // remove potential comments str = iter->fLine; @@ -3394,14 +3420,12 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // handle the maps if (str.Contains("map")) { -//cout << endl << ">> " << str.Data(); // tokenize string tokens = str.Tokenize(" \t"); if (!tokens) continue; // get the parameter number via map -//cout << endl << ">> map.size() = " << map.size(); for (UInt_t i=0; i 0) { fParamInUse[ival-1]++; // this is OK since map is ranging from 1 .. -//cout << endl << ">>>> param no : " << ival << ", via map no : " << map[i]; } } } @@ -3426,11 +3449,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi } } -// cout << endl << ">> fParamInUse: "; -// for (UInt_t i=0; i + *

Checks if all the fit parameters are unique. If not parX, parY will show + * the first occurence of equal fit parameter names. * - * \param parX - * \param parY + * return: + * - true if the fit parameter names are unique. + * - false otherwise + * + * \param parX index of the 1st fit parameter name for which there is a counter part. + * \param parY index of the counter part fit parameter name. */ Bool_t PMsrHandler::CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY) { @@ -3478,7 +3501,11 @@ Bool_t PMsrHandler::CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY) //-------------------------------------------------------------------------- /** *

Checks if map entries found in the theory- or function-block are also - * present in the run-block, if yes return true otherwise return false. + * present in the run-block. + * + * return: + * - true if maps or OK + * - false otherwise */ Bool_t PMsrHandler::CheckMaps() { @@ -3584,7 +3611,11 @@ Bool_t PMsrHandler::CheckMaps() //-------------------------------------------------------------------------- /** *

Checks if fun entries found in the theory- and run-block are also - * present in the functions-block, if yes return true otherwise return false. + * present in the functions-block. + * + * return: + * - true if fun entries or present in the FUNCTIONS block + * - false otherwise */ Bool_t PMsrHandler::CheckFuncs() { @@ -3672,6 +3703,10 @@ Bool_t PMsrHandler::CheckFuncs() //-------------------------------------------------------------------------- /** *

Checks if histogram grouping makes any sense. + * + * return: + * - true if histogram grouping seems OK + * - false otherwise */ Bool_t PMsrHandler::CheckHistoGrouping() { @@ -3722,7 +3757,11 @@ Bool_t PMsrHandler::CheckHistoGrouping() // CheckAddRunParameters (private) //-------------------------------------------------------------------------- /** - *

Check if addrun is present that given parameters make any sense. + *

In case addrun is present check that if addt0's are given there are as many addt0's than addrun's. + * + * return: + * - true if either no addt0 present, or # of addrun's == # of addt0's. + * - false otherwise */ Bool_t PMsrHandler::CheckAddRunParameters() { diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index 75445470..40eb7151 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -44,7 +44,7 @@ using namespace std; // Constructor //-------------------------------------------------------------------------- /** - *

Holds the muSR data which will be fitted. + *

Constructor */ PRunData::PRunData() { @@ -63,7 +63,7 @@ PRunData::PRunData() // Destructor //-------------------------------------------------------------------------- /** - *

Cleans up + *

Destructor. */ PRunData::~PRunData() { @@ -112,7 +112,7 @@ void PRunData::ReplaceTheory(const PDoubleVector &theo) // Constructor //-------------------------------------------------------------------------- /** - *

Holds non-muSR data raw data. + *

Constructor. */ PNonMusrRawRunData::PNonMusrRawRunData() { @@ -133,7 +133,7 @@ PNonMusrRawRunData::PNonMusrRawRunData() // Destructor //-------------------------------------------------------------------------- /** - *

Destructor. Cleans up + *

Destructor. */ PNonMusrRawRunData::~PNonMusrRawRunData() { @@ -173,7 +173,7 @@ void PNonMusrRawRunData::SetLabel(const UInt_t idx, const TString str) // AppendSubData //-------------------------------------------------------------------------- /** - *

Modifies the data set at position idx. In case idx is larges than the number + *

Modifies the data set at position idx. In case idx is larger than the number * of data sets, only a warning will be sent to stderr. * * \param idx index at which position the label should be set @@ -193,7 +193,7 @@ void PNonMusrRawRunData::AppendSubData(const UInt_t idx, const Double_t dval) // AppendSubErrData //-------------------------------------------------------------------------- /** - *

Modifies the error-data set at position idx. In case idx is larges than the number + *

Modifies the error-data set at position idx. In case idx is larger than the number * of error-data sets, only a warning will be sent to stderr. * * \param idx index at which position the label should be set @@ -217,7 +217,7 @@ void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval) // Constructor //-------------------------------------------------------------------------- /** - *

Holds muSR raw run data. + *

Constructor */ PRawRunData::PRawRunData() { @@ -234,7 +234,7 @@ PRawRunData::PRawRunData() // Destructor //-------------------------------------------------------------------------- /** - *

Destructor. Cleans up. + *

Destructor. */ PRawRunData::~PRawRunData() { @@ -255,6 +255,10 @@ PRawRunData::~PRawRunData() /** *

Returns the temperature of a muSR run. * + * return: + * - temperature value, if idx is within proper boundaries + * - PMUSR_UNDEFINED, otherwise + * * \param idx index of the temperature whished */ const Double_t PRawRunData::GetTemperature(const UInt_t idx) @@ -273,7 +277,11 @@ const Double_t PRawRunData::GetTemperature(const UInt_t idx) /** *

Returns the error estimate of the temperature of a muSR run. * - * \param idx index of the temperature whished + * return: + * - temperature error value, if idx is within proper boundaries + * - PMUSR_UNDEFINED, otherwise + * + * \param idx index of the temperature error whished */ const Double_t PRawRunData::GetTempError(const UInt_t idx) { @@ -291,6 +299,10 @@ const Double_t PRawRunData::GetTempError(const UInt_t idx) /** *

Returns the value of a ring anode high voltage. (idx = 0: RAL, 1: RAR, 2: RAT, 3: RAB) * + * return: + * - ring anode HV value, if idx is within proper boundaries + * - PMUSR_UNDEFINED, otherwise + * * \param idx index of the ring anode whished */ const Double_t PRawRunData::GetRingAnode(const UInt_t idx) @@ -309,6 +321,10 @@ const Double_t PRawRunData::GetRingAnode(const UInt_t idx) /** *

Returns a T0 value. * + * return: + * - t0 value, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the T0 value whished */ const Int_t PRawRunData::GetT0(const UInt_t idx) @@ -327,6 +343,10 @@ const Int_t PRawRunData::GetT0(const UInt_t idx) /** *

Returns an estimated T0 value. * + * return: + * - estimated t0 value, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the T0 value whished */ const Int_t PRawRunData::GetT0Estimated(const UInt_t idx) @@ -346,6 +366,10 @@ const Int_t PRawRunData::GetT0Estimated(const UInt_t idx) *

Returns the background bin range (start, stop) from the data file. * Currently only used in mud-files. * + * return: + * - (start, stop) values, if idx is within proper boundaries + * - (-1, -1), otherwise + * * \param idx index of the background range. */ const PIntPair PRawRunData::GetBkgBin(const UInt_t idx) @@ -371,6 +395,10 @@ const PIntPair PRawRunData::GetBkgBin(const UInt_t idx) *

Returns the data range (first good bin, last good bin) from the data file. * Currently only used in mud-files. * + * return: + * - (first good bin, last good bin) values, if idx is within proper boundaries + * - (-1, -1), otherwise + * * \param idx index of the data range */ const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx) @@ -395,6 +423,10 @@ const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx) /** *

Returns a raw muSR run histogram. * + * return: + * - pointer of the data vector, if idx is within proper boundaries + * - 0, otherwise + * * \param idx histo number index */ const PDoubleVector* PRawRunData::GetDataBin(const UInt_t idx) @@ -534,7 +566,6 @@ PMsrRunBlock::PMsrRunBlock() fBetaParamNo = -1; // undefined beta parameter number fNormParamNo = -1; // undefined norm parameter number fBkgFitParamNo = -1; // undefined background parameter number - fPhaseParamNo = -1; // undefined phase parameter number fLifetimeParamNo = -1; // undefined lifetime parameter number fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview) for (UInt_t i=0; i<2; i++) @@ -583,7 +614,6 @@ void PMsrRunBlock::CleanUp() fBetaParamNo = -1; // undefined beta parameter number fNormParamNo = -1; // undefined norm parameter number fBkgFitParamNo = -1; // undefined background parameter number - fPhaseParamNo = -1; // undefined phase parameter number fLifetimeParamNo = -1; // undefined lifetime parameter number fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview) fBkgFix[0] = PMUSR_UNDEFINED; // undefined fixed background for forward @@ -619,6 +649,10 @@ void PMsrRunBlock::CleanUp() /** *

get run name at position idx * + * return: + * - pointer of the run name string, if idx is within proper boundaries + * - 0, otherwise + * * \param idx index of the run name to be returned */ TString* PMsrRunBlock::GetRunName(UInt_t idx) @@ -657,6 +691,10 @@ void PMsrRunBlock::SetRunName(TString &str, Int_t idx) /** *

get beamline name at position idx * + * return: + * - pointer of the beamline string, if idx is within proper boundaries + * - 0, otherwise + * * \param idx index of the beamline to be returned */ TString* PMsrRunBlock::GetBeamline(UInt_t idx) @@ -695,6 +733,10 @@ void PMsrRunBlock::SetBeamline(TString &str, Int_t idx) /** *

get institute name at position idx * + * return: + * - pointer of the institute string, if idx is within proper boundaries + * - 0, otherwise + * * \param idx index of the institute to be returned */ TString* PMsrRunBlock::GetInstitute(UInt_t idx) @@ -733,6 +775,10 @@ void PMsrRunBlock::SetInstitute(TString &str, Int_t idx) /** *

get file format name at position idx * + * return: + * - pointer of the file format string, if idx is within proper boundaries + * - 0, otherwise + * * \param idx index of the file format to be returned */ TString* PMsrRunBlock::GetFileFormat(UInt_t idx) @@ -771,6 +817,10 @@ void PMsrRunBlock::SetFileFormat(TString &str, Int_t idx) /** *

get forward histogram value at position idx * + * return: + * - forward histogram number, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the forward histogram value to be returned */ Int_t PMsrRunBlock::GetForwardHistoNo(UInt_t idx) @@ -811,6 +861,10 @@ void PMsrRunBlock::SetForwardHistoNo(Int_t histoNo, Int_t idx) /** *

get backward histogram value at position idx * + * return: + * - backward histogram number, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the map value to be returned */ Int_t PMsrRunBlock::GetBackwardHistoNo(UInt_t idx) @@ -851,6 +905,10 @@ void PMsrRunBlock::SetBackwardHistoNo(Int_t histoNo, Int_t idx) /** *

get map value at position idx * + * return: + * - map value, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the map value to be returned */ Int_t PMsrRunBlock::GetMap(UInt_t idx) @@ -889,6 +947,10 @@ void PMsrRunBlock::SetMap(Int_t mapVal, Int_t idx) /** *

get background fixed value at position idx * + * return: + * - fixed background value, if idx is within proper boundaries + * - PMUSR_UNDEFINED, otherwise + * * \param idx index of the background fixed value to be returned */ Double_t PMsrRunBlock::GetBkgFix(UInt_t idx) @@ -925,6 +987,10 @@ void PMsrRunBlock::SetBkgFix(Double_t dval, Int_t idx) /** *

get background range at position idx * + * return: + * - background range value, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the background range to be returned */ Int_t PMsrRunBlock::GetBkgRange(UInt_t idx) @@ -963,6 +1029,10 @@ void PMsrRunBlock::SetBkgRange(Int_t ival, Int_t idx) /** *

get data range at position idx * + * return: + * - data range value, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the data range to be returned */ Int_t PMsrRunBlock::GetDataRange(UInt_t idx) @@ -1000,6 +1070,10 @@ void PMsrRunBlock::SetDataRange(Int_t ival, Int_t idx) /** *

get T0 value at position idx * + * return: + * - t0 value, if idx is within proper boundaries + * - -1, otherwise + * * \param idx index of the T0 value to be returned */ Int_t PMsrRunBlock::GetT0(UInt_t idx) @@ -1038,6 +1112,10 @@ void PMsrRunBlock::SetT0(Int_t ival, Int_t idx) /** *

get add T0 size of the addrun at index addRunIdx * + * return: + * - addt0 value, if idx is within proper boundaries + * - -1, otherwise + * * \param addRunIdx index of the addrun */ Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx) @@ -1057,6 +1135,10 @@ Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx) /** *

get add T0 of the addrun (index addRunIdx) at index histoIdx * + * return: + * - addt0 value, if indices are within proper boundaries + * - -1, otherwise + * * \param addRunIdx index of the addrun * \param histoIdx index of the add backward histo number value */ @@ -1105,6 +1187,10 @@ void PMsrRunBlock::SetAddT0(Int_t ival, UInt_t addRunIdx, UInt_t histoNoIdx) /** *

get fit range value at position idx * + * return: + * - fit range value, if idx is within proper boundaries + * - PMUSR_UNDEFINED, otherwise + * * \param idx index of the fit range value to be returned */ Double_t PMsrRunBlock::GetFitRange(UInt_t idx) diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index e4433752..5bb6e6e3 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -47,7 +47,7 @@ ClassImpQ(PMusrCanvas) // Constructor //-------------------------------------------------------------------------- /** - * + *

Constructor */ PMusrCanvas::PMusrCanvas() { @@ -90,7 +90,16 @@ PMusrCanvas::PMusrCanvas() // Constructor //-------------------------------------------------------------------------- /** + *

Constructor. * + * \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. + * \param ww width (in pixels) of the canvas. + * \param wh height (in pixels) of the canvas. + * \param batch flag: if set true, the canvas will not be displayed. This is used when just dumping of a + * graphical output file is wished. */ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, @@ -117,7 +126,19 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title, // Constructor //-------------------------------------------------------------------------- /** + *

Constructor. * + * \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. + * \param ww width (in pixels) of the canvas. + * \param wh height (in pixels) of the canvas. + * \param fourierDefault structure holding the pre-defined settings for a Fourier transform + * \param markerList pre-defined list of markers + * \param colorList pre-defined list of colors + * \param batch flag: if set true, the canvas will not be displayed. This is used when just dumping of a + * graphical output file is wished. */ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, @@ -147,11 +168,10 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title, // Destructor //-------------------------------------------------------------------------- /** - * + *

Destructor. */ PMusrCanvas::~PMusrCanvas() { -//cout << "~PMusrCanvas() called. fMainCanvas name=" << fMainCanvas->GetName() << endl; // cleanup if (fCurrentFourierPhaseText) { delete fCurrentFourierPhaseText; @@ -231,6 +251,8 @@ PMusrCanvas::~PMusrCanvas() //-------------------------------------------------------------------------- /** *

Keep the msr-handler object pointer and fill the Fourier structure if present. + * + * \param msrHandler pointer of the msr-file handler. */ void PMusrCanvas::SetMsrHandler(PMsrHandler *msrHandler) { @@ -305,7 +327,7 @@ void PMusrCanvas::SetMsrHandler(PMsrHandler *msrHandler) // UpdateParamTheoryPad (public) //-------------------------------------------------------------------------- /** - *

+ *

Feeds the pad with the fit parameter informations, and refreshes the pad. */ void PMusrCanvas::UpdateParamTheoryPad() { @@ -423,7 +445,7 @@ void PMusrCanvas::UpdateParamTheoryPad() // UpdateDataTheoryPad (public) //-------------------------------------------------------------------------- /** - *

+ *

Feeds the pad with data/theory histograms (error graphs) and refreshes it. */ void PMusrCanvas::UpdateDataTheoryPad() { @@ -443,8 +465,6 @@ void PMusrCanvas::UpdateDataTheoryPad() } // check that the plottype and the fittype do correspond runNo = (UInt_t)plotInfo.fRuns[i]-1; -//cout << endl << ">> runNo = " << runNo; -//cout << endl; if (fPlotType != runs[runNo].GetFitType()) { fValid = false; cerr << endl << "PMusrCanvas::UpdateDataTheoryPad: **ERROR** plottype = " << fPlotType << ", fittype = " << runs[runNo].GetFitType() << ", however they have to correspond!"; @@ -536,7 +556,7 @@ void PMusrCanvas::UpdateDataTheoryPad() // UpdateInfoPad (public) //-------------------------------------------------------------------------- /** - *

+ *

Feeds the pad with the statistics block information and the legend and refreshes it. */ void PMusrCanvas::UpdateInfoPad() { @@ -641,7 +661,6 @@ void PMusrCanvas::UpdateInfoPad() // energy if present tstr += TString("E="); dval = fRunList->GetEnergy(*runs[runNo].GetRunName()); -//cout << endl << ">> dval = " << dval << " (Engery)"; if (dval == PMUSR_UNDEFINED) { tstr += TString("??,"); } else { @@ -663,8 +682,9 @@ void PMusrCanvas::UpdateInfoPad() // Done (SIGNAL) //-------------------------------------------------------------------------- /** - *

+ *

Signal emitted that the user wants to terminate the application. * + * \param status Status info */ void PMusrCanvas::Done(Int_t status) { @@ -675,8 +695,20 @@ void PMusrCanvas::Done(Int_t status) // HandleCmdKey (SLOT) //-------------------------------------------------------------------------- /** - *

+ *

Filters keyboard events, and if they are a command key (see below) carries out the + * necessary actions. + *

Currently implemented command keys: + * - 'q' quit musrview + * - 'd' toggle between difference view and data view + * - 'u' unzoom to the original plot range given in the msr-file. + * - 'f' Fourier transform data. + * - '+' increment the phase (real/imaginary Fourier). The phase step is defined in the musrfit_startup.xml + * - '-' decrement the phase (real/imaginary Fourier). The phase step is defined in the musrfit_startup.xml * + * \param event event type + * \param x character key + * \param y not used + * \param selected not used */ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) { @@ -686,13 +718,6 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) if (fBatchMode) return; -// cout << ">this " << this << endl; -// cout << ">fMainCanvas " << fMainCanvas << endl; -// cout << ">selected " << selected << endl; -// -//cout << "x : " << (Char_t)x << endl; -//cout << "px: " << (Char_t)fMainCanvas->GetEventX() << endl; - // handle keys and popup menu entries enum eKeySwitch {kNotRelevant, kData, kDiffData, kFourier, kDiffFourier, kFourierDiff}; eKeySwitch relevantKeySwitch = kNotRelevant; @@ -827,8 +852,9 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) // HandleMenuPopup (SLOT) //-------------------------------------------------------------------------- /** - *

+ *

Handles the Musrfit menu. * + * \param id identification key of the selected menu */ void PMusrCanvas::HandleMenuPopup(Int_t id) { @@ -1027,8 +1053,8 @@ void PMusrCanvas::HandleMenuPopup(Int_t id) // LastCanvasClosed (SLOT) //-------------------------------------------------------------------------- /** - *

- * + *

Slot called when the last canvas has been closed. Will emit Done(0) which will + * terminate the application. */ void PMusrCanvas::LastCanvasClosed() { @@ -1042,8 +1068,9 @@ void PMusrCanvas::LastCanvasClosed() // SaveGraphicsAndQuit //-------------------------------------------------------------------------- /** - *

+ *

Will save the canvas as graphics output. Needed in the batch mode of musrview. * + * \param fileName file name under which the canvas shall be saved. * \param graphicsFormat One of the supported graphics formats. */ void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat) @@ -1125,13 +1152,14 @@ void PMusrCanvas::InitFourier() // InitMusrCanvas (private) //-------------------------------------------------------------------------- /** - *

+ *

Initialize the class, and sets up the necessary objects. * - * \param title - * \param wtopx - * \param wtopy - * \param ww - * \param wh + * \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. + * \param ww width (in pixels) of the canvas. + * \param wh height (in pixels) of the canvas. */ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh) { @@ -1264,23 +1292,15 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, fMainCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", "PMusrCanvas", this, "HandleCmdKey(Int_t,Int_t,Int_t,TObject*)"); - -// cout << "this " << this << endl; -// cout << "fMainCanvas " << fMainCanvas << endl; -// cout << "fTitlePad " << fTitlePad << endl; -// cout << "fDataTheoryPad " << fDataTheoryPad << endl; -// cout << "fParameterPad " << fParameterPad << endl; -// cout << "fTheoryPad " << fTheoryPad << endl; -// cout << "fInfoPad " << fInfoPad << endl; } //-------------------------------------------------------------------------- // InitDataSet (private) //-------------------------------------------------------------------------- /** - *

+ *

Initializes the data set (histogram representation). * - * \param dataSet + * \param dataSet data set to be initialized */ void PMusrCanvas::InitDataSet(PMusrCanvasDataSet &dataSet) { @@ -1305,9 +1325,9 @@ void PMusrCanvas::InitDataSet(PMusrCanvasDataSet &dataSet) // InitDataSet (private) //-------------------------------------------------------------------------- /** - *

+ *

Initializes the data set (error graph representation). * - * \param dataSet + * \param dataSet data set to be initialized */ void PMusrCanvas::InitDataSet(PMusrCanvasNonMusrDataSet &dataSet) { @@ -1332,9 +1352,9 @@ void PMusrCanvas::InitDataSet(PMusrCanvasNonMusrDataSet &dataSet) // CleanupDataSet (private) //-------------------------------------------------------------------------- /** - *

+ *

Cleans up a data set (histogram representation). * - * \param dataSet + * \param dataSet data set to be cleaned up. */ void PMusrCanvas::CleanupDataSet(PMusrCanvasDataSet &dataSet) { @@ -1404,9 +1424,9 @@ void PMusrCanvas::CleanupDataSet(PMusrCanvasDataSet &dataSet) // CleanupDataSet (private) //-------------------------------------------------------------------------- /** - *

+ *

Cleans up a data set (error graph representation). * - * \param dataSet + * \param dataSet data set to be cleaned up. */ void PMusrCanvas::CleanupDataSet(PMusrCanvasNonMusrDataSet &dataSet) { @@ -1476,15 +1496,14 @@ void PMusrCanvas::CleanupDataSet(PMusrCanvasNonMusrDataSet &dataSet) // HandleDataSet (private) //-------------------------------------------------------------------------- /** - *

+ *

Generates the necessary histograms for plotting, starting from the pre-processed data. * - * \param plotNo is the number of the histo within the run list (fPlotNumber is the number of the plot BLOCK) - * \param runNo is the number of the run - * \param data + * \param plotNo The number of the histo within the run list (fPlotNumber is the number of the plot BLOCK) + * \param runNo The number of the run + * \param data pre-processed data */ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) { -//cout << endl << ">> PMusrCanvas::HandleDataSet(): start ...; plotNo = " << plotNo << ", fPlotNumber = " << fPlotNumber << ", runNo = " << runNo << endl; PMusrCanvasDataSet dataSet; TH1F *dataHisto; TH1F *theoHisto; @@ -1495,7 +1514,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) Int_t size; InitDataSet(dataSet); -//cout << endl << ">> PMusrCanvas::HandleDataSet(): after InitDataSet ..." << endl; // dataHisto ------------------------------------------------------------- // create histo specific infos @@ -1507,8 +1525,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) end = start + data->GetValue()->size()*data->GetDataTimeStep(); size = data->GetValue()->size(); -//cout << endl << ">> PMusrCanvas::HandleDataSet(): data->GetDataTimeStart = " << data->GetDataTimeStart << ", data->GetDataTimeStep() = " << data->GetDataTimeStep() << endl; - // check if 'use_fit_range' plotting is whished if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fUseFitRanges) { start = fMsrHandler->GetMsrRunList()->at(runNo).GetFitRange(0); // needed to estimate size @@ -1531,8 +1547,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) end = start + size * data->GetDataTimeStep(); // closesd end value compatible with the user given } -//cout << endl << ">> PMusrCanvas::HandleDataSet(): start = " << start << ", end = " << end << ", size = " << size << ", data->GetDataTimeStep() = " << data->GetDataTimeStep() << endl; - // invoke histo dataHisto = new TH1F(name, name, size, start, end); @@ -1552,7 +1566,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) startBin = (UInt_t)((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin[runNo] - data->GetDataTimeStart())/data->GetDataTimeStep()); endBin = (UInt_t)((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmax[runNo] - data->GetDataTimeStart())/data->GetDataTimeStep()); } -//cout << endl << ">> PMusrCanvas::HandleDataSet(): data: startBin = " << startBin << ", endBin = " << endBin << endl; for (UInt_t i=startBin; iSetBinContent(i-startBin+1, data->GetValue()->at(i)); @@ -1611,8 +1624,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) end = start + size * data->GetTheoryTimeStep(); // closesd end value compatible with the user given } -//cout << endl << ">> PMusrCanvas::HandleDataSet(): start = " << start << ", end = " << end << ", size = " << size << ", data->GetTheoryTimeStep() = " << data->GetTheoryTimeStep() << endl; - // invoke histo theoHisto = new TH1F(name, name, size, start, end); @@ -1625,7 +1636,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) startBin = (UInt_t)((fMsrHandler->GetMsrRunList()->at(runNo).GetFitRange(0) - data->GetDataTimeStart())/data->GetTheoryTimeStep()); endBin = (UInt_t)((fMsrHandler->GetMsrRunList()->at(runNo).GetFitRange(1) - data->GetDataTimeStart())/data->GetTheoryTimeStep()); } -//cout << endl << ">> PMusrCanvas::HandleDataSet(): theory: startBin = " << startBin << ", endBin = " << endBin << endl; // check if 'sub_ranges' plotting is whished if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin.size() > 1) { @@ -1637,8 +1647,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) theoHisto->SetBinContent(i-startBin+1, data->GetTheory()->at(i)); } -//cout << endl << ">> PMusrCanvas::HandleDataSet(): after fill theory histo" << endl; - // set the line color if (plotNo < fColorList.size()) { theoHisto->SetLineColor(fColorList[plotNo]); @@ -1653,19 +1661,17 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) dataSet.theory = theoHisto; fData.push_back(dataSet); - -//cout << endl << ">> PMusrCanvas::HandleDataSet(): after data push_back"; -//cout << endl << ">> --------------------------------------- <<" << endl; } //-------------------------------------------------------------------------- // HandleNonMusrDataSet (private) //-------------------------------------------------------------------------- /** - *

+ *

Generates the necessary error graphs for plotting, starting from the pre-processed data. * - * \param runNo - * \param data + * \param plotNo The number of the histo within the run list (fPlotNumber is the number of the plot BLOCK) + * \param runNo The number of the run + * \param data pre-processed data */ void PMusrCanvas::HandleNonMusrDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) { @@ -1737,21 +1743,20 @@ void PMusrCanvas::HandleNonMusrDataSet(UInt_t plotNo, UInt_t runNo, PRunData *da // HandleDifference (private) //-------------------------------------------------------------------------- /** - *

- * + *

Handles the calculation of the difference spectra (i.e. data-theory). + * It allocates the necessary objects if they are not already present. At the + * end it calls the plotting routine. */ void PMusrCanvas::HandleDifference() { // check if it is necessary to calculate diff data if ((fPlotType != MSR_PLOT_NON_MUSR) && (fData[0].diff == 0)) { -//cout << endl << ">> calculate diff ..." << endl; TH1F *diffHisto; TString name; // loop over all histos for (UInt_t i=0; iGetTitle()) + "_diff"; -//cout << endl << ">> diff-name = " << name.Data() << endl; diffHisto = new TH1F(name, name, fData[i].data->GetNbinsX(), fData[i].data->GetXaxis()->GetXmin(), fData[i].data->GetXaxis()->GetXmax()); @@ -1789,7 +1794,6 @@ void PMusrCanvas::HandleDifference() // create difference histos name = TString(fNonMusrData[i].data->GetTitle()) + "_diff"; -//cout << endl << ">> diff-name = " << name.Data() << endl; diffHisto->SetNameTitle(name.Data(), name.Data()); // set marker and line color @@ -1841,7 +1845,9 @@ void PMusrCanvas::HandleDifference() // HandleFourier (private) //-------------------------------------------------------------------------- /** - *

+ *

Handles the calculation of the Fourier transform. + * It allocates the necessary objects if they are not already present. At the + * end it calls the plotting routine. */ void PMusrCanvas::HandleFourier() { @@ -1849,8 +1855,6 @@ void PMusrCanvas::HandleFourier() if (fPlotType == MSR_PLOT_NON_MUSR) return; -//cout << endl << ">> in HandleFourier ..." << endl; - // check if fourier needs to be calculated if (fData[0].dataFourierRe == 0) { Int_t bin; @@ -1868,23 +1872,14 @@ void PMusrCanvas::HandleFourier() fourierData.Transform(fFourier.fApodization); double scale; scale = sqrt(fData[0].data->GetBinWidth(1)/(endTime-startTime)); -//cout << endl << ">> data scale = " << scale; // get real part of the data fData[i].dataFourierRe = fourierData.GetRealFourier(scale); -//cout << endl << ">> i: " << i << ", fData[i].dataFourierRe = " << fData[i].dataFourierRe; // get imaginary part of the data fData[i].dataFourierIm = fourierData.GetImaginaryFourier(scale); // get power part of the data fData[i].dataFourierPwr = fourierData.GetPowerFourier(scale); // get phase part of the data fData[i].dataFourierPhase = fourierData.GetPhaseFourier(); -/* -cout << endl << ">> Fourier: i=" << i; -for (unsigned j=0; j<10; j++) { - cout << endl << ">> Fourier: " << j << ", data = " << fData[i].data->GetBinContent(j) << ", fourier.power = " << fData[i].dataFourierPwr->GetBinContent(j); -} -cout << endl; -*/ // set marker and line color fData[i].dataFourierRe->SetMarkerColor(fData[i].data->GetMarkerColor()); @@ -1909,7 +1904,6 @@ cout << endl; // calculate fourier transform of the theory Int_t powerPad = (Int_t)round(log((endTime-startTime)/fData[i].theory->GetBinWidth(1))/log(2))+3; -//cout << endl << ">> powerPad = " << powerPad; PFourier fourierTheory(fData[i].theory, fFourier.fUnits, startTime, endTime, powerPad); if (!fourierTheory.IsValid()) { cerr << endl << "**SEVERE ERROR** PMusrCanvas::HandleFourier: couldn't invoke PFourier to calculate the Fourier theory ..." << endl; @@ -1917,10 +1911,8 @@ cout << endl; } fourierTheory.Transform(fFourier.fApodization); scale = sqrt(fData[0].theory->GetBinWidth(1)/(endTime-startTime)*fData[0].theory->GetBinWidth(1)/fData[0].data->GetBinWidth(1)); -//cout << endl << ">> theory scale = " << scale << ", data.res/theory.res = " << fData[0].theory->GetBinWidth(1)/fData[0].data->GetBinWidth(1); // get real part of the data fData[i].theoryFourierRe = fourierTheory.GetRealFourier(scale); -//cout << endl << ">> i: " << i << ", fData[i].dataFourierRe = " << fData[i].dataFourierRe; // get imaginary part of the data fData[i].theoryFourierIm = fourierTheory.GetImaginaryFourier(scale); // get power part of the data @@ -1936,9 +1928,7 @@ cout << endl; } // apply global phase if present -//cout << endl << ">> fFourier.fPhase = " << fFourier.fPhase << endl; if (fFourier.fPhase != 0.0) { -//cout << endl << ">> apply global phase fFourier.fPhase = " << fFourier.fPhase; double re, im; const double cp = TMath::Cos(fFourier.fPhase/180.0*TMath::Pi()); const double sp = TMath::Sin(fFourier.fPhase/180.0*TMath::Pi()); @@ -2011,7 +2001,9 @@ cout << endl; // HandleDifferenceFourier (private) //-------------------------------------------------------------------------- /** - *

+ *

Handles the calculation of the Fourier transform of the difference spectra (i.e. data-theory). + * It allocates the necessary objects if they are not already present. At the + * end it calls the plotting routine. */ void PMusrCanvas::HandleDifferenceFourier() { @@ -2019,10 +2011,8 @@ void PMusrCanvas::HandleDifferenceFourier() if (fPlotType == MSR_PLOT_NON_MUSR) return; -//cout << endl << ">> in HandleDifferenceFourier ..." << endl; // check if fourier needs to be calculated if (fData[0].diffFourierRe == 0) { -//cout << endl << ">> will calculate Fourier diff ..." << endl; // check if difference has been already calcualted, if not do it if (fData[0].diff == 0) HandleDifference(); @@ -2031,7 +2021,6 @@ void PMusrCanvas::HandleDifferenceFourier() double startTime = fData[0].diff->GetBinCenter(bin); bin = fData[0].diff->GetXaxis()->GetLast(); double endTime = fData[0].diff->GetBinCenter(bin); -//cout << endl << ">> startTime = " << startTime << ", endTime = " << endTime << endl; for (UInt_t i=0; iGetBinWidth(1)/(endTime-startTime)); -//cout << endl << ">> data scale = " << scale; // get real part of the data fData[i].diffFourierRe = fourierData.GetRealFourier(scale); -//cout << endl << ">> i: " << i << ", fData[i].diffFourierRe = " << fData[i].diffFourierRe; // get imaginary part of the data fData[i].diffFourierIm = fourierData.GetImaginaryFourier(scale); // get power part of the data @@ -2105,7 +2092,9 @@ void PMusrCanvas::HandleDifferenceFourier() // HandleFourierDifference (private) //-------------------------------------------------------------------------- /** - *

+ *

Handles the calculation of the difference of the Fourier spectra. + * It allocates the necessary objects if they are not already present. At the + * end it calls the plotting routine. */ void PMusrCanvas::HandleFourierDifference() { @@ -2200,8 +2189,6 @@ void PMusrCanvas::HandleFourierDifference() */ double PMusrCanvas::FindOptimalFourierPhase() { -//cout << endl << ">> in FindOptimalFourierPhase ... "; - // check that Fourier is really present if ((fData[0].dataFourierRe == 0) || (fData[0].dataFourierIm == 0)) return 0.0; @@ -2256,12 +2243,10 @@ double PMusrCanvas::FindOptimalFourierPhase() } } if (fabs(asymmetry) > fabs((maxIm+minIm)*(val_xMin-val_xMax))) { -//cout << endl << ">> phase = " << phase << ", asymmetry = " << asymmetry << ", min/max = " << minIm << "/" << maxIm; minPhase = phase; asymmetry = (maxIm+minIm)*(val_xMin-val_xMax); } } -cout << endl << ">> optimal phase = " << minPhase << endl; return minPhase; } @@ -2270,8 +2255,7 @@ cout << endl << ">> optimal phase = " << minPhase << endl; // CleanupDifference (private) //-------------------------------------------------------------------------- /** - *

- * + *

Cleans up (deallocate) difference data. */ void PMusrCanvas::CleanupDifference() { @@ -2287,8 +2271,7 @@ void PMusrCanvas::CleanupDifference() // CleanupFourier (private) //-------------------------------------------------------------------------- /** - *

- * + *

Cleans up (deallocate) Fourier transform data. */ void PMusrCanvas::CleanupFourier() { @@ -2332,8 +2315,7 @@ void PMusrCanvas::CleanupFourier() // CleanupFourierDifference (private) //-------------------------------------------------------------------------- /** - *

- * + *

Cleans up (deallocate) Fourier difference spectra. */ void PMusrCanvas::CleanupFourierDifference() { @@ -2361,7 +2343,10 @@ void PMusrCanvas::CleanupFourierDifference() // CalculateDiff (private) //-------------------------------------------------------------------------- /** - *

+ *

Calculates the difference between data and theory for histograms. + * + * return: + * - (data - theory) value * * \param x x-value of the data * \param y y-value of the data @@ -2378,11 +2363,14 @@ double PMusrCanvas::CalculateDiff(const double x, const double y, TH1F *theo) // CalculateDiff (private) //-------------------------------------------------------------------------- /** - *

+ *

Calculates the difference between data and theory for error graphs. + * + * return: + * - (data - theory) value * * \param x x-value of the data * \param y y-value of the data - * \param theo theory error graph + * \param theo theory error graphs */ double PMusrCanvas::CalculateDiff(const double x, const double y, TGraphErrors *theo) { @@ -2393,8 +2381,6 @@ double PMusrCanvas::CalculateDiff(const double x, const double y, TGraphErrors * theo->GetPoint(bin, xVal, yVal); -//cout << endl << ">> bin=" << bin << ", x=" << xVal << " (xData=" << x << "), y=" << yVal; - return y - yVal; } @@ -2404,8 +2390,11 @@ double PMusrCanvas::CalculateDiff(const double x, const double y, TGraphErrors * /** *

Analog to FindBin for histograms (TH1F) but here for TGraphErrors. * + * return: + * - bin closest to a given x value. + * * \param x x-value of the data - * \param graph TGraphErrors which should be seaarched + * \param graph TGraphErrors which should be searched */ Int_t PMusrCanvas::FindBin(const double x, TGraphErrors *graph) { @@ -2433,7 +2422,10 @@ Int_t PMusrCanvas::FindBin(const double x, TGraphErrors *graph) /** *

returns the global maximum of a histogram * - * \param histo + * return: + * - global maximum, or 0.0 if the histo pointer is the null pointer. + * + * \param histo pointer of the histogram */ double PMusrCanvas::GetGlobalMaximum(TH1F* histo) { @@ -2457,7 +2449,10 @@ double PMusrCanvas::GetGlobalMaximum(TH1F* histo) /** *

returns the global minimum of a histogram * - * \param histo + * return: + * - global minimum, or 0.0 if the histo pointer is the null pointer. + * + * \param histo pointer of the histogram */ double PMusrCanvas::GetGlobalMinimum(TH1F* histo) { @@ -2479,8 +2474,7 @@ double PMusrCanvas::GetGlobalMinimum(TH1F* histo) // PlotData (private) //-------------------------------------------------------------------------- /** - *

- * + *

Plots the data. */ void PMusrCanvas::PlotData() { @@ -2696,8 +2690,7 @@ void PMusrCanvas::PlotData() // PlotDifference (private) //-------------------------------------------------------------------------- /** - *

- * + *

Plots the difference data, i.e. data-theory */ void PMusrCanvas::PlotDifference() { @@ -2707,7 +2700,6 @@ void PMusrCanvas::PlotDifference() return; if (fPlotType != MSR_PLOT_NON_MUSR) { -//cout << endl << ">> PlotDifference(): going to plot diff spectra ... (" << fData[0].diff->GetNbinsX() << ")" << endl; fHistoFrame = fDataTheoryPad->DrawFrame(fXmin, fYmin, fXmax, fYmax); // set x-axis label fHistoFrame->GetXaxis()->SetTitle("time (#mus)"); @@ -2770,13 +2762,10 @@ void PMusrCanvas::PlotDifference() // PlotFourier (private) //-------------------------------------------------------------------------- /** - *

- * + *

Plot the Fourier spectra. */ void PMusrCanvas::PlotFourier() { -//cout << endl << ">> in PlotFourier() ..." << endl; - fDataTheoryPad->cd(); if (fPlotType < 0) // plot type not defined @@ -3047,13 +3036,10 @@ void PMusrCanvas::PlotFourier() // PlotFourierDifference (private) //-------------------------------------------------------------------------- /** - *

- * + *

Plot the Fourier difference, i.e. F(data)-F(theory). */ void PMusrCanvas::PlotFourierDifference() { -//cout << endl << ">> in PlotFourierDifference() ..." << endl; - fDataTheoryPad->cd(); if (fPlotType < 0) // plot type not defined @@ -3294,8 +3280,7 @@ void PMusrCanvas::PlotFourierDifference() // PlotFourierPhaseValue (private) //-------------------------------------------------------------------------- /** - *

- * + *

Writes the Fourier phase value into the data window. */ void PMusrCanvas::PlotFourierPhaseValue() { @@ -3330,9 +3315,7 @@ void PMusrCanvas::PlotFourierPhaseValue() // IncrementFourierPhase (private) //-------------------------------------------------------------------------- /** - *

- * - * \param tag + *

Increments the Fourier phase and recalculate the real/imaginary part of the Fourier transform. */ void PMusrCanvas::IncrementFourierPhase() { @@ -3381,9 +3364,7 @@ void PMusrCanvas::IncrementFourierPhase() // DecrementFourierPhase (private) //-------------------------------------------------------------------------- /** - *

- * - * \param tag + *

Decrements the Fourier phase and recalculate the real/imaginary part of the Fourier transform. */ void PMusrCanvas::DecrementFourierPhase() { @@ -3432,8 +3413,7 @@ void PMusrCanvas::DecrementFourierPhase() // SaveDataAscii (private) //-------------------------------------------------------------------------- /** - *

- * + *

Saves the currently seen data (data, difference, Fourier spectra, ...) in ascii column format. */ void PMusrCanvas::SaveDataAscii() { diff --git a/src/classes/PMusrT0.cpp b/src/classes/PMusrT0.cpp index 1e0f6c41..1c917e2c 100644 --- a/src/classes/PMusrT0.cpp +++ b/src/classes/PMusrT0.cpp @@ -47,7 +47,7 @@ using namespace std; // Constructor //-------------------------------------------------------------------------- /** - * + *

Constructor. */ PMusrT0Data::PMusrT0Data() { @@ -58,7 +58,7 @@ PMusrT0Data::PMusrT0Data() // Destructor //-------------------------------------------------------------------------- /** - * + *

Destructor. */ PMusrT0Data::~PMusrT0Data() { @@ -74,7 +74,7 @@ PMusrT0Data::~PMusrT0Data() // InitData //-------------------------------------------------------------------------- /** - * + *

Initialize the necessary variables. */ void PMusrT0Data::InitData() { @@ -96,7 +96,13 @@ void PMusrT0Data::InitData() // GetRawRunData //-------------------------------------------------------------------------- /** + *

Returns the raw run data set with index idx. * + * return: + * - raw run data set + * - 0 pointer, if idx is out of range + * + * \param idx index of the raw run data */ PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx) { @@ -110,7 +116,13 @@ PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx) // GetHistoNo //-------------------------------------------------------------------------- /** + *

Get histogram number of a run. * + * return: + * - histogram number + * - -1 if index is out of range + * + * \param idx index of the run (msr-file). */ Int_t PMusrT0Data::GetHistoNo(UInt_t idx) { @@ -124,7 +136,13 @@ Int_t PMusrT0Data::GetHistoNo(UInt_t idx) // GetT0 //-------------------------------------------------------------------------- /** + *

Get t0 (in bin) of a run. * + * return: + * - t0 bin + * - -1 if index is out of range + * + * \param idx index of the run (msr-file). */ Int_t PMusrT0Data::GetT0(UInt_t idx) { @@ -138,7 +156,13 @@ Int_t PMusrT0Data::GetT0(UInt_t idx) // GetAddT0Size //-------------------------------------------------------------------------- /** + *

Get addt0 size of a run, i.e. the number of addt0's for a given msr-file run. * + * return: + * - number of addt0's + * - -1 if index is out of range + * + * \param idx index of the run (msr-file). */ UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx) { @@ -152,7 +176,14 @@ UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx) // GetAddT0 //-------------------------------------------------------------------------- /** + *

Get addt0 (in bin) of a run. * + * return: + * - addt0 bin + * - -1 if index is out of range + * + * \param addRunIdx index of the addrun + * \param idx index of the run (msr-file). */ Int_t PMusrT0Data::GetAddT0(UInt_t addRunIdx, UInt_t idx) { @@ -169,13 +200,13 @@ Int_t PMusrT0Data::GetAddT0(UInt_t addRunIdx, UInt_t idx) // SetT0 //-------------------------------------------------------------------------- /** + *

Set t0 value. * + * \param val t0 value to be set + * \param idx index at which t0 shall be set. */ void PMusrT0Data::SetT0(UInt_t val, UInt_t idx) { -//cout << endl << "debug+> SetT0: size=" << fT0.size(); -//cout << endl << "debug+> SetT0: val=" << val << ", idx=" << idx << endl; - if (idx >= fT0.size()) fT0.resize(idx+1); @@ -186,13 +217,14 @@ void PMusrT0Data::SetT0(UInt_t val, UInt_t idx) // SetAddT0 //-------------------------------------------------------------------------- /** + *

Set addt0 value. * + * \param val t0 value to be set + * \param addRunIdx addt0 index (for each addrun, there has to be an addt0) + * \param idx index at which t0 shall be set. */ void PMusrT0Data::SetAddT0(UInt_t val, UInt_t addRunIdx, UInt_t idx) { -//cout << endl << "debug+> SetAddT0: size=" << fAddT0.size(); -//cout << endl << "debug+> SetAddT0: val=" << val << ", addRunIdx=" << addRunIdx << ", idx=" << idx << endl; - if (addRunIdx >= fAddT0.size()) fAddT0.resize(addRunIdx+1); @@ -210,7 +242,7 @@ ClassImpQ(PMusrT0) // Constructor //-------------------------------------------------------------------------- /** - * + *

Constructor. */ PMusrT0::PMusrT0() { @@ -245,9 +277,9 @@ PMusrT0::PMusrT0() // Constructor //-------------------------------------------------------------------------- /** - *

+ *

Constructor * - * \param data + * \param data raw run data set */ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data) { @@ -316,19 +348,6 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data) } } } else { -/* -cout << endl << "debug> all t0's:" << endl; -for (UInt_t i=0; i all addt0's:" << endl; -for (UInt_t j=0; j j=" << j << endl; - for (UInt_t i=0; iGetRunName() + TString(" : "); if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD) str += " forward grouped and runs added"; @@ -533,7 +552,7 @@ cout << endl; // Destructor //-------------------------------------------------------------------------- /** - * + *

Destructor. */ PMusrT0::~PMusrT0() { @@ -583,8 +602,7 @@ PMusrT0::~PMusrT0() // Done (SIGNAL) //-------------------------------------------------------------------------- /** - *

- * + *

Signal emitted if the user wants to terminate the application. */ void PMusrT0::Done(Int_t status) { @@ -595,8 +613,23 @@ void PMusrT0::Done(Int_t status) // HandleCmdKey (SLOT) //-------------------------------------------------------------------------- /** - *

+ *

Filters keyboard and mouse events, and if they are a command key (see below) carries out the + * necessary actions. + *

Currently implemented command keys: + * - 'q' close the currently shown canvas + * - 'Q' quite the application + * - 'z' zoom to the region aroung t0 + * - 'T' set t0 channel to the estimated t0 + * - 't' set t0 channel to the current cursor position + * - 'b' set first background channel + * - 'B' set last background channel + * - 'd' set first good bin channel + * - 'D' set last good bin channel * + * \param event event type + * \param x keyboard event: character key; mouse event: x-position + * \param mouse event: y-position + * \param selected not used */ void PMusrT0::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) { @@ -636,8 +669,9 @@ void PMusrT0::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) // SetMsrHandler //-------------------------------------------------------------------------- /** - *

+ *

Set the msr-file handler * + * \param msrHandler msr-file handler pointer */ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler) { @@ -648,8 +682,7 @@ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler) // InitT0 //-------------------------------------------------------------------------- /** - *

- * + *

Initialize t0 data. */ void PMusrT0::InitT0() { @@ -679,8 +712,6 @@ void PMusrT0::InitT0() } Double_t max = fHisto->GetMaximum(); -//cout << "debug-> histoIdx=" << histoIdx << ", addRunIdx=" << addRunIdx << ", t0Bin=" << t0Bin << endl; - fT0Line = new TLine((Double_t)t0Bin, 0.0, (Double_t)t0Bin, max); fT0Line->SetLineStyle(1); // solid fT0Line->SetLineColor(TColor::GetColor(0,255,0)); // green @@ -692,8 +723,7 @@ void PMusrT0::InitT0() // InitDataAndBkg //-------------------------------------------------------------------------- /** - *

- * + *

Initialize data and background ranges. */ void PMusrT0::InitDataAndBkg() { @@ -789,8 +819,7 @@ void PMusrT0::InitDataAndBkg() // SetT0Channel //-------------------------------------------------------------------------- /** - *

- * + *

Set the t0 channel to the current cursor position and keep the x-position as new t0 bin. */ void PMusrT0::SetT0Channel() { @@ -817,8 +846,6 @@ void PMusrT0::SetT0Channel() idx += 1; } -//cout << endl << "debug> SetT0Channel: t0-idx=" << idx << ", t0-value=" << binx; - if (fMusrT0Data.GetAddRunIdx() == 0) fMsrHandler->SetMsrT0Entry(fMusrT0Data.GetRunNo(), idx, binx); else if (fMusrT0Data.GetAddRunIdx() > 0) @@ -836,8 +863,7 @@ void PMusrT0::SetT0Channel() // SetEstimatedT0Channel //-------------------------------------------------------------------------- /** - *

- * + *

Set the estimated t0 channel to the current cursor position and keep the x-position as new t0 bin. */ void PMusrT0::SetEstimatedT0Channel() { @@ -877,8 +903,7 @@ void PMusrT0::SetEstimatedT0Channel() // SetDataFirstChannel //-------------------------------------------------------------------------- /** - *

- * + *

Set the first good data channel to the current cursor position and keep the x-position as new first good data bin. */ void PMusrT0::SetDataFirstChannel() { @@ -891,7 +916,7 @@ void PMusrT0::SetDataFirstChannel() // get binx to set the data first channel corresponding to fPx fDataRange[0] = fHisto->GetXaxis()->FindFixBin(x) - 1; -cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRange[0] << endl; + cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRange[0] << endl; // set the data first bin in msr-Handler UInt_t idx = 0; @@ -928,8 +953,7 @@ cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRa // SetDataLastChannel //-------------------------------------------------------------------------- /** - *

- * + *

Set the last good data channel to the current cursor position and keep the x-position as new last good data bin. */ void PMusrT0::SetDataLastChannel() { @@ -942,7 +966,7 @@ void PMusrT0::SetDataLastChannel() // get binx to set the data last channel corresponding to fPx fDataRange[1] = fHisto->GetXaxis()->FindFixBin(x) - 1; -cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRange[1] << endl; + cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRange[1] << endl; // set the data first bin in msr-Handler UInt_t idx = 1; @@ -979,8 +1003,7 @@ cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRan // SetBkgFirstChannel //-------------------------------------------------------------------------- /** - *

- * + *

Set the first background channel to the current cursor position and keep the x-position as new first background bin. */ void PMusrT0::SetBkgFirstChannel() { @@ -993,7 +1016,7 @@ void PMusrT0::SetBkgFirstChannel() // get binx to set the background first channel corresponding to fPx fBkgRange[0] = fHisto->GetXaxis()->FindFixBin(x) - 1; -cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange[0] << endl; + cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange[0] << endl; // set the background first bin in msr-Handler UInt_t idx = 0; @@ -1030,8 +1053,7 @@ cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange // SetBkgLastChannel //-------------------------------------------------------------------------- /** - *

- * + *

Set the last background channel to the current cursor position and keep the x-position as new last background bin. */ void PMusrT0::SetBkgLastChannel() { @@ -1044,7 +1066,7 @@ void PMusrT0::SetBkgLastChannel() // get binx to set the background last channel corresponding to fPx fBkgRange[1] = fHisto->GetXaxis()->FindFixBin(x) - 1; -cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[1] << endl; + cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[1] << endl; // set the background first bin in msr-Handler UInt_t idx = 1; @@ -1081,8 +1103,7 @@ cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[ // UnZoom //-------------------------------------------------------------------------- /** - *

- * + *

Unzoom the current histogram */ void PMusrT0::UnZoom() { @@ -1096,8 +1117,7 @@ void PMusrT0::UnZoom() // ZoomT0 //-------------------------------------------------------------------------- /** - *

- * + *

Zoom into the histogram region of the t0, and/or estimated t0 range. */ void PMusrT0::ZoomT0() { @@ -1126,8 +1146,6 @@ void PMusrT0::ZoomT0() max = fT0Estimated + range; } -// cout << endl << "debug> ZoomT0: min=" << min << ", max=" << max << endl; - fHisto->GetXaxis()->SetRangeUser(min, max); fMainCanvas->Modified(); // needed that Update is actually working diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 99210986..0fac67a8 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -40,8 +40,7 @@ // Constructor //-------------------------------------------------------------------------- /** - *

- * + *

Constructor */ PRunAsymmetry::PRunAsymmetry() : PRunBase() { @@ -54,10 +53,12 @@ PRunAsymmetry::PRunAsymmetry() : PRunBase() // Constructor //-------------------------------------------------------------------------- /** - *

+ *

Constructor * - * \param msrInfo pointer to the msr info structure - * \param runNo number of the run of the msr-file + * \param msrInfo pointer to the msr-file handler + * \param rawData raw run data + * \param runNo number of the run within the msr-file + * \param tag tag showing what shall be done: kFit == fitting, kView == viewing */ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag) { @@ -82,7 +83,6 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn } // check if alpha is fixed Bool_t alphaFixedToOne = false; -//cout << endl << ">> alpha = " << (*param)[fRunInfo->GetAlphaParamNo()-1].fValue << ", " << (*param)[fRunInfo->GetAlphaParamNo()-1].fStep; if (((*param)[fRunInfo->GetAlphaParamNo()-1].fStep == 0.0) && ((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0)) alphaFixedToOne = true; @@ -113,8 +113,6 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn else fAlphaBetaTag = 4; -//cout << endl << ">> PRunAsymmetry::PRunAsymmetry(): fAlphaBetaTag = " << fAlphaBetaTag << endl; - // calculate fData if (!PrepareData()) fValid = false; @@ -124,8 +122,7 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn // Destructor //-------------------------------------------------------------------------- /** - *

- * + *

Destructor. */ PRunAsymmetry::~PRunAsymmetry() { @@ -139,9 +136,12 @@ PRunAsymmetry::~PRunAsymmetry() // CalcChiSquare //-------------------------------------------------------------------------- /** - *

+ *

Calculate chi-square. * - * \param par parameter vector iterated by minuit + * return: + * - chisq value + * + * \param par parameter vector iterated by minuit2 */ Double_t PRunAsymmetry::CalcChiSquare(const std::vector& par) { @@ -183,7 +183,6 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector& par) default: break; } -//if (i==0) cout << endl << "A(0) = " << asymFcnValue; diff = fData.GetValue()->at(i) - asymFcnValue; chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i)); } @@ -196,7 +195,7 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector& par) // CalcMaxLikelihood //-------------------------------------------------------------------------- /** - *

+ *

NOT IMPLEMENTED!! * * \param par parameter vector iterated by minuit */ @@ -211,8 +210,7 @@ Double_t PRunAsymmetry::CalcMaxLikelihood(const std::vector& par) // CalcTheory //-------------------------------------------------------------------------- /** - *

- * + *

Calculate theory for a given set of fit-parameters. */ void PRunAsymmetry::CalcTheory() { @@ -268,17 +266,26 @@ void PRunAsymmetry::CalcTheory() // PrepareData //-------------------------------------------------------------------------- /** - *

+ *

Prepare data for fitting or viewing. What is already processed at this stage: + * - get all needed forward/backward histograms + * - get timeresolution + * - get start/stop fit time + * - get t0's and perform necessary cross checks (e.g. if t0 of msr-file (if present) are consistent with t0 of the data files, etc.) + * - add runs (if addruns are present) + * - group histograms (if grouping is present) + * - subtract background * * Error propagation for \f$ A_i = (f_i^{\rm c}-b_i^{\rm c})/(f_i^{\rm c}+b_i^{\rm c})\f$: * \f[ \Delta A_i = \pm\frac{2}{(f_i^{\rm c}+b_i^{\rm c})^2}\left[ * (b_i^{\rm c})^2 (\Delta f_i^{\rm c})^2 + * (\Delta b_i^{\rm c})^2 (f_i^{\rm c})^2\right]^{1/2}\f] + * + * return: + * - true if everthing went smooth + * - false, otherwise. */ Bool_t PRunAsymmetry::PrepareData() { -//cout << endl << "in PRunAsymmetry::PrepareData(): will feed fData" << endl; - // get forward/backward histo from PRunDataHandler object ------------------------ // get the correct run PRawRunData *runData = fRawData->GetRunData(*(fRunInfo->GetRunName())); @@ -294,7 +301,6 @@ Bool_t PRunAsymmetry::PrepareData() // keep start/stop time for fit fFitStartTime = fRunInfo->GetFitRange(0); fFitStopTime = fRunInfo->GetFitRange(1); -//cout << endl << "start/stop (fit): " << fFitStartTime << ", " << fFitStopTime << endl; // collect histogram numbers PUIntVector forwardHistoNo; @@ -603,6 +609,10 @@ Bool_t PRunAsymmetry::PrepareData() * \pm\left[ f_i + \mathrm{bkg} \right]^{1/2}, \f] * where \f$ f_i^{\rm c} \f$ is the background corrected histogram, \f$ f_i \f$ the raw histogram * and \f$ \mathrm{bkg} \f$ the fix given background. + * + * return: + * - true + * */ Bool_t PRunAsymmetry::SubtractFixBkg() { @@ -620,7 +630,7 @@ Bool_t PRunAsymmetry::SubtractFixBkg() // SubtractEstimatedBkg //-------------------------------------------------------------------------- /** - *

Subtracts the background given ... + *

Subtracts the background which is estimated from a given interval (typically before t0). * * The background corrected histogramms are: * \f$ f_i^{\rm c} = f_i - \mathrm{bkg} \f$, where \f$ f_i \f$ is the raw data histogram, @@ -632,6 +642,9 @@ Bool_t PRunAsymmetry::SubtractFixBkg() * \f[ \Delta \mathrm{bkg} = \pm\frac{1}{N}\left[\sum_{i=0}^N (\Delta f_i)^2\right]^{1/2} = * \pm\frac{1}{N}\left[\sum_{i=0}^N f_i \right]^{1/2},\f] * where \f$N\f$ is the number of bins over which the background is formed. + * + * return: + * - true */ Bool_t PRunAsymmetry::SubtractEstimatedBkg() { @@ -698,14 +711,12 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg() bkg[0] += fForward[i]; errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1); bkg[0] /= static_cast(end[0] - start[0] + 1); -//cout << endl << ">> bkg[0] = " << bkg[0]; // backward for (UInt_t i=start[1]; i(end[1] - start[1] + 1); -//cout << endl << ">> bkg[1] = " << bkg[1] << endl; // correct error for forward, backward for (UInt_t i=0; i + *

Take the pre-processed data (i.e. grouping and addrun are preformed) and form the asymmetry for fitting. + * Before forming the asymmetry, the following checks will be performed: + * -# check if data range is given, if not try to estimate one. + * -# check that data range is present, that it makes any sense. + * -# check that 'first good bin'-'t0' is the same for forward and backward histogram. If not adjust it. + * -# pack data (rebin). + * -# if packed forward size != backward size, truncate the longer one such that an asymmetry can be formed. + * -# calculate the asymmetry: \f$ A_i = (f_i^c-b_i^c)/(f_i^c+b_i^c) \f$ + * -# calculate the asymmetry errors: \f$ \delta A_i = 2 \sqrt{(b_i^c)^2 (\delta f_i^c)^2 + (\delta b_i^c)^2 (f_i^c)^2}/(f_i^c+b_i^c)^2\f$ * + * \param runData raw run data needed to perform some crosschecks + * \param histoNo histogram number (within a run). histoNo[0]: forward histogram number, histNo[1]: backward histogram number */ Bool_t PRunAsymmetry::PrepareFitData(PRawRunData* runData, UInt_t histoNo[2]) { @@ -914,8 +935,20 @@ Bool_t PRunAsymmetry::PrepareFitData(PRawRunData* runData, UInt_t histoNo[2]) // PrepareViewData //-------------------------------------------------------------------------- /** - *

+ *

Take the pre-processed data (i.e. grouping and addrun are preformed) and form the asymmetry for view representation. + * Before forming the asymmetry, the following checks will be performed: + * -# check if view packing is whished. + * -# check if data range is given, if not try to estimate one. + * -# check that data range is present, that it makes any sense. + * -# check that 'first good bin'-'t0' is the same for forward and backward histogram. If not adjust it. + * -# pack data (rebin). + * -# if packed forward size != backward size, truncate the longer one such that an asymmetry can be formed. + * -# calculate the asymmetry: \f$ A_i = (\alpha f_i^c-b_i^c)/(\alpha \beta f_i^c+b_i^c) \f$ + * -# calculate the asymmetry errors: \f$ \delta A_i = 2 \sqrt{(b_i^c)^2 (\delta f_i^c)^2 + (\delta b_i^c)^2 (f_i^c)^2}/(f_i^c+b_i^c)^2\f$ + * -# calculate the theory vector. * + * \param runData raw run data needed to perform some crosschecks + * \param histoNo histogram number (within a run). histoNo[0]: forward histogram number, histNo[1]: backward histogram number */ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) { @@ -1067,11 +1100,6 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) fData.SetDataTimeStart(fTimeResolution*((Double_t)start[0]-t0[0]+(Double_t)(packing-1)/2.0)); fData.SetDataTimeStep(fTimeResolution*(Double_t)packing); -/* -cout << endl << ">> start time = " << fData.GetDataTimeStart() << ", step = " << fData.GetDataTimeStep(); -cout << endl << "--------------------------------" << endl; -*/ - // get the proper alpha and beta switch (fAlphaBetaTag) { case 1: // alpha == 1, beta == 1 @@ -1093,7 +1121,6 @@ cout << endl << "--------------------------------" << endl; default: break; } -//cout << endl << ">> alpha = " << alpha << ", beta = " << beta; for (UInt_t i=0; isize(); i++) { // to make the formulae more readable @@ -1143,7 +1170,6 @@ cout << endl << "--------------------------------" << endl; size = fData.GetValue()->size() * 10; factor = (Double_t)runData->GetDataBin(histoNo[0])->size() / (Double_t)size; } -//cout << endl << ">> runData->fDataBin[histoNo[0]].size() = " << runData->fDataBin[histoNo[0]].size() << ", fData.GetValue()->size() * 10 = " << fData.GetValue()->size() * 10 << ", size = " << size << ", factor = " << factor << endl; fData.SetTheoryTimeStart(fData.GetDataTimeStart()); fData.SetTheoryTimeStep(fTimeResolution*factor); for (UInt_t i=0; i Prepares the RRF data set for visual representation. This is done the following way: * -# make all necessary checks - * -# build the asymmetry [ \f[ A(t) \f] ] WITHOUT packing. - * -# \f[ A_R(t) = A(t) \cdot 2 \cos(\omega_R t + \phi_R) \f] - * -# do the packing of \f[ A_R(t) \f] - * -# calculate theory [ \f[ T(t) \f] ] as close as possible to the time resolution [compatible with the RRF frequency] - * -# \f[ T_R(t) = T(t) \cdot 2 \cos(\omega_R t + \phi_R) \f] - * -# do the packing of \f[ T_R(t) \f] + * -# build the asymmetry, \f$ A(t) \f$, WITHOUT packing. + * -# \f$ A_R(t) = A(t) \cdot 2 \cos(\omega_R t + \phi_R) \f$ + * -# do the packing of \f$ A_R(t) \f$ + * -# calculate theory, \f$ T(t) \f$, as close as possible to the time resolution [compatible with the RRF frequency] + * -# \f$ T_R(t) = T(t) \cdot 2 \cos(\omega_R t + \phi_R) \f$ + * -# do the packing of \f$ T_R(t) \f$ * -# calculate the Kaiser FIR filter coefficients - * -# filter \f[ T_R(t) \f]. + * -# filter \f$ T_R(t) \f$. * * \param runData raw run data needed to perform some crosschecks * \param histNo array of the histo numbers form which to build the asymmetry diff --git a/src/include/PMsrHandler.h b/src/include/PMsrHandler.h index c0ca8139..b307a356 100644 --- a/src/include/PMsrHandler.h +++ b/src/include/PMsrHandler.h @@ -42,7 +42,7 @@ //------------------------------------------------------------- /** - *

+ *

This class provides the routines needed to handle msr-files, i.e. reading, writing, parsing, etc. */ class PMsrHandler { diff --git a/src/include/PMusr.h b/src/include/PMusr.h index 999bd36f..326201d7 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -125,67 +125,68 @@ using namespace std; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of a bool vector. + *

typedef to make to code more readable. Definition of a bool vector. */ typedef vector PBoolVector; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of an unsigned int vector + *

typedef to make to code more readable. Definition of an unsigned int vector */ typedef vector PUIntVector; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of an int vector + *

typedef to make to code more readable. Definition of an int vector */ typedef vector PIntVector; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of an int pair + *

typedef to make to code more readable. Definition of an int pair */ typedef pair PIntPair; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of an int pair vector + *

typedef to make to code more readable. Definition of an int pair vector */ typedef vector PIntPairVector; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of a double vector + *

typedef to make to code more readable. Definition of a double vector */ typedef vector PDoubleVector; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of a double pair + *

typedef to make to code more readable. Definition of a double pair */ typedef pair PDoublePair; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of a double pair vector + *

typedef to make to code more readable. Definition of a double pair vector */ typedef vector PDoublePairVector; //------------------------------------------------------------- /** - *

typedef to make to code more readable. Definition of a string vector + *

typedef to make to code more readable. Definition of a string vector */ typedef vector PStringVector; //------------------------------------------------------------- /** - *

data handling tag + *

data handling tag */ enum EPMusrHandleTag { kEmpty, kFit, kView }; //------------------------------------------------------------- /** - *

Holds the data which will be fitted, i.e. packed, background corrected, ... + *

Handles the data which will be fitted, i.e. packed, background corrected, ... + * This are not the raw histogram data of a run. This are the pre-processed data. */ class PRunData { public: @@ -233,7 +234,7 @@ class PRunData { //------------------------------------------------------------- /** - *

Non-Musr raw data. + *

Handles Non-Musr raw data. */ class PNonMusrRawRunData { public: @@ -265,7 +266,7 @@ class PNonMusrRawRunData { //------------------------------------------------------------- /** - *

Histogram raw muSR data. + *

Handles raw data, both non-muSR data as well muSR histogram data. */ class PRawRunData { public: @@ -335,13 +336,13 @@ class PRawRunData { //------------------------------------------------------------- /** - *

typedef to make to code more readable. A vector of a raw musr run. + *

typedef to make to code more readable. A vector of a raw musr run. */ typedef vector PRawRunDataList; //------------------------------------------------------------- /** - *

Helper structure for parsing. Keeps a msr-file line string and the corresponding line number. + *

Helper structure for parsing. Keeps a msr-file line string and the corresponding line number. */ typedef struct { Int_t fLineNo; ///< original line number of the msr-file @@ -350,13 +351,13 @@ typedef struct { //------------------------------------------------------------- /** - *

typedef to make to code more readable: list of msr-file lines. + *

typedef to make to code more readable: list of msr-file lines. */ typedef vector PMsrLines; //------------------------------------------------------------- /** - *

Holds the information of a parameter. + *

Handles the information of a parameter. */ typedef struct { Int_t fNoOfParams; ///< how many parameters are given @@ -374,13 +375,13 @@ typedef struct { //------------------------------------------------------------- /** - *

typedef to make to code more readable: vector of fit parameters. + *

typedef to make to code more readable: vector of fit parameters. */ typedef vector PMsrParamList; //------------------------------------------------------------- /** - *

Holds the information of a single run block + *

Handles the information of a single run block * */ class PMsrRunBlock { @@ -402,7 +403,6 @@ class PMsrRunBlock { virtual Int_t GetBetaParamNo() { return fBetaParamNo; } virtual Int_t GetNormParamNo() { return fNormParamNo; } virtual Int_t GetBkgFitParamNo() { return fBkgFitParamNo; } - virtual Int_t GetPhaseParamNo() { return fPhaseParamNo; } virtual Int_t GetLifetimeParamNo() { return fLifetimeParamNo; } virtual Bool_t IsLifetimeCorrected() { return fLifetimeCorrection; } virtual PIntVector* GetMap() { return &fMap; } @@ -435,7 +435,6 @@ class PMsrRunBlock { virtual void SetBetaParamNo(Int_t ival) { fBetaParamNo = ival; } virtual void SetNormParamNo(Int_t ival) { fNormParamNo = ival; } virtual void SetBkgFitParamNo(Int_t ival) { fBkgFitParamNo = ival; } - virtual void SetPhaseParamNo(Int_t ival) { fPhaseParamNo = ival; } virtual void SetLifetimeParamNo(Int_t ival) { fLifetimeParamNo = ival; } virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; } virtual void SetMap(Int_t mapVal, Int_t idx=-1); @@ -463,7 +462,6 @@ class PMsrRunBlock { Int_t fBetaParamNo; ///< beta parameter number (fit type 2, 4) Int_t fNormParamNo; ///< N0 parameter number (fit type 0) Int_t fBkgFitParamNo; ///< background fit parameter number (fit type 0) - Int_t fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!! Int_t fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0) Bool_t fLifetimeCorrection; ///< lifetime correction flag for viewing (fit type 0) PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory @@ -482,13 +480,13 @@ class PMsrRunBlock { //------------------------------------------------------------- /** - *

typedef to make to code more readable: list of runs with its parameters. + *

typedef to make to code more readable: list of runs with its parameters. */ typedef vector PMsrRunList; //------------------------------------------------------------- /** - *

Holds the information of the Fourier block + *

Holds the information of the Fourier block */ typedef struct { Bool_t fFourierBlockPresent; ///< flag indicating if a Fourier block is present in the msr-file @@ -505,7 +503,7 @@ typedef struct { //------------------------------------------------------------- /** - *

Holds the information of a single plot block + *

Holds the information of a single plot block */ typedef struct { Int_t fPlotType; ///< plot type @@ -526,13 +524,13 @@ typedef struct { //------------------------------------------------------------- /** - *

typedef to make to code more readable: list of plots. + *

typedef to make to code more readable: list of plots. */ typedef vector PMsrPlotList; //------------------------------------------------------------- /** - *

+ *

Holds the informations for the statistics block. */ typedef struct { Bool_t fValid; ///< flag showing if the statistics block is valid, i.e. a fit took place which converged diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h index 382108e1..c54ab762 100644 --- a/src/include/PMusrCanvas.h +++ b/src/include/PMusrCanvas.h @@ -84,57 +84,59 @@ //------------------------------------------------------------------------ /** - *

+ *

Structure holding all necessary histograms for a single plot block entry for + * fit types: asymmetry fit and single histogram fit. */ typedef struct { - TH1F *data; - TH1F *dataFourierRe; - TH1F *dataFourierIm; - TH1F *dataFourierPwr; - TH1F *dataFourierPhase; - TH1F *theory; - TH1F *theoryFourierRe; - TH1F *theoryFourierIm; - TH1F *theoryFourierPwr; - TH1F *theoryFourierPhase; - TH1F *diff; - TH1F *diffFourierRe; - TH1F *diffFourierIm; - TH1F *diffFourierPwr; - TH1F *diffFourierPhase; + TH1F *data; ///< data histogram + TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram + TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram + TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram + TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram + TH1F *theory; ///< theory histogram belonging to the data histogram + TH1F *theoryFourierRe; ///< real part of the Fourier transform of the theory histogram + TH1F *theoryFourierIm; ///< imaginary part of the Fourier transform of the theory histogram + TH1F *theoryFourierPwr; ///< power spectrum of the Fourier transform of the theory histogram + TH1F *theoryFourierPhase; ///< phase spectrum of the Fourier transform of the theory histogram + TH1F *diff; ///< difference histogram, i.e. data-theory + TH1F *diffFourierRe; ///< real part of the Fourier transform of the diff histogram + TH1F *diffFourierIm; ///< imaginary part of the Fourier transform of the diff histogram + TH1F *diffFourierPwr; ///< power spectrum of the Fourier transform of the diff histogram + TH1F *diffFourierPhase; ///< phase spectrum of the Fourier transform of the diff histogram } PMusrCanvasDataSet; //------------------------------------------------------------------------ /** - *

+ *

typedef to make to code more readable: list of histogram data sets. */ typedef vector PMusrCanvasDataList; //------------------------------------------------------------------------ /** - *

+ *

Structure holding all necessary error graphs for a single plot block entry for + * fit types: non-muSR fit. */ typedef struct { - TGraphErrors *data; - TGraphErrors *dataFourierRe; - TGraphErrors *dataFourierIm; - TGraphErrors *dataFourierPwr; - TGraphErrors *dataFourierPhase; - TGraphErrors *theory; - TGraphErrors *theoryFourierRe; - TGraphErrors *theoryFourierIm; - TGraphErrors *theoryFourierPwr; - TGraphErrors *theoryFourierPhase; - TGraphErrors *diff; - TGraphErrors *diffFourierRe; - TGraphErrors *diffFourierIm; - TGraphErrors *diffFourierPwr; - TGraphErrors *diffFourierPhase; + TGraphErrors *data; ///< data error graph + TGraphErrors *dataFourierRe; ///< real part of the Fourier transform of the data error graph + TGraphErrors *dataFourierIm; ///< imaginary part of the Fourier transform of the data error graph + TGraphErrors *dataFourierPwr; ///< power spectrum of the Fourier transform of the data error graph + TGraphErrors *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data error graph + TGraphErrors *theory; ///< theory histogram belonging to the data error graph + TGraphErrors *theoryFourierRe; ///< real part of the Fourier transform of the theory error graph + TGraphErrors *theoryFourierIm; ///< imaginary part of the Fourier transform of the theory error graph + TGraphErrors *theoryFourierPwr; ///< power spectrum of the Fourier transform of the theory error graph + TGraphErrors *theoryFourierPhase; ///< phase spectrum of the Fourier transform of the theory error graph + TGraphErrors *diff; ///< difference error graph, i.e. data-theory + TGraphErrors *diffFourierRe; ///< real part of the Fourier transform of the diff error graph + TGraphErrors *diffFourierIm; ///< imaginary part of the Fourier transform of the diff error graph + TGraphErrors *diffFourierPwr; ///< power spectrum of the Fourier transform of the diff error graph + TGraphErrors *diffFourierPhase; ///< phase spectrum of the Fourier transform of the diff error graph } PMusrCanvasNonMusrDataSet; //------------------------------------------------------------------------ /** - *

+ *

typedef to make to code more readable: list of error graph data sets. */ typedef vector PMusrCanvasNonMusrDataList; @@ -143,17 +145,17 @@ typedef vector PMusrCanvasNonMusrDataList; *

data structure needed for ascii dump within musrview. */ typedef struct { - PDoubleVector dataX; - PDoubleVector data; - PDoubleVector dataErr; - PDoubleVector theoryX; - PDoubleVector theory; + PDoubleVector dataX; ///< x-axis data set + PDoubleVector data; ///< y-axis data set + PDoubleVector dataErr; ///< error of the y-axis data set + PDoubleVector theoryX; ///< x-axis theory set + PDoubleVector theory; ///< y-axis theory set } PMusrCanvasAsciiDump; //------------------------------------------------------------------------ /** - *

vectore of the above data structure. Used if there are multiple histogramms - * to be dumped. + *

typedef to make to code more readable: vector of the above data structure. + * Used if there are multiple histogramms to be dumped. */ typedef vector PMusrCanvasAsciiDumpVector; @@ -193,53 +195,53 @@ class PMusrCanvas : public TObject, public TQObject virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat); private: - Bool_t fBatchMode; /// musrview in ROOT batch mode - Bool_t fValid; - Bool_t fDifferenceView; /// tag showing that the shown data, fourier, are the difference between data and theory - Int_t fCurrentPlotView; /// tag showing what the current plot view is: data, fourier, ... - Int_t fPlotType; - Int_t fPlotNumber; + Bool_t fBatchMode; ///< musrview in ROOT batch mode + Bool_t fValid; ///< if true, everything looks OK + Bool_t fDifferenceView; ///< tag showing that the shown data, fourier, are the difference between data and theory + Int_t fCurrentPlotView; ///< tag showing what the current plot view is: data, fourier, ... + Int_t fPlotType; ///< plot type tag: -1 == undefined, MSR_PLOT_SINGLE_HISTO == single histogram, MSR_PLOT_ASYM == asymmetry, MSR_PLOT_MU_MINUS == mu minus (not yet implemented), MSR_PLOT_NON_MUSR == non-muSR + Int_t fPlotNumber; ///< plot number - Double_t fXmin, fXmax, fYmin, fYmax; /// data/theory frame range + Double_t fXmin, fXmax, fYmin, fYmax; ///< data/theory frame range - Double_t fCurrentFourierPhase; /// holds the current Fourier phase - TLatex *fCurrentFourierPhaseText; /// used in Re/Im Fourier to show the current phase in the pad - TString *fRRFText; - TLatex *fRRFLatexText; /// used to display RRF info + Double_t fCurrentFourierPhase; ///< holds the current Fourier phase + TLatex *fCurrentFourierPhaseText; ///< used in Re/Im Fourier to show the current phase in the pad + TString *fRRFText; ///< RRF information + TLatex *fRRFLatexText; ///< used to display RRF info - TStyle *fStyle; + TStyle *fStyle; ///< A collection of all graphics attributes // canvas menu related variables - TRootCanvas *fImp; - TGMenuBar *fBar; - TGPopupMenu *fPopupMain; - TGPopupMenu *fPopupSave; - TGPopupMenu *fPopupFourier; + TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area + TGMenuBar *fBar; ///< menu bar + TGPopupMenu *fPopupMain; ///< popup menu Musrfit in the main menu bar + TGPopupMenu *fPopupSave; ///< popup menu of the Musrfit/Save Data sub menu + TGPopupMenu *fPopupFourier; ///< popup menu of the Musrfit/Fourier sub menu // canvas related variables - TCanvas *fMainCanvas; - TPaveText *fTitlePad; - TPad *fDataTheoryPad; - TPaveText *fParameterPad; - TPaveText *fTheoryPad; - TLegend *fInfoPad; - TLegend *fMultiGraphLegend; + TCanvas *fMainCanvas; ///< main canvas + TPaveText *fTitlePad; ///< title pad used to display a title + TPad *fDataTheoryPad; ///< data/theory pad used to display the data/theory + TPaveText *fParameterPad; ///< parameter pad used to display the fitting parameters + TPaveText *fTheoryPad; ///< theory pad used to display the theory and functions + TLegend *fInfoPad; ///< info pad used to display a legend of the data plotted + TLegend *fMultiGraphLegend; ///< used for non-muSR plots to display a legend - TH1F *fHistoFrame; + TH1F *fHistoFrame; ///< fHistoFrame is a 'global' frame needed in order to plot histograms with (potentially) different x-frames #ifndef __MAKECINT__ - PMsrHandler *fMsrHandler; - PRunListCollection *fRunList; + PMsrHandler *fMsrHandler; ///< msr-file handler + PRunListCollection *fRunList; ///< data handler #endif // __MAKECINT__ - PMusrCanvasDataList fData; - PMusrCanvasNonMusrDataList fNonMusrData; - TMultiGraph *fMultiGraphData; - TMultiGraph *fMultiGraphDiff; + PMusrCanvasDataList fData; ///< list of all histogram data to be plotted (asymmetry/single histogram) + PMusrCanvasNonMusrDataList fNonMusrData; ///< list of all error graphs to be plotted (non-muSR) + TMultiGraph *fMultiGraphData; ///< fMultiGraphData is a 'global' graph needed in order to plot error graphs (data) with (potentially) different x-frames + TMultiGraph *fMultiGraphDiff; ///< fMultiGraphDiff is a 'global' graph needed in order to plot error graphs (data-theory) with (potentially) different x-frames - PMsrFourierStructure fFourier; - PIntVector fMarkerList; - PIntVector fColorList; + PMsrFourierStructure fFourier; ///< structure holding all the information necessary to perform the Fourier transform + PIntVector fMarkerList; ///< list of markers + PIntVector fColorList; ///< list of colors virtual void CreateStyle(); virtual void InitFourier(); diff --git a/src/include/PMusrT0.h b/src/include/PMusrT0.h index a168edd9..a0da3ced 100644 --- a/src/include/PMusrT0.h +++ b/src/include/PMusrT0.h @@ -54,13 +54,11 @@ #define PMUSRT0_GET_DATA_AND_BKG_RANGE 1 #define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE 2 -/* -#define PMUSRT0_NOADDRUN_NOGROUPING 0 -#define PMUSRT0_ADDRUN_NOGROUPING 1 -#define PMUSRT0_NOADDRUN_GROUPING 2 -#define PMUSRT0_ADDRUN_GROUPING 3 -*/ +//-------------------------------------------------------------------------- +/** + *

Handles the raw muSR run data sets. + */ class PMusrT0Data { public: PMusrT0Data(); @@ -112,6 +110,7 @@ class PMusrT0Data { //-------------------------------------------------------------------------- /** + *

Handles the musrt0 graphical user interface. *

The preprocessor tag __MAKECINT__ is used to hide away from rootcint * the overly complex spirit header files. */ @@ -138,39 +137,39 @@ class PMusrT0 : public TObject, public TQObject private: #ifndef __MAKECINT__ - PMsrHandler *fMsrHandler; + PMsrHandler *fMsrHandler; ///< msr-file handler #endif // __MAKECINT__ - Bool_t fValid; + Bool_t fValid; ///< true if raw data set are available, otherwise false - Int_t fStatus; + Int_t fStatus; ///< 0=quit locally, i.e. only a single musrt0 raw data canvas will terminate but not the application, 1=quit the application - PMusrT0Data fMusrT0Data; + PMusrT0Data fMusrT0Data; ///< raw muSR run data sets. - Bool_t fDataAndBkgEnabled; - Bool_t fT0Enabled; - Int_t fT0Estimated; + Bool_t fDataAndBkgEnabled; ///< enable/disable data and background range handling (necessary in connection with grouping and addrun) + Bool_t fT0Enabled; ///< enable/disable t0 handling (necessary in connection with grouping and addrun) + Int_t fT0Estimated; ///< estimated t0 value (in bins) // canvas related variables - TCanvas *fMainCanvas; + TCanvas *fMainCanvas; ///< main canvas for the graphical user interface - TH1F *fHisto; - TH1F *fData; - TH1F *fBkg; + TH1F *fHisto; ///< full raw data histogram + TH1F *fData; ///< ranged raw data histogram (first good bin, last good bin) + TH1F *fBkg; ///< histogram starting from 'bkg start' up to 'bkg end' - TLatex *fToDoInfo; + TLatex *fToDoInfo; ///< clear text user instruction string - TLine *fT0Line; - TLine *fFirstBkgLine; - TLine *fLastBkgLine; - TLine *fFirstDataLine; - TLine *fLastDataLine; + TLine *fT0Line; ///< line showing the position of t0 + TLine *fFirstBkgLine; ///< line showing the start of the background + TLine *fLastBkgLine; ///< line showing the end of the background + TLine *fFirstDataLine; ///< line showing the start of the data (first good data bin) + TLine *fLastDataLine; ///< line showing the end of the data (last good data bin) - Int_t fPx; - Int_t fPy; + Int_t fPx; ///< x-position of the cursor + Int_t fPy; ///< y-position of the cursor - Int_t fDataRange[2]; - Int_t fBkgRange[2]; + Int_t fDataRange[2]; ///< data range (first good bin, last good bin) + Int_t fBkgRange[2]; ///< background range (first bkg bin, last bkg bin) void SetT0Channel(); void SetEstimatedT0Channel(); diff --git a/src/include/PRunAsymmetry.h b/src/include/PRunAsymmetry.h index b3d81ab3..a6e901c8 100644 --- a/src/include/PRunAsymmetry.h +++ b/src/include/PRunAsymmetry.h @@ -34,6 +34,10 @@ #include "PRunBase.h" +//--------------------------------------------------------------------------- +/** + *

Class handling the asymmetry fit. + */ class PRunAsymmetry : public PRunBase { public: @@ -45,7 +49,7 @@ class PRunAsymmetry : public PRunBase virtual Double_t CalcMaxLikelihood(const std::vector& par); virtual void CalcTheory(); - virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; } + virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; } ///< returns the number of bins to be fitted. protected: virtual Bool_t PrepareData(); @@ -54,11 +58,11 @@ class PRunAsymmetry : public PRunBase virtual Bool_t PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]); private: - UInt_t fAlphaBetaTag; ///< 1-> alpha = beta = 1; 2-> alpha != 1, beta = 1; 3-> alpha = 1, beta != 1; 4-> alpha != 1, beta != 1 + UInt_t fAlphaBetaTag; ///< \f$ 1 \to \alpha = \beta = 1\f$; \f$ 2 \to \alpha \neq 1, \beta = 1\f$; \f$ 3 \to \alpha = 1, \beta \neq 1\f$; \f$ 4 \to \alpha \neq 1, \beta \neq 1\f$. - Double_t fFitStartTime; - Double_t fFitStopTime; - UInt_t fNoOfFitBins; + Double_t fFitStartTime; ///< fit start time + Double_t fFitStopTime; ///< fit stop time + UInt_t fNoOfFitBins; ///< number of bins to be be fitted PDoubleVector fForward; ///< forward histo data PDoubleVector fForwardErr; ///< forward histo errors