diff --git a/src/ToDo.txt b/src/ToDo.txt index 018d7682..2d666ca1 100644 --- a/src/ToDo.txt +++ b/src/ToDo.txt @@ -73,6 +73,23 @@ short term: * nonMusr: check why in nonMusr view there is NO legend?? +* PRawRunData needs to be changed for nonMusr: ascii and db handling should be on the + same footing. Since db handles vectors of data, PRawRunData should handle it as the + db-format and ascii should follow that philosophy even though ascii will only contain + one x- and one y-vector. + fXAxisTitle and fYAxisTitle should be removed and being replaced by a fDataLabel vector. + fXData, fYData, and fErrYData should be removed and being fDataBin and fErrDataBin vectors. + +* nonMusr: db-file format should be added. That this is going to work, in the + RUN block part, a new entry is needed, namely + xy-data. Indices or label are used to pick to proper data + from the db-file. + xy-data T asym <- labels + or + xy-data 3 6 <- indices + +* musrparam should be extended that is also can produce a db-file output. + * implement FFT with msr-interface --------------------- diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index ed1646ec..24697fc6 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -1043,6 +1043,12 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines) TObjString *ostr; TObjArray *tokens; + // init some stuff + param.fXYDataIndex[0] = -1; + param.fXYDataIndex[1] = -1; + param.fXYDataLabel[0] = TString(""); + param.fXYDataLabel[1] = TString(""); + iter = lines.begin(); while ((iter != lines.end()) && !error) { // tokenize line @@ -1428,6 +1434,30 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines) } } + // xy-data ----------------------------------------------- + if (iter->fLine.BeginsWith("xy-data", TString::kIgnoreCase)) { + if (tokens->GetEntries() != 3) { // xy-data x-label y-label + error = true; + } else { + ostr = dynamic_cast(tokens->At(1)); + str = ostr->GetString(); + if (str.IsDigit()) { // xy-data indices given + param.fXYDataIndex[0] = str.Atoi(); // x-index + ostr = dynamic_cast(tokens->At(2)); + str = ostr->GetString(); + if (str.IsDigit()) + param.fXYDataIndex[1] = str.Atoi(); // y-index + else + error = true; + } else { // xy-data labels given + param.fXYDataLabel[0] = str; // x-label + ostr = dynamic_cast(tokens->At(2)); + str = ostr->GetString(); + param.fXYDataLabel[1] = str; // y-label + } + } + } + // clean up if (tokens) { delete tokens; diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index af235dc7..06dc2a1b 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -174,6 +174,8 @@ bool PRunDataHandler::ReadFile() success = ReadNemuFile(); else if (!run_it->fFileFormat.CompareTo("ascii")) success = ReadAsciiFile(); + else if (!run_it->fFileFormat.CompareTo("db")) + success = ReadDBFile(); else success = false; } @@ -235,6 +237,8 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo) ext = TString("nemu"); else if (!runInfo.fFileFormat.CompareTo("ascii")) ext = TString("dat"); + else if (!runInfo.fFileFormat.CompareTo("db")) + ext = TString("db"); else success = false; @@ -251,6 +255,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo) cout << endl << " MUD -> triumf mud file format"; cout << endl << " NEMU -> lem ascii file format"; cout << endl << " ASCII -> column like file format"; + cout << endl << " DB -> triumf db file \"format\""; cout << endl; return success; } @@ -853,8 +858,10 @@ bool PRunDataHandler::ReadAsciiFile() PRawRunData runData; // init some stuff - runData.fXAxisTitle = "??"; - runData.fYAxisTitle = "??"; + runData.fDataNonMusr.fXIndex = 0; + runData.fDataNonMusr.fYIndex = 1; + runData.fDataNonMusr.fLabels.push_back("??"); // x default label + runData.fDataNonMusr.fLabels.push_back("??"); // y default label runData.fRunName = fRunName; // keep the run name @@ -864,6 +871,7 @@ bool PRunDataHandler::ReadAsciiFile() bool headerTag = false; bool dataTag = false; double x, y, ey; + PDoubleVector xVec, exVec, yVec, eyVec; while (!f.eof()) { f.getline(instr, sizeof(instr)); @@ -876,7 +884,7 @@ bool PRunDataHandler::ReadAsciiFile() // check if header tag workStr = line; - workStr.Remove(TString::kLeading, ' '); // remove spaces from the beining + workStr.Remove(TString::kLeading, ' '); // remove spaces from the begining if (workStr.BeginsWith("header", TString::kIgnoreCase)) { headerTag = true; dataTag = false; @@ -911,9 +919,9 @@ bool PRunDataHandler::ReadAsciiFile() } runData.fField = workStr.Atof(); } else if (workStr.BeginsWith("x-axis-title:", TString::kIgnoreCase)) { - runData.fXAxisTitle = TString(workStr.Data()+workStr.First(":")+2); + runData.fDataNonMusr.fLabels[0] = TString(workStr.Data()+workStr.First(":")+2); } else if (workStr.BeginsWith("y-axis-title:", TString::kIgnoreCase)) { - runData.fYAxisTitle = TString(workStr.Data()+workStr.First(":")+2); + runData.fDataNonMusr.fLabels[1] = TString(workStr.Data()+workStr.First(":")+2); } else if (workStr.BeginsWith("temp:", TString::kIgnoreCase)) { workStr = TString(workStr.Data()+workStr.First(":")+2); if (!workStr.IsFloat()) { @@ -994,9 +1002,12 @@ bool PRunDataHandler::ReadAsciiFile() } // keep values - runData.fXData.push_back(x); - runData.fYData.push_back(y); - runData.fErrYData.push_back(ey); + xVec.push_back(x); + exVec.push_back(1.0); + yVec.push_back(y); + eyVec.push_back(ey); +cout << endl << ">> (x/y/ey) = (" << x << "/" << y << "/" << ey << ")"; + } else { cout << endl << "PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << " neither header nor data line. No idea how to handle it!"; cout << endl; @@ -1007,6 +1018,232 @@ bool PRunDataHandler::ReadAsciiFile() f.close(); + // keep values + runData.fDataNonMusr.fData.push_back(xVec); + runData.fDataNonMusr.fErrData.push_back(exVec); + runData.fDataNonMusr.fData.push_back(yVec); + runData.fDataNonMusr.fErrData.push_back(eyVec); + + fData.push_back(runData); + + // clean up + xVec.clear(); + exVec.clear(); + yVec.clear(); + eyVec.clear(); + runData.fDataNonMusr.fData.clear(); + runData.fDataNonMusr.fErrData.clear(); + +cout << endl << ">> end of ReadAsciiFile()"; + + return success; +} + +//-------------------------------------------------------------------------- +// ReadDBFile +//-------------------------------------------------------------------------- +/** + *

Reads triumf db-files. Intended for the nonMuSR data. + * + *

The file format definition is: + * The following is a description of the features of the TRIUMF .db file format that are + * currently recognized by musrfit/musrview. The available commands include: title, abstract, + * comments, labels, and data. + * + * \verbatim + * TITLE + * The following line must contain the title. + * + * + * ABSTRACT + * The abstract is read in starting with the following line until an empty line is reached. + * + * COMMENTS + * The comments are read in starting with the following line until an empty line is reached. + * + * + * LABELS + * One label must occupy each subsequent line until an empty line is reached. The number + * of labels should preferably match the number of variables in the data. + * + * DATA + * On the same line as the DATA command, there must appear a comma-delimited list of variable + * names. These names should be kept short (some applications truncate to 4 characters). The + * numerical data is read in beginning with the following line until an empty line is reached. + * + * In every line, there must appear exactly 3 comma-delimited fields for each specified name. + * The first field is the value, the second is the positive error, and the third is the negative + * error. If you leave the last field blank (the comma is still required), then the positive error + * will be interpreted as a symmetric error. If you include only the value, then the errors will be + * set to zero. + * + * To reiterate, if you provide a DATA command with 2 names, e.g. "DATA 1st, 2nd", then every subsequent + * line must contain 2*3 - 1 = 5 commas. If you give 3 names, then there must be 3*3 - 1 = 8 commas. + * + * Example + * TITLE + * Most Excellent Fake Data + * + * ABSTRACT + * This data was collected over + * many minutes of light work + * that was required to make it up. + * + * COMMENTS + * This data was generated using C++. + * The file was formatted with Emacs. + * + * LABEL + * Randomized Linear + * Randomized Gaussian + * Randomized Lorentzian + * Run + * + * DATA line, gauss, lrntz, run + * -1.966, -0.168, -0.106, 0.048, 0.002, 0.005, 0.184, 0.010, 0.017, 1001,,, run 1001 title + * -1.895, -0.151, -0.128, 0.014, 0.001, 0.001, 0.259, 0.017, 0.015, 1002,,, run 1002 title + * -1.836, -0.127, -0.184, 0.013, 0.001, 0.001, 0.202, 0.017, 0.020, 1003,,, run 1003 title + * -1.739, -0.064, -0.166, 0.057, 0.003, 0.004, 0.237, 0.016, 0.018, 1004,,, run 1004 title + * -1.601, -0.062, -0.147, 0.104, 0.008, 0.006, 0.271, 0.012, 0.025, 1005,,, run 1005 title + * . . . . . . . . . + * . . . . . . . . . + * . . . . . . . . . + * Alternatively, the data often utilizes the continuation character ('\') and is labelled like so... + * DATA line, gauss, lrntz + * linear = -1.966, -0.168, -0.106, \ + * gaussn = 0.048, 0.002, 0.005, \ + * lorntz = 0.184, 0.010, 0.017, \ + * 1001,,, run 1001 title + * linear = -1.895, -0.151, -0.128, \ + * gaussn = 0.014, 0.001, 0.001, \ + * lorntz = 0.259, 0.017, 0.015, | + * 1002,,, run 1002 title + * linear = -1.836, -0.127, -0.184, \ + * gaussn = 0.013, 0.001, 0.001, \ + * lorntz = 0.202, 0.017, 0.020, | + * 1003,,, run 1003 title + * . . . . + * . . . . + * . . . . + * If there is a run line as in the above examples, it must be at the end of the data and given + * in this just slight odd manner (do not blame me, I haven't invented this format ;-) ). + * \endverbatim + * + *

Some db-files do have a '\-e' or '\e' label just between the DATA tag line and the real data. + * This tag will just be ignored. + */ +bool PRunDataHandler::ReadDBFile() +{ + bool success = true; + + cout << endl << "not implemented yet ..."; + + // open file + ifstream f; + + // open db-file + f.open(fRunPathName.Data(), ifstream::in); + if (!f.is_open()) { + cout << endl << "Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ..."; + cout << endl; + return false; + } + + PRawRunData runData; + + int lineNo = 0; + int dbTag = -1; + char instr[512]; + TString line, workStr; + double x, y, ey; + bool firstData = true; // needed as a switch to check in which format the data are given. + bool labelledFormat = true; // flag showing if the data are given in row format, or as labelled format (see description above, default is labelled format) + + while (!f.eof()) { + // get next line from file + f.getline(instr, sizeof(instr)); + line = TString(instr); + lineNo++; + + // check if comment line + if (line.BeginsWith("#") || line.BeginsWith("%")) + continue; + + // ignore empty lines + if (line.IsWhitespace()) + continue; + + // check for db specific tags + workStr = line; + workStr.Remove(TString::kLeading, ' '); // remove spaces from the begining + if (workStr.BeginsWith("title", TString::kIgnoreCase)) { +cout << endl << ">> TITLE line found ..."; + dbTag = 0; + continue; + } else if (workStr.BeginsWith("abstract", TString::kIgnoreCase)) { +cout << endl << ">> ABSTRACT line found ..."; + dbTag = 1; + continue; + } else if (workStr.BeginsWith("comments", TString::kIgnoreCase)) { +cout << endl << ">> COMMENTS line found ..."; + dbTag = 2; + continue; + } else if (workStr.BeginsWith("label", TString::kIgnoreCase)) { +cout << endl << ">> LABEL line found ..."; + dbTag = 3; + continue; + } else if (workStr.BeginsWith("data", TString::kIgnoreCase)) { +cout << endl << ">> DATA line found ..."; + dbTag = 4; + continue; + } + + switch (dbTag) { + case 0: // TITLE + runData.fRunTitle = workStr; + break; + case 1: // ABSTRACT + // nothing to be done for now + break; + case 2: // COMMENTS + // nothing to be done for now + break; + case 3: // LABEL +// cout << endl << ">> label: " << workStr.Data(); + runData.fDataNonMusr.fLabels.push_back(workStr); + break; + case 4: // DATA + // filter out potential start data tag + if (workStr.BeginsWith("\\-e", TString::kIgnoreCase) || + workStr.BeginsWith("\\e", TString::kIgnoreCase) || + workStr.BeginsWith("/-e", TString::kIgnoreCase) || + workStr.BeginsWith("/e", TString::kIgnoreCase)) { +cout << endl << ">> \\-e like tag found ..."; + continue; + } + // check if data are given just as rows are as labelled columns (see description above) + if (firstData) { + if (workStr.Contains("=")) { + labelledFormat = true; +cout << endl << ">> data give in labelled format ..."; + } else { + labelledFormat = false; +cout << endl << ">> data give in row format ..."; + } + firstData = false; + } + break; + default: + break; + } + } + + f.close(); + +cout << endl << ">> run title: '" << runData.fRunTitle.Data() << "'"; +cout << endl; +assert(0); + fData.push_back(runData); return success; diff --git a/src/classes/PRunListCollection.cpp b/src/classes/PRunListCollection.cpp index b08f08fb..ce366c4c 100644 --- a/src/classes/PRunListCollection.cpp +++ b/src/classes/PRunListCollection.cpp @@ -488,7 +488,10 @@ const char* PRunListCollection::GetSetup(TString &runName) */ const char* PRunListCollection::GetXAxisTitle(TString &runName) { - return fData->GetRunData(runName)->fXAxisTitle.Data(); + PRawRunData *runData = fData->GetRunData(runName); + int index = fData->GetRunData(runName)->fDataNonMusr.fXIndex; + + return runData->fDataNonMusr.fLabels[index].Data(); } //-------------------------------------------------------------------------- @@ -501,6 +504,9 @@ const char* PRunListCollection::GetXAxisTitle(TString &runName) */ const char* PRunListCollection::GetYAxisTitle(TString &runName) { - return fData->GetRunData(runName)->fYAxisTitle.Data(); + PRawRunData *runData = fData->GetRunData(runName); + int index = fData->GetRunData(runName)->fDataNonMusr.fYIndex; + + return runData->fDataNonMusr.fLabels[index].Data(); } diff --git a/src/classes/PRunNonMusr.cpp b/src/classes/PRunNonMusr.cpp index 0f92667b..bd1521a8 100644 --- a/src/classes/PRunNonMusr.cpp +++ b/src/classes/PRunNonMusr.cpp @@ -180,28 +180,32 @@ bool PRunNonMusr::PrepareFitData() fFitStartTime = fRunInfo->fFitRange[0]; fFitStopTime = fRunInfo->fFitRange[1]; + // get x-, y-index + unsigned int xIndex = GetXIndex(runData); + unsigned int yIndex = GetYIndex(runData); + // pack the raw data double value = 0.0; double err = 0.0; -cout << endl << ">> runData->fXData.size()=" << runData->fXData.size(); - for (unsigned int i=0; ifXData.size(); i++) { +cout << endl << ">> runData->fDataNonMusr.fData[" << xIndex << "].size()=" << runData->fDataNonMusr.fData[xIndex].size(); + for (unsigned int i=0; ifDataNonMusr.fData[xIndex].size(); i++) { cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking; if (fRunInfo->fPacking == 1) { - fData.fX.push_back(runData->fXData[i]); - fData.fValue.push_back(runData->fYData[i]); - fData.fError.push_back(runData->fErrYData[i]); + fData.fX.push_back(runData->fDataNonMusr.fData[xIndex][i]); + fData.fValue.push_back(runData->fDataNonMusr.fData[yIndex][i]); + fData.fError.push_back(runData->fDataNonMusr.fErrData[yIndex][i]); } else { // packed data, i.e. fRunInfo->fPacking > 1 if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data cout << endl << "-> i=" << i; - fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0); + fData.fX.push_back(runData->fDataNonMusr.fData[xIndex][i]-(runData->fDataNonMusr.fData[xIndex][i]-runData->fDataNonMusr.fData[xIndex][i-fRunInfo->fPacking])/2.0); fData.fValue.push_back(value); fData.fError.push_back(TMath::Sqrt(err)); value = 0.0; err = 0.0; } // sum raw data values - value += runData->fYData[i]; - err += runData->fErrYData[i]*runData->fErrYData[i]; + value += runData->fDataNonMusr.fData[yIndex][i]; + err += runData->fDataNonMusr.fErrData[yIndex][i]*runData->fDataNonMusr.fErrData[yIndex][i]; } } cout << endl << ">> fData.fValue.size()=" << fData.fValue.size(); @@ -237,29 +241,33 @@ bool PRunNonMusr::PrepareViewData() return false; } + // get x-, y-index + unsigned int xIndex = GetXIndex(runData); + unsigned int yIndex = GetYIndex(runData); + // fill data histo // pack the raw data double value = 0.0; double err = 0.0; -cout << endl << ">> runData->fXData.size()=" << runData->fXData.size(); - for (unsigned int i=0; ifXData.size(); i++) { +cout << endl << ">> runData->fDataNonMusr.fData[" << xIndex << "].size()=" << runData->fDataNonMusr.fData[xIndex].size(); + for (unsigned int i=0; ifDataNonMusr.fData[xIndex].size(); i++) { cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking; if (fRunInfo->fPacking == 1) { - fData.fX.push_back(runData->fXData[i]); - fData.fValue.push_back(runData->fYData[i]); - fData.fError.push_back(runData->fErrYData[i]); + fData.fX.push_back(runData->fDataNonMusr.fData[xIndex][i]); + fData.fValue.push_back(runData->fDataNonMusr.fData[yIndex][i]); + fData.fError.push_back(runData->fDataNonMusr.fErrData[yIndex][i]); } else { // packed data, i.e. fRunInfo->fPacking > 1 if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data cout << endl << "-> i=" << i; - fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0); + fData.fX.push_back(runData->fDataNonMusr.fData[xIndex][i]-(runData->fDataNonMusr.fData[xIndex][i]-runData->fDataNonMusr.fData[xIndex][i-fRunInfo->fPacking])/2.0); fData.fValue.push_back(value); fData.fError.push_back(TMath::Sqrt(err)); value = 0.0; err = 0.0; } // sum raw data values - value += runData->fYData[i]; - err += runData->fErrYData[i]*runData->fErrYData[i]; + value += runData->fDataNonMusr.fData[yIndex][i]; + err += runData->fDataNonMusr.fErrData[yIndex][i]*runData->fDataNonMusr.fErrData[yIndex][i]; } } cout << endl << ">> fData.fValue.size()=" << fData.fValue.size(); @@ -344,3 +352,81 @@ cout << endl << ">> after the xmin/xmax loop." << endl; return success; } + +//-------------------------------------------------------------------------- +// GetXIndex +//-------------------------------------------------------------------------- +/** + *

+ * + * \param runData + */ +unsigned int PRunNonMusr::GetXIndex(PRawRunData* runData) +{ + unsigned int index = 0; + bool found = false; + + if (runData->fDataNonMusr.fXIndex >= 0) { // ascii-file format + index = runData->fDataNonMusr.fXIndex; + found = true; + } else { // db-file format + if (fRunInfo->fXYDataIndex[0] > 0) { // xy-data already indices + index = fRunInfo->fXYDataIndex[0]-1; // since xy-data start with 1 ... + found = true; + } else { // xy-data data tags which needs to be converted to an index + for (unsigned int i=0; ifDataNonMusr.fDataTags.size(); i++) { + if (runData->fDataNonMusr.fDataTags[i].CompareTo(fRunInfo->fXYDataLabel[0]) == 0) { + found = true; + break; + } + } + } + } + + if (!found) { + cout << endl << "PRunNonMusr::GetXIndex(): **ERROR** Couldn't obtain x-data index!"; + cout << endl; + assert(0); + } + + return index; +} + +//-------------------------------------------------------------------------- +// GetYIndex +//-------------------------------------------------------------------------- +/** + *

+ * + * \param runData + */ +unsigned int PRunNonMusr::GetYIndex(PRawRunData* runData) +{ + unsigned int index = 0; + bool found = false; + + if (runData->fDataNonMusr.fYIndex >= 0) { // ascii-file format + index = runData->fDataNonMusr.fYIndex; + found = true; + } else { // db-file format + if (fRunInfo->fXYDataIndex[1] > 0) { // xy-data already indices + index = fRunInfo->fXYDataIndex[1]-1; // since xy-data start with 1 ... + found = true; + } else { // xy-data data tags which needs to be converted to an index + for (unsigned int i=0; ifDataNonMusr.fDataTags.size(); i++) { + if (runData->fDataNonMusr.fDataTags[i].CompareTo(fRunInfo->fXYDataLabel[1]) == 0) { + found = true; + break; + } + } + } + } + + if (!found) { + cout << endl << "PRunNonMusr::GetYIndex(): **ERROR** Couldn't obtain y-data index!"; + cout << endl; + assert(0); + } + + return index; +} diff --git a/src/include/PMusr.h b/src/include/PMusr.h index adc10cc3..4e582767 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -145,20 +145,29 @@ typedef struct { *

*/ typedef struct { - TString fRunName; ///< name of the run - TString fRunTitle; ///< run title - TString fXAxisTitle; ///< x-axis title for noMusr view - TString fYAxisTitle; ///< x-axis title for noMusr view - TString fSetup; ///< description of the setup of this run - double fField; ///< magnetic field value - double fTemp; ///< temperature during the run - double fEnergy; ///< implantation energy of the muon - double fTimeResolution; ///< time resolution of the run - PDoubleVector fT0s; ///< vector of t0's of a run - vector fDataBin; ///< vector of all histos of a run - PDoubleVector fXData; ///< vector of all x-data if noMuSR fit - PDoubleVector fYData; ///< vector of all x-data if noMuSR fit - PDoubleVector fErrYData; ///< vector of all x-data if noMuSR fit + int fXIndex; ///< index for the x-data vector + int fYIndex; ///< index for the y-data vector + PStringVector fLabels; ///< vector of all labels (used for x-, y-axis title in view) + PStringVector fDataTags; ///< vector of all data tags + vector fData; ///< vector of all data + vector fErrData; ///< vector of all data errors +} PNonMusrRawRunData; + +//------------------------------------------------------------- +/** + *

+ */ +typedef struct { + TString fRunName; ///< name of the run + TString fRunTitle; ///< run title + TString fSetup; ///< description of the setup of this run + double fField; ///< magnetic field value + double fTemp; ///< temperature during the run + double fEnergy; ///< implantation energy of the muon + double fTimeResolution; ///< time resolution of the run + PDoubleVector fT0s; ///< vector of t0's of a run + vector fDataBin; ///< vector of all histos of a run + PNonMusrRawRunData fDataNonMusr; ///< keeps all ascii- or db-file info in case of nonMusr fit } PRawRunData; //------------------------------------------------------------- @@ -210,33 +219,35 @@ typedef vector PMsrParamList; * */ typedef struct { - TString fRunName; ///< name of the run file - TString fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type) - TString fInstitute; ///< e.g. psi, ral, triumf (former: run format) - TString fFileFormat; ///< e.g. root, nexus, psi-bin, mud - int fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR - int fAlphaParamNo; ///< alpha - int fBetaParamNo; ///< - int fNormParamNo; ///< - int fBkgFitParamNo; ///< - int fPhaseParamNo; ///< - int fLifetimeParamNo; ///< + TString fRunName; ///< name of the run file + TString fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type) + TString fInstitute; ///< e.g. psi, ral, triumf (former: run format) + TString fFileFormat; ///< e.g. root, nexus, psi-bin, mud, ascii, db + int fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR + int fAlphaParamNo; ///< alpha + int fBetaParamNo; ///< + int fNormParamNo; ///< + int fBkgFitParamNo; ///< + int fPhaseParamNo; ///< + int fLifetimeParamNo; ///< bool fLifetimeCorrection; ///< - PIntVector fMap; ///< - int fForwardHistoNo; ///< - int fBackwardHistoNo; ///< - double fBkgFix[2]; ///< - int fBkgRange[4]; ///< - int fDataRange[4]; ///< - int fT0[2]; ///< - double fFitRange[2]; ///< - int fPacking; ///< - double fRRFFreq; ///< rotating reference frequency - int fRRFPacking; ///< rotating reference packing - int fAlpha2ParamNo; ///< - int fBeta2ParamNo; ///< - int fRightHistoNo; ///< - int fLeftHistoNo; ///< + PIntVector fMap; ///< + int fForwardHistoNo; ///< + int fBackwardHistoNo; ///< + double fBkgFix[2]; ///< + int fBkgRange[4]; ///< + int fDataRange[4]; ///< + int fT0[2]; ///< + double fFitRange[2]; ///< + int fPacking; ///< + double fRRFFreq; ///< rotating reference frequency + int fRRFPacking; ///< rotating reference packing + int fAlpha2ParamNo; ///< + int fBeta2ParamNo; ///< + int fRightHistoNo; ///< + int fLeftHistoNo; ///< + int fXYDataIndex[2]; ///< used to get the data indices when using db-files + TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files } PMsrRunStructure; //------------------------------------------------------------- diff --git a/src/include/PRunDataHandler.h b/src/include/PRunDataHandler.h index 8b4acff8..90346814 100644 --- a/src/include/PRunDataHandler.h +++ b/src/include/PRunDataHandler.h @@ -68,6 +68,7 @@ class PRunDataHandler virtual bool ReadPsiBinFile(); virtual bool ReadMudFile(); virtual bool ReadAsciiFile(); + virtual bool ReadDBFile(); virtual bool StripWhitespace(TString &str); virtual bool IsWhitespace(const char *str); diff --git a/src/include/PRunNonMusr.h b/src/include/PRunNonMusr.h index 15aca2c0..ef7474c9 100644 --- a/src/include/PRunNonMusr.h +++ b/src/include/PRunNonMusr.h @@ -56,6 +56,9 @@ class PRunNonMusr : public PRunBase double fFitStartTime; double fFitStopTime; unsigned int fNoOfFitBins; + + unsigned int GetXIndex(PRawRunData* runData); + unsigned int GetYIndex(PRawRunData* runData); }; #endif // _PRUNNONMUSR_H_