implemented db-file handling

This commit is contained in:
nemu 2008-08-08 12:43:28 +00:00
parent 2a65b0cad7
commit 1bf4af1eee
5 changed files with 316 additions and 59 deletions

View File

@ -69,17 +69,6 @@ short term:
* implement NonMuSR stuff **DONE** 08-06-20, some more testing needed
* Minuit2: name length is now unlimited and hence the 10 char restriction can be lifted.
* 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
@ -87,8 +76,17 @@ short term:
xy-data T asym <- labels
or
xy-data 3 6 <- indices
**DONE** 08-08-08
* Minuit2: name length is now unlimited and hence the 10 char restriction can be lifted.
* nonMusr: check why in nonMusr view there is NO legend??
* musrparam should be extended that is also can produce a db-file output.
I would suggest two switches:
--db -> will produce db-files but still expecting the independent variables in the par-list-file
--db-lem -> will extract some default independent variables from the system (to be checked what and
from where the data shall be taken).
* implement FFT with msr-interface

View File

@ -555,6 +555,32 @@ int PMsrHandler::WriteMsrLogFile()
}
CheckAndWriteComment(f, ++lineNo);
}
// xy-data (indices)
if (fRuns[i].fXYDataIndex[0] != -1) {
f.width(16);
f << endl << left << "xy-data";
for (unsigned int j=0; j<2; j++) {
if (fRuns[i].fXYDataIndex[j] == -1)
break;
f.width(8);
f.precision(2);
f << left << fixed << fRuns[i].fXYDataIndex[j];
}
CheckAndWriteComment(f, ++lineNo);
}
// xy-data (labels)
if (!fRuns[i].fXYDataLabel[0].IsWhitespace()) {
f.width(16);
f << endl << left << "xy-data";
for (unsigned int j=0; j<2; j++) {
if (fRuns[i].fXYDataLabel[j].IsWhitespace())
break;
f.width(8);
f.precision(2);
f << left << fixed << fRuns[i].fXYDataLabel[j].Data();
}
CheckAndWriteComment(f, ++lineNo);
}
// fit
if (fRuns[i].fFitRange[0] != -1) {
f.width(16);
@ -1547,6 +1573,10 @@ void PMsrHandler::InitRunParameterStructure(PMsrRunStructure &param)
param.fBeta2ParamNo = -1;
param.fRightHistoNo = -1;
param.fLeftHistoNo = -1;
for (int i=0; i<2; i++)
param.fXYDataIndex[i] = -1;
for (int i=0; i<2; i++)
param.fXYDataLabel[i] = "";
}
//--------------------------------------------------------------------------

View File

@ -850,7 +850,7 @@ bool PRunDataHandler::ReadAsciiFile()
// open dump-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 << "PRunDataHandler::ReadAsciiFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ...";
cout << endl;
return false;
}
@ -952,7 +952,7 @@ bool PRunDataHandler::ReadAsciiFile()
TObjString *ostr;
TObjArray *tokens;
// check if data have x, y [, error y] structure, and that x, y, and error y are numbers
tokens = line.Tokenize(" ,/t");
tokens = line.Tokenize(" ,\t");
// check if the number of data line entries is 2 or 3
if ((tokens->GetEntries() != 2) && (tokens->GetEntries() != 3)) {
cout << endl << "PRunDataHandler::ReadAsciiFile **ERROR** found data line with a structure different than \"x, y [, error y]\", cannot be handled (line no " << lineNo << ")";
@ -1006,7 +1006,7 @@ bool PRunDataHandler::ReadAsciiFile()
exVec.push_back(1.0);
yVec.push_back(y);
eyVec.push_back(ey);
cout << endl << ">> (x/y/ey) = (" << x << "/" << y << "/" << 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!";
@ -1034,7 +1034,7 @@ cout << endl << ">> (x/y/ey) = (" << x << "/" << y << "/" << ey << ")";
runData.fDataNonMusr.fData.clear();
runData.fDataNonMusr.fErrData.clear();
cout << endl << ">> end of ReadAsciiFile()";
//cout << endl << ">> end of ReadAsciiFile()";
return success;
}
@ -1100,15 +1100,15 @@ cout << endl << ">> end of ReadAsciiFile()";
* 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
* -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...
* Alternatively, the data often utilizes the continuation character ('\') and is labelled like
* DATA line, gauss, lrntz
* linear = -1.966, -0.168, -0.106, \
* gaussn = 0.048, 0.002, 0.005, \
@ -1129,6 +1129,22 @@ cout << endl << ">> end of ReadAsciiFile()";
* in this just slight odd manner (do not blame me, I haven't invented this format ;-) ).
* \endverbatim
*
* <p><b>WARNING:</b>For the row like data representation (the top DATA representation shown)
* it is essential that there are always at least one space inbetween commas (the reason is that
* I am too lazy to write my own tokenizer), e.g.
*
* \verbatim
* -1.966, -0.168, , 0.048, , , 0.184, 0.010, 0.017, 1001, , , run 1001 title
* \endverbatim
*
* <p>which is ok, but
*
* \verbatim
* -1.966, -0.168,, 0.048,,, 0.184, 0.010, 0.017, 1001,,, run 1001 title
* \endverbatim
*
* <p>will <b>not</b> work!
*
* <p>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.
*/
@ -1136,29 +1152,36 @@ 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 << "PRunDataHandler::ReadDBFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ...";
cout << endl;
return false;
}
PRawRunData runData;
runData.fDataNonMusr.fXIndex = -1;
runData.fDataNonMusr.fYIndex = -1;
int lineNo = 0;
int dataNo = 0;
int dbTag = -1;
char instr[512];
TString line, workStr;
double x, y, ey;
double val;
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)
// variables needed to tokenize strings
TString tstr;
TObjString *ostr;
TObjArray *tokens;
while (!f.eof()) {
// get next line from file
f.getline(instr, sizeof(instr));
@ -1177,24 +1200,38 @@ bool PRunDataHandler::ReadDBFile()
workStr = line;
workStr.Remove(TString::kLeading, ' '); // remove spaces from the begining
if (workStr.BeginsWith("title", TString::kIgnoreCase)) {
cout << endl << ">> TITLE line found ...";
// cout << endl << ">> TITLE line found ...";
dbTag = 0;
continue;
} else if (workStr.BeginsWith("abstract", TString::kIgnoreCase)) {
cout << endl << ">> ABSTRACT line found ...";
// cout << endl << ">> ABSTRACT line found ...";
dbTag = 1;
continue;
} else if (workStr.BeginsWith("comments", TString::kIgnoreCase)) {
cout << endl << ">> COMMENTS line found ...";
// cout << endl << ">> COMMENTS line found ...";
dbTag = 2;
continue;
} else if (workStr.BeginsWith("label", TString::kIgnoreCase)) {
cout << endl << ">> LABEL line found ...";
// cout << endl << ">> LABEL line found ...";
dbTag = 3;
continue;
} else if (workStr.BeginsWith("data", TString::kIgnoreCase)) {
cout << endl << ">> DATA line found ...";
// cout << endl << ">> DATA line found ...";
dbTag = 4;
// filter out all data tags
tokens = workStr.Tokenize(" ,\t");
for (int i=1; i<tokens->GetEntries(); i++) {
ostr = dynamic_cast<TObjString*>(tokens->At(i));
runData.fDataNonMusr.fDataTags.push_back(ostr->GetString());
// cout << endl << ">> DATA tag " << i << ": " << ostr->GetString().Data();
}
// clean up tokens
if (tokens) {
delete tokens;
tokens = 0;
}
continue;
}
@ -1218,20 +1255,172 @@ cout << endl << ">> DATA line found ...";
workStr.BeginsWith("\\e", TString::kIgnoreCase) ||
workStr.BeginsWith("/-e", TString::kIgnoreCase) ||
workStr.BeginsWith("/e", TString::kIgnoreCase)) {
cout << endl << ">> \\-e like tag found ...";
// cout << endl << ">> \\-e like tag found ...";
continue;
}
// check if data are given just as rows are as labelled columns (see description above)
// check if first real data line
if (firstData) {
if (workStr.Contains("=")) {
// check if data are given just as rows are as labelled columns (see description above)
tokens = workStr.Tokenize(",");
ostr = dynamic_cast<TObjString*>(tokens->At(0));
if (!ostr->GetString().IsFloat()) {
labelledFormat = true;
cout << endl << ">> data give in labelled format ...";
// cout << endl << ">> data give in labelled format ...";
} else {
labelledFormat = false;
cout << endl << ">> data give in row format ...";
// cout << endl << ">> data give in row format ...";
}
// clean up tokens
if (tokens) {
delete tokens;
tokens = 0;
}
// prepare data vector for use
PDoubleVector dummy;
for (unsigned int i=0; i<runData.fDataNonMusr.fDataTags.size(); i++) {
runData.fDataNonMusr.fData.push_back(dummy);
runData.fDataNonMusr.fErrData.push_back(dummy);
}
firstData = false;
}
if (labelledFormat) { // handle labelled formated data
// check if run line
const char *str = workStr.Data();
if (isdigit(str[0])) { // run line
// split string in tokens
tokens = workStr.Tokenize(","); // line has structure: runNo,,, runTitle
ostr = dynamic_cast<TObjString*>(tokens->At(0));
tstr = ostr->GetString();
if (!tstr.IsFloat()) {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: runNo,,, runTitle";
cout << endl << ">> runNo = " << tstr.Data() << ", seems to be not a number.";
delete tokens;
return false;
}
val = tstr.Atof();
runData.fDataNonMusr.fData[dataNo].push_back(val);
runData.fDataNonMusr.fErrData[dataNo].push_back(0.0);
dataNo = 0; // next run block starts
} else { // tag = data line
// split string in tokens
tokens = workStr.Tokenize("=,"); // line has structure: tag = val,err1,err2,
if (tokens->GetEntries() < 3) {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\";
delete tokens;
return false;
}
switch (tokens->GetEntries()) {
case 3: // tag = val,,,
ostr = dynamic_cast<TObjString*>(tokens->At(1));
tstr = ostr->GetString();
if (!tstr.IsFloat()) {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\";
cout << endl << ">> val = " << tstr.Data() << ", seems to be not a number.";
delete tokens;
return false;
}
val = tstr.Atof();
runData.fDataNonMusr.fData[dataNo].push_back(val);
runData.fDataNonMusr.fErrData[dataNo].push_back(0.0);
break;
case 4: // tag = val,err,,
case 5: // tag = val,err1,err2,
// handle val
ostr = dynamic_cast<TObjString*>(tokens->At(1));
tstr = ostr->GetString();
if (!tstr.IsFloat()) {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\";
cout << endl << ">> val = " << tstr.Data() << ", seems to be not a number.";
delete tokens;
return false;
}
val = tstr.Atof();
runData.fDataNonMusr.fData[dataNo].push_back(val);
// handle err1 (err2 will be ignored for the time being)
ostr = dynamic_cast<TObjString*>(tokens->At(2));
tstr = ostr->GetString();
if (!tstr.IsFloat()) {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\";
cout << endl << ">> err1 = " << tstr.Data() << ", seems to be not a number.";
delete tokens;
return false;
}
val = tstr.Atof();
runData.fDataNonMusr.fErrData[dataNo].push_back(val);
break;
default:
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\";
delete tokens;
return false;
break;
}
dataNo++;
}
} else { // handle row formated data
// split string in tokens
tokens = workStr.Tokenize(","); // line has structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle
if (tokens->GetEntries() != (int)(3*runData.fDataNonMusr.fDataTags.size()+1)) {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle";
cout << endl << ">> found = " << tokens->GetEntries() << " tokens, however expected " << 3*runData.fDataNonMusr.fDataTags.size()+1;
cout << endl << ">> Perhaps there are commas without space inbetween, like 12.3,, 3.2,...";
delete tokens;
return false;
}
// extract data
int j=0;
for (int i=0; i<tokens->GetEntries()-1; i+=3) {
// handle value
ostr = dynamic_cast<TObjString*>(tokens->At(i));
tstr = ostr->GetString();
if (!tstr.IsFloat()) {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle";
cout << endl << ">> value=" << tstr.Data() << " seems not to be a number";
delete tokens;
return false;
}
runData.fDataNonMusr.fData[j].push_back(tstr.Atof());
// handle 1st error if present (2nd will be ignored for now)
ostr = dynamic_cast<TObjString*>(tokens->At(i+1));
tstr = ostr->GetString();
if (tstr.IsWhitespace()) {
runData.fDataNonMusr.fErrData[j].push_back(0.0);
} else if (tstr.IsFloat()) {
runData.fDataNonMusr.fErrData[j].push_back(tstr.Atof());
} else {
cout << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
cout << endl << ">> " << workStr.Data();
cout << endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle";
cout << endl << ">> error1=" << tstr.Data() << " seems not to be a number";
delete tokens;
return false;
}
j++;
}
}
break;
default:
break;
@ -1240,9 +1429,26 @@ cout << endl << ">> data give in row format ...";
f.close();
cout << endl << ">> run title: '" << runData.fRunTitle.Data() << "'";
cout << endl;
assert(0);
// cout << endl << ">> run title: '" << runData.fRunTitle.Data() << "'";
// cout << endl;
//
// cout << endl << ">> first data vector:";
// cout << endl << ">> label:" << runData.fDataNonMusr.fLabels[28].Data();
// for (unsigned int i=0; i<runData.fDataNonMusr.fData[28].size(); i++) {
// cout << endl << ">> " << runData.fDataNonMusr.fData[28][i] << " +- " << runData.fDataNonMusr.fErrData[28][i];
// }
// cout << endl;
//
// assert(0);
// clean up tokens
if (tokens) {
delete tokens;
tokens = 0;
}
// keep run name
runData.fRunName = fRunName;
fData.push_back(runData);

View File

@ -491,6 +491,9 @@ const char* PRunListCollection::GetXAxisTitle(TString &runName)
PRawRunData *runData = fData->GetRunData(runName);
int index = fData->GetRunData(runName)->fDataNonMusr.fXIndex;
// cout << endl << ">>PRunListCollection::GetXAxisTitle, x-index = " << index;
// cout << endl;
return runData->fDataNonMusr.fLabels[index].Data();
}
@ -507,6 +510,9 @@ const char* PRunListCollection::GetYAxisTitle(TString &runName)
PRawRunData *runData = fData->GetRunData(runName);
int index = fData->GetRunData(runName)->fDataNonMusr.fYIndex;
// cout << endl << ">>PRunListCollection::GetYAxisTitle, y-index = " << index;
// cout << endl;
return runData->fDataNonMusr.fLabels[index].Data();
}

View File

@ -183,20 +183,21 @@ bool PRunNonMusr::PrepareFitData()
// get x-, y-index
unsigned int xIndex = GetXIndex(runData);
unsigned int yIndex = GetYIndex(runData);
// cout << endl << ">> xIndex=" << xIndex << ", yIndex=" << yIndex;
// pack the raw data
double value = 0.0;
double err = 0.0;
cout << endl << ">> runData->fDataNonMusr.fData[" << xIndex << "].size()=" << runData->fDataNonMusr.fData[xIndex].size();
// cout << endl << ">> runData->fDataNonMusr.fData[" << xIndex << "].size()=" << runData->fDataNonMusr.fData[xIndex].size();
for (unsigned int i=0; i<runData->fDataNonMusr.fData[xIndex].size(); i++) {
cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
// cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
if (fRunInfo->fPacking == 1) {
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;
// cout << endl << "-> i=" << i;
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));
@ -208,7 +209,7 @@ cout << endl << "-> i=" << i;
err += runData->fDataNonMusr.fErrData[yIndex][i]*runData->fDataNonMusr.fErrData[yIndex][i];
}
}
cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();
// cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();
// count the number of bins to be fitted
fNoOfFitBins=0;
@ -218,7 +219,7 @@ cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();
if ((x >= fFitStartTime) && (x <= fFitStopTime))
fNoOfFitBins++;
}
cout << endl << ">> fNoOfFitBins=" << fNoOfFitBins;
// cout << endl << ">> fNoOfFitBins=" << fNoOfFitBins;
return success;
}
@ -244,21 +245,25 @@ bool PRunNonMusr::PrepareViewData()
// get x-, y-index
unsigned int xIndex = GetXIndex(runData);
unsigned int yIndex = GetYIndex(runData);
// cout << endl << "PRunNonMusr::PrepareViewData: xIndex=" << xIndex << ", yIndex=" << yIndex << endl;
// set x-, y-axis-index
runData->fDataNonMusr.fXIndex = xIndex;
runData->fDataNonMusr.fYIndex = yIndex;
// fill data histo
// pack the raw data
double value = 0.0;
double err = 0.0;
cout << endl << ">> runData->fDataNonMusr.fData[" << xIndex << "].size()=" << runData->fDataNonMusr.fData[xIndex].size();
// cout << endl << ">> runData->fDataNonMusr.fData[" << xIndex << "].size()=" << runData->fDataNonMusr.fData[xIndex].size();
for (unsigned int i=0; i<runData->fDataNonMusr.fData[xIndex].size(); i++) {
cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
// cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
if (fRunInfo->fPacking == 1) {
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;
// cout << endl << "-> i=" << i;
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));
@ -270,11 +275,11 @@ cout << endl << "-> i=" << i;
err += runData->fDataNonMusr.fErrData[yIndex][i]*runData->fDataNonMusr.fErrData[yIndex][i];
}
}
cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();
// cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();
// count the number of bins to be fitted
fNoOfFitBins = fData.fValue.size();
cout << endl << ">> fNoOfFitBins=" << fNoOfFitBins;
// cout << endl << ">> fNoOfFitBins=" << fNoOfFitBins;
// fill theory histo
// feed the parameter vector
@ -287,7 +292,7 @@ cout << endl << ">> fNoOfFitBins=" << fNoOfFitBins;
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
}
cout << endl << ">> after parameter fill" << endl;
// cout << endl << ">> after parameter fill" << endl;
// get plot range
PMsrPlotList *plotList;
PMsrPlotStructure plotBlock;
@ -302,15 +307,15 @@ cout << endl << ">> after parameter fill" << endl;
double xMin, xMax;
double xAbsMin, xAbsMax;
bool first = true;
cout << endl << ">> plotList->size()=" << plotList->size();
// cout << endl << ">> plotList->size()=" << plotList->size();
for (unsigned int i=0; i<plotList->size(); i++) {
plotBlock = plotList->at(i);
cout << endl << ">> plotBlock.fRuns.size()=" << plotBlock.fRuns.size() << endl;
// cout << endl << ">> plotBlock.fRuns.size()=" << plotBlock.fRuns.size() << endl;
for (unsigned int j=0; j<plotBlock.fRuns.size(); j++) {
cout << endl << ">> j=" << j;
cout << endl << ">> fRunNo=" << fRunNo;
cout << endl << ">> plotBlock.fRuns[j].Re()=" << plotBlock.fRuns[j].Re();
cout << endl;
// cout << endl << ">> j=" << j;
// cout << endl << ">> fRunNo=" << fRunNo;
// cout << endl << ">> plotBlock.fRuns[j].Re()=" << plotBlock.fRuns[j].Re();
// cout << endl;
if (fRunNo == plotBlock.fRuns[j].Re()-1) { // run found
if (first) {
first = false;
@ -318,7 +323,7 @@ cout << endl;
xMax = plotBlock.fTmax;
xAbsMin = xMin;
xAbsMax = xMax;
cout << endl << ">> first: xMin=" << xMin << ", xMax=" << xMax << endl;
// cout << endl << ">> first: xMin=" << xMin << ", xMax=" << xMax << endl;
} else {
if (fabs(xMax-xMin) > fabs(plotBlock.fTmax-plotBlock.fTmin)) {
xMin = plotBlock.fTmin;
@ -328,13 +333,13 @@ cout << endl << ">> first: xMin=" << xMin << ", xMax=" << xMax << endl;
xAbsMin = xMin;
if (xMax > xAbsMax)
xAbsMax = xMax;
cout << endl << ">> !first: xMin=" << xMin << ", xMax=" << xMax << endl;
// cout << endl << ">> !first: xMin=" << xMin << ", xMax=" << xMax << endl;
}
cout << endl << ">> xMin=" << xMin << ", xMax=" << xMax << endl;
// cout << endl << ">> xMin=" << xMin << ", xMax=" << xMax << endl;
}
}
}
cout << endl << ">> after the xmin/xmax loop." << endl;
// cout << endl << ">> after the xmin/xmax loop." << endl;
double xStep = (xMax-xMin)/1000.0;
double xx = xAbsMin;
@ -366,16 +371,24 @@ unsigned int PRunNonMusr::GetXIndex(PRawRunData* runData)
unsigned int index = 0;
bool found = false;
// cout << endl << ">> PRunNonMusr::GetXIndex:";
if (runData->fDataNonMusr.fXIndex >= 0) { // ascii-file format
// cout << endl << ">> PRunNonMusr::GetXIndex: ascii-file format";
index = runData->fDataNonMusr.fXIndex;
found = true;
} else { // db-file format
// cout << endl << ">> PRunNonMusr::GetXIndex: db-file format";
if (fRunInfo->fXYDataIndex[0] > 0) { // xy-data already indices
// cout << endl << ">> PRunNonMusr::GetXIndex: 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
// cout << endl << ">> fDataTags.size()=" << runData->fDataNonMusr.fDataTags.size();
for (unsigned int i=0; i<runData->fDataNonMusr.fDataTags.size(); i++) {
if (runData->fDataNonMusr.fDataTags[i].CompareTo(fRunInfo->fXYDataLabel[0]) == 0) {
// cout << endl << ">> i=" << i << ", runData->fDataNonMusr.fDataTags[i]=" << runData->fDataNonMusr.fDataTags[i].Data();
// cout << endl << ">> fRunInfo->fXYDataLabel[0]=" << fRunInfo->fXYDataLabel[0].Data();
index = i;
found = true;
break;
}
@ -405,6 +418,7 @@ unsigned int PRunNonMusr::GetYIndex(PRawRunData* runData)
unsigned int index = 0;
bool found = false;
// cout << endl << ">> PRunNonMusr::GetYIndex:";
if (runData->fDataNonMusr.fYIndex >= 0) { // ascii-file format
index = runData->fDataNonMusr.fYIndex;
found = true;
@ -415,6 +429,9 @@ unsigned int PRunNonMusr::GetYIndex(PRawRunData* runData)
} else { // xy-data data tags which needs to be converted to an index
for (unsigned int i=0; i<runData->fDataNonMusr.fDataTags.size(); i++) {
if (runData->fDataNonMusr.fDataTags[i].CompareTo(fRunInfo->fXYDataLabel[1]) == 0) {
// cout << endl << ">> i=" << i << ", runData->fDataNonMusr.fDataTags[i]=" << runData->fDataNonMusr.fDataTags[i].Data();
// cout << endl << ">> fRunInfo->fXYDataLabel[1]=" << fRunInfo->fXYDataLabel[1].Data();
index = i;
found = true;
break;
}