diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index ef0270b9..2f903fe4 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -50,8 +50,8 @@ using namespace std; * * \param fileName name of a msr-file. */ -PMsrHandler::PMsrHandler(const Char_t *fileName, PStartupOptions *startupOptions) : - fStartupOptions(startupOptions), fFileName(fileName) +PMsrHandler::PMsrHandler(const Char_t *fileName, const Bool_t fourierOnly, PStartupOptions *startupOptions) : + fFourierOnly(fourierOnly), fStartupOptions(startupOptions), fFileName(fileName) { // init variables fMsrBlockCounter = 0; @@ -130,6 +130,7 @@ Int_t PMsrHandler::ReadMsrFile() PMsrLines fit_parameter; PMsrLines theory; PMsrLines functions; + PMsrLines global; PMsrLines run; PMsrLines commands; PMsrLines fourier; @@ -174,6 +175,9 @@ Int_t PMsrHandler::ReadMsrFile() } else if (line.BeginsWith("FUNCTIONS")) { // FUNCTIONS block tag fMsrBlockCounter = MSR_TAG_FUNCTIONS; functions.push_back(current); + } else if (line.BeginsWith("GLOBAL")) { // GLOBAL block tag + fMsrBlockCounter = MSR_TAG_GLOBAL; + global.push_back(current); } else if (line.BeginsWith("RUN")) { // RUN block tag fMsrBlockCounter = MSR_TAG_RUN; run.push_back(current); @@ -201,6 +205,9 @@ Int_t PMsrHandler::ReadMsrFile() case MSR_TAG_FUNCTIONS: // FUNCTIONS block functions.push_back(current); break; + case MSR_TAG_GLOBAL: // GLOBAL block + global.push_back(current); + break; case MSR_TAG_RUN: // RUN block run.push_back(current); break; @@ -235,6 +242,9 @@ Int_t PMsrHandler::ReadMsrFile() if (result == PMUSR_SUCCESS) if (!HandleFunctionsEntry(functions)) result = PMUSR_MSR_SYNTAX_ERROR; + if (result == PMUSR_SUCCESS) + if (!HandleGlobalEntry(global)) + result = PMUSR_MSR_SYNTAX_ERROR; if (result == PMUSR_SUCCESS) if (!HandleRunEntry(run)) result = PMUSR_MSR_SYNTAX_ERROR; @@ -310,6 +320,7 @@ Int_t PMsrHandler::ReadMsrFile() fit_parameter.clear(); theory.clear(); functions.clear(); + global.clear(); run.clear(); commands.clear(); fourier.clear(); @@ -453,6 +464,10 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) tag = MSR_TAG_FUNCTIONS; fout << str.Data() << endl; continue; + } else if (str.BeginsWith("GLOBAL")) { // GLOBAL block tag + tag = MSR_TAG_GLOBAL; + fout << str.Data() << endl; + continue; } else if (str.BeginsWith("RUN")) { // RUN block tag tag = MSR_TAG_RUN; runNo++; @@ -588,6 +603,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout << str.Data() << endl; } break; + case MSR_TAG_GLOBAL: + // STILL MISSING + break; case MSR_TAG_RUN: sstr = str; sstr.Remove(TString::kLeading, ' '); @@ -1473,6 +1491,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co fout << endl; fout << hline.Data() << endl; + // write GLOBAL block + // STILL MISSING + // write RUN blocks for (i = 0; i < fRuns.size(); ++i) { if (commentsRUN) { @@ -2523,6 +2544,169 @@ Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines) return true; } +//-------------------------------------------------------------------------- +// HandleGlobalEntry (private) +//-------------------------------------------------------------------------- +/** + *

Parses the GLOBAL block of the msr-file. + * + * return: + * - true if successful + * - false otherwise + * + * \param lines is a list of lines containing the run blocks + */ +Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) +{ + PMsrLines::iterator iter; + PMsrGlobalBlock global; + + Bool_t error = false; + + TString str; + TObjArray *tokens = 0; + TObjString *ostr = 0; + Int_t ival; + Double_t dval; + + iter = lines.begin(); + while ((iter != lines.end()) && !error) { + // remove potential comment at the end of lines + str = iter->fLine; + Ssiz_t idx = str.Index("#"); + if (idx != -1) + str.Remove(idx); + + // tokenize line + tokens = str.Tokenize(" \t"); + if (!tokens) { + cerr << endl << ">> PMsrHandler::HandleGlobalEntry: **SEVERE ERROR** Couldn't tokenize line " << iter->fLineNo; + cerr << endl << endl; + return false; + } + + if (iter->fLine.BeginsWith("fittype", TString::kIgnoreCase)) { // fittype + if (tokens->GetEntries() < 2) { + error = true; + } else { + ostr = dynamic_cast(tokens->At(1)); + str = ostr->GetString(); + if (str.IsDigit()) { + Int_t fittype = str.Atoi(); + if ((fittype == MSR_FITTYPE_SINGLE_HISTO) || + (fittype == MSR_FITTYPE_ASYM) || + (fittype == MSR_FITTYPE_MU_MINUS) || + (fittype == MSR_FITTYPE_NON_MUSR)) { + global.SetFitType(fittype); + } else { + error = true; + } + } else { + error = true; + } + } + } else if (iter->fLine.BeginsWith("data", TString::kIgnoreCase)) { // data + if (tokens->GetEntries() < 3) { + error = true; + } else { + for (Int_t i=1; iGetEntries(); i++) { + ostr = dynamic_cast(tokens->At(i)); + str = ostr->GetString(); + if (str.IsDigit()) { + ival = str.Atoi(); + if (ival >= 0) { + global.SetDataRange(ival, i-1); + } else { + error = true; + } + } else { + error = true; + } + } + } + } else if (iter->fLine.BeginsWith("t0", TString::kIgnoreCase)) { // t0 + if (tokens->GetEntries() < 2) { + error = true; + } else { + for (Int_t i=1; iGetEntries(); i++) { + ostr = dynamic_cast(tokens->At(i)); + str = ostr->GetString(); + if (str.IsFloat()) { + dval = str.Atof(); + if (dval >= 0.0) + global.SetT0Bin(dval); + else + error = true; + } else { + error = true; + } + } + } + } else if (iter->fLine.BeginsWith("fit", TString::kIgnoreCase)) { // fit range + if (tokens->GetEntries() < 3) { + error = true; + } else { // fit given in time, i.e. fit , where , are given as doubles + for (Int_t i=1; i<3; i++) { + ostr = dynamic_cast(tokens->At(i)); + str = ostr->GetString(); + if (str.IsFloat()) + global.SetFitRange(str.Atof(), i-1); + else + error = true; + } + } + } else if (iter->fLine.BeginsWith("packing", TString::kIgnoreCase)) { // packing + if (tokens->GetEntries() < 2) { + error = true; + } else { + ostr = dynamic_cast(tokens->At(1)); + str = ostr->GetString(); + if (str.IsDigit()) { + ival = str.Atoi(); + if (ival >= 0) { + global.SetPacking(ival); + } else { + error = true; + } + } else { + error = true; + } + } + } + + // clean up + if (tokens) { + delete tokens; + tokens = 0; + } + + ++iter; + } + + if (error) { + --iter; + cerr << endl << ">> PMsrHandler::HandleGlobalEntry: **ERROR** in line " << iter->fLineNo << ":"; + cerr << endl << ">> '" << iter->fLine.Data() << "'"; + cerr << endl << ">> GLOBAL block syntax is too complex to print it here. Please check the manual."; + } else { // save global + fGlobal = global; + } + + cout << endl << "debug> Global: fittype : " << fGlobal.GetFitType(); + cout << endl << "debug> Global: data bin range: "; + for (UInt_t i=0; i<4; i++) { + cout << fGlobal.GetDataRange(i) << ", "; + } + cout << endl << "debug> Global: t0's : "; + for (UInt_t i=0; i Global: fit : " << fGlobal.GetFitRange(0) << ", " << fGlobal.GetFitRange(1); + cout << endl << "debug> Global: packing : " << fGlobal.GetPacking(); + cout << endl; + + return !error; +} + //-------------------------------------------------------------------------- // HandleRunEntry (private) //-------------------------------------------------------------------------- @@ -3165,7 +3349,7 @@ Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines) { PMsrLines::iterator iter; - if (lines.empty()) { + if (lines.empty() && !fFourierOnly) { cerr << endl << ">> PMsrHandler::HandleCommandsEntry(): **WARNING**: There is no COMMAND block! Do you really want this?"; cerr << endl; } @@ -3216,8 +3400,6 @@ void PMsrHandler::InitFourierParameterStructure(PMsrFourierStructure &fourier) */ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) { -//cout << endl << ">> in PMsrHandler::HandleFourierEntry ..."; - Bool_t error = false; if (lines.empty()) // no fourier block present @@ -3999,7 +4181,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) */ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines) { - if (lines.empty()) { + if (lines.empty() && !fFourierOnly) { cerr << endl << ">> PMsrHandler::HandleStatisticEntry: **WARNING** There is no STATISTIC block! Do you really want this?"; cerr << endl; fStatistic.fValid = false; @@ -4637,35 +4819,40 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() for (UInt_t i=0; i> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype is not defined in RUN block number " << i+1 << endl; - return false; + if (fitType == -1) { // fittype not given in the run block + fitType = fGlobal.GetFitType(); + if (fitType == -1) { + cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype is neither defined in RUN block number " << i+1 << ", nor in the GLOBAL block." << endl; + return false; + } } // check for the different fittypes differently switch (fitType) { case PRUN_SINGLE_HISTO: // check of norm is present - if (fRuns[i].GetNormParamNo() == -1) { + if ((fRuns[i].GetNormParamNo() == -1) && !fFourierOnly) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; cerr << endl << ">> Norm parameter number not defined. Necessary for single histogram fits." << endl; return false; } - // check if norm parameter is given that it is either a valid function of a fit parameter present - if (fRuns[i].GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // parameter number - // check that norm parameter number is not larger than the number of parameters - if (fRuns[i].GetNormParamNo() > static_cast(fParam.size())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Norm parameter number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; - return false; - } - } else { // function norm - if (fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET > GetNoOfFuncs()) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Norm parameter function number " << fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET << " is larger than the number of functions (" << GetNoOfFuncs() << ")."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; - return false; + if (!fFourierOnly) { // next check NOT needed for Fourier only + // check if norm parameter is given that it is either a valid function of a fit parameter present + if (fRuns[i].GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // parameter number + // check that norm parameter number is not larger than the number of parameters + if (fRuns[i].GetNormParamNo() > static_cast(fParam.size())) { + cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + cerr << endl << ">> Norm parameter number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; + cerr << endl << ">> Consider to check the manual ;-)" << endl; + return false; + } + } else { // function norm + if (fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET > GetNoOfFuncs()) { + cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + cerr << endl << ">> Norm parameter function number " << fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET << " is larger than the number of functions (" << GetNoOfFuncs() << ")."; + cerr << endl << ">> Consider to check the manual ;-)" << endl; + return false; + } } } // check that there is a forward parameter number @@ -4685,28 +4872,32 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() } // check fit range if (!fRuns[i].IsFitRangeInBin()) { // fit range given as times in usec - if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { - cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << " Fit range is not defined. Necessary for single histogram fits." << endl; - return false; + if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in RUN block + if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in GLOBAL block + cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + cerr << endl << " Fit range is not defined. Necessary for single histogram fits." << endl; + return false; + } } } // check number of T0's provided - if (fRuns[i].GetT0BinSize() > fRuns[i].GetForwardHistoNoSize()) { + if ((fRuns[i].GetT0BinSize() > fRuns[i].GetForwardHistoNoSize()) && + (fGlobal.GetT0BinSize() > fRuns[i].GetForwardHistoNoSize())) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; + cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; return false; } // check packing - if (fRuns[i].GetPacking() == -1) { + if ((fRuns[i].GetPacking() == -1) && (fGlobal.GetPacking() == -1)) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; - cerr << endl << ">> Packing is not defined, will set it to 1." << endl; + cerr << endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << endl; fRuns[i].SetPacking(1); } break; case PRUN_ASYMMETRY: // check alpha - if (fRuns[i].GetAlphaParamNo() == -1) { + if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; cerr << endl << ">> alpha parameter number missing which is needed for an asymmetry fit."; cerr << endl << ">> Consider to check the manual ;-)" << endl; @@ -4715,38 +4906,44 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() // check that there is a forward parameter number if (fRuns[i].GetForwardHistoNo() == -1) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> forward histogram number not defined. Necessary for single histogram fits." << endl; + cerr << endl << ">> forward histogram number not defined. Necessary for asymmetry fits." << endl; return false; } // check that there is a backward parameter number if (fRuns[i].GetBackwardHistoNo() == -1) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> backward histogram number not defined. Necessary for single histogram fits." << endl; + cerr << endl << ">> backward histogram number not defined. Necessary for asymmetry fits." << endl; return false; } // check fit range if (!fRuns[i].IsFitRangeInBin()) { // fit range given as times in usec if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Fit range is not defined. Necessary for single histogram fits." << endl; - return false; + if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { + cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + cerr << endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << endl; + return false; + } } } // check number of T0's provided - if (fRuns[i].GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize()) { + if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize()) && + (fGlobal.GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize())) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << endl; + cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; return false; } - if (fRuns[i].GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize()) { + if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize()) && + (fGlobal.GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize())) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << endl; + cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << endl; return false; } // check packing - if (fRuns[i].GetPacking() == -1) { + if ((fRuns[i].GetPacking() == -1) && (fGlobal.GetPacking() == -1)) { cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; - cerr << endl << ">> Packing is not defined, will set it to 1." << endl; + cerr << endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << endl; fRuns[i].SetPacking(1); } break; diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index 03669cc9..e2ca724b 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -693,6 +693,146 @@ void PRawRunData::SetTempError(const UInt_t idx, const Double_t errTemp) fTemp[idx].second = errTemp; } +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// implementation PMsrGlobalBlock +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +//-------------------------------------------------------------------------- +// PMsrGlobalBlock +//-------------------------------------------------------------------------- +/** + *

Constructor + */ +PMsrGlobalBlock::PMsrGlobalBlock() +{ + fFitType = -1; // undefined fit type + for (UInt_t i=0; i<4; i++) { + fDataRange[i] = -1; // undefined data bin range + } + fFitRange[0] = PMUSR_UNDEFINED; // undefined start fit range + fFitRange[1] = PMUSR_UNDEFINED; // undefined end fit range + fPacking = -1; // undefined packing/rebinning +} + +//-------------------------------------------------------------------------- +// GetDataRange (public) +//-------------------------------------------------------------------------- +/** + *

get data range at position idx + * + * return: + * - data range value, if idx is within proper boundaries + * - -1, otherwise + * + * \param idx index of the data range to be returned + */ +Int_t PMsrGlobalBlock::GetDataRange(UInt_t idx) +{ + if (idx >= 4) + return -1; + + return fDataRange[idx]; +} + +//-------------------------------------------------------------------------- +// SetDataRange (public) +//-------------------------------------------------------------------------- +/** + *

set data range element at position idx + * + * \param ival data range element + * \param idx index of the data range element to be set. + */ +void PMsrGlobalBlock::SetDataRange(Int_t ival, Int_t idx) +{ + if (idx >= 4) { + cerr << endl << ">> PMsrGlobalBlock::SetDataRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible."; + cerr << endl; + return; + } + + fDataRange[idx] = ival; +} + +//-------------------------------------------------------------------------- +// GetT0Bin (public) +//-------------------------------------------------------------------------- +/** + *

get T0 bin at position idx + * + * return: + * - T0 bin, if idx is within proper boundaries + * - -1, otherwise + * + * \param idx index of the T0 bin to be returned + */ +Double_t PMsrGlobalBlock::GetT0Bin(UInt_t idx) +{ + if (idx >= fT0.size()) + return -1; + + return fT0[idx]; +} + +//-------------------------------------------------------------------------- +// SetT0Bin (public) +//-------------------------------------------------------------------------- +/** + *

set T0 bin at position idx + * + * \param ival T0 bin + * \param idx index of the T0 bin to be set. If idx==-1, append value + */ +void PMsrGlobalBlock::SetT0Bin(Double_t dval, Int_t idx) +{ + if (idx == -1) { + fT0.push_back(dval); + return; + } + + if (idx >= static_cast(fT0.size())) + fT0.resize(idx+1); + + fT0[idx] = dval; +} + +//-------------------------------------------------------------------------- +// GetFitRange (public) +//-------------------------------------------------------------------------- +/** + *

get fit range value at position idx. idx: 0=fit range start, 1=fit range end. + * + * return: + * - fit range value, if idx is within proper boundaries + * - PMUSR_UNDEFINED, otherwise + * + * \param idx index of the fit range value to be returned + */ +Double_t PMsrGlobalBlock::GetFitRange(UInt_t idx) +{ + if (idx >= 2) + return PMUSR_UNDEFINED; + + return fFitRange[idx]; +} + +//-------------------------------------------------------------------------- +// SetFitRange (public) +//-------------------------------------------------------------------------- +/** + *

set fit range value at position idx + * + * \param dval value to be set + * \param idx index of the fit range value to be set + */ +void PMsrGlobalBlock::SetFitRange(Double_t dval, UInt_t idx) +{ + if (idx >= 2) + return; + + fFitRange[idx] = dval; +} + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // implementation PMsrRunBlock //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/src/include/PMsrHandler.h b/src/include/PMsrHandler.h index 92f5e257..20022f00 100644 --- a/src/include/PMsrHandler.h +++ b/src/include/PMsrHandler.h @@ -45,7 +45,7 @@ class PMsrHandler { public: - PMsrHandler(const Char_t *fileName, PStartupOptions *startupOptions=0); + PMsrHandler(const Char_t *fileName, const Bool_t fourierOnly=false, PStartupOptions *startupOptions=0); virtual ~PMsrHandler(); virtual Int_t ReadMsrFile(); @@ -57,6 +57,7 @@ class PMsrHandler virtual PMsrParamList* GetMsrParamList() { return &fParam; } virtual PMsrLines* GetMsrTheory() { return &fTheory; } virtual PMsrLines* GetMsrFunctions() { return &fFunctions; } + virtual PMsrGlobalBlock* GetMsrGlobal() { return &fGlobal; } virtual PMsrRunList* GetMsrRunList() { return &fRuns; } virtual PMsrLines* GetMsrCommands() { return &fCommands; } virtual PMsrFourierStructure* GetMsrFourierList() { return &fFourier; } @@ -108,6 +109,7 @@ class PMsrHandler virtual Double_t GetAlphaEstimateN0(); private: + Bool_t fFourierOnly; ///< flag indicating if Fourier transform only is wished. If yes, some part of the msr-file blocks are not needed. PStartupOptions *fStartupOptions; ///< contains information about startup options from the musrfit_startup.xml TString fFileName; ///< file name of the msr-file @@ -116,6 +118,7 @@ class PMsrHandler PMsrParamList fParam; ///< holds a list of the fit parameters PMsrLines fTheory; ///< holds the theory definition PMsrLines fFunctions; ///< holds the user defined functions + PMsrGlobalBlock fGlobal; ///< holds the information of the global section PMsrRunList fRuns; ///< holds a list of run information PMsrLines fCommands; ///< holds a list of the minuit commands PMsrFourierStructure fFourier; ///< holds the parameters used for the Fourier transform @@ -133,6 +136,7 @@ class PMsrHandler virtual Bool_t HandleFitParameterEntry(PMsrLines &line); virtual Bool_t HandleTheoryEntry(PMsrLines &line); virtual Bool_t HandleFunctionsEntry(PMsrLines &line); + virtual Bool_t HandleGlobalEntry(PMsrLines &line); virtual Bool_t HandleRunEntry(PMsrLines &line); virtual Bool_t HandleCommandsEntry(PMsrLines &line); virtual Bool_t HandleFourierEntry(PMsrLines &line); diff --git a/src/include/PMusr.h b/src/include/PMusr.h index 312fc1f7..3b5a56cb 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -76,11 +76,12 @@ using namespace std; #define MSR_TAG_FITPARAMETER 1 #define MSR_TAG_THEORY 2 #define MSR_TAG_FUNCTIONS 3 -#define MSR_TAG_RUN 4 -#define MSR_TAG_COMMANDS 5 -#define MSR_TAG_FOURIER 6 -#define MSR_TAG_PLOT 7 -#define MSR_TAG_STATISTIC 8 +#define MSR_TAG_GLOBAL 4 +#define MSR_TAG_RUN 5 +#define MSR_TAG_COMMANDS 6 +#define MSR_TAG_FOURIER 7 +#define MSR_TAG_PLOT 8 +#define MSR_TAG_STATISTIC 9 //------------------------------------------------------------- // msr fit type tags @@ -523,6 +524,36 @@ typedef struct { */ typedef vector PMsrParamList; +//------------------------------------------------------------- +/** + *

Handles the information of the GLOBAL section + */ +class PMsrGlobalBlock { + public: + PMsrGlobalBlock(); + virtual ~PMsrGlobalBlock() {} + + virtual Int_t GetFitType() { return fFitType; } + virtual Int_t GetDataRange(UInt_t idx); + virtual UInt_t GetT0BinSize() { return fT0.size(); } + virtual Double_t GetT0Bin(UInt_t idx=0); + virtual Double_t GetFitRange(UInt_t idx); + virtual Int_t GetPacking() { return fPacking; } + + virtual void SetFitType(Int_t ival) { fFitType = ival; } + virtual void SetDataRange(Int_t ival, Int_t idx); + virtual void SetT0Bin(Double_t dval, Int_t idx=-1); + virtual void SetFitRange(Double_t dval, UInt_t idx); + virtual void SetPacking(Int_t ival) { fPacking = ival; } + + private: + Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=mu^- single histo fit, 8=non muSR fit + Int_t fDataRange[4]; ///< data bin range (fit type 0, 2, 4) + PDoubleVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type + Double_t fFitRange[2]; ///< fit range in (us) + Int_t fPacking; ///< packing/rebinning +}; + //------------------------------------------------------------- /** *

Handles the information of a single run block