added more docu

This commit is contained in:
nemu 2010-05-31 08:25:57 +00:00
parent 959c792a68
commit 5d124b3d79
11 changed files with 669 additions and 508 deletions

View File

@ -461,19 +461,23 @@ WARN_LOGFILE =
INPUT = ../src/include/PFitterFcn.h \ INPUT = ../src/include/PFitterFcn.h \
../src/include/PFitter.h \ ../src/include/PFitter.h \
../src/include/PFourier.h \
../src/include/PFunctionGrammar.h \ ../src/include/PFunctionGrammar.h \
../src/include/PFunction.h \ ../src/include/PFunction.h \
../src/include/PFunctionHandler.h \ ../src/include/PFunctionHandler.h \
../src/include/PMsr2Data.h \
../src/include/PMsrHandler.h \ ../src/include/PMsrHandler.h \
../src/include/PMusrCanvas.h \ ../src/include/PMusrCanvas.h \
../src/include/PMusrCanvasLinkDef.h \ ../src/include/PMusrCanvasLinkDef.h \
../src/include/PMusr.h \ ../src/include/PMusr.h \
../src/include/PMusrT0.h \
../src/include/PMusrT0LinkDef.h \
../src/include/PRunAsymmetry.h \ ../src/include/PRunAsymmetry.h \
../src/include/PRunBase.h \ ../src/include/PRunBase.h \
../src/include/PRunDataHandler.h \ ../src/include/PRunDataHandler.h \
../src/include/PRunListCollection.h \ ../src/include/PRunListCollection.h \
../src/include/PRunMuMinus.h \
../src/include/PRunNonMusr.h \ ../src/include/PRunNonMusr.h \
../src/include/PRunRRF.h \
../src/include/PRunSingleHisto.h \ ../src/include/PRunSingleHisto.h \
../src/include/PStartupHandler.h \ ../src/include/PStartupHandler.h \
../src/include/PStartupHandlerLinkDef.h \ ../src/include/PStartupHandlerLinkDef.h \
@ -481,28 +485,33 @@ INPUT = ../src/include/PFitterFcn.h \
../src/include/PUserFcnBase.h \ ../src/include/PUserFcnBase.h \
../src/include/PUserFcnBaseLinkDef.h \ ../src/include/PUserFcnBaseLinkDef.h \
../src/include/PUserFcn.h \ ../src/include/PUserFcn.h \
../src/include/PUserFcnLinkDef.h \
../src/classes/PFitter.cpp \ ../src/classes/PFitter.cpp \
../src/classes/PFitterFcn.cpp \ ../src/classes/PFitterFcn.cpp \
../src/classes/PFourier.cpp \
../src/classes/PFunction.cpp \ ../src/classes/PFunction.cpp \
../src/classes/PFunctionHandler.cpp \ ../src/classes/PFunctionHandler.cpp \
../src/classes/PMsr2Data.cpp \
../src/classes/PMsrHandler.cpp \ ../src/classes/PMsrHandler.cpp \
../src/classes/PMusrCanvas.cpp \ ../src/classes/PMusrCanvas.cpp \
../src/classes/PMusr.cpp \
../src/classes/PMusrT0.cpp \
../src/classes/PRunAsymmetry.cpp \ ../src/classes/PRunAsymmetry.cpp \
../src/classes/PRunBase.cpp \ ../src/classes/PRunBase.cpp \
../src/classes/PRunDataHandler.cpp \ ../src/classes/PRunDataHandler.cpp \
../src/classes/PRunListCollection.cpp \ ../src/classes/PRunListCollection.cpp \
../src/classes/PRunMuMinus.cpp \
../src/classes/PRunNonMusr.cpp \ ../src/classes/PRunNonMusr.cpp \
../src/classes/PRunRRF.cpp \
../src/classes/PRunSingleHisto.cpp \ ../src/classes/PRunSingleHisto.cpp \
../src/classes/PStartupHandler.cpp \ ../src/classes/PStartupHandler.cpp \
../src/classes/PTheory.cpp \ ../src/classes/PTheory.cpp \
../src/classes/PUserFcnBase.cpp \ ../src/classes/PUserFcnBase.cpp \
../src/classes/PUserFcn.cpp \ ../src/classes/PUserFcn.cpp \
../src/msr2data.cpp \
../src/msr2msr.cpp \
../src/musrfit.cpp \ ../src/musrfit.cpp \
../src/musrview.cpp \
../src/musrparam.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 # 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 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp

View File

@ -48,9 +48,9 @@ using namespace std;
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Constructor
* *
* \param fileName * \param fileName name of a msr-file.
*/ */
PMsrHandler::PMsrHandler(const Char_t *fileName) : fFileName(fileName) PMsrHandler::PMsrHandler(const Char_t *fileName) : fFileName(fileName)
{ {
@ -67,6 +67,7 @@ PMsrHandler::PMsrHandler(const Char_t *fileName) : fFileName(fileName)
fFuncHandler = 0; 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("/")) { if (fFileName.Contains("/")) {
Int_t idx = -1; Int_t idx = -1;
while (fFileName.Index("/", idx+1) != -1) { while (fFileName.Index("/", idx+1) != -1) {
@ -83,7 +84,7 @@ PMsrHandler::PMsrHandler(const Char_t *fileName) : fFileName(fileName)
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Destructor
*/ */
PMsrHandler::~PMsrHandler() PMsrHandler::~PMsrHandler()
{ {
@ -106,12 +107,11 @@ PMsrHandler::~PMsrHandler()
// ReadMsrFile (public) // ReadMsrFile (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Reads and parses a msr-file.
* *
* <p><b>return:</b> * <p><b>return:</b>
* - PMUSR_SUCCESS if everything is OK * - PMUSR_SUCCESS if everything is OK
* - line number if an error in the MSR file was encountered which cannot be handled. * - line number if an error in the MSR file was encountered which cannot be handled.
*
*/ */
Int_t PMsrHandler::ReadMsrFile() Int_t PMsrHandler::ReadMsrFile()
{ {
@ -303,7 +303,15 @@ Int_t PMsrHandler::ReadMsrFile()
// WriteMsrLogFile (public) // WriteMsrLogFile (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Writes a mlog-file.
*
* <p><b>return:</b>
* - 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) Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
{ {
@ -1095,20 +1103,24 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
// SetMsrParamValue (public) // SetMsrParamValue (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Sets the fit parameter value at position idx.
* *
* \param i * <p><b>return:</b>
* \param value * - 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()) { if (idx >= fParam.size()) {
cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is >= than the number of fit parameters " << fParam.size();
cerr << endl; cerr << endl;
return false; return false;
} }
fParam[i].fValue = value; fParam[idx].fValue = value;
return true; return true;
} }
@ -1117,20 +1129,25 @@ Bool_t PMsrHandler::SetMsrParamValue(UInt_t i, Double_t value)
// SetMsrParamStep (public) // SetMsrParamStep (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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 * <p><b>return:</b>
* \param value * - 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()) { if (idx >= fParam.size()) {
cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); cerr << endl << "PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size();
cerr << endl; cerr << endl;
return false; return false;
} }
fParam[i].fStep = value; fParam[idx].fStep = value;
return true; return true;
} }
@ -1139,20 +1156,24 @@ Bool_t PMsrHandler::SetMsrParamStep(UInt_t i, Double_t value)
// SetMsrParamPosErrorPresent (public) // SetMsrParamPosErrorPresent (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Sets the flag whether the fit parameter positive error value is persent. This at positon idx.
* *
* \param i * <p><b>return:</b>
* \param value * - 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()) { if (idx >= fParam.size()) {
cerr << endl << "PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); cerr << endl << "PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size();
cerr << endl; cerr << endl;
return false; return false;
} }
fParam[i].fPosErrorPresent = value; fParam[idx].fPosErrorPresent = value;
return true; return true;
} }
@ -1161,21 +1182,25 @@ Bool_t PMsrHandler::SetMsrParamPosErrorPresent(UInt_t i, Bool_t value)
// SetMsrParamPosError (public) // SetMsrParamPosError (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Sets the fit parameter positive error value at positon idx.
* *
* \param i * <p><b>return:</b>
* \param value * - 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()) { if (idx >= fParam.size()) {
cerr << endl << "PMsrHandler::SetMsrParamPosError(): **ERROR** i = " << i << " is larger than the number of parameters " << fParam.size(); cerr << endl << "PMsrHandler::SetMsrParamPosError(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size();
cerr << endl; cerr << endl;
return false; return false;
} }
fParam[i].fPosErrorPresent = true; fParam[idx].fPosErrorPresent = true;
fParam[i].fPosError = value; fParam[idx].fPosError = value;
return true; return true;
} }
@ -1184,11 +1209,11 @@ Bool_t PMsrHandler::SetMsrParamPosError(UInt_t i, Double_t value)
// SetMsrT0Entry (public) // SetMsrT0Entry (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Sets the t0 entries for a given runNo and a given histogram index idx.
* *
* \param runNo * \param runNo msr-file run number
* \param idx * \param idx msr-file histogram index
* \param bin * \param bin t0 bin value
*/ */
void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin) 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 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 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 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) 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) // SetMsrDataRangeEntry (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Sets the data range entries for a given runNo and a given histogram index idx.
* *
* \param runNo * \param runNo msr-file run number
* \param idx * \param idx 0=start bin index, 1=end bin index
* \param bin * \param bin data range bin value
*/ */
void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) 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 << "PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
cerr << endl; cerr << endl;
return; return;
@ -1266,15 +1291,15 @@ void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
// SetMsrBkgRangeEntry (public) // SetMsrBkgRangeEntry (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Sets the background range entries for a given runNo and a given histogram index idx.
* *
* \param runNo * \param runNo msr-file run number
* \param idx * \param idx 0=start bin index, 1=end bin index
* \param bin * \param bin background range bin value
*/ */
void PMsrHandler::SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) 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 << "PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
cerr << endl; cerr << endl;
return; return;
@ -1292,12 +1317,16 @@ void PMsrHandler::SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
* parameter is <b>NOT</b> used at all. This is stupid! Hence one has to check * parameter is <b>NOT</b> 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. * if the parameter is used at all and if not, it has to be fixed.
* *
* \param paramNo * <p><b>return:</b>
* - 0 if the parameter is <b>not</b> used.
* - a value > 0 if the parameter is used.
*
* \param paramNo parameter number
*/ */
Int_t PMsrHandler::ParameterInUse(UInt_t paramNo) Int_t PMsrHandler::ParameterInUse(UInt_t paramNo)
{ {
// check that paramNo is within acceptable range // check that paramNo is within acceptable range
if ((paramNo < 0) || (paramNo > fParam.size())) if ((paramNo < 0) || (paramNo >= fParam.size()))
return -1; return -1;
return fParamInUse[paramNo]; return fParamInUse[paramNo];
@ -1321,6 +1350,10 @@ Int_t PMsrHandler::ParameterInUse(UInt_t paramNo)
* when starting * when starting
* \endcode * \endcode
* *
* <b>return:</b>
* - true is fit parameter lines are OK.
* - false otherwise
*
* \param lines is a list of lines containing the fitparameter block * \param lines is a list of lines containing the fitparameter block
*/ */
Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines)
@ -1524,9 +1557,12 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines)
// HandleTheoryEntry (private) // HandleTheoryEntry (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Just stores the THEORY block lines.
* *
* \param lines is a list of lines containing the fitparameter block * <b>return:</b>
* - true always
*
* \param lines is a list of lines containing the theory block
*/ */
Bool_t PMsrHandler::HandleTheoryEntry(PMsrLines &lines) Bool_t PMsrHandler::HandleTheoryEntry(PMsrLines &lines)
{ {
@ -1540,9 +1576,13 @@ Bool_t PMsrHandler::HandleTheoryEntry(PMsrLines &lines)
// HandleFunctionsEntry (private) // HandleFunctionsEntry (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Parses the FUNCTIONS block of the msr-file.
* *
* \param lines is a list of lines containing the fitparameter block * <b>return:</b>
* - 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) Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines)
{ {
@ -1576,9 +1616,13 @@ Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines)
// HandleRunEntry (private) // HandleRunEntry (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Parses the RUN blocks of the msr-file.
* *
* \param lines is a list of lines containing the fitparameter block * <b>return:</b>
* - true if successful
* - false otherwise
*
* \param lines is a list of lines containing the run blocks
*/ */
Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) 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 * It is used to filter strings like: map1 or fun4. At the moment only
* the filter strings 'map', 'fun', and 'par' are supported. * the filter strings 'map', 'fun', and 'par' are supported.
* *
* <b>return:</b>
* - true if successful
* - false otherwise
*
* \param str input string * \param str input string
* \param filter filter string * \param filter filter string
* \param offset it is used to offset to found number, e.g. strX -> no = X+offset * \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) // HandleCommandsEntry (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> In the command block there shall be a new command which can be used * <p> Just copies the COMMAND block lines.
* to switch between chi2 and maximum_likelihood!!
* *
* \param lines is a list of lines containing the fitparameter block * <b>return:</b>
* - true
*
* \param lines is a list of lines containing the command block
*/ */
Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines) Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines)
{ {
@ -2184,7 +2234,7 @@ Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines)
// InitFourierParameterStructure (private) // InitFourierParameterStructure (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Initializes the Fourier parameter structure.
* *
* \param fourier fourier parameters * \param fourier fourier parameters
*/ */
@ -2207,7 +2257,11 @@ void PMsrHandler::InitFourierParameterStructure(PMsrFourierStructure &fourier)
// HandleFourierEntry (private) // HandleFourierEntry (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Parses the Fourier block of a msr-file.
*
* <b>return:</b>
* - true if successful
* - false otherwise
* *
* \param lines is a list of lines containing the fourier parameter block * \param lines is a list of lines containing the fourier parameter block
*/ */
@ -2448,9 +2502,13 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines)
// HandlePlotEntry (private) // HandlePlotEntry (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Parses the PLOT block of a msr-file.
* *
* \param lines is a list of lines containing the fitparameter block * <b>return:</b>
* - true if successful
* - false otherwise
*
* \param lines is a list of lines containing the plot block
*/ */
Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
{ {
@ -2968,9 +3026,13 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
// HandleStatisticEntry (private) // HandleStatisticEntry (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Handles the STATISTIC block of a msr-file.
* *
* \param lines is a list of lines containing the fitparameter block * <b>return:</b>
* - true if successful
* - false otherwise
*
* \param lines is a list of lines containing the statistic block
*/ */
Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines) Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines)
{ {
@ -3057,16 +3119,6 @@ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines)
fStatistic.fStatLines.push_back(lines[i]); 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; return true;
} }
@ -3074,11 +3126,12 @@ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines)
// FillParameterInUse (private) // FillParameterInUse (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Fills the fParamInUse vector. An element of the vector will be 0 if the fit parameter
* is <b>not</b> used at all, otherwise it will be > 0.
* *
* \param theory * \param theory msr-file THEROY block lines
* \param funcs * \param funcs msr-file FUNCTIONS block lines
* \param run * \param run msr-file RUN blocks lines
*/ */
void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLines &run) 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); fParamInUse.push_back(0);
// go through all the theory lines ------------------------------------ // go through all the theory lines ------------------------------------
//cout << endl << ">> theory block check ...";
for (iter = theory.begin(); iter != theory.end(); ++iter) { for (iter = theory.begin(); iter != theory.end(); ++iter) {
// remove potential comments // remove potential comments
str = iter->fLine; str = iter->fLine;
@ -3118,13 +3170,11 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
ival = str.Atoi(); ival = str.Atoi();
if ((ival > 0) && (ival < (Int_t)fParam.size()+1)) { if ((ival > 0) && (ival < (Int_t)fParam.size()+1)) {
fParamInUse[ival-1]++; fParamInUse[ival-1]++;
//cout << endl << ">>>> theo: param no : " << ival;
} }
} else if (str.Contains("map")) { // map } else if (str.Contains("map")) { // map
if (FilterNumber(str, "map", MSR_PARAM_MAP_OFFSET, ival)) if (FilterNumber(str, "map", MSR_PARAM_MAP_OFFSET, ival))
map.push_back(ival-MSR_PARAM_MAP_OFFSET); map.push_back(ival-MSR_PARAM_MAP_OFFSET);
} else if (str.Contains("fun")) { // fun } else if (str.Contains("fun")) { // fun
//cout << endl << "theo:fun: " << str.Data();
if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, ival)) if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, ival))
fun.push_back(ival-MSR_PARAM_FUN_OFFSET); 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 ----------------------------- // go through all the function lines: 1st time -----------------------------
//cout << endl << ">> function block check (1st time) ...";
for (iter = funcs.begin(); iter != funcs.end(); ++iter) { for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
// remove potential comments // remove potential comments
str = iter->fLine; str = iter->fLine;
@ -3148,9 +3197,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
// everything to lower case // everything to lower case
str.ToLower(); str.ToLower();
// cout << endl << "-----------------------";
// cout << endl << ">> " << str.Data();
tokens = str.Tokenize(" /t"); tokens = str.Tokenize(" /t");
if (!tokens) if (!tokens)
continue; 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 // check if fun number is used, and if yes, filter parameter numbers and maps
TString sstr; TString sstr;
//cout << endl << ">> fun.size() = " << fun.size();
for (UInt_t i=0; i<fun.size(); i++) { for (UInt_t i=0; i<fun.size(); i++) {
//cout << endl << ">> funNo: " << fun[i] << ", funNo: " << funNo;
if (fun[i] == funNo) { // function number found if (fun[i] == funNo) { // function number found
// filter for parX // filter for parX
sstr = iter->fLine; sstr = iter->fLine;
@ -3174,14 +3218,12 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
while (sstr.Index("par") != -1) { while (sstr.Index("par") != -1) {
memset(sval, 0, sizeof(sval)); memset(sval, 0, sizeof(sval));
sstr = &sstr[sstr.Index("par")+3]; // trunc sstr sstr = &sstr[sstr.Index("par")+3]; // trunc sstr
//cout << endl << ">> par:sstr: " << sstr.Data();
for (Int_t j=0; j<sstr.Sizeof(); j++) { for (Int_t j=0; j<sstr.Sizeof(); j++) {
if (!isdigit(sstr[j])) if (!isdigit(sstr[j]))
break; break;
sval[j] = sstr[j]; sval[j] = sstr[j];
} }
sscanf(sval, "%d", &ival); sscanf(sval, "%d", &ival);
//cout << endl << ">>>> parX from func 1st, X = " << ival;
fParamInUse[ival-1]++; fParamInUse[ival-1]++;
} }
@ -3190,14 +3232,12 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
while (sstr.Index("map") != -1) { while (sstr.Index("map") != -1) {
memset(sval, 0, sizeof(sval)); memset(sval, 0, sizeof(sval));
sstr = &sstr[sstr.Index("map")+3]; // trunc sstr sstr = &sstr[sstr.Index("map")+3]; // trunc sstr
//cout << endl << ">> map:sstr: " << sstr.Data();
for (Int_t j=0; j<sstr.Sizeof(); j++) { for (Int_t j=0; j<sstr.Sizeof(); j++) {
if (!isdigit(sstr[j])) if (!isdigit(sstr[j]))
break; break;
sval[j] = sstr[j]; sval[j] = sstr[j];
} }
sscanf(sval, "%d", &ival); sscanf(sval, "%d", &ival);
//cout << endl << ">>>> mapX from func 1st, X = " << ival;
// check if map value already in map, otherwise add it // check if map value already in map, otherwise add it
if (ival > 0) { if (ival > 0) {
UInt_t pos; UInt_t pos;
@ -3222,7 +3262,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
} }
// go through all the run block lines ------------------------------------- // go through all the run block lines -------------------------------------
//cout << endl << ">> run block check (1st time) ...";
for (iter = run.begin(); iter != run.end(); ++iter) { for (iter = run.begin(); iter != run.end(); ++iter) {
// remove potential comments // remove potential comments
str = iter->fLine; str = iter->fLine;
@ -3250,13 +3289,11 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
if (str.IsDigit()) { if (str.IsDigit()) {
ival = str.Atoi(); ival = str.Atoi();
fParamInUse[ival-1]++; fParamInUse[ival-1]++;
//cout << endl << ">>>> run : parameter no : " << ival;
} }
// check if fun // check if fun
if (str.Contains("fun")) { if (str.Contains("fun")) {
if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, ival)) { if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, ival)) {
fun.push_back(ival-MSR_PARAM_FUN_OFFSET); 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 // handle the maps
if (str.Contains("map")) { if (str.Contains("map")) {
//cout << endl << ">> " << str.Data();
// tokenize string // tokenize string
tokens = str.Tokenize(" \t"); tokens = str.Tokenize(" \t");
if (!tokens) if (!tokens)
continue; continue;
// get the parameter number via map // get the parameter number via map
//cout << endl << ">> map.size() = " << map.size();
for (UInt_t i=0; i<map.size(); i++) { for (UInt_t i=0; i<map.size(); i++) {
if (map[i] == 0) if (map[i] == 0)
continue; continue;
@ -3287,7 +3322,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
ival = str.Atoi(); ival = str.Atoi();
if (ival > 0) { if (ival > 0) {
fParamInUse[ival-1]++; // this is OK since map is ranging from 1 .. 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 ----------------------------- // go through all the function lines: 2nd time -----------------------------
//cout << endl << ">> function block check (2nd time) ...";
for (iter = funcs.begin(); iter != funcs.end(); ++iter) { for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
// remove potential comments // remove potential comments
str = iter->fLine; str = iter->fLine;
@ -3312,9 +3345,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
// everything to lower case // everything to lower case
str.ToLower(); str.ToLower();
// cout << endl << "===========================";
// cout << endl << ">> " << str.Data();
tokens = str.Tokenize(" /t"); tokens = str.Tokenize(" /t");
if (!tokens) if (!tokens)
continue; 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 // check if fun number is used, and if yes, filter parameter numbers and maps
TString sstr; TString sstr;
for (UInt_t i=0; i<fun.size(); i++) { for (UInt_t i=0; i<fun.size(); i++) {
//cout << endl << ">> funNo: " << fun[i] << ", funNo: " << funNo;
if (fun[i] == funNo) { // function number found if (fun[i] == funNo) { // function number found
// filter for parX // filter for parX
sstr = iter->fLine; sstr = iter->fLine;
@ -3344,7 +3373,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
} }
sscanf(sval, "%d", &ival); sscanf(sval, "%d", &ival);
fParamInUse[ival-1]++; fParamInUse[ival-1]++;
//cout << endl << ">>>> parX from func 2nd, X = " << ival;
} }
// filter for mapX // filter for mapX
@ -3358,7 +3386,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
sval[j] = sstr[j]; sval[j] = sstr[j];
} }
sscanf(sval, "%d", &ival); sscanf(sval, "%d", &ival);
//cout << endl << ">>>> mapX from func 2nd, X = " << ival;
// check if map value already in map, otherwise add it // check if map value already in map, otherwise add it
if (ival > 0) { if (ival > 0) {
UInt_t pos; 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 // 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) { for (iter = run.begin(); iter != run.end(); ++iter) {
// remove potential comments // remove potential comments
str = iter->fLine; str = iter->fLine;
@ -3394,14 +3420,12 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
// handle the maps // handle the maps
if (str.Contains("map")) { if (str.Contains("map")) {
//cout << endl << ">> " << str.Data();
// tokenize string // tokenize string
tokens = str.Tokenize(" \t"); tokens = str.Tokenize(" \t");
if (!tokens) if (!tokens)
continue; continue;
// get the parameter number via map // get the parameter number via map
//cout << endl << ">> map.size() = " << map.size();
for (UInt_t i=0; i<map.size(); i++) { for (UInt_t i=0; i<map.size(); i++) {
if (map[i] == 0) if (map[i] == 0)
continue; continue;
@ -3412,7 +3436,6 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
ival = str.Atoi(); ival = str.Atoi();
if (ival > 0) { if (ival > 0) {
fParamInUse[ival-1]++; // this is OK since map is ranging from 1 .. 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<fParamInUse.size(); i++)
// cout << endl << i+1 << ", " << fParamInUse[i];
// cout << endl;
// if unused parameters are present, set the step value to 0.0 // if unused parameters are present, set the step value to 0.0
for (UInt_t i=0; i<fParam.size(); i++) { for (UInt_t i=0; i<fParam.size(); i++) {
if (!ParameterInUse(i)) { if (!ParameterInUse(i)) {
@ -3450,10 +3468,15 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
// CheckUniquenessOfParamNames (private) // CheckUniquenessOfParamNames (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Checks if all the fit parameters are unique. If not parX, parY will show
* the first occurence of equal fit parameter names.
* *
* \param parX * <b>return:</b>
* \param parY * - 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) Bool_t PMsrHandler::CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY)
{ {
@ -3478,7 +3501,11 @@ Bool_t PMsrHandler::CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Checks if map entries found in the theory- or function-block are also * <p>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.
*
* <b>return:</b>
* - true if maps or OK
* - false otherwise
*/ */
Bool_t PMsrHandler::CheckMaps() Bool_t PMsrHandler::CheckMaps()
{ {
@ -3584,7 +3611,11 @@ Bool_t PMsrHandler::CheckMaps()
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Checks if fun entries found in the theory- and run-block are also * <p>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.
*
* <b>return:</b>
* - true if fun entries or present in the FUNCTIONS block
* - false otherwise
*/ */
Bool_t PMsrHandler::CheckFuncs() Bool_t PMsrHandler::CheckFuncs()
{ {
@ -3672,6 +3703,10 @@ Bool_t PMsrHandler::CheckFuncs()
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Checks if histogram grouping makes any sense. * <p>Checks if histogram grouping makes any sense.
*
* <b>return:</b>
* - true if histogram grouping seems OK
* - false otherwise
*/ */
Bool_t PMsrHandler::CheckHistoGrouping() Bool_t PMsrHandler::CheckHistoGrouping()
{ {
@ -3722,7 +3757,11 @@ Bool_t PMsrHandler::CheckHistoGrouping()
// CheckAddRunParameters (private) // CheckAddRunParameters (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Check if addrun is present that given parameters make any sense. * <p>In case addrun is present check that if addt0's are given there are as many addt0's than addrun's.
*
* <b>return:</b>
* - true if either no addt0 present, or # of addrun's == # of addt0's.
* - false otherwise
*/ */
Bool_t PMsrHandler::CheckAddRunParameters() Bool_t PMsrHandler::CheckAddRunParameters()
{ {

View File

@ -44,7 +44,7 @@ using namespace std;
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Holds the muSR data which will be fitted. * <p>Constructor
*/ */
PRunData::PRunData() PRunData::PRunData()
{ {
@ -63,7 +63,7 @@ PRunData::PRunData()
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Cleans up * <p>Destructor.
*/ */
PRunData::~PRunData() PRunData::~PRunData()
{ {
@ -112,7 +112,7 @@ void PRunData::ReplaceTheory(const PDoubleVector &theo)
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Holds non-muSR data raw data. * <p>Constructor.
*/ */
PNonMusrRawRunData::PNonMusrRawRunData() PNonMusrRawRunData::PNonMusrRawRunData()
{ {
@ -133,7 +133,7 @@ PNonMusrRawRunData::PNonMusrRawRunData()
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Destructor. Cleans up * <p>Destructor.
*/ */
PNonMusrRawRunData::~PNonMusrRawRunData() PNonMusrRawRunData::~PNonMusrRawRunData()
{ {
@ -173,7 +173,7 @@ void PNonMusrRawRunData::SetLabel(const UInt_t idx, const TString str)
// AppendSubData // AppendSubData
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Modifies the data set at position idx. In case idx is larges than the number * <p>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. * of data sets, only a warning will be sent to stderr.
* *
* \param idx index at which position the label should be set * \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 // AppendSubErrData
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Modifies the error-data set at position idx. In case idx is larges than the number * <p>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. * of error-data sets, only a warning will be sent to stderr.
* *
* \param idx index at which position the label should be set * \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 // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Holds muSR raw run data. * <p>Constructor
*/ */
PRawRunData::PRawRunData() PRawRunData::PRawRunData()
{ {
@ -234,7 +234,7 @@ PRawRunData::PRawRunData()
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Destructor. Cleans up. * <p>Destructor.
*/ */
PRawRunData::~PRawRunData() PRawRunData::~PRawRunData()
{ {
@ -255,6 +255,10 @@ PRawRunData::~PRawRunData()
/** /**
* <p>Returns the temperature of a muSR run. * <p>Returns the temperature of a muSR run.
* *
* <b>return:</b>
* - temperature value, if idx is within proper boundaries
* - PMUSR_UNDEFINED, otherwise
*
* \param idx index of the temperature whished * \param idx index of the temperature whished
*/ */
const Double_t PRawRunData::GetTemperature(const UInt_t idx) const Double_t PRawRunData::GetTemperature(const UInt_t idx)
@ -273,7 +277,11 @@ const Double_t PRawRunData::GetTemperature(const UInt_t idx)
/** /**
* <p>Returns the error estimate of the temperature of a muSR run. * <p>Returns the error estimate of the temperature of a muSR run.
* *
* \param idx index of the temperature whished * <b>return:</b>
* - 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) const Double_t PRawRunData::GetTempError(const UInt_t idx)
{ {
@ -291,6 +299,10 @@ const Double_t PRawRunData::GetTempError(const UInt_t idx)
/** /**
* <p> Returns the value of a ring anode high voltage. (idx = 0: RAL, 1: RAR, 2: RAT, 3: RAB) * <p> Returns the value of a ring anode high voltage. (idx = 0: RAL, 1: RAR, 2: RAT, 3: RAB)
* *
* <b>return:</b>
* - ring anode HV value, if idx is within proper boundaries
* - PMUSR_UNDEFINED, otherwise
*
* \param idx index of the ring anode whished * \param idx index of the ring anode whished
*/ */
const Double_t PRawRunData::GetRingAnode(const UInt_t idx) const Double_t PRawRunData::GetRingAnode(const UInt_t idx)
@ -309,6 +321,10 @@ const Double_t PRawRunData::GetRingAnode(const UInt_t idx)
/** /**
* <p> Returns a T0 value. * <p> Returns a T0 value.
* *
* <b>return:</b>
* - t0 value, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the T0 value whished * \param idx index of the T0 value whished
*/ */
const Int_t PRawRunData::GetT0(const UInt_t idx) const Int_t PRawRunData::GetT0(const UInt_t idx)
@ -327,6 +343,10 @@ const Int_t PRawRunData::GetT0(const UInt_t idx)
/** /**
* <p>Returns an estimated T0 value. * <p>Returns an estimated T0 value.
* *
* <b>return:</b>
* - estimated t0 value, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the T0 value whished * \param idx index of the T0 value whished
*/ */
const Int_t PRawRunData::GetT0Estimated(const UInt_t idx) const Int_t PRawRunData::GetT0Estimated(const UInt_t idx)
@ -346,6 +366,10 @@ const Int_t PRawRunData::GetT0Estimated(const UInt_t idx)
* <p>Returns the background bin range (start, stop) from the data file. * <p>Returns the background bin range (start, stop) from the data file.
* Currently only used in mud-files. * Currently only used in mud-files.
* *
* <b>return:</b>
* - (start, stop) values, if idx is within proper boundaries
* - (-1, -1), otherwise
*
* \param idx index of the background range. * \param idx index of the background range.
*/ */
const PIntPair PRawRunData::GetBkgBin(const UInt_t idx) const PIntPair PRawRunData::GetBkgBin(const UInt_t idx)
@ -371,6 +395,10 @@ const PIntPair PRawRunData::GetBkgBin(const UInt_t idx)
* <p>Returns the data range (first good bin, last good bin) from the data file. * <p>Returns the data range (first good bin, last good bin) from the data file.
* Currently only used in mud-files. * Currently only used in mud-files.
* *
* <b>return:</b>
* - (first good bin, last good bin) values, if idx is within proper boundaries
* - (-1, -1), otherwise
*
* \param idx index of the data range * \param idx index of the data range
*/ */
const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx) const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
@ -395,6 +423,10 @@ const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
/** /**
* <p>Returns a raw muSR run histogram. * <p>Returns a raw muSR run histogram.
* *
* <b>return:</b>
* - pointer of the data vector, if idx is within proper boundaries
* - 0, otherwise
*
* \param idx histo number index * \param idx histo number index
*/ */
const PDoubleVector* PRawRunData::GetDataBin(const UInt_t idx) const PDoubleVector* PRawRunData::GetDataBin(const UInt_t idx)
@ -534,7 +566,6 @@ PMsrRunBlock::PMsrRunBlock()
fBetaParamNo = -1; // undefined beta parameter number fBetaParamNo = -1; // undefined beta parameter number
fNormParamNo = -1; // undefined norm parameter number fNormParamNo = -1; // undefined norm parameter number
fBkgFitParamNo = -1; // undefined background parameter number fBkgFitParamNo = -1; // undefined background parameter number
fPhaseParamNo = -1; // undefined phase parameter number
fLifetimeParamNo = -1; // undefined lifetime parameter number fLifetimeParamNo = -1; // undefined lifetime parameter number
fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview) fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview)
for (UInt_t i=0; i<2; i++) for (UInt_t i=0; i<2; i++)
@ -583,7 +614,6 @@ void PMsrRunBlock::CleanUp()
fBetaParamNo = -1; // undefined beta parameter number fBetaParamNo = -1; // undefined beta parameter number
fNormParamNo = -1; // undefined norm parameter number fNormParamNo = -1; // undefined norm parameter number
fBkgFitParamNo = -1; // undefined background parameter number fBkgFitParamNo = -1; // undefined background parameter number
fPhaseParamNo = -1; // undefined phase parameter number
fLifetimeParamNo = -1; // undefined lifetime parameter number fLifetimeParamNo = -1; // undefined lifetime parameter number
fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview) fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview)
fBkgFix[0] = PMUSR_UNDEFINED; // undefined fixed background for forward fBkgFix[0] = PMUSR_UNDEFINED; // undefined fixed background for forward
@ -619,6 +649,10 @@ void PMsrRunBlock::CleanUp()
/** /**
* <p> get run name at position idx * <p> get run name at position idx
* *
* <b>return:</b>
* - pointer of the run name string, if idx is within proper boundaries
* - 0, otherwise
*
* \param idx index of the run name to be returned * \param idx index of the run name to be returned
*/ */
TString* PMsrRunBlock::GetRunName(UInt_t idx) TString* PMsrRunBlock::GetRunName(UInt_t idx)
@ -657,6 +691,10 @@ void PMsrRunBlock::SetRunName(TString &str, Int_t idx)
/** /**
* <p> get beamline name at position idx * <p> get beamline name at position idx
* *
* <b>return:</b>
* - pointer of the beamline string, if idx is within proper boundaries
* - 0, otherwise
*
* \param idx index of the beamline to be returned * \param idx index of the beamline to be returned
*/ */
TString* PMsrRunBlock::GetBeamline(UInt_t idx) TString* PMsrRunBlock::GetBeamline(UInt_t idx)
@ -695,6 +733,10 @@ void PMsrRunBlock::SetBeamline(TString &str, Int_t idx)
/** /**
* <p> get institute name at position idx * <p> get institute name at position idx
* *
* <b>return:</b>
* - pointer of the institute string, if idx is within proper boundaries
* - 0, otherwise
*
* \param idx index of the institute to be returned * \param idx index of the institute to be returned
*/ */
TString* PMsrRunBlock::GetInstitute(UInt_t idx) TString* PMsrRunBlock::GetInstitute(UInt_t idx)
@ -733,6 +775,10 @@ void PMsrRunBlock::SetInstitute(TString &str, Int_t idx)
/** /**
* <p> get file format name at position idx * <p> get file format name at position idx
* *
* <b>return:</b>
* - pointer of the file format string, if idx is within proper boundaries
* - 0, otherwise
*
* \param idx index of the file format to be returned * \param idx index of the file format to be returned
*/ */
TString* PMsrRunBlock::GetFileFormat(UInt_t idx) TString* PMsrRunBlock::GetFileFormat(UInt_t idx)
@ -771,6 +817,10 @@ void PMsrRunBlock::SetFileFormat(TString &str, Int_t idx)
/** /**
* <p> get forward histogram value at position idx * <p> get forward histogram value at position idx
* *
* <b>return:</b>
* - forward histogram number, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the forward histogram value to be returned * \param idx index of the forward histogram value to be returned
*/ */
Int_t PMsrRunBlock::GetForwardHistoNo(UInt_t idx) Int_t PMsrRunBlock::GetForwardHistoNo(UInt_t idx)
@ -811,6 +861,10 @@ void PMsrRunBlock::SetForwardHistoNo(Int_t histoNo, Int_t idx)
/** /**
* <p> get backward histogram value at position idx * <p> get backward histogram value at position idx
* *
* <b>return:</b>
* - backward histogram number, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the map value to be returned * \param idx index of the map value to be returned
*/ */
Int_t PMsrRunBlock::GetBackwardHistoNo(UInt_t idx) Int_t PMsrRunBlock::GetBackwardHistoNo(UInt_t idx)
@ -851,6 +905,10 @@ void PMsrRunBlock::SetBackwardHistoNo(Int_t histoNo, Int_t idx)
/** /**
* <p> get map value at position idx * <p> get map value at position idx
* *
* <b>return:</b>
* - map value, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the map value to be returned * \param idx index of the map value to be returned
*/ */
Int_t PMsrRunBlock::GetMap(UInt_t idx) Int_t PMsrRunBlock::GetMap(UInt_t idx)
@ -889,6 +947,10 @@ void PMsrRunBlock::SetMap(Int_t mapVal, Int_t idx)
/** /**
* <p> get background fixed value at position idx * <p> get background fixed value at position idx
* *
* <b>return:</b>
* - fixed background value, if idx is within proper boundaries
* - PMUSR_UNDEFINED, otherwise
*
* \param idx index of the background fixed value to be returned * \param idx index of the background fixed value to be returned
*/ */
Double_t PMsrRunBlock::GetBkgFix(UInt_t idx) Double_t PMsrRunBlock::GetBkgFix(UInt_t idx)
@ -925,6 +987,10 @@ void PMsrRunBlock::SetBkgFix(Double_t dval, Int_t idx)
/** /**
* <p> get background range at position idx * <p> get background range at position idx
* *
* <b>return:</b>
* - background range value, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the background range to be returned * \param idx index of the background range to be returned
*/ */
Int_t PMsrRunBlock::GetBkgRange(UInt_t idx) Int_t PMsrRunBlock::GetBkgRange(UInt_t idx)
@ -963,6 +1029,10 @@ void PMsrRunBlock::SetBkgRange(Int_t ival, Int_t idx)
/** /**
* <p> get data range at position idx * <p> get data range at position idx
* *
* <b>return:</b>
* - data range value, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the data range to be returned * \param idx index of the data range to be returned
*/ */
Int_t PMsrRunBlock::GetDataRange(UInt_t idx) Int_t PMsrRunBlock::GetDataRange(UInt_t idx)
@ -1000,6 +1070,10 @@ void PMsrRunBlock::SetDataRange(Int_t ival, Int_t idx)
/** /**
* <p> get T0 value at position idx * <p> get T0 value at position idx
* *
* <b>return:</b>
* - t0 value, if idx is within proper boundaries
* - -1, otherwise
*
* \param idx index of the T0 value to be returned * \param idx index of the T0 value to be returned
*/ */
Int_t PMsrRunBlock::GetT0(UInt_t idx) Int_t PMsrRunBlock::GetT0(UInt_t idx)
@ -1038,6 +1112,10 @@ void PMsrRunBlock::SetT0(Int_t ival, Int_t idx)
/** /**
* <p> get add T0 size of the addrun at index addRunIdx * <p> get add T0 size of the addrun at index addRunIdx
* *
* <b>return:</b>
* - addt0 value, if idx is within proper boundaries
* - -1, otherwise
*
* \param addRunIdx index of the addrun * \param addRunIdx index of the addrun
*/ */
Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx) Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx)
@ -1057,6 +1135,10 @@ Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx)
/** /**
* <p> get add T0 of the addrun (index addRunIdx) at index histoIdx * <p> get add T0 of the addrun (index addRunIdx) at index histoIdx
* *
* <b>return:</b>
* - addt0 value, if indices are within proper boundaries
* - -1, otherwise
*
* \param addRunIdx index of the addrun * \param addRunIdx index of the addrun
* \param histoIdx index of the add backward histo number value * \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)
/** /**
* <p> get fit range value at position idx * <p> get fit range value at position idx
* *
* <b>return:</b>
* - fit range value, if idx is within proper boundaries
* - PMUSR_UNDEFINED, otherwise
*
* \param idx index of the fit range value to be returned * \param idx index of the fit range value to be returned
*/ */
Double_t PMsrRunBlock::GetFitRange(UInt_t idx) Double_t PMsrRunBlock::GetFitRange(UInt_t idx)

View File

@ -47,7 +47,7 @@ ClassImpQ(PMusrCanvas)
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* * <p>Constructor
*/ */
PMusrCanvas::PMusrCanvas() PMusrCanvas::PMusrCanvas()
{ {
@ -90,7 +90,16 @@ PMusrCanvas::PMusrCanvas()
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>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, PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, 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
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>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, PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, 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
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* * <p>Destructor.
*/ */
PMusrCanvas::~PMusrCanvas() PMusrCanvas::~PMusrCanvas()
{ {
//cout << "~PMusrCanvas() called. fMainCanvas name=" << fMainCanvas->GetName() << endl;
// cleanup // cleanup
if (fCurrentFourierPhaseText) { if (fCurrentFourierPhaseText) {
delete fCurrentFourierPhaseText; delete fCurrentFourierPhaseText;
@ -231,6 +251,8 @@ PMusrCanvas::~PMusrCanvas()
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Keep the msr-handler object pointer and fill the Fourier structure if present. * <p>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) void PMusrCanvas::SetMsrHandler(PMsrHandler *msrHandler)
{ {
@ -305,7 +327,7 @@ void PMusrCanvas::SetMsrHandler(PMsrHandler *msrHandler)
// UpdateParamTheoryPad (public) // UpdateParamTheoryPad (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Feeds the pad with the fit parameter informations, and refreshes the pad.
*/ */
void PMusrCanvas::UpdateParamTheoryPad() void PMusrCanvas::UpdateParamTheoryPad()
{ {
@ -423,7 +445,7 @@ void PMusrCanvas::UpdateParamTheoryPad()
// UpdateDataTheoryPad (public) // UpdateDataTheoryPad (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Feeds the pad with data/theory histograms (error graphs) and refreshes it.
*/ */
void PMusrCanvas::UpdateDataTheoryPad() void PMusrCanvas::UpdateDataTheoryPad()
{ {
@ -443,8 +465,6 @@ void PMusrCanvas::UpdateDataTheoryPad()
} }
// check that the plottype and the fittype do correspond // check that the plottype and the fittype do correspond
runNo = (UInt_t)plotInfo.fRuns[i]-1; runNo = (UInt_t)plotInfo.fRuns[i]-1;
//cout << endl << ">> runNo = " << runNo;
//cout << endl;
if (fPlotType != runs[runNo].GetFitType()) { if (fPlotType != runs[runNo].GetFitType()) {
fValid = false; fValid = false;
cerr << endl << "PMusrCanvas::UpdateDataTheoryPad: **ERROR** plottype = " << fPlotType << ", fittype = " << runs[runNo].GetFitType() << ", however they have to correspond!"; 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) // UpdateInfoPad (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Feeds the pad with the statistics block information and the legend and refreshes it.
*/ */
void PMusrCanvas::UpdateInfoPad() void PMusrCanvas::UpdateInfoPad()
{ {
@ -641,7 +661,6 @@ void PMusrCanvas::UpdateInfoPad()
// energy if present // energy if present
tstr += TString("E="); tstr += TString("E=");
dval = fRunList->GetEnergy(*runs[runNo].GetRunName()); dval = fRunList->GetEnergy(*runs[runNo].GetRunName());
//cout << endl << ">> dval = " << dval << " (Engery)";
if (dval == PMUSR_UNDEFINED) { if (dval == PMUSR_UNDEFINED) {
tstr += TString("??,"); tstr += TString("??,");
} else { } else {
@ -663,8 +682,9 @@ void PMusrCanvas::UpdateInfoPad()
// Done (SIGNAL) // Done (SIGNAL)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Signal emitted that the user wants to terminate the application.
* *
* \param status Status info
*/ */
void PMusrCanvas::Done(Int_t status) void PMusrCanvas::Done(Int_t status)
{ {
@ -675,8 +695,20 @@ void PMusrCanvas::Done(Int_t status)
// HandleCmdKey (SLOT) // HandleCmdKey (SLOT)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Filters keyboard events, and if they are a command key (see below) carries out the
* necessary actions.
* <p>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) 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) if (fBatchMode)
return; 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 // handle keys and popup menu entries
enum eKeySwitch {kNotRelevant, kData, kDiffData, kFourier, kDiffFourier, kFourierDiff}; enum eKeySwitch {kNotRelevant, kData, kDiffData, kFourier, kDiffFourier, kFourierDiff};
eKeySwitch relevantKeySwitch = kNotRelevant; eKeySwitch relevantKeySwitch = kNotRelevant;
@ -827,8 +852,9 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
// HandleMenuPopup (SLOT) // HandleMenuPopup (SLOT)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Handles the Musrfit menu.
* *
* \param id identification key of the selected menu
*/ */
void PMusrCanvas::HandleMenuPopup(Int_t id) void PMusrCanvas::HandleMenuPopup(Int_t id)
{ {
@ -1027,8 +1053,8 @@ void PMusrCanvas::HandleMenuPopup(Int_t id)
// LastCanvasClosed (SLOT) // LastCanvasClosed (SLOT)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Slot called when the last canvas has been closed. Will emit Done(0) which will
* * terminate the application.
*/ */
void PMusrCanvas::LastCanvasClosed() void PMusrCanvas::LastCanvasClosed()
{ {
@ -1042,8 +1068,9 @@ void PMusrCanvas::LastCanvasClosed()
// SaveGraphicsAndQuit // SaveGraphicsAndQuit
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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. * \param graphicsFormat One of the supported graphics formats.
*/ */
void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat) void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat)
@ -1125,13 +1152,14 @@ void PMusrCanvas::InitFourier()
// InitMusrCanvas (private) // InitMusrCanvas (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Initialize the class, and sets up the necessary objects.
* *
* \param title * \param number The plot number of the msr-file PLOT block
* \param wtopx * \param title Title to be displayed
* \param wtopy * \param wtopx top x coordinate (in pixels) to place the canvas.
* \param ww * \param wtopy top y coordinate (in pixels) to place the canvas.
* \param wh * \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) 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", fMainCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", "PMusrCanvas",
this, "HandleCmdKey(Int_t,Int_t,Int_t,TObject*)"); 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) // InitDataSet (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Initializes the data set (histogram representation).
* *
* \param dataSet * \param dataSet data set to be initialized
*/ */
void PMusrCanvas::InitDataSet(PMusrCanvasDataSet &dataSet) void PMusrCanvas::InitDataSet(PMusrCanvasDataSet &dataSet)
{ {
@ -1305,9 +1325,9 @@ void PMusrCanvas::InitDataSet(PMusrCanvasDataSet &dataSet)
// InitDataSet (private) // InitDataSet (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Initializes the data set (error graph representation).
* *
* \param dataSet * \param dataSet data set to be initialized
*/ */
void PMusrCanvas::InitDataSet(PMusrCanvasNonMusrDataSet &dataSet) void PMusrCanvas::InitDataSet(PMusrCanvasNonMusrDataSet &dataSet)
{ {
@ -1332,9 +1352,9 @@ void PMusrCanvas::InitDataSet(PMusrCanvasNonMusrDataSet &dataSet)
// CleanupDataSet (private) // CleanupDataSet (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Cleans up a data set (histogram representation).
* *
* \param dataSet * \param dataSet data set to be cleaned up.
*/ */
void PMusrCanvas::CleanupDataSet(PMusrCanvasDataSet &dataSet) void PMusrCanvas::CleanupDataSet(PMusrCanvasDataSet &dataSet)
{ {
@ -1404,9 +1424,9 @@ void PMusrCanvas::CleanupDataSet(PMusrCanvasDataSet &dataSet)
// CleanupDataSet (private) // CleanupDataSet (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Cleans up a data set (error graph representation).
* *
* \param dataSet * \param dataSet data set to be cleaned up.
*/ */
void PMusrCanvas::CleanupDataSet(PMusrCanvasNonMusrDataSet &dataSet) void PMusrCanvas::CleanupDataSet(PMusrCanvasNonMusrDataSet &dataSet)
{ {
@ -1476,15 +1496,14 @@ void PMusrCanvas::CleanupDataSet(PMusrCanvasNonMusrDataSet &dataSet)
// HandleDataSet (private) // HandleDataSet (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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 plotNo 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 runNo The number of the run
* \param data * \param data pre-processed data
*/ */
void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *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; PMusrCanvasDataSet dataSet;
TH1F *dataHisto; TH1F *dataHisto;
TH1F *theoHisto; TH1F *theoHisto;
@ -1495,7 +1514,6 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
Int_t size; Int_t size;
InitDataSet(dataSet); InitDataSet(dataSet);
//cout << endl << ">> PMusrCanvas::HandleDataSet(): after InitDataSet ..." << endl;
// dataHisto ------------------------------------------------------------- // dataHisto -------------------------------------------------------------
// create histo specific infos // 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(); end = start + data->GetValue()->size()*data->GetDataTimeStep();
size = data->GetValue()->size(); 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 // check if 'use_fit_range' plotting is whished
if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fUseFitRanges) { if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fUseFitRanges) {
start = fMsrHandler->GetMsrRunList()->at(runNo).GetFitRange(0); // needed to estimate size 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 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 // invoke histo
dataHisto = new TH1F(name, name, size, start, end); 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()); 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()); 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; i<endBin; i++) { for (UInt_t i=startBin; i<endBin; i++) {
dataHisto->SetBinContent(i-startBin+1, data->GetValue()->at(i)); dataHisto->SetBinContent(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 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 // invoke histo
theoHisto = new TH1F(name, name, size, start, end); 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()); 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()); 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 // check if 'sub_ranges' plotting is whished
if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin.size() > 1) { 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)); theoHisto->SetBinContent(i-startBin+1, data->GetTheory()->at(i));
} }
//cout << endl << ">> PMusrCanvas::HandleDataSet(): after fill theory histo" << endl;
// set the line color // set the line color
if (plotNo < fColorList.size()) { if (plotNo < fColorList.size()) {
theoHisto->SetLineColor(fColorList[plotNo]); theoHisto->SetLineColor(fColorList[plotNo]);
@ -1653,19 +1661,17 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
dataSet.theory = theoHisto; dataSet.theory = theoHisto;
fData.push_back(dataSet); fData.push_back(dataSet);
//cout << endl << ">> PMusrCanvas::HandleDataSet(): after data push_back";
//cout << endl << ">> --------------------------------------- <<" << endl;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// HandleNonMusrDataSet (private) // HandleNonMusrDataSet (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Generates the necessary error graphs for plotting, starting from the pre-processed data.
* *
* \param runNo * \param plotNo The number of the histo within the run list (fPlotNumber is the number of the plot BLOCK)
* \param data * \param runNo The number of the run
* \param data pre-processed data
*/ */
void PMusrCanvas::HandleNonMusrDataSet(UInt_t plotNo, UInt_t runNo, PRunData *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) // HandleDifference (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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() void PMusrCanvas::HandleDifference()
{ {
// check if it is necessary to calculate diff data // check if it is necessary to calculate diff data
if ((fPlotType != MSR_PLOT_NON_MUSR) && (fData[0].diff == 0)) { if ((fPlotType != MSR_PLOT_NON_MUSR) && (fData[0].diff == 0)) {
//cout << endl << ">> calculate diff ..." << endl;
TH1F *diffHisto; TH1F *diffHisto;
TString name; TString name;
// loop over all histos // loop over all histos
for (UInt_t i=0; i<fData.size(); i++) { for (UInt_t i=0; i<fData.size(); i++) {
// create difference histos // create difference histos
name = TString(fData[i].data->GetTitle()) + "_diff"; name = TString(fData[i].data->GetTitle()) + "_diff";
//cout << endl << ">> diff-name = " << name.Data() << endl;
diffHisto = new TH1F(name, name, fData[i].data->GetNbinsX(), diffHisto = new TH1F(name, name, fData[i].data->GetNbinsX(),
fData[i].data->GetXaxis()->GetXmin(), fData[i].data->GetXaxis()->GetXmin(),
fData[i].data->GetXaxis()->GetXmax()); fData[i].data->GetXaxis()->GetXmax());
@ -1789,7 +1794,6 @@ void PMusrCanvas::HandleDifference()
// create difference histos // create difference histos
name = TString(fNonMusrData[i].data->GetTitle()) + "_diff"; name = TString(fNonMusrData[i].data->GetTitle()) + "_diff";
//cout << endl << ">> diff-name = " << name.Data() << endl;
diffHisto->SetNameTitle(name.Data(), name.Data()); diffHisto->SetNameTitle(name.Data(), name.Data());
// set marker and line color // set marker and line color
@ -1841,7 +1845,9 @@ void PMusrCanvas::HandleDifference()
// HandleFourier (private) // HandleFourier (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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() void PMusrCanvas::HandleFourier()
{ {
@ -1849,8 +1855,6 @@ void PMusrCanvas::HandleFourier()
if (fPlotType == MSR_PLOT_NON_MUSR) if (fPlotType == MSR_PLOT_NON_MUSR)
return; return;
//cout << endl << ">> in HandleFourier ..." << endl;
// check if fourier needs to be calculated // check if fourier needs to be calculated
if (fData[0].dataFourierRe == 0) { if (fData[0].dataFourierRe == 0) {
Int_t bin; Int_t bin;
@ -1868,23 +1872,14 @@ void PMusrCanvas::HandleFourier()
fourierData.Transform(fFourier.fApodization); fourierData.Transform(fFourier.fApodization);
double scale; double scale;
scale = sqrt(fData[0].data->GetBinWidth(1)/(endTime-startTime)); scale = sqrt(fData[0].data->GetBinWidth(1)/(endTime-startTime));
//cout << endl << ">> data scale = " << scale;
// get real part of the data // get real part of the data
fData[i].dataFourierRe = fourierData.GetRealFourier(scale); fData[i].dataFourierRe = fourierData.GetRealFourier(scale);
//cout << endl << ">> i: " << i << ", fData[i].dataFourierRe = " << fData[i].dataFourierRe;
// get imaginary part of the data // get imaginary part of the data
fData[i].dataFourierIm = fourierData.GetImaginaryFourier(scale); fData[i].dataFourierIm = fourierData.GetImaginaryFourier(scale);
// get power part of the data // get power part of the data
fData[i].dataFourierPwr = fourierData.GetPowerFourier(scale); fData[i].dataFourierPwr = fourierData.GetPowerFourier(scale);
// get phase part of the data // get phase part of the data
fData[i].dataFourierPhase = fourierData.GetPhaseFourier(); 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 // set marker and line color
fData[i].dataFourierRe->SetMarkerColor(fData[i].data->GetMarkerColor()); fData[i].dataFourierRe->SetMarkerColor(fData[i].data->GetMarkerColor());
@ -1909,7 +1904,6 @@ cout << endl;
// calculate fourier transform of the theory // calculate fourier transform of the theory
Int_t powerPad = (Int_t)round(log((endTime-startTime)/fData[i].theory->GetBinWidth(1))/log(2))+3; 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); PFourier fourierTheory(fData[i].theory, fFourier.fUnits, startTime, endTime, powerPad);
if (!fourierTheory.IsValid()) { if (!fourierTheory.IsValid()) {
cerr << endl << "**SEVERE ERROR** PMusrCanvas::HandleFourier: couldn't invoke PFourier to calculate the Fourier theory ..." << endl; 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); fourierTheory.Transform(fFourier.fApodization);
scale = sqrt(fData[0].theory->GetBinWidth(1)/(endTime-startTime)*fData[0].theory->GetBinWidth(1)/fData[0].data->GetBinWidth(1)); 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 // get real part of the data
fData[i].theoryFourierRe = fourierTheory.GetRealFourier(scale); fData[i].theoryFourierRe = fourierTheory.GetRealFourier(scale);
//cout << endl << ">> i: " << i << ", fData[i].dataFourierRe = " << fData[i].dataFourierRe;
// get imaginary part of the data // get imaginary part of the data
fData[i].theoryFourierIm = fourierTheory.GetImaginaryFourier(scale); fData[i].theoryFourierIm = fourierTheory.GetImaginaryFourier(scale);
// get power part of the data // get power part of the data
@ -1936,9 +1928,7 @@ cout << endl;
} }
// apply global phase if present // apply global phase if present
//cout << endl << ">> fFourier.fPhase = " << fFourier.fPhase << endl;
if (fFourier.fPhase != 0.0) { if (fFourier.fPhase != 0.0) {
//cout << endl << ">> apply global phase fFourier.fPhase = " << fFourier.fPhase;
double re, im; double re, im;
const double cp = TMath::Cos(fFourier.fPhase/180.0*TMath::Pi()); const double cp = TMath::Cos(fFourier.fPhase/180.0*TMath::Pi());
const double sp = TMath::Sin(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) // HandleDifferenceFourier (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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() void PMusrCanvas::HandleDifferenceFourier()
{ {
@ -2019,10 +2011,8 @@ void PMusrCanvas::HandleDifferenceFourier()
if (fPlotType == MSR_PLOT_NON_MUSR) if (fPlotType == MSR_PLOT_NON_MUSR)
return; return;
//cout << endl << ">> in HandleDifferenceFourier ..." << endl;
// check if fourier needs to be calculated // check if fourier needs to be calculated
if (fData[0].diffFourierRe == 0) { if (fData[0].diffFourierRe == 0) {
//cout << endl << ">> will calculate Fourier diff ..." << endl;
// check if difference has been already calcualted, if not do it // check if difference has been already calcualted, if not do it
if (fData[0].diff == 0) if (fData[0].diff == 0)
HandleDifference(); HandleDifference();
@ -2031,7 +2021,6 @@ void PMusrCanvas::HandleDifferenceFourier()
double startTime = fData[0].diff->GetBinCenter(bin); double startTime = fData[0].diff->GetBinCenter(bin);
bin = fData[0].diff->GetXaxis()->GetLast(); bin = fData[0].diff->GetXaxis()->GetLast();
double endTime = fData[0].diff->GetBinCenter(bin); double endTime = fData[0].diff->GetBinCenter(bin);
//cout << endl << ">> startTime = " << startTime << ", endTime = " << endTime << endl;
for (UInt_t i=0; i<fData.size(); i++) { for (UInt_t i=0; i<fData.size(); i++) {
// calculate fourier transform of the data // calculate fourier transform of the data
PFourier fourierData(fData[i].diff, fFourier.fUnits, startTime, endTime, fFourier.fFourierPower); PFourier fourierData(fData[i].diff, fFourier.fUnits, startTime, endTime, fFourier.fFourierPower);
@ -2042,10 +2031,8 @@ void PMusrCanvas::HandleDifferenceFourier()
fourierData.Transform(fFourier.fApodization); fourierData.Transform(fFourier.fApodization);
double scale; double scale;
scale = sqrt(fData[0].diff->GetBinWidth(1)/(endTime-startTime)); scale = sqrt(fData[0].diff->GetBinWidth(1)/(endTime-startTime));
//cout << endl << ">> data scale = " << scale;
// get real part of the data // get real part of the data
fData[i].diffFourierRe = fourierData.GetRealFourier(scale); fData[i].diffFourierRe = fourierData.GetRealFourier(scale);
//cout << endl << ">> i: " << i << ", fData[i].diffFourierRe = " << fData[i].diffFourierRe;
// get imaginary part of the data // get imaginary part of the data
fData[i].diffFourierIm = fourierData.GetImaginaryFourier(scale); fData[i].diffFourierIm = fourierData.GetImaginaryFourier(scale);
// get power part of the data // get power part of the data
@ -2105,7 +2092,9 @@ void PMusrCanvas::HandleDifferenceFourier()
// HandleFourierDifference (private) // HandleFourierDifference (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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() void PMusrCanvas::HandleFourierDifference()
{ {
@ -2200,8 +2189,6 @@ void PMusrCanvas::HandleFourierDifference()
*/ */
double PMusrCanvas::FindOptimalFourierPhase() double PMusrCanvas::FindOptimalFourierPhase()
{ {
//cout << endl << ">> in FindOptimalFourierPhase ... ";
// check that Fourier is really present // check that Fourier is really present
if ((fData[0].dataFourierRe == 0) || (fData[0].dataFourierIm == 0)) if ((fData[0].dataFourierRe == 0) || (fData[0].dataFourierIm == 0))
return 0.0; return 0.0;
@ -2256,12 +2243,10 @@ double PMusrCanvas::FindOptimalFourierPhase()
} }
} }
if (fabs(asymmetry) > fabs((maxIm+minIm)*(val_xMin-val_xMax))) { if (fabs(asymmetry) > fabs((maxIm+minIm)*(val_xMin-val_xMax))) {
//cout << endl << ">> phase = " << phase << ", asymmetry = " << asymmetry << ", min/max = " << minIm << "/" << maxIm;
minPhase = phase; minPhase = phase;
asymmetry = (maxIm+minIm)*(val_xMin-val_xMax); asymmetry = (maxIm+minIm)*(val_xMin-val_xMax);
} }
} }
cout << endl << ">> optimal phase = " << minPhase << endl;
return minPhase; return minPhase;
} }
@ -2270,8 +2255,7 @@ cout << endl << ">> optimal phase = " << minPhase << endl;
// CleanupDifference (private) // CleanupDifference (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Cleans up (deallocate) difference data.
*
*/ */
void PMusrCanvas::CleanupDifference() void PMusrCanvas::CleanupDifference()
{ {
@ -2287,8 +2271,7 @@ void PMusrCanvas::CleanupDifference()
// CleanupFourier (private) // CleanupFourier (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Cleans up (deallocate) Fourier transform data.
*
*/ */
void PMusrCanvas::CleanupFourier() void PMusrCanvas::CleanupFourier()
{ {
@ -2332,8 +2315,7 @@ void PMusrCanvas::CleanupFourier()
// CleanupFourierDifference (private) // CleanupFourierDifference (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Cleans up (deallocate) Fourier difference spectra.
*
*/ */
void PMusrCanvas::CleanupFourierDifference() void PMusrCanvas::CleanupFourierDifference()
{ {
@ -2361,7 +2343,10 @@ void PMusrCanvas::CleanupFourierDifference()
// CalculateDiff (private) // CalculateDiff (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Calculates the difference between data and theory for histograms.
*
* <b>return:</b>
* - (data - theory) value
* *
* \param x x-value of the data * \param x x-value of the data
* \param y y-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) // CalculateDiff (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Calculates the difference between data and theory for error graphs.
*
* <b>return:</b>
* - (data - theory) value
* *
* \param x x-value of the data * \param x x-value of the data
* \param y y-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) 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); theo->GetPoint(bin, xVal, yVal);
//cout << endl << ">> bin=" << bin << ", x=" << xVal << " (xData=" << x << "), y=" << yVal;
return y - yVal; return y - yVal;
} }
@ -2404,8 +2390,11 @@ double PMusrCanvas::CalculateDiff(const double x, const double y, TGraphErrors *
/** /**
* <p>Analog to FindBin for histograms (TH1F) but here for TGraphErrors. * <p>Analog to FindBin for histograms (TH1F) but here for TGraphErrors.
* *
* <b>return:</b>
* - bin closest to a given x value.
*
* \param x x-value of the data * \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) Int_t PMusrCanvas::FindBin(const double x, TGraphErrors *graph)
{ {
@ -2433,7 +2422,10 @@ Int_t PMusrCanvas::FindBin(const double x, TGraphErrors *graph)
/** /**
* <p>returns the global maximum of a histogram * <p>returns the global maximum of a histogram
* *
* \param histo * <b>return:</b>
* - global maximum, or 0.0 if the histo pointer is the null pointer.
*
* \param histo pointer of the histogram
*/ */
double PMusrCanvas::GetGlobalMaximum(TH1F* histo) double PMusrCanvas::GetGlobalMaximum(TH1F* histo)
{ {
@ -2457,7 +2449,10 @@ double PMusrCanvas::GetGlobalMaximum(TH1F* histo)
/** /**
* <p>returns the global minimum of a histogram * <p>returns the global minimum of a histogram
* *
* \param histo * <b>return:</b>
* - global minimum, or 0.0 if the histo pointer is the null pointer.
*
* \param histo pointer of the histogram
*/ */
double PMusrCanvas::GetGlobalMinimum(TH1F* histo) double PMusrCanvas::GetGlobalMinimum(TH1F* histo)
{ {
@ -2479,8 +2474,7 @@ double PMusrCanvas::GetGlobalMinimum(TH1F* histo)
// PlotData (private) // PlotData (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Plots the data.
*
*/ */
void PMusrCanvas::PlotData() void PMusrCanvas::PlotData()
{ {
@ -2696,8 +2690,7 @@ void PMusrCanvas::PlotData()
// PlotDifference (private) // PlotDifference (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Plots the difference data, i.e. data-theory
*
*/ */
void PMusrCanvas::PlotDifference() void PMusrCanvas::PlotDifference()
{ {
@ -2707,7 +2700,6 @@ void PMusrCanvas::PlotDifference()
return; return;
if (fPlotType != MSR_PLOT_NON_MUSR) { 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); fHistoFrame = fDataTheoryPad->DrawFrame(fXmin, fYmin, fXmax, fYmax);
// set x-axis label // set x-axis label
fHistoFrame->GetXaxis()->SetTitle("time (#mus)"); fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
@ -2770,13 +2762,10 @@ void PMusrCanvas::PlotDifference()
// PlotFourier (private) // PlotFourier (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Plot the Fourier spectra.
*
*/ */
void PMusrCanvas::PlotFourier() void PMusrCanvas::PlotFourier()
{ {
//cout << endl << ">> in PlotFourier() ..." << endl;
fDataTheoryPad->cd(); fDataTheoryPad->cd();
if (fPlotType < 0) // plot type not defined if (fPlotType < 0) // plot type not defined
@ -3047,13 +3036,10 @@ void PMusrCanvas::PlotFourier()
// PlotFourierDifference (private) // PlotFourierDifference (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Plot the Fourier difference, i.e. F(data)-F(theory).
*
*/ */
void PMusrCanvas::PlotFourierDifference() void PMusrCanvas::PlotFourierDifference()
{ {
//cout << endl << ">> in PlotFourierDifference() ..." << endl;
fDataTheoryPad->cd(); fDataTheoryPad->cd();
if (fPlotType < 0) // plot type not defined if (fPlotType < 0) // plot type not defined
@ -3294,8 +3280,7 @@ void PMusrCanvas::PlotFourierDifference()
// PlotFourierPhaseValue (private) // PlotFourierPhaseValue (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Writes the Fourier phase value into the data window.
*
*/ */
void PMusrCanvas::PlotFourierPhaseValue() void PMusrCanvas::PlotFourierPhaseValue()
{ {
@ -3330,9 +3315,7 @@ void PMusrCanvas::PlotFourierPhaseValue()
// IncrementFourierPhase (private) // IncrementFourierPhase (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Increments the Fourier phase and recalculate the real/imaginary part of the Fourier transform.
*
* \param tag
*/ */
void PMusrCanvas::IncrementFourierPhase() void PMusrCanvas::IncrementFourierPhase()
{ {
@ -3381,9 +3364,7 @@ void PMusrCanvas::IncrementFourierPhase()
// DecrementFourierPhase (private) // DecrementFourierPhase (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Decrements the Fourier phase and recalculate the real/imaginary part of the Fourier transform.
*
* \param tag
*/ */
void PMusrCanvas::DecrementFourierPhase() void PMusrCanvas::DecrementFourierPhase()
{ {
@ -3432,8 +3413,7 @@ void PMusrCanvas::DecrementFourierPhase()
// SaveDataAscii (private) // SaveDataAscii (private)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Saves the currently seen data (data, difference, Fourier spectra, ...) in ascii column format.
*
*/ */
void PMusrCanvas::SaveDataAscii() void PMusrCanvas::SaveDataAscii()
{ {

View File

@ -47,7 +47,7 @@ using namespace std;
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* * <p>Constructor.
*/ */
PMusrT0Data::PMusrT0Data() PMusrT0Data::PMusrT0Data()
{ {
@ -58,7 +58,7 @@ PMusrT0Data::PMusrT0Data()
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* * <p>Destructor.
*/ */
PMusrT0Data::~PMusrT0Data() PMusrT0Data::~PMusrT0Data()
{ {
@ -74,7 +74,7 @@ PMusrT0Data::~PMusrT0Data()
// InitData // InitData
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* * <p>Initialize the necessary variables.
*/ */
void PMusrT0Data::InitData() void PMusrT0Data::InitData()
{ {
@ -96,7 +96,13 @@ void PMusrT0Data::InitData()
// GetRawRunData // GetRawRunData
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Returns the raw run data set with index idx.
* *
* <b>return:</b>
* - 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) PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx)
{ {
@ -110,7 +116,13 @@ PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx)
// GetHistoNo // GetHistoNo
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Get histogram number of a run.
* *
* <b>return:</b>
* - histogram number
* - -1 if index is out of range
*
* \param idx index of the run (msr-file).
*/ */
Int_t PMusrT0Data::GetHistoNo(UInt_t idx) Int_t PMusrT0Data::GetHistoNo(UInt_t idx)
{ {
@ -124,7 +136,13 @@ Int_t PMusrT0Data::GetHistoNo(UInt_t idx)
// GetT0 // GetT0
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Get t0 (in bin) of a run.
* *
* <b>return:</b>
* - t0 bin
* - -1 if index is out of range
*
* \param idx index of the run (msr-file).
*/ */
Int_t PMusrT0Data::GetT0(UInt_t idx) Int_t PMusrT0Data::GetT0(UInt_t idx)
{ {
@ -138,7 +156,13 @@ Int_t PMusrT0Data::GetT0(UInt_t idx)
// GetAddT0Size // GetAddT0Size
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Get addt0 size of a run, i.e. the number of addt0's for a given msr-file run.
* *
* <b>return:</b>
* - 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) UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx)
{ {
@ -152,7 +176,14 @@ UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx)
// GetAddT0 // GetAddT0
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Get addt0 (in bin) of a run.
* *
* <b>return:</b>
* - 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) 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 // SetT0
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>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) 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()) if (idx >= fT0.size())
fT0.resize(idx+1); fT0.resize(idx+1);
@ -186,13 +217,14 @@ void PMusrT0Data::SetT0(UInt_t val, UInt_t idx)
// SetAddT0 // SetAddT0
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>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) 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()) if (addRunIdx >= fAddT0.size())
fAddT0.resize(addRunIdx+1); fAddT0.resize(addRunIdx+1);
@ -210,7 +242,7 @@ ClassImpQ(PMusrT0)
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* * <p>Constructor.
*/ */
PMusrT0::PMusrT0() PMusrT0::PMusrT0()
{ {
@ -245,9 +277,9 @@ PMusrT0::PMusrT0()
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Constructor
* *
* \param data * \param data raw run data set
*/ */
PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data) PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
{ {
@ -316,19 +348,6 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
} }
} }
} else { } else {
/*
cout << endl << "debug> all t0's:" << endl;
for (UInt_t i=0; i<fMusrT0Data.GetT0Size(); i++) {
cout << fMusrT0Data.GetT0(i) << ",";
}
cout << endl << "debug> all addt0's:" << endl;
for (UInt_t j=0; j<fMusrT0Data.GetAddT0Entries(); j++) {
cout << "debug> j=" << j << endl;
for (UInt_t i=0; i<fMusrT0Data.GetAddT0Size(j); i++)
cout << fMusrT0Data.GetAddT0(j,i) << ",";
}
cout << endl;
*/
str = *fMusrT0Data.GetRawRunData(0)->GetRunName() + TString(" : "); str = *fMusrT0Data.GetRawRunData(0)->GetRunName() + TString(" : ");
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD) if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
str += " forward grouped and runs added"; str += " forward grouped and runs added";
@ -533,7 +552,7 @@ cout << endl;
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* * <p>Destructor.
*/ */
PMusrT0::~PMusrT0() PMusrT0::~PMusrT0()
{ {
@ -583,8 +602,7 @@ PMusrT0::~PMusrT0()
// Done (SIGNAL) // Done (SIGNAL)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Signal emitted if the user wants to terminate the application.
*
*/ */
void PMusrT0::Done(Int_t status) void PMusrT0::Done(Int_t status)
{ {
@ -595,8 +613,23 @@ void PMusrT0::Done(Int_t status)
// HandleCmdKey (SLOT) // HandleCmdKey (SLOT)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Filters keyboard and mouse events, and if they are a command key (see below) carries out the
* necessary actions.
* <p>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) 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 // SetMsrHandler
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Set the msr-file handler
* *
* \param msrHandler msr-file handler pointer
*/ */
void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler) void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
{ {
@ -648,8 +682,7 @@ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
// InitT0 // InitT0
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Initialize t0 data.
*
*/ */
void PMusrT0::InitT0() void PMusrT0::InitT0()
{ {
@ -679,8 +712,6 @@ void PMusrT0::InitT0()
} }
Double_t max = fHisto->GetMaximum(); 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 = new TLine((Double_t)t0Bin, 0.0, (Double_t)t0Bin, max);
fT0Line->SetLineStyle(1); // solid fT0Line->SetLineStyle(1); // solid
fT0Line->SetLineColor(TColor::GetColor(0,255,0)); // green fT0Line->SetLineColor(TColor::GetColor(0,255,0)); // green
@ -692,8 +723,7 @@ void PMusrT0::InitT0()
// InitDataAndBkg // InitDataAndBkg
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Initialize data and background ranges.
*
*/ */
void PMusrT0::InitDataAndBkg() void PMusrT0::InitDataAndBkg()
{ {
@ -789,8 +819,7 @@ void PMusrT0::InitDataAndBkg()
// SetT0Channel // SetT0Channel
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Set the t0 channel to the current cursor position and keep the x-position as new t0 bin.
*
*/ */
void PMusrT0::SetT0Channel() void PMusrT0::SetT0Channel()
{ {
@ -817,8 +846,6 @@ void PMusrT0::SetT0Channel()
idx += 1; idx += 1;
} }
//cout << endl << "debug> SetT0Channel: t0-idx=" << idx << ", t0-value=" << binx;
if (fMusrT0Data.GetAddRunIdx() == 0) if (fMusrT0Data.GetAddRunIdx() == 0)
fMsrHandler->SetMsrT0Entry(fMusrT0Data.GetRunNo(), idx, binx); fMsrHandler->SetMsrT0Entry(fMusrT0Data.GetRunNo(), idx, binx);
else if (fMusrT0Data.GetAddRunIdx() > 0) else if (fMusrT0Data.GetAddRunIdx() > 0)
@ -836,8 +863,7 @@ void PMusrT0::SetT0Channel()
// SetEstimatedT0Channel // SetEstimatedT0Channel
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Set the estimated t0 channel to the current cursor position and keep the x-position as new t0 bin.
*
*/ */
void PMusrT0::SetEstimatedT0Channel() void PMusrT0::SetEstimatedT0Channel()
{ {
@ -877,8 +903,7 @@ void PMusrT0::SetEstimatedT0Channel()
// SetDataFirstChannel // SetDataFirstChannel
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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() void PMusrT0::SetDataFirstChannel()
{ {
@ -928,8 +953,7 @@ cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRa
// SetDataLastChannel // SetDataLastChannel
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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() void PMusrT0::SetDataLastChannel()
{ {
@ -979,8 +1003,7 @@ cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRan
// SetBkgFirstChannel // SetBkgFirstChannel
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Set the first background channel to the current cursor position and keep the x-position as new first background bin.
*
*/ */
void PMusrT0::SetBkgFirstChannel() void PMusrT0::SetBkgFirstChannel()
{ {
@ -1030,8 +1053,7 @@ cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange
// SetBkgLastChannel // SetBkgLastChannel
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Set the last background channel to the current cursor position and keep the x-position as new last background bin.
*
*/ */
void PMusrT0::SetBkgLastChannel() void PMusrT0::SetBkgLastChannel()
{ {
@ -1081,8 +1103,7 @@ cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[
// UnZoom // UnZoom
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Unzoom the current histogram
*
*/ */
void PMusrT0::UnZoom() void PMusrT0::UnZoom()
{ {
@ -1096,8 +1117,7 @@ void PMusrT0::UnZoom()
// ZoomT0 // ZoomT0
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Zoom into the histogram region of the t0, and/or estimated t0 range.
*
*/ */
void PMusrT0::ZoomT0() void PMusrT0::ZoomT0()
{ {
@ -1126,8 +1146,6 @@ void PMusrT0::ZoomT0()
max = fT0Estimated + range; max = fT0Estimated + range;
} }
// cout << endl << "debug> ZoomT0: min=" << min << ", max=" << max << endl;
fHisto->GetXaxis()->SetRangeUser(min, max); fHisto->GetXaxis()->SetRangeUser(min, max);
fMainCanvas->Modified(); // needed that Update is actually working fMainCanvas->Modified(); // needed that Update is actually working

View File

@ -40,8 +40,7 @@
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Constructor
*
*/ */
PRunAsymmetry::PRunAsymmetry() : PRunBase() PRunAsymmetry::PRunAsymmetry() : PRunBase()
{ {
@ -54,10 +53,12 @@ PRunAsymmetry::PRunAsymmetry() : PRunBase()
// Constructor // Constructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Constructor
* *
* \param msrInfo pointer to the msr info structure * \param msrInfo pointer to the msr-file handler
* \param runNo number of the run of the msr-file * \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) 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 // check if alpha is fixed
Bool_t alphaFixedToOne = false; 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) && if (((*param)[fRunInfo->GetAlphaParamNo()-1].fStep == 0.0) &&
((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0)) ((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0))
alphaFixedToOne = true; alphaFixedToOne = true;
@ -113,8 +113,6 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
else else
fAlphaBetaTag = 4; fAlphaBetaTag = 4;
//cout << endl << ">> PRunAsymmetry::PRunAsymmetry(): fAlphaBetaTag = " << fAlphaBetaTag << endl;
// calculate fData // calculate fData
if (!PrepareData()) if (!PrepareData())
fValid = false; fValid = false;
@ -124,8 +122,7 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
// Destructor // Destructor
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Destructor.
*
*/ */
PRunAsymmetry::~PRunAsymmetry() PRunAsymmetry::~PRunAsymmetry()
{ {
@ -139,9 +136,12 @@ PRunAsymmetry::~PRunAsymmetry()
// CalcChiSquare // CalcChiSquare
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Calculate chi-square.
* *
* \param par parameter vector iterated by minuit * <b>return:</b>
* - chisq value
*
* \param par parameter vector iterated by minuit2
*/ */
Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par) Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
{ {
@ -183,7 +183,6 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
default: default:
break; break;
} }
//if (i==0) cout << endl << "A(0) = " << asymFcnValue;
diff = fData.GetValue()->at(i) - asymFcnValue; diff = fData.GetValue()->at(i) - asymFcnValue;
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i)); chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
} }
@ -196,7 +195,7 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
// CalcMaxLikelihood // CalcMaxLikelihood
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>NOT IMPLEMENTED!!
* *
* \param par parameter vector iterated by minuit * \param par parameter vector iterated by minuit
*/ */
@ -211,8 +210,7 @@ Double_t PRunAsymmetry::CalcMaxLikelihood(const std::vector<Double_t>& par)
// CalcTheory // CalcTheory
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>Calculate theory for a given set of fit-parameters.
*
*/ */
void PRunAsymmetry::CalcTheory() void PRunAsymmetry::CalcTheory()
{ {
@ -268,17 +266,26 @@ void PRunAsymmetry::CalcTheory()
// PrepareData // PrepareData
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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$: * 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[ * \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 + * (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] * (\Delta b_i^{\rm c})^2 (f_i^{\rm c})^2\right]^{1/2}\f]
*
* <b>return:</b>
* - true if everthing went smooth
* - false, otherwise.
*/ */
Bool_t PRunAsymmetry::PrepareData() Bool_t PRunAsymmetry::PrepareData()
{ {
//cout << endl << "in PRunAsymmetry::PrepareData(): will feed fData" << endl;
// get forward/backward histo from PRunDataHandler object ------------------------ // get forward/backward histo from PRunDataHandler object ------------------------
// get the correct run // get the correct run
PRawRunData *runData = fRawData->GetRunData(*(fRunInfo->GetRunName())); PRawRunData *runData = fRawData->GetRunData(*(fRunInfo->GetRunName()));
@ -294,7 +301,6 @@ Bool_t PRunAsymmetry::PrepareData()
// keep start/stop time for fit // keep start/stop time for fit
fFitStartTime = fRunInfo->GetFitRange(0); fFitStartTime = fRunInfo->GetFitRange(0);
fFitStopTime = fRunInfo->GetFitRange(1); fFitStopTime = fRunInfo->GetFitRange(1);
//cout << endl << "start/stop (fit): " << fFitStartTime << ", " << fFitStopTime << endl;
// collect histogram numbers // collect histogram numbers
PUIntVector forwardHistoNo; PUIntVector forwardHistoNo;
@ -603,6 +609,10 @@ Bool_t PRunAsymmetry::PrepareData()
* \pm\left[ f_i + \mathrm{bkg} \right]^{1/2}, \f] * \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 * 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. * and \f$ \mathrm{bkg} \f$ the fix given background.
*
* <b>return:</b>
* - true
*
*/ */
Bool_t PRunAsymmetry::SubtractFixBkg() Bool_t PRunAsymmetry::SubtractFixBkg()
{ {
@ -620,7 +630,7 @@ Bool_t PRunAsymmetry::SubtractFixBkg()
// SubtractEstimatedBkg // SubtractEstimatedBkg
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Subtracts the background given ... * <p>Subtracts the background which is estimated from a given interval (typically before t0).
* *
* The background corrected histogramms are: * 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, * \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} = * \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] * \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. * where \f$N\f$ is the number of bins over which the background is formed.
*
* <b>return:</b>
* - true
*/ */
Bool_t PRunAsymmetry::SubtractEstimatedBkg() Bool_t PRunAsymmetry::SubtractEstimatedBkg()
{ {
@ -698,14 +711,12 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
bkg[0] += fForward[i]; bkg[0] += fForward[i];
errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1); errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
bkg[0] /= static_cast<Double_t>(end[0] - start[0] + 1); bkg[0] /= static_cast<Double_t>(end[0] - start[0] + 1);
//cout << endl << ">> bkg[0] = " << bkg[0];
// backward // backward
for (UInt_t i=start[1]; i<end[1]; i++) for (UInt_t i=start[1]; i<end[1]; i++)
bkg[1] += fBackward[i]; bkg[1] += fBackward[i];
errBkg[1] = TMath::Sqrt(bkg[1])/(end[0] - start[0] + 1); errBkg[1] = TMath::Sqrt(bkg[1])/(end[0] - start[0] + 1);
bkg[1] /= static_cast<Double_t>(end[1] - start[1] + 1); bkg[1] /= static_cast<Double_t>(end[1] - start[1] + 1);
//cout << endl << ">> bkg[1] = " << bkg[1] << endl;
// correct error for forward, backward // correct error for forward, backward
for (UInt_t i=0; i<fForward.size(); i++) { for (UInt_t i=0; i<fForward.size(); i++) {
@ -726,8 +737,18 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
// PrepareFitData // PrepareFitData
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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]) 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 // PrepareViewData
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p> * <p>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]) 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.SetDataTimeStart(fTimeResolution*((Double_t)start[0]-t0[0]+(Double_t)(packing-1)/2.0));
fData.SetDataTimeStep(fTimeResolution*(Double_t)packing); fData.SetDataTimeStep(fTimeResolution*(Double_t)packing);
/*
cout << endl << ">> start time = " << fData.GetDataTimeStart() << ", step = " << fData.GetDataTimeStep();
cout << endl << "--------------------------------" << endl;
*/
// get the proper alpha and beta // get the proper alpha and beta
switch (fAlphaBetaTag) { switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1 case 1: // alpha == 1, beta == 1
@ -1093,7 +1121,6 @@ cout << endl << "--------------------------------" << endl;
default: default:
break; break;
} }
//cout << endl << ">> alpha = " << alpha << ", beta = " << beta;
for (UInt_t i=0; i<forwardPacked.GetValue()->size(); i++) { for (UInt_t i=0; i<forwardPacked.GetValue()->size(); i++) {
// to make the formulae more readable // to make the formulae more readable
@ -1143,7 +1170,6 @@ cout << endl << "--------------------------------" << endl;
size = fData.GetValue()->size() * 10; size = fData.GetValue()->size() * 10;
factor = (Double_t)runData->GetDataBin(histoNo[0])->size() / (Double_t)size; 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.SetTheoryTimeStart(fData.GetDataTimeStart());
fData.SetTheoryTimeStep(fTimeResolution*factor); fData.SetTheoryTimeStep(fTimeResolution*factor);
for (UInt_t i=0; i<size; i++) { for (UInt_t i=0; i<size; i++) {
@ -1167,14 +1193,14 @@ cout << endl << "--------------------------------" << endl;
/** /**
* <p> Prepares the RRF data set for visual representation. This is done the following way: * <p> Prepares the RRF data set for visual representation. This is done the following way:
* -# make all necessary checks * -# make all necessary checks
* -# build the asymmetry [ \f[ A(t) \f] ] WITHOUT packing. * -# build the asymmetry, \f$ A(t) \f$, WITHOUT packing.
* -# \f[ A_R(t) = A(t) \cdot 2 \cos(\omega_R t + \phi_R) \f] * -# \f$ A_R(t) = A(t) \cdot 2 \cos(\omega_R t + \phi_R) \f$
* -# do the packing of \f[ A_R(t) \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] * -# 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] * -# \f$ T_R(t) = T(t) \cdot 2 \cos(\omega_R t + \phi_R) \f$
* -# do the packing of \f[ T_R(t) \f] * -# do the packing of \f$ T_R(t) \f$
* -# calculate the Kaiser FIR filter coefficients * -# 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 runData raw run data needed to perform some crosschecks
* \param histNo array of the histo numbers form which to build the asymmetry * \param histNo array of the histo numbers form which to build the asymmetry

View File

@ -42,7 +42,7 @@
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p> * <p>This class provides the routines needed to handle msr-files, i.e. reading, writing, parsing, etc.
*/ */
class PMsrHandler class PMsrHandler
{ {

View File

@ -185,7 +185,8 @@ enum EPMusrHandleTag { kEmpty, kFit, kView };
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>Holds the data which will be fitted, i.e. packed, background corrected, ... * <p>Handles the data which will be fitted, i.e. packed, background corrected, ...
* This are <b>not</b> the raw histogram data of a run. This are the pre-processed data.
*/ */
class PRunData { class PRunData {
public: public:
@ -233,7 +234,7 @@ class PRunData {
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>Non-Musr raw data. * <p>Handles Non-Musr raw data.
*/ */
class PNonMusrRawRunData { class PNonMusrRawRunData {
public: public:
@ -265,7 +266,7 @@ class PNonMusrRawRunData {
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>Histogram raw muSR data. * <p>Handles raw data, both non-muSR data as well muSR histogram data.
*/ */
class PRawRunData { class PRawRunData {
public: public:
@ -356,7 +357,7 @@ typedef vector<PMsrLineStructure> PMsrLines;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p> Holds the information of a parameter. * <p>Handles the information of a parameter.
*/ */
typedef struct { typedef struct {
Int_t fNoOfParams; ///< how many parameters are given Int_t fNoOfParams; ///< how many parameters are given
@ -380,7 +381,7 @@ typedef vector<PMsrParamStructure> PMsrParamList;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p> Holds the information of a single run block * <p>Handles the information of a single run block
* *
*/ */
class PMsrRunBlock { class PMsrRunBlock {
@ -402,7 +403,6 @@ class PMsrRunBlock {
virtual Int_t GetBetaParamNo() { return fBetaParamNo; } virtual Int_t GetBetaParamNo() { return fBetaParamNo; }
virtual Int_t GetNormParamNo() { return fNormParamNo; } virtual Int_t GetNormParamNo() { return fNormParamNo; }
virtual Int_t GetBkgFitParamNo() { return fBkgFitParamNo; } virtual Int_t GetBkgFitParamNo() { return fBkgFitParamNo; }
virtual Int_t GetPhaseParamNo() { return fPhaseParamNo; }
virtual Int_t GetLifetimeParamNo() { return fLifetimeParamNo; } virtual Int_t GetLifetimeParamNo() { return fLifetimeParamNo; }
virtual Bool_t IsLifetimeCorrected() { return fLifetimeCorrection; } virtual Bool_t IsLifetimeCorrected() { return fLifetimeCorrection; }
virtual PIntVector* GetMap() { return &fMap; } virtual PIntVector* GetMap() { return &fMap; }
@ -435,7 +435,6 @@ class PMsrRunBlock {
virtual void SetBetaParamNo(Int_t ival) { fBetaParamNo = ival; } virtual void SetBetaParamNo(Int_t ival) { fBetaParamNo = ival; }
virtual void SetNormParamNo(Int_t ival) { fNormParamNo = ival; } virtual void SetNormParamNo(Int_t ival) { fNormParamNo = ival; }
virtual void SetBkgFitParamNo(Int_t ival) { fBkgFitParamNo = 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 SetLifetimeParamNo(Int_t ival) { fLifetimeParamNo = ival; }
virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; } virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; }
virtual void SetMap(Int_t mapVal, Int_t idx=-1); 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 fBetaParamNo; ///< beta parameter number (fit type 2, 4)
Int_t fNormParamNo; ///< N0 parameter number (fit type 0) Int_t fNormParamNo; ///< N0 parameter number (fit type 0)
Int_t fBkgFitParamNo; ///< background fit 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) Int_t fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0)
Bool_t fLifetimeCorrection; ///< lifetime correction flag for viewing (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 PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory
@ -532,7 +530,7 @@ typedef vector<PMsrPlotStructure> PMsrPlotList;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p> * <p>Holds the informations for the statistics block.
*/ */
typedef struct { typedef struct {
Bool_t fValid; ///< flag showing if the statistics block is valid, i.e. a fit took place which converged Bool_t fValid; ///< flag showing if the statistics block is valid, i.e. a fit took place which converged

View File

@ -84,57 +84,59 @@
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** /**
* <p> * <p>Structure holding all necessary histograms for a single plot block entry for
* fit types: asymmetry fit and single histogram fit.
*/ */
typedef struct { typedef struct {
TH1F *data; TH1F *data; ///< data histogram
TH1F *dataFourierRe; TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram
TH1F *dataFourierIm; TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
TH1F *dataFourierPwr; TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhase; TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram
TH1F *theory; TH1F *theory; ///< theory histogram belonging to the data histogram
TH1F *theoryFourierRe; TH1F *theoryFourierRe; ///< real part of the Fourier transform of the theory histogram
TH1F *theoryFourierIm; TH1F *theoryFourierIm; ///< imaginary part of the Fourier transform of the theory histogram
TH1F *theoryFourierPwr; TH1F *theoryFourierPwr; ///< power spectrum of the Fourier transform of the theory histogram
TH1F *theoryFourierPhase; TH1F *theoryFourierPhase; ///< phase spectrum of the Fourier transform of the theory histogram
TH1F *diff; TH1F *diff; ///< difference histogram, i.e. data-theory
TH1F *diffFourierRe; TH1F *diffFourierRe; ///< real part of the Fourier transform of the diff histogram
TH1F *diffFourierIm; TH1F *diffFourierIm; ///< imaginary part of the Fourier transform of the diff histogram
TH1F *diffFourierPwr; TH1F *diffFourierPwr; ///< power spectrum of the Fourier transform of the diff histogram
TH1F *diffFourierPhase; TH1F *diffFourierPhase; ///< phase spectrum of the Fourier transform of the diff histogram
} PMusrCanvasDataSet; } PMusrCanvasDataSet;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** /**
* <p> * <p>typedef to make to code more readable: list of histogram data sets.
*/ */
typedef vector<PMusrCanvasDataSet> PMusrCanvasDataList; typedef vector<PMusrCanvasDataSet> PMusrCanvasDataList;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** /**
* <p> * <p>Structure holding all necessary error graphs for a single plot block entry for
* fit types: non-muSR fit.
*/ */
typedef struct { typedef struct {
TGraphErrors *data; TGraphErrors *data; ///< data error graph
TGraphErrors *dataFourierRe; TGraphErrors *dataFourierRe; ///< real part of the Fourier transform of the data error graph
TGraphErrors *dataFourierIm; TGraphErrors *dataFourierIm; ///< imaginary part of the Fourier transform of the data error graph
TGraphErrors *dataFourierPwr; TGraphErrors *dataFourierPwr; ///< power spectrum of the Fourier transform of the data error graph
TGraphErrors *dataFourierPhase; TGraphErrors *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data error graph
TGraphErrors *theory; TGraphErrors *theory; ///< theory histogram belonging to the data error graph
TGraphErrors *theoryFourierRe; TGraphErrors *theoryFourierRe; ///< real part of the Fourier transform of the theory error graph
TGraphErrors *theoryFourierIm; TGraphErrors *theoryFourierIm; ///< imaginary part of the Fourier transform of the theory error graph
TGraphErrors *theoryFourierPwr; TGraphErrors *theoryFourierPwr; ///< power spectrum of the Fourier transform of the theory error graph
TGraphErrors *theoryFourierPhase; TGraphErrors *theoryFourierPhase; ///< phase spectrum of the Fourier transform of the theory error graph
TGraphErrors *diff; TGraphErrors *diff; ///< difference error graph, i.e. data-theory
TGraphErrors *diffFourierRe; TGraphErrors *diffFourierRe; ///< real part of the Fourier transform of the diff error graph
TGraphErrors *diffFourierIm; TGraphErrors *diffFourierIm; ///< imaginary part of the Fourier transform of the diff error graph
TGraphErrors *diffFourierPwr; TGraphErrors *diffFourierPwr; ///< power spectrum of the Fourier transform of the diff error graph
TGraphErrors *diffFourierPhase; TGraphErrors *diffFourierPhase; ///< phase spectrum of the Fourier transform of the diff error graph
} PMusrCanvasNonMusrDataSet; } PMusrCanvasNonMusrDataSet;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** /**
* <p> * <p>typedef to make to code more readable: list of error graph data sets.
*/ */
typedef vector<PMusrCanvasNonMusrDataSet> PMusrCanvasNonMusrDataList; typedef vector<PMusrCanvasNonMusrDataSet> PMusrCanvasNonMusrDataList;
@ -143,17 +145,17 @@ typedef vector<PMusrCanvasNonMusrDataSet> PMusrCanvasNonMusrDataList;
* <p> data structure needed for ascii dump within musrview. * <p> data structure needed for ascii dump within musrview.
*/ */
typedef struct { typedef struct {
PDoubleVector dataX; PDoubleVector dataX; ///< x-axis data set
PDoubleVector data; PDoubleVector data; ///< y-axis data set
PDoubleVector dataErr; PDoubleVector dataErr; ///< error of the y-axis data set
PDoubleVector theoryX; PDoubleVector theoryX; ///< x-axis theory set
PDoubleVector theory; PDoubleVector theory; ///< y-axis theory set
} PMusrCanvasAsciiDump; } PMusrCanvasAsciiDump;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** /**
* <p> vectore of the above data structure. Used if there are multiple histogramms * <p> typedef to make to code more readable: vector of the above data structure.
* to be dumped. * Used if there are multiple histogramms to be dumped.
*/ */
typedef vector<PMusrCanvasAsciiDump> PMusrCanvasAsciiDumpVector; typedef vector<PMusrCanvasAsciiDump> PMusrCanvasAsciiDumpVector;
@ -193,53 +195,53 @@ class PMusrCanvas : public TObject, public TQObject
virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat); virtual void SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat);
private: private:
Bool_t fBatchMode; /// musrview in ROOT batch mode Bool_t fBatchMode; ///< musrview in ROOT batch mode
Bool_t fValid; 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 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 fCurrentPlotView; ///< tag showing what the current plot view is: data, fourier, ...
Int_t fPlotType; 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; 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 Double_t fCurrentFourierPhase; ///< holds the current Fourier phase
TLatex *fCurrentFourierPhaseText; /// used in Re/Im Fourier to show the current phase in the pad TLatex *fCurrentFourierPhaseText; ///< used in Re/Im Fourier to show the current phase in the pad
TString *fRRFText; TString *fRRFText; ///< RRF information
TLatex *fRRFLatexText; /// used to display RRF info TLatex *fRRFLatexText; ///< used to display RRF info
TStyle *fStyle; TStyle *fStyle; ///< A collection of all graphics attributes
// canvas menu related variables // canvas menu related variables
TRootCanvas *fImp; TRootCanvas *fImp; ///< ROOT native GUI version of main window with menubar and drawing area
TGMenuBar *fBar; TGMenuBar *fBar; ///< menu bar
TGPopupMenu *fPopupMain; TGPopupMenu *fPopupMain; ///< popup menu Musrfit in the main menu bar
TGPopupMenu *fPopupSave; TGPopupMenu *fPopupSave; ///< popup menu of the Musrfit/Save Data sub menu
TGPopupMenu *fPopupFourier; TGPopupMenu *fPopupFourier; ///< popup menu of the Musrfit/Fourier sub menu
// canvas related variables // canvas related variables
TCanvas *fMainCanvas; TCanvas *fMainCanvas; ///< main canvas
TPaveText *fTitlePad; TPaveText *fTitlePad; ///< title pad used to display a title
TPad *fDataTheoryPad; TPad *fDataTheoryPad; ///< data/theory pad used to display the data/theory
TPaveText *fParameterPad; TPaveText *fParameterPad; ///< parameter pad used to display the fitting parameters
TPaveText *fTheoryPad; TPaveText *fTheoryPad; ///< theory pad used to display the theory and functions
TLegend *fInfoPad; TLegend *fInfoPad; ///< info pad used to display a legend of the data plotted
TLegend *fMultiGraphLegend; 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__ #ifndef __MAKECINT__
PMsrHandler *fMsrHandler; PMsrHandler *fMsrHandler; ///< msr-file handler
PRunListCollection *fRunList; PRunListCollection *fRunList; ///< data handler
#endif // __MAKECINT__ #endif // __MAKECINT__
PMusrCanvasDataList fData; PMusrCanvasDataList fData; ///< list of all histogram data to be plotted (asymmetry/single histogram)
PMusrCanvasNonMusrDataList fNonMusrData; PMusrCanvasNonMusrDataList fNonMusrData; ///< list of all error graphs to be plotted (non-muSR)
TMultiGraph *fMultiGraphData; TMultiGraph *fMultiGraphData; ///< fMultiGraphData is a 'global' graph needed in order to plot error graphs (data) with (potentially) different x-frames
TMultiGraph *fMultiGraphDiff; TMultiGraph *fMultiGraphDiff; ///< fMultiGraphDiff is a 'global' graph needed in order to plot error graphs (data-theory) with (potentially) different x-frames
PMsrFourierStructure fFourier; PMsrFourierStructure fFourier; ///< structure holding all the information necessary to perform the Fourier transform
PIntVector fMarkerList; PIntVector fMarkerList; ///< list of markers
PIntVector fColorList; PIntVector fColorList; ///< list of colors
virtual void CreateStyle(); virtual void CreateStyle();
virtual void InitFourier(); virtual void InitFourier();

View File

@ -54,13 +54,11 @@
#define PMUSRT0_GET_DATA_AND_BKG_RANGE 1 #define PMUSRT0_GET_DATA_AND_BKG_RANGE 1
#define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE 2 #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
*/
//--------------------------------------------------------------------------
/**
* <p>Handles the raw muSR run data sets.
*/
class PMusrT0Data { class PMusrT0Data {
public: public:
PMusrT0Data(); PMusrT0Data();
@ -112,6 +110,7 @@ class PMusrT0Data {
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* <p>Handles the musrt0 graphical user interface.
* <p>The preprocessor tag __MAKECINT__ is used to hide away from rootcint * <p>The preprocessor tag __MAKECINT__ is used to hide away from rootcint
* the overly complex spirit header files. * the overly complex spirit header files.
*/ */
@ -138,39 +137,39 @@ class PMusrT0 : public TObject, public TQObject
private: private:
#ifndef __MAKECINT__ #ifndef __MAKECINT__
PMsrHandler *fMsrHandler; PMsrHandler *fMsrHandler; ///< msr-file handler
#endif // __MAKECINT__ #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 fDataAndBkgEnabled; ///< enable/disable data and background range handling (necessary in connection with grouping and addrun)
Bool_t fT0Enabled; Bool_t fT0Enabled; ///< enable/disable t0 handling (necessary in connection with grouping and addrun)
Int_t fT0Estimated; Int_t fT0Estimated; ///< estimated t0 value (in bins)
// canvas related variables // canvas related variables
TCanvas *fMainCanvas; TCanvas *fMainCanvas; ///< main canvas for the graphical user interface
TH1F *fHisto; TH1F *fHisto; ///< full raw data histogram
TH1F *fData; TH1F *fData; ///< ranged raw data histogram (first good bin, last good bin)
TH1F *fBkg; TH1F *fBkg; ///< histogram starting from 'bkg start' up to 'bkg end'
TLatex *fToDoInfo; TLatex *fToDoInfo; ///< clear text user instruction string
TLine *fT0Line; TLine *fT0Line; ///< line showing the position of t0
TLine *fFirstBkgLine; TLine *fFirstBkgLine; ///< line showing the start of the background
TLine *fLastBkgLine; TLine *fLastBkgLine; ///< line showing the end of the background
TLine *fFirstDataLine; TLine *fFirstDataLine; ///< line showing the start of the data (first good data bin)
TLine *fLastDataLine; TLine *fLastDataLine; ///< line showing the end of the data (last good data bin)
Int_t fPx; Int_t fPx; ///< x-position of the cursor
Int_t fPy; Int_t fPy; ///< y-position of the cursor
Int_t fDataRange[2]; Int_t fDataRange[2]; ///< data range (first good bin, last good bin)
Int_t fBkgRange[2]; Int_t fBkgRange[2]; ///< background range (first bkg bin, last bkg bin)
void SetT0Channel(); void SetT0Channel();
void SetEstimatedT0Channel(); void SetEstimatedT0Channel();

View File

@ -34,6 +34,10 @@
#include "PRunBase.h" #include "PRunBase.h"
//---------------------------------------------------------------------------
/**
* <p>Class handling the asymmetry fit.
*/
class PRunAsymmetry : public PRunBase class PRunAsymmetry : public PRunBase
{ {
public: public:
@ -45,7 +49,7 @@ class PRunAsymmetry : public PRunBase
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par); virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
virtual void CalcTheory(); virtual void CalcTheory();
virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; } virtual UInt_t GetNoOfFitBins() { return fNoOfFitBins; } ///< returns the number of bins to be fitted.
protected: protected:
virtual Bool_t PrepareData(); virtual Bool_t PrepareData();
@ -54,11 +58,11 @@ class PRunAsymmetry : public PRunBase
virtual Bool_t PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]); virtual Bool_t PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2]);
private: 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 fFitStartTime; ///< fit start time
Double_t fFitStopTime; Double_t fFitStopTime; ///< fit stop time
UInt_t fNoOfFitBins; UInt_t fNoOfFitBins; ///< number of bins to be be fitted
PDoubleVector fForward; ///< forward histo data PDoubleVector fForward; ///< forward histo data
PDoubleVector fForwardErr; ///< forward histo errors PDoubleVector fForwardErr; ///< forward histo errors