diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 78b867ed..00096cc5 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -315,7 +315,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) Int_t runNo = -1, addRunNo = 0; Int_t plotNo = -1; string line; - TString str, sstr; + TString str, sstr, *pstr; TObjArray *tokens = 0; TObjString *ostr = 0; Bool_t found = false; @@ -492,31 +492,55 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) sstr.Remove(TString::kLeading, ' '); if (sstr.BeginsWith("RUN")) { fout << "RUN " << fRuns[runNo].GetRunName()->Data() << " "; - str = fRuns[runNo].fBeamline[0]; - str.ToUpper(); - fout << str.Data() << " "; - str = fRuns[runNo].fInstitute[0]; - str.ToUpper(); - fout << str.Data() << " "; - str = fRuns[runNo].fFileFormat[0]; - str.ToUpper(); - fout << str.Data() << " (name beamline institute data-file-format)" << endl; + pstr = fRuns[runNo].GetBeamline(); + if (pstr == 0) { + cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data." << endl; + assert(0); + } + pstr->ToUpper(); + fout << pstr->Data() << " "; + pstr = fRuns[runNo].GetInstitute(); + if (pstr == 0) { + cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data." << endl; + assert(0); + } + pstr->ToUpper(); + fout << pstr->Data() << " "; + pstr = fRuns[runNo].GetFileFormat(); + if (pstr == 0) { + cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data." << endl; + assert(0); + } + pstr->ToUpper(); + fout << pstr->Data() << " (name beamline institute data-file-format)" << endl; } else if (sstr.BeginsWith("ADDRUN")) { addRunNo++; fout << "ADDRUN " << fRuns[runNo].GetRunName(addRunNo)->Data() << " "; - str = fRuns[runNo].fBeamline[addRunNo]; - str.ToUpper(); - fout << str.Data() << " "; - str = fRuns[runNo].fInstitute[addRunNo]; - str.ToUpper(); - fout << str.Data() << " "; - str = fRuns[runNo].fFileFormat[addRunNo]; - str.ToUpper(); - fout << str.Data() << " (name beamline institute data-file-format)" << endl; + pstr = fRuns[runNo].GetBeamline(addRunNo); + if (pstr == 0) { + cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data (addrun)." << endl; + assert(0); + } + pstr->ToUpper(); + fout << pstr->Data() << " "; + pstr = fRuns[runNo].GetInstitute(addRunNo); + if (pstr == 0) { + cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data (addrun)." << endl; + assert(0); + } + pstr->ToUpper(); + fout << pstr->Data() << " "; + pstr = fRuns[runNo].GetFileFormat(addRunNo); + if (pstr == 0) { + cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data (addrun)." << endl; + assert(0); + } + pstr->ToUpper(); + fout << pstr->Data() << " (name beamline institute data-file-format)" << endl; } else if (sstr.BeginsWith("fittype")) { addRunNo = 0; fout.width(16); - switch (fRuns[runNo].fFitType) { + switch (fRuns[runNo].GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl; break; @@ -545,53 +569,53 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } else if (sstr.BeginsWith("alpha ")) { fout.width(16); fout << left << "alpha"; - fout << fRuns[runNo].fAlphaParamNo << endl; + fout << fRuns[runNo].GetAlphaParamNo() << endl; } else if (sstr.BeginsWith("beta ")) { fout.width(16); fout << left << "beta"; - fout << fRuns[runNo].fBetaParamNo << endl; + fout << fRuns[runNo].GetBetaParamNo() << endl; } else if (sstr.BeginsWith("alpha2")) { fout.width(16); fout << left << "alpha2"; - fout << fRuns[runNo].fAlphaParamNo << endl; + fout << fRuns[runNo].fAlpha2ParamNo << endl; } else if (sstr.BeginsWith("beta2")) { fout.width(16); fout << left << "beta2"; - fout << fRuns[runNo].fBetaParamNo << endl; + fout << fRuns[runNo].fBeta2ParamNo << endl; } else if (sstr.BeginsWith("norm")) { fout.width(16); fout << left << "norm"; // check if norm is give as a function - if (fRuns[runNo].fNormParamNo >= MSR_PARAM_FUN_OFFSET) - fout << "fun" << fRuns[runNo].fNormParamNo-MSR_PARAM_FUN_OFFSET; + if (fRuns[runNo].GetNormParamNo() >= MSR_PARAM_FUN_OFFSET) + fout << "fun" << fRuns[runNo].GetNormParamNo()-MSR_PARAM_FUN_OFFSET; else - fout << fRuns[runNo].fNormParamNo; + fout << fRuns[runNo].GetNormParamNo(); fout << endl; } else if (sstr.BeginsWith("backgr.fit")) { fout.width(16); fout << left << "backgr.fit"; - fout << fRuns[runNo].fBkgFitParamNo << endl; + fout << fRuns[runNo].GetBkgFitParamNo() << endl; } else if (sstr.BeginsWith("rphase")) { fout.width(16); fout << left << "rphase"; - fout << fRuns[runNo].fPhaseParamNo << endl; + fout << fRuns[runNo].GetPhaseParamNo() << endl; } else if (sstr.BeginsWith("lifetime ")) { fout.width(16); fout << left << "lifetime"; - fout << fRuns[runNo].fLifetimeParamNo << endl; + fout << fRuns[runNo].GetLifetimeParamNo() << endl; } else if (sstr.BeginsWith("lifetimecorrection")) { - if ((fRuns[runNo].fLifetimeCorrection) && (fRuns[runNo].fFitType == MSR_FITTYPE_SINGLE_HISTO)) { + if ((fRuns[runNo].IsLifetimeCorrected()) && (fRuns[runNo].GetFitType() == MSR_FITTYPE_SINGLE_HISTO)) { fout << "lifetimecorrection" << endl; } } else if (sstr.BeginsWith("map")) { fout << "map "; - for (UInt_t j=0; jsize(); j++) { fout.width(5); - fout << right << fRuns[runNo].fMap[j]; + fout << right << fRuns[runNo].GetMap(j); } // if there are less maps then 10 fill with zeros - if (fRuns[runNo].fMap.size() < 10) { - for (UInt_t j=fRuns[runNo].fMap.size(); j<10; j++) + if (fRuns[runNo].GetMap()->size() < 10) { + for (UInt_t j=fRuns[runNo].GetMap()->size(); j<10; j++) fout << " 0"; } fout << endl; @@ -1448,13 +1472,13 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) param.AppendRunName(ostr->GetString()); // beamline ostr = dynamic_cast(tokens->At(2)); - param.fBeamline.push_back(ostr->GetString()); + param.AppendBeamline(ostr->GetString()); // institute ostr = dynamic_cast(tokens->At(3)); - param.fInstitute.push_back(ostr->GetString()); + param.AppendInstitute(ostr->GetString()); // data file format ostr = dynamic_cast(tokens->At(4)); - param.fFileFormat.push_back(ostr->GetString()); + param.AppendFileFormat(ostr->GetString()); } } @@ -1469,13 +1493,13 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) param.AppendRunName(ostr->GetString()); // beamline ostr = dynamic_cast(tokens->At(2)); - param.fBeamline.push_back(ostr->GetString()); + param.AppendBeamline(ostr->GetString()); // institute ostr = dynamic_cast(tokens->At(3)); - param.fInstitute.push_back(ostr->GetString()); + param.AppendInstitute(ostr->GetString()); // data file format ostr = dynamic_cast(tokens->At(4)); - param.fFileFormat.push_back(ostr->GetString()); + param.AppendFileFormat(ostr->GetString()); } } @@ -1492,7 +1516,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) (fittype == MSR_FITTYPE_ASYM) || (fittype == MSR_FITTYPE_ASYM_RRF) || (fittype == MSR_FITTYPE_NON_MUSR)) { - param.fFitType = fittype; + param.SetFitType(fittype); } else { error = true; } @@ -1510,7 +1534,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsDigit()) - param.fAlphaParamNo = str.Atoi(); + param.SetAlphaParamNo(str.Atoi()); else error = true; } @@ -1524,7 +1548,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsDigit()) - param.fBetaParamNo = str.Atoi(); + param.SetBetaParamNo(str.Atoi()); else error = true; } @@ -1538,11 +1562,11 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsDigit()) { - param.fNormParamNo = str.Atoi(); + param.SetNormParamNo(str.Atoi()); } else if (str.Contains("fun")) { Int_t no; if (FilterNumber(str, "fun", MSR_PARAM_FUN_OFFSET, no)) - param.fNormParamNo = no; + param.SetNormParamNo(no); else error = true; } else { @@ -1559,7 +1583,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsDigit()) - param.fBkgFitParamNo = str.Atoi(); + param.SetBkgFitParamNo(str.Atoi()); else error = true; } @@ -1573,7 +1597,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsDigit()) - param.fPhaseParamNo = str.Atoi(); + param.SetPhaseParamNo(str.Atoi()); else error = true; } @@ -1587,7 +1611,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsDigit()) - param.fLifetimeParamNo = str.Atoi(); + param.SetLifetimeParamNo(str.Atoi()); else error = true; } @@ -1595,7 +1619,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) // lifetimecorrection --------------------------------------- if (iter->fLine.BeginsWith("lifetimecorrection", TString::kIgnoreCase)) { - param.fLifetimeCorrection = true; + param.SetLifetimeCorrection(true); } // map ------------------------------------------------------ @@ -1604,14 +1628,14 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(i)); str = ostr->GetString(); if (str.IsDigit()) - param.fMap.push_back(str.Atoi()); + param.AppendMap(str.Atoi()); else error = true; } // check map entries, i.e. if the map values are within parameter bounds - for (UInt_t i=0; i (Int_t) fParam.size())) { - cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.fMap[i] << " in line " << iter->fLineNo << " is out of range!"; + for (UInt_t i=0; isize(); i++) { + if ((param.GetMap(i) < 0) || (param.GetMap(i) > (Int_t) fParam.size())) { + cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.GetMap(i) << " in line " << iter->fLineNo << " is out of range!"; error = true; break; } @@ -1869,11 +1893,11 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) // check if for fittypes: single histo, asymmetry, RRF any background info is given for (UInt_t i=0; i= 0) { // check if backgr.fit is given + if (fRuns[i].GetBkgFitParamNo() >= 0) { // check if backgr.fit is given found = true; } else if (fRuns[i].fBkgFix.size() > 0) { // check if backgr.fix is given found = true; @@ -3234,9 +3258,9 @@ Bool_t PMsrHandler::CheckMaps() for (UInt_t i=0; isize()) && (mapVec[i]-MSR_PARAM_MAP_OFFSET-1 >= 0)) { // map value smaller than run-block map length - if (fRuns[j].fMap[mapVec[i]-MSR_PARAM_MAP_OFFSET-1] != 0) { // map value in the run-block != 0 + if (fRuns[j].GetMap(mapVec[i]-MSR_PARAM_MAP_OFFSET-1) != 0) { // map value in the run-block != 0 found = true; break; } @@ -3313,8 +3337,8 @@ Bool_t PMsrHandler::CheckFuncs() // check if func is present in the run-block for (UInt_t i=0; i= MSR_PARAM_FUN_OFFSET) { // function found - funVec.push_back(fRuns[i].fNormParamNo); + if (fRuns[i].GetNormParamNo() >= MSR_PARAM_FUN_OFFSET) { // function found + funVec.push_back(fRuns[i].GetNormParamNo()); funBlock.push_back(1); // 1 = run-block funLineBlockNo.push_back(i+1); } diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index 4557c3ad..cdcb00c1 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -580,3 +580,131 @@ void PMsrRunBlock::SetRunName(TString &str, UInt_t i) fRunName[i] = str; } + +//-------------------------------------------------------------------------- +// GetBeamline +//-------------------------------------------------------------------------- +/** + *

get beamline name at position i + * + * \param i index of the beamline to be returned + */ +TString* PMsrRunBlock::GetBeamline(UInt_t i) +{ + if (i>fBeamline.size()) + return 0; + + return &fBeamline[i]; +} + +//-------------------------------------------------------------------------- +// SetBeamline +//-------------------------------------------------------------------------- +/** + *

set beamline name at position i + * + * \param i index of the beamline name to be set + */ +void PMsrRunBlock::SetBeamline(TString &str, UInt_t i) +{ + if (i>fBeamline.size()) + fBeamline.resize(i+1); + + fBeamline[i] = str; +} + +//-------------------------------------------------------------------------- +// GetInstitute +//-------------------------------------------------------------------------- +/** + *

get institute name at position i + * + * \param i index of the institute to be returned + */ +TString* PMsrRunBlock::GetInstitute(UInt_t i) +{ + if (i>fInstitute.size()) + return 0; + + return &fInstitute[i]; +} + +//-------------------------------------------------------------------------- +// SetInstitute +//-------------------------------------------------------------------------- +/** + *

set institute name at position i + * + * \param i index of the run name to be set + */ +void PMsrRunBlock::SetInstitute(TString &str, UInt_t i) +{ + if (i>fInstitute.size()) + fInstitute.resize(i+1); + + fInstitute[i] = str; +} + +//-------------------------------------------------------------------------- +// GetFileFormat +//-------------------------------------------------------------------------- +/** + *

get file format name at position i + * + * \param i index of the file format to be returned + */ +TString* PMsrRunBlock::GetFileFormat(UInt_t i) +{ + if (i>fFileFormat.size()) + return 0; + + return &fFileFormat[i]; +} + +//-------------------------------------------------------------------------- +// SetFileFormat +//-------------------------------------------------------------------------- +/** + *

set file format name at position i + * + * \param i index of the file format name to be set + */ +void PMsrRunBlock::SetFileFormat(TString &str, UInt_t i) +{ + if (i>fFileFormat.size()) + fFileFormat.resize(i+1); + + fFileFormat[i] = str; +} + +//-------------------------------------------------------------------------- +// GetMap +//-------------------------------------------------------------------------- +/** + *

get map value at position i + * + * \param i index of the map value to be returned + */ +Int_t PMsrRunBlock::GetMap(UInt_t i) +{ + if (i>fMap.size()) + return -1; + + return fMap[i]; +} + +//-------------------------------------------------------------------------- +// SetMap +//-------------------------------------------------------------------------- +/** + *

set file format name at position i + * + * \param i index of the file format name to be set + */ +void PMsrRunBlock::SetMap(Int_t mapVal, UInt_t idx) +{ + if (idx>fMap.size()) + fMap.resize(idx+1); + + fMap[idx] = mapVal; +} diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 5fbf1f72..d4b83bb0 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -390,9 +390,9 @@ void PMusrCanvas::UpdateDataTheoryPad() runNo = (UInt_t)plotInfo.fRuns[i].Re()-1; //cout << endl << ">> runNo = " << runNo; //cout << endl; - if (fPlotType != runs[runNo].fFitType) { + if (fPlotType != runs[runNo].GetFitType()) { fValid = false; - cerr << endl << "PMusrCanvas::UpdateDataTheoryPad: **ERROR** plottype = " << fPlotType << ", fittype = " << runs[runNo].fFitType << ", however they have to correspond!"; + cerr << endl << "PMusrCanvas::UpdateDataTheoryPad: **ERROR** plottype = " << fPlotType << ", fittype = " << runs[runNo].GetFitType() << ", however they have to correspond!"; cerr << endl; return; } @@ -404,7 +404,7 @@ void PMusrCanvas::UpdateDataTheoryPad() data = 0; runNo = (UInt_t)plotInfo.fRuns[i].Re()-1; // get data depending on the fittype - switch (runs[runNo].fFitType) { + switch (runs[runNo].GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: data = fRunList->GetSingleHisto(runNo, PRunListCollection::kRunNo); if (!data) { // something wrong @@ -530,15 +530,15 @@ void PMusrCanvas::UpdateInfoPad() // run label = run_name/histo/T=0K/B=0G/E=0keV/... runNo = (UInt_t)plotInfo.fRuns[i].Re()-1; if (runs[runNo].GetRunNames().size() > 1) - tstr = "++" + *(runs[runNo].GetRunName()) + TString(","); // run_name + tstr = "++" + *runs[runNo].GetRunName() + TString(","); // run_name else - tstr = *(runs[runNo].GetRunName()) + TString(","); // run_name + tstr = *runs[runNo].GetRunName() + TString(","); // run_name // histo info (depending on the fittype - if (runs[runNo].fFitType == MSR_FITTYPE_SINGLE_HISTO) { + if (runs[runNo].GetFitType() == MSR_FITTYPE_SINGLE_HISTO) { tstr += TString("h:"); tstr += runs[runNo].fForwardHistoNo; tstr += TString(","); - } else if (runs[runNo].fFitType == MSR_FITTYPE_ASYM) { + } else if (runs[runNo].GetFitType() == MSR_FITTYPE_ASYM) { tstr += TString("h:"); tstr += runs[runNo].fForwardHistoNo; tstr += TString("/"); @@ -546,7 +546,7 @@ void PMusrCanvas::UpdateInfoPad() tstr += TString(","); } // temperature if present - ddvec = fRunList->GetTemp(*(runs[runNo].GetRunName())); + ddvec = fRunList->GetTemp(*runs[runNo].GetRunName()); if (ddvec.empty()) { tstr += TString("T="); tstr += TString("??,"); @@ -564,7 +564,7 @@ void PMusrCanvas::UpdateInfoPad() } // field if present tstr += TString("B="); - dval = fRunList->GetField(*(runs[runNo].GetRunName())); + dval = fRunList->GetField(*runs[runNo].GetRunName()); if (dval == PMUSR_UNDEFINED) { tstr += TString("??,"); } else { @@ -573,7 +573,7 @@ void PMusrCanvas::UpdateInfoPad() } // energy if present tstr += TString("E="); - dval = fRunList->GetEnergy(*(runs[runNo].GetRunName())); + dval = fRunList->GetEnergy(*runs[runNo].GetRunName()); //cout << endl << ">> dval = " << dval << " (Engery)"; if (dval == PMUSR_UNDEFINED) { tstr += TString("??,"); @@ -582,7 +582,7 @@ void PMusrCanvas::UpdateInfoPad() tstr += TString(sval) + TString("keV,"); } // setup if present - tstr += fRunList->GetSetup(*(runs[runNo].GetRunName())); + tstr += fRunList->GetSetup(*runs[runNo].GetRunName()); // add entry fInfoPad->AddEntry(fData[i].data, tstr.Data(), "p"); } @@ -1390,7 +1390,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) // dataHisto ------------------------------------------------------------- // create histo specific infos - name = *(fMsrHandler->GetMsrRunList()->at(runNo).GetRunName()) + "_DataRunNo"; + name = *fMsrHandler->GetMsrRunList()->at(runNo).GetRunName() + "_DataRunNo"; name += (Int_t)runNo; name += "_"; name += fPlotNumber; @@ -1472,7 +1472,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) // theoHisto ------------------------------------------------------------- // create histo specific infos - name = *(fMsrHandler->GetMsrRunList()->at(runNo).GetRunName()) + "_TheoRunNo"; + name = *fMsrHandler->GetMsrRunList()->at(runNo).GetRunName() + "_TheoRunNo"; name += (Int_t)runNo; name += "_"; name += fPlotNumber; @@ -2378,7 +2378,7 @@ void PMusrCanvas::PlotData() PMsrRunList *runList = fMsrHandler->GetMsrRunList(); switch (fPlotType) { case MSR_PLOT_SINGLE_HISTO: - if (runList->at(0).fLifetimeCorrection) { // lifetime correction + if (runList->at(0).IsLifetimeCorrected()) { // lifetime correction yAxisTitle = "asymmetry"; } else { // no liftime correction yAxisTitle = "N(t) per nsec"; @@ -2413,8 +2413,8 @@ void PMusrCanvas::PlotData() PMsrRunList runs = *fMsrHandler->GetMsrRunList(); PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber); UInt_t runNo = (UInt_t)plotInfo.fRuns[0].Re()-1; - TString xAxisTitle = fRunList->GetXAxisTitle(*(runs[runNo].GetRunName()), runNo); - TString yAxisTitle = fRunList->GetYAxisTitle(*(runs[runNo].GetRunName()), runNo); + TString xAxisTitle = fRunList->GetXAxisTitle(*runs[runNo].GetRunName(), runNo); + TString yAxisTitle = fRunList->GetYAxisTitle(*runs[runNo].GetRunName(), runNo); if (fNonMusrData.size() > 0) { // check if fMultiGraphData needs to be created, and if yes add all data and theory @@ -2472,8 +2472,8 @@ void PMusrCanvas::PlotData() PStringVector legendLabel; for (UInt_t i=0; iGetXAxisTitle(*(runs[runNo].GetRunName()), runNo); - yAxisTitle = fRunList->GetYAxisTitle(*(runs[runNo].GetRunName()), runNo); + xAxisTitle = fRunList->GetXAxisTitle(*runs[runNo].GetRunName(), runNo); + yAxisTitle = fRunList->GetYAxisTitle(*runs[runNo].GetRunName(), runNo); legendLabel.push_back(xAxisTitle + " vs. " + yAxisTitle); } for (UInt_t i=0; iGetMsrRunList(); PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber); UInt_t runNo = (UInt_t)plotInfo.fRuns[0].Re()-1; - TString xAxisTitle = fRunList->GetXAxisTitle(*(runs[runNo].GetRunName()), runNo); + TString xAxisTitle = fRunList->GetXAxisTitle(*runs[runNo].GetRunName(), runNo); // if fMultiGraphDiff is not present create it and add the diff data if (!fMultiGraphDiff) { diff --git a/src/classes/PMusrT0.cpp b/src/classes/PMusrT0.cpp index 70a64d4f..eeeb7d62 100644 --- a/src/classes/PMusrT0.cpp +++ b/src/classes/PMusrT0.cpp @@ -243,7 +243,7 @@ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler) void PMusrT0::InitDataAndBkg() { // get addRun offset which depends on the fit type - Int_t fitType = fMsrHandler->GetMsrRunList()->at(fRunNo).fFitType; + Int_t fitType = fMsrHandler->GetMsrRunList()->at(fRunNo).GetFitType(); if (fitType == MSR_FITTYPE_SINGLE_HISTO) { fAddRunOffset = 2; } else if (fitType == MSR_FITTYPE_ASYM) { diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 9f851844..fb34d022 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -66,15 +66,15 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn PMsrParamList *param = msrInfo->GetMsrParamList(); // check if alpha is given - if (fRunInfo->fAlphaParamNo == -1) { // no alpha given + if (fRunInfo->GetAlphaParamNo() == -1) { // no alpha given cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!"; cerr << endl; fValid = false; return; } // check if alpha parameter is within proper bounds - if ((fRunInfo->fAlphaParamNo < 0) || (fRunInfo->fAlphaParamNo > (Int_t)param->size())) { - cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->fAlphaParamNo; + if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > (Int_t)param->size())) { + cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo(); cerr << endl << " This is out of bound, since there are only " << param->size() << " parameters."; cerr << endl; fValid = false; @@ -82,24 +82,24 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn } // check if alpha is fixed Bool_t alphaFixedToOne = false; -//cout << endl << ">> alpha = " << (*param)[fRunInfo->fAlphaParamNo-1].fValue << ", " << (*param)[fRunInfo->fAlphaParamNo-1].fStep; - if (((*param)[fRunInfo->fAlphaParamNo-1].fStep == 0.0) && - ((*param)[fRunInfo->fAlphaParamNo-1].fValue == 1.0)) +//cout << endl << ">> alpha = " << (*param)[fRunInfo->GetAlphaParamNo()-1].fValue << ", " << (*param)[fRunInfo->GetAlphaParamNo()-1].fStep; + if (((*param)[fRunInfo->GetAlphaParamNo()-1].fStep == 0.0) && + ((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0)) alphaFixedToOne = true; // check if beta is given Bool_t betaFixedToOne = false; - if (fRunInfo->fBetaParamNo == -1) { // no beta given hence assuming beta == 1 + if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1 betaFixedToOne = true; - } else if ((fRunInfo->fBetaParamNo < 0) || (fRunInfo->fBetaParamNo > (Int_t)param->size())) { // check if beta parameter is within proper bounds - cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->fBetaParamNo; + } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > (Int_t)param->size())) { // check if beta parameter is within proper bounds + cerr << endl << "PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); cerr << endl << " This is out of bound, since there are only " << param->size() << " parameters."; cerr << endl; fValid = false; return; } else { // check if beta is fixed - if (((*param)[fRunInfo->fBetaParamNo-1].fStep == 0.0) && - ((*param)[fRunInfo->fBetaParamNo-1].fValue == 1.0)) + if (((*param)[fRunInfo->GetBetaParamNo()-1].fStep == 0.0) && + ((*param)[fRunInfo->GetBetaParamNo()-1].fValue == 1.0)) betaFixedToOne = true; } @@ -152,7 +152,7 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector& par) // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // calculate chisq @@ -165,18 +165,18 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector& par) asymFcnValue = fTheory->Func(time, par, fFuncValues); break; case 2: // alpha != 1, beta == 1 - a = par[fRunInfo->fAlphaParamNo-1]; + a = par[fRunInfo->GetAlphaParamNo()-1]; f = fTheory->Func(time, par, fFuncValues); asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0)); break; case 3: // alpha == 1, beta != 1 - b = par[fRunInfo->fBetaParamNo-1]; + b = par[fRunInfo->GetBetaParamNo()-1]; f = fTheory->Func(time, par, fFuncValues); asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0)); break; case 4: // alpha != 1, beta != 1 - a = par[fRunInfo->fAlphaParamNo-1]; - b = par[fRunInfo->fBetaParamNo-1]; + a = par[fRunInfo->GetAlphaParamNo()-1]; + b = par[fRunInfo->GetBetaParamNo()-1]; f = fTheory->Func(time, par, fFuncValues); asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0)); break; @@ -226,7 +226,7 @@ void PRunAsymmetry::CalcTheory() // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // calculate asymmetry @@ -240,18 +240,18 @@ void PRunAsymmetry::CalcTheory() asymFcnValue = fTheory->Func(time, par, fFuncValues); break; case 2: // alpha != 1, beta == 1 - a = par[fRunInfo->fAlphaParamNo-1]; + a = par[fRunInfo->GetAlphaParamNo()-1]; f = fTheory->Func(time, par, fFuncValues); asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0)); break; case 3: // alpha == 1, beta != 1 - b = par[fRunInfo->fBetaParamNo-1]; + b = par[fRunInfo->GetBetaParamNo()-1]; f = fTheory->Func(time, par, fFuncValues); asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0)); break; case 4: // alpha != 1, beta != 1 - a = par[fRunInfo->fAlphaParamNo-1]; - b = par[fRunInfo->fBetaParamNo-1]; + a = par[fRunInfo->GetAlphaParamNo()-1]; + b = par[fRunInfo->GetBetaParamNo()-1]; f = fTheory->Func(time, par, fFuncValues); asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0)); break; @@ -520,11 +520,11 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg() Double_t beamPeriod = 0.0; // check if data are from PSI, RAL, or TRIUMF - if (fRunInfo->fInstitute[0].Contains("psi")) + if (fRunInfo->GetInstitute()->Contains("psi")) beamPeriod = ACCEL_PERIOD_PSI; - else if (fRunInfo->fInstitute[0].Contains("ral")) + else if (fRunInfo->GetInstitute()->Contains("ral")) beamPeriod = ACCEL_PERIOD_RAL; - else if (fRunInfo->fInstitute[0].Contains("triumf")) + else if (fRunInfo->GetInstitute()->Contains("triumf")) beamPeriod = ACCEL_PERIOD_TRIUMF; else beamPeriod = 0.0; @@ -902,16 +902,16 @@ cout << endl << "--------------------------------" << endl; beta = 1.0; break; case 2: // alpha != 1, beta == 1 - alpha = par[fRunInfo->fAlphaParamNo-1]; + alpha = par[fRunInfo->GetAlphaParamNo()-1]; beta = 1.0; break; case 3: // alpha == 1, beta != 1 alpha = 1.0; - beta = par[fRunInfo->fBetaParamNo-1]; + beta = par[fRunInfo->GetBetaParamNo()-1]; break; case 4: // alpha != 1, beta != 1 - alpha = par[fRunInfo->fAlphaParamNo-1]; - beta = par[fRunInfo->fBetaParamNo-1]; + alpha = par[fRunInfo->GetAlphaParamNo()-1]; + beta = par[fRunInfo->GetBetaParamNo()-1]; break; default: break; @@ -956,7 +956,7 @@ cout << endl << "--------------------------------" << endl; // fill theory vector for kView // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // calculate theory diff --git a/src/classes/PRunBase.cpp b/src/classes/PRunBase.cpp index 67b5f2b1..89a7ed21 100644 --- a/src/classes/PRunBase.cpp +++ b/src/classes/PRunBase.cpp @@ -90,7 +90,7 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, fRunInfo = &(*msrInfo->GetMsrRunList())[runNo]; // check the parameter and map range of the functions - if (!fMsrInfo->CheckMapAndParamRange(fRunInfo->fMap.size(), fMsrInfo->GetNoOfParams())) { + if (!fMsrInfo->CheckMapAndParamRange(fRunInfo->GetMap()->size(), fMsrInfo->GetNoOfParams())) { cerr << endl << "**SEVERE ERROR** PRunBase::PRunBase: map and/or parameter out of range in FUNCTIONS." << endl; exit(0); } diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index ebab60f0..f4084b79 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -153,23 +153,23 @@ Bool_t PRunDataHandler::ReadFile() if (!FileExistsCheck(runList->at(i), j)) return false; // everything looks fine, hence try to read the data file - if (!runList->at(i).fFileFormat[j].CompareTo("root-npp")) // not post pile up corrected histos + if (!runList->at(i).GetFileFormat(j)->CompareTo("root-npp")) // not post pile up corrected histos success = ReadRootFile(true); - else if (!runList->at(i).fFileFormat[j].CompareTo("root-ppc")) // post pile up corrected histos + else if (!runList->at(i).GetFileFormat(j)->CompareTo("root-ppc")) // post pile up corrected histos success = ReadRootFile(false); - else if (!runList->at(i).fFileFormat[j].CompareTo("nexus")) + else if (!runList->at(i).GetFileFormat(j)->CompareTo("nexus")) success = ReadNexusFile(); - else if (!runList->at(i).fFileFormat[j].CompareTo("psi-bin")) + else if (!runList->at(i).GetFileFormat(j)->CompareTo("psi-bin")) success = ReadPsiBinFile(); - else if (!runList->at(i).fFileFormat[j].CompareTo("mud")) + else if (!runList->at(i).GetFileFormat(j)->CompareTo("mud")) success = ReadMudFile(); - else if (!runList->at(i).fFileFormat[j].CompareTo("wkm")) + else if (!runList->at(i).GetFileFormat(j)->CompareTo("wkm")) success = ReadWkmFile(); - else if (!runList->at(i).fFileFormat[j].CompareTo("mdu-ascii")) + else if (!runList->at(i).GetFileFormat(j)->CompareTo("mdu-ascii")) success = ReadMduAsciiFile(); - else if (!runList->at(i).fFileFormat[j].CompareTo("ascii")) + else if (!runList->at(i).GetFileFormat(j)->CompareTo("ascii")) success = ReadAsciiFile(); - else if (!runList->at(i).fFileFormat[j].CompareTo("db")) + else if (!runList->at(i).GetFileFormat(j)->CompareTo("db")) success = ReadDBFile(); else success = false; @@ -217,44 +217,66 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) // local init TROOT root("PRunBase", "PRunBase", 0); TString pathName = "???"; - TString str; + TString str, *pstr; TString ext; - runInfo.fBeamline[idx].ToLower(); - runInfo.fInstitute[idx].ToLower(); - runInfo.fFileFormat[idx].ToLower(); + pstr = runInfo.GetBeamline(idx); + if (pstr == 0) { + cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain beamline data." << endl; + assert(0); + } + pstr->ToLower(); + runInfo.SetBeamline(*pstr, idx); + pstr = runInfo.GetInstitute(idx); + if (pstr == 0) { + cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain institute data." << endl; + assert(0); + } + pstr->ToLower(); + runInfo.SetInstitute(*pstr, idx); + pstr = runInfo.GetFileFormat(idx); + if (pstr == 0) { + cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain file format data." << endl; + assert(0); + } + pstr->ToLower(); + runInfo.SetFileFormat(*pstr, idx); // file extensions for the various formats - if (!runInfo.fFileFormat[idx].CompareTo("root-npp")) // not post pile up corrected histos + if (!runInfo.GetFileFormat(idx)->CompareTo("root-npp")) // not post pile up corrected histos ext = TString("root"); - else if (!runInfo.fFileFormat[idx].CompareTo("root-ppc")) // post pile up corrected histos + else if (!runInfo.GetFileFormat(idx)->CompareTo("root-ppc")) // post pile up corrected histos ext = TString("root"); - else if (!runInfo.fFileFormat[idx].CompareTo("nexus")) + else if (!runInfo.GetFileFormat(idx)->CompareTo("nexus")) ext = TString("nexus"); - else if (!runInfo.fFileFormat[idx].CompareTo("psi-bin")) + else if (!runInfo.GetFileFormat(idx)->CompareTo("psi-bin")) ext = TString("bin"); - else if (!runInfo.fFileFormat[idx].CompareTo("mud")) + else if (!runInfo.GetFileFormat(idx)->CompareTo("mud")) ext = TString("msr"); - else if (!runInfo.fFileFormat[idx].CompareTo("wkm")) { - if (!runInfo.fBeamline[idx].CompareTo("mue4")) + else if (!runInfo.GetFileFormat(idx)->CompareTo("wkm")) { + if (!runInfo.GetBeamline(idx)->CompareTo("mue4")) ext = TString("nemu"); else - ext = runInfo.fBeamline[idx]; + ext = *runInfo.GetBeamline(idx); } - else if (!runInfo.fFileFormat[idx].CompareTo("mdu-ascii")) + else if (!runInfo.GetFileFormat(idx)->CompareTo("mdu-ascii")) ext = TString("mdua"); - else if (!runInfo.fFileFormat[idx].CompareTo("ascii")) + else if (!runInfo.GetFileFormat(idx)->CompareTo("ascii")) ext = TString("dat"); - else if (!runInfo.fFileFormat[idx].CompareTo("db")) + else if (!runInfo.GetFileFormat(idx)->CompareTo("db")) ext = TString("db"); else success = false; // unkown file format found if (!success) { - str = runInfo.fFileFormat[idx]; - str.ToUpper(); - cerr << endl << "**ERROR** File Format '" << str.Data() << "' unsupported."; + pstr = runInfo.GetFileFormat(idx); + if (pstr == 0) { + cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain file format data." << endl; + assert(0); + } + pstr->ToUpper(); + cerr << endl << "**ERROR** File Format '" << pstr->Data() << "' unsupported."; cerr << endl << " support file formats are:"; cerr << endl << " ROOT-NPP -> root not post pileup corrected for lem"; cerr << endl << " ROOT-PPC -> root post pileup corrected for lem"; @@ -270,7 +292,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) } // check if the file is in the local directory - str = *(runInfo.GetRunName(idx)) + TString(".") + ext; + str = *runInfo.GetRunName(idx) + TString(".") + ext; if (gSystem->AccessPathName(str.Data())!=true) { // found in the local dir pathName = str; } @@ -278,7 +300,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) // check if the file is found in the if (pathName.CompareTo("???") == 0) { // not found in local directory search str = *fMsrInfo->GetMsrFileDirectoryPath(); - str += *(runInfo.GetRunName(idx)) + TString(".") + ext; + str += *runInfo.GetRunName(idx) + TString(".") + ext; if (gSystem->AccessPathName(str.Data())!=true) { // found pathName = str; } @@ -287,7 +309,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) // check if the file is found in the directory given in the startup file if (pathName.CompareTo("???") == 0) { // not found in local directory search for (UInt_t i=0; iAccessPathName(str.Data())!=true) { // found pathName = str; break; @@ -304,7 +326,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) TObjString *ostr; for (Int_t i=0; iGetEntries(); i++) { ostr = dynamic_cast(tokens->At(i)); - str = ostr->GetString() + TString("/") + *(runInfo.GetRunName(idx)) + TString(".") + ext; + str = ostr->GetString() + TString("/") + *runInfo.GetRunName(idx) + TString(".") + ext; if (gSystem->AccessPathName(str.Data())!=true) { // found pathName = str; break; @@ -318,18 +340,30 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) // WKMFULLDATAPATH has the structure: path_1:path_2:...:path_n TObjArray *tokens = str.Tokenize(":"); TObjString *ostr; - runInfo.fInstitute[idx].ToUpper(); - runInfo.fBeamline[idx].ToUpper(); + pstr = runInfo.GetInstitute(idx); + if (pstr == 0) { + cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain institute data." << endl; + assert(0); + } + pstr->ToUpper(); + runInfo.SetInstitute(*pstr, idx); + pstr = runInfo.GetBeamline(idx); + if (pstr == 0) { + cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain beamline data." << endl; + assert(0); + } + pstr->ToUpper(); + runInfo.SetBeamline(*pstr, idx); TDatime datetime; TString dt; dt += datetime.GetYear(); for (Int_t i=0; iGetEntries(); i++) { ostr = dynamic_cast(tokens->At(i)); str = ostr->GetString() + TString("/DATA/") + - runInfo.fInstitute[idx] + TString("/") + - runInfo.fBeamline[idx] + TString("/") + + *runInfo.GetInstitute(idx) + TString("/") + + *runInfo.GetBeamline(idx) + TString("/") + dt + TString("/") + - *(runInfo.GetRunName(idx)) + TString(".") + ext; + *runInfo.GetRunName(idx) + TString(".") + ext; if (gSystem->AccessPathName(str.Data())!=true) { // found pathName = str; break; diff --git a/src/classes/PRunListCollection.cpp b/src/classes/PRunListCollection.cpp index fef7745d..6add629f 100644 --- a/src/classes/PRunListCollection.cpp +++ b/src/classes/PRunListCollection.cpp @@ -105,7 +105,7 @@ Bool_t PRunListCollection::Add(Int_t runNo, EPMusrHandleTag tag) // cout << ", name = " << runList->fRunName.Data(); // cout << ", type = " << runList->fFitType; - Int_t fitType = (*fMsrInfo->GetMsrRunList())[runNo].fFitType; + Int_t fitType = (*fMsrInfo->GetMsrRunList())[runNo].GetFitType(); switch (fitType) { case PRUN_SINGLE_HISTO: diff --git a/src/classes/PRunNonMusr.cpp b/src/classes/PRunNonMusr.cpp index ad872907..575137e6 100644 --- a/src/classes/PRunNonMusr.cpp +++ b/src/classes/PRunNonMusr.cpp @@ -101,7 +101,7 @@ Double_t PRunNonMusr::CalcChiSquare(const std::vector& par) // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // calculate chi square @@ -288,7 +288,7 @@ Bool_t PRunNonMusr::PrepareViewData() par.push_back((*paramList)[i].fValue); // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // cout << endl << ">> after parameter fill" << endl; diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index 0e1896b2..175de068 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -101,39 +101,39 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector& par) Double_t N0; // check if norm is a parameter or a function - if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter - N0 = par[fRunInfo->fNormParamNo-1]; + if (fRunInfo->GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // norm is a parameter + N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET; + UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function - N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par); + N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } // get tau Double_t tau; - if (fRunInfo->fLifetimeParamNo != -1) - tau = par[fRunInfo->fLifetimeParamNo-1]; + if (fRunInfo->GetLifetimeParamNo() != -1) + tau = par[fRunInfo->GetLifetimeParamNo()-1]; else tau = PMUON_LIFETIME; // get background Double_t bkg; - if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted + if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval) bkg = fBackground; } else { // fixed bkg given bkg = fRunInfo->fBkgFix[0]; } } else { // bkg fitted - bkg = par[fRunInfo->fBkgFitParamNo-1]; + bkg = par[fRunInfo->GetBkgFitParamNo()-1]; } // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { Int_t funcNo = fMsrInfo->GetFuncNo(i); //cout << ">> i = " << i << ", funcNo = " << funcNo << endl; - fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par); } // calculate chi square @@ -165,38 +165,38 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector& par) Double_t N0; // check if norm is a parameter or a function - if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter - N0 = par[fRunInfo->fNormParamNo-1]; + if (fRunInfo->GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // norm is a parameter + N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET; + UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function - N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par); + N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } // get tau Double_t tau; - if (fRunInfo->fLifetimeParamNo != -1) - tau = par[fRunInfo->fLifetimeParamNo-1]; + if (fRunInfo->GetLifetimeParamNo() != -1) + tau = par[fRunInfo->GetLifetimeParamNo()-1]; else tau = PMUON_LIFETIME; // get background Double_t bkg; - if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted + if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval) bkg = fBackground; } else { // fixed bkg given bkg = fRunInfo->fBkgFix[0]; } } else { // bkg fitted - bkg = par[fRunInfo->fBkgFitParamNo-1]; + bkg = par[fRunInfo->GetBkgFitParamNo()-1]; } // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { Int_t funcNo = fMsrInfo->GetFuncNo(i); - fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par); } // calculate maximum log likelihood @@ -239,37 +239,37 @@ void PRunSingleHisto::CalcTheory() // calculate asymmetry Double_t N0; // check if norm is a parameter or a function - if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter - N0 = par[fRunInfo->fNormParamNo-1]; + if (fRunInfo->GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // norm is a parameter + N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET; + UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function - N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par); + N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } // get tau Double_t tau; - if (fRunInfo->fLifetimeParamNo != -1) - tau = par[fRunInfo->fLifetimeParamNo-1]; + if (fRunInfo->GetLifetimeParamNo() != -1) + tau = par[fRunInfo->GetLifetimeParamNo()-1]; else tau = PMUON_LIFETIME; // get background Double_t bkg; - if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted + if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval) bkg = fBackground; } else { // fixed bkg given bkg = fRunInfo->fBkgFix[0]; } } else { // bkg fitted - bkg = par[fRunInfo->fBkgFitParamNo-1]; + bkg = par[fRunInfo->GetBkgFitParamNo()-1]; } // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // calculate theory @@ -299,7 +299,7 @@ Bool_t PRunSingleHisto::PrepareData() Bool_t success = true; // get the proper run - PRawRunData* runData = fRawData->GetRunData(*(fRunInfo->GetRunName())); + PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName()); if (!runData) { // couldn't get run cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; cerr << endl; @@ -360,7 +360,7 @@ Bool_t PRunSingleHisto::PrepareData() for (UInt_t i=1; iGetRunNames().size(); i++) { // get run to be added to the main one - addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i))); + addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i)); if (addRunData == 0) { // couldn't get run cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; cerr << endl; @@ -423,9 +423,9 @@ Bool_t PRunSingleHisto::PrepareData() if (fHandleTag == kFit) success = PrepareFitData(runData, histoNo); - else if ((fHandleTag == kView) && !fRunInfo->fLifetimeCorrection) + else if ((fHandleTag == kView) && !fRunInfo->IsLifetimeCorrected()) success = PrepareRawViewData(runData, histoNo); - else if ((fHandleTag == kView) && fRunInfo->fLifetimeCorrection) + else if ((fHandleTag == kView) && fRunInfo->IsLifetimeCorrected()) success = PrepareViewData(runData, histoNo); else success = false; @@ -476,7 +476,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN } // check how the background shall be handled - if (fRunInfo->fBkgFitParamNo == -1) { // bkg shall **NOT** be fitted + if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg shall **NOT** be fitted // subtract background from histogramms ------------------------------------------ if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given if (fRunInfo->fBkgRange.size() != 0) { @@ -632,25 +632,25 @@ cout << endl << ">> data start time = " << fData.GetDataTimeStart(); // calculate asymmetry Double_t N0; // check if norm is a parameter or a function - if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter - N0 = par[fRunInfo->fNormParamNo-1]; + if (fRunInfo->GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // norm is a parameter + N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET; + UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function - N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par); + N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } // get tau Double_t tau; - if (fRunInfo->fLifetimeParamNo != -1) - tau = par[fRunInfo->fLifetimeParamNo-1]; + if (fRunInfo->GetLifetimeParamNo() != -1) + tau = par[fRunInfo->GetLifetimeParamNo()-1]; else tau = PMUON_LIFETIME; // get background Double_t bkg; - if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted + if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval) if (!EstimateBkg(histoNo)) return false; @@ -659,12 +659,12 @@ cout << endl << ">> data start time = " << fData.GetDataTimeStart(); bkg = fRunInfo->fBkgFix[0]; } } else { // bkg fitted - bkg = par[fRunInfo->fBkgFitParamNo-1]; + bkg = par[fRunInfo->GetBkgFitParamNo()-1]; } // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // calculate theory @@ -756,26 +756,26 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo // calculate asymmetry Double_t N0; // check if norm is a parameter or a function - if (fRunInfo->fNormParamNo < MSR_PARAM_FUN_OFFSET) { // norm is a parameter - N0 = par[fRunInfo->fNormParamNo-1]; + if (fRunInfo->GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // norm is a parameter + N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->fNormParamNo-MSR_PARAM_FUN_OFFSET; + UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function - N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par); + N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } // get tau Double_t tau; - if (fRunInfo->fLifetimeParamNo != -1) - tau = par[fRunInfo->fLifetimeParamNo-1]; + if (fRunInfo->GetLifetimeParamNo() != -1) + tau = par[fRunInfo->GetLifetimeParamNo()-1]; else tau = PMUON_LIFETIME; //cout << endl << ">> tau = " << tau; // get background Double_t bkg; - if (fRunInfo->fBkgFitParamNo == -1) { // bkg not fitted + if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted if (fRunInfo->fBkgFix.size() == 0) { // no fixed background given (background interval) if (!EstimateBkg(histoNo)) return false; @@ -784,7 +784,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo bkg = fRunInfo->fBkgFix[0]; } } else { // bkg fitted - bkg = par[fRunInfo->fBkgFitParamNo-1]; + bkg = par[fRunInfo->GetBkgFitParamNo()-1]; } Double_t value = 0.0; @@ -829,7 +829,7 @@ cout << endl << "--------------------------------" << endl; // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), *fRunInfo->GetMap(), par); } // calculate theory @@ -870,11 +870,11 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo) Double_t beamPeriod = 0.0; // check if data are from PSI, RAL, or TRIUMF - if (fRunInfo->fInstitute[0].Contains("psi")) + if (fRunInfo->GetInstitute()->Contains("psi")) beamPeriod = ACCEL_PERIOD_PSI; - else if (fRunInfo->fInstitute[0].Contains("ral")) + else if (fRunInfo->GetInstitute()->Contains("ral")) beamPeriod = ACCEL_PERIOD_RAL; - else if (fRunInfo->fInstitute[0].Contains("triumf")) + else if (fRunInfo->GetInstitute()->Contains("triumf")) beamPeriod = ACCEL_PERIOD_TRIUMF; else beamPeriod = 0.0; @@ -900,7 +900,7 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo) } // get the proper run - PRawRunData* runData = fRawData->GetRunData(*(fRunInfo->GetRunName())); + PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName()); // check if start is within histogram bounds if ((start < 0) || (start >= runData->GetDataBin(histoNo)->size())) { diff --git a/src/classes/PTheory.cpp b/src/classes/PTheory.cpp index 7715eeb5..9a6f0f23 100644 --- a/src/classes/PTheory.cpp +++ b/src/classes/PTheory.cpp @@ -190,7 +190,7 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) if (status == 1) { // everthing ok ok = true; // get parameter from map - PIntVector maps = (*msrInfo->GetMsrRunList())[runNo].fMap; + PIntVector maps = *(*msrInfo->GetMsrRunList())[runNo].GetMap(); if ((value <= maps.size()) && (value > 0)) { // everything fine fParamNo.push_back(maps[value-1]-1); } else { // map index out of range diff --git a/src/include/PMusr.h b/src/include/PMusr.h index e7e52bff..45c2b390 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -364,23 +364,43 @@ class PMsrRunBlock { virtual void CleanUp(); virtual PStringVector GetRunNames() { return fRunName; } - virtual TString* GetRunName(UInt_t i=0); + virtual TString *GetRunName(UInt_t i=0); + virtual PStringVector GetBeamlines() { return fBeamline; } + virtual TString *GetBeamline(UInt_t i=0); + virtual PStringVector GetInstitutes() { return fInstitute; } + virtual TString *GetInstitute(UInt_t i=0); + virtual PStringVector GetFileFormats() { return fFileFormat; } + virtual TString *GetFileFormat(UInt_t i=0); + virtual Int_t GetFitType() { return fFitType; } + virtual Int_t GetAlphaParamNo() { return fAlphaParamNo; } + virtual Int_t GetBetaParamNo() { return fBetaParamNo; } + virtual Int_t GetNormParamNo() { return fNormParamNo; } + virtual Int_t GetBkgFitParamNo() { return fBkgFitParamNo; } + virtual Int_t GetPhaseParamNo() { return fPhaseParamNo; } + virtual Int_t GetLifetimeParamNo() { return fLifetimeParamNo; } + virtual Bool_t IsLifetimeCorrected() { return fLifetimeCorrection; } + virtual PIntVector* GetMap() { return &fMap; } + virtual Int_t GetMap(UInt_t idx); virtual void AppendRunName(TString str) { fRunName.push_back(str); } virtual void SetRunName(TString &str, UInt_t i); + virtual void AppendBeamline(TString str) { fBeamline.push_back(str); } + virtual void SetBeamline(TString &str, UInt_t i); + virtual void AppendInstitute(TString str) { fInstitute.push_back(str); } + virtual void SetInstitute(TString &str, UInt_t i); + virtual void AppendFileFormat(TString str) { fFileFormat.push_back(str); } + virtual void SetFileFormat(TString &str, UInt_t i); + virtual void SetFitType(Int_t ival) { fFitType = ival; } + virtual void SetAlphaParamNo(Int_t ival) { fAlphaParamNo = ival; } + virtual void SetBetaParamNo(Int_t ival) { fBetaParamNo = ival; } + virtual void SetNormParamNo(Int_t ival) { fNormParamNo = ival; } + virtual void SetBkgFitParamNo(Int_t ival) { fBkgFitParamNo = ival; } + virtual void SetPhaseParamNo(Int_t ival) { fPhaseParamNo = ival; } + virtual void SetLifetimeParamNo(Int_t ival) { fLifetimeParamNo = ival; } + virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; } + virtual void AppendMap(Int_t ival) { fMap.push_back(ival); } + virtual void SetMap(Int_t mapVal, UInt_t idx); - PStringVector fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type) - PStringVector fInstitute; ///< e.g. psi, ral, triumf (former: run format) - PStringVector fFileFormat; ///< e.g. root, nexus, psi-bin, mud, ascii, db - Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR - Int_t fAlphaParamNo; ///< alpha 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 fBkgFitParamNo; ///< background fit parameter number (fit type 0) - Int_t fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!! - Int_t fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0) - Bool_t fLifetimeCorrection; ///< lifetime correction flag for viewing (fit type 0) - PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory Int_t fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4) Int_t fBackwardHistoNo; ///< backward histogram number (fit type 2, 4) PDoubleVector fBkgFix; ///< fixed background in (1/ns) (fit type 0, 2, 4) @@ -400,6 +420,18 @@ class PMsrRunBlock { private: PStringVector fRunName; ///< name of the run file + PStringVector fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type) + PStringVector fInstitute; ///< e.g. psi, ral, triumf (former: run format) + PStringVector fFileFormat; ///< e.g. root, nexus, psi-bin, mud, ascii, db + Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR + Int_t fAlphaParamNo; ///< alpha 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 fBkgFitParamNo; ///< background fit parameter number (fit type 0) + Int_t fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!! + Int_t fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0) + Bool_t fLifetimeCorrection; ///< lifetime correction flag for viewing (fit type 0) + PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory }; //------------------------------------------------------------- diff --git a/src/musrt0.cpp b/src/musrt0.cpp index a76b0b3b..ce32f47f 100644 --- a/src/musrt0.cpp +++ b/src/musrt0.cpp @@ -215,7 +215,7 @@ int main(int argc, char *argv[]) // check if the fittype is not NonMusr PMsrRunList *runList = msrHandler->GetMsrRunList(); for (unsigned int i=0; isize(); i++) { - if (runList->at(i).fFitType == MSR_FITTYPE_NON_MUSR) { + if (runList->at(i).GetFitType() == MSR_FITTYPE_NON_MUSR) { cout << endl << "**ERROR** t0 setting for NonMusr fittype doesn't make any sense, will quit ..." << endl; success = false; break; @@ -243,7 +243,7 @@ int main(int argc, char *argv[]) // generate vector of all necessary PMusrT0 objects for (unsigned int i=0; isize(); i++) { - switch (runList->at(i).fFitType) { + switch (runList->at(i).GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: for (unsigned int j=0; jat(i).GetRunNames().size(); j++) { // necessary in case of ADDRUN if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).fForwardHistoNo, 0, j)) {