implemented ADDRUN feature which adds runs on the fly. Still very experimental and not thoroughly tested.

This commit is contained in:
nemu 2009-03-12 15:59:19 +00:00
parent 6eacc87cee
commit 3eaa9e433f
12 changed files with 505 additions and 321 deletions

View File

@ -402,7 +402,6 @@ int PMsrHandler::WriteMsrLogFile()
} }
// write functions block // write functions block
cout << endl << ">> GetNoOfFuncs() = " << GetNoOfFuncs() << endl;
if (GetNoOfFuncs() != 0) { if (GetNoOfFuncs() != 0) {
f << endl << "FUNCTIONS"; f << endl << "FUNCTIONS";
CheckAndWriteComment(f, ++lineNo); CheckAndWriteComment(f, ++lineNo);
@ -419,17 +418,33 @@ cout << endl << ">> GetNoOfFuncs() = " << GetNoOfFuncs() << endl;
// write run block // write run block
for (unsigned int i=0; i<fRuns.size(); i++) { for (unsigned int i=0; i<fRuns.size(); i++) {
// run header // run header
f << endl << "RUN " << fRuns[i].fRunName.Data() << " "; f << endl << "RUN " << fRuns[i].fRunName[0].Data() << " ";
str = fRuns[i].fBeamline; str = fRuns[i].fBeamline[0];
str.ToUpper(); str.ToUpper();
f << str.Data() << " "; f << str.Data() << " ";
str = fRuns[i].fInstitute; str = fRuns[i].fInstitute[0];
str.ToUpper(); str.ToUpper();
f << str.Data() << " "; f << str.Data() << " ";
str = fRuns[i].fFileFormat; str = fRuns[i].fFileFormat[0];
str.ToUpper(); str.ToUpper();
f << str.Data() << " (name beamline institute data-file-format)"; f << str.Data() << " (name beamline institute data-file-format)";
CheckAndWriteComment(f, ++lineNo); CheckAndWriteComment(f, ++lineNo);
// check for ADDRUN entries
if (fRuns[i].fRunName.size() > 1) {
for (unsigned int j=1; j<fRuns[i].fRunName.size(); j++) {
f << endl << "ADDRUN " << fRuns[i].fRunName[j].Data() << " ";
str = fRuns[i].fBeamline[j];
str.ToUpper();
f << str.Data() << " ";
str = fRuns[i].fInstitute[j];
str.ToUpper();
f << str.Data() << " ";
str = fRuns[i].fFileFormat[j];
str.ToUpper();
f << str.Data() << " (name beamline institute data-file-format)";
CheckAndWriteComment(f, ++lineNo);
}
}
// fittype // fittype
f.width(16); f.width(16);
switch (fRuns[i].fFitType) { switch (fRuns[i].fFitType) {
@ -609,12 +624,10 @@ cout << endl << ">> GetNoOfFuncs() = " << GetNoOfFuncs() << endl;
CheckAndWriteComment(f, ++lineNo); CheckAndWriteComment(f, ++lineNo);
} }
// t0 // t0
if (fRuns[i].fT0[0] != -1) { if (fRuns[i].fT0.size() > 0) {
f.width(16); f.width(16);
f << endl << left << "t0"; f << endl << left << "t0";
for (unsigned int j=0; j<2; j++) { for (unsigned int j=0; j<fRuns[i].fT0.size(); j++) {
if (fRuns[i].fT0[j] == -1)
break;
f.width(8); f.width(8);
f << left << fRuns[i].fT0[j]; f << left << fRuns[i].fT0[j];
} }
@ -1248,16 +1261,37 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines)
} else { } else {
// run name // run name
ostr = dynamic_cast<TObjString*>(tokens->At(1)); ostr = dynamic_cast<TObjString*>(tokens->At(1));
param.fRunName = ostr->GetString(); param.fRunName.push_back(ostr->GetString());
// beamline // beamline
ostr = dynamic_cast<TObjString*>(tokens->At(2)); ostr = dynamic_cast<TObjString*>(tokens->At(2));
param.fBeamline = ostr->GetString(); param.fBeamline.push_back(ostr->GetString());
// institute // institute
ostr = dynamic_cast<TObjString*>(tokens->At(3)); ostr = dynamic_cast<TObjString*>(tokens->At(3));
param.fInstitute = ostr->GetString(); param.fInstitute.push_back(ostr->GetString());
// data file format // data file format
ostr = dynamic_cast<TObjString*>(tokens->At(4)); ostr = dynamic_cast<TObjString*>(tokens->At(4));
param.fFileFormat = ostr->GetString(); param.fFileFormat.push_back(ostr->GetString());
}
}
// ADDRUN line ---------------------------------------------
if (iter->fLine.BeginsWith("addrun", TString::kIgnoreCase)) {
// get run name, beamline, institute, and file-format
if (tokens->GetEntries() < 5) {
error = true;
} else {
// run name
ostr = dynamic_cast<TObjString*>(tokens->At(1));
param.fRunName.push_back(ostr->GetString());
// beamline
ostr = dynamic_cast<TObjString*>(tokens->At(2));
param.fBeamline.push_back(ostr->GetString());
// institute
ostr = dynamic_cast<TObjString*>(tokens->At(3));
param.fInstitute.push_back(ostr->GetString());
// data file format
ostr = dynamic_cast<TObjString*>(tokens->At(4));
param.fFileFormat.push_back(ostr->GetString());
} }
} }
@ -1478,14 +1512,14 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines)
// t0 ----------------------------------------------------- // t0 -----------------------------------------------------
if (iter->fLine.BeginsWith("t0", TString::kIgnoreCase)) { if (iter->fLine.BeginsWith("t0", TString::kIgnoreCase)) {
if ((tokens->GetEntries() != 2) && (tokens->GetEntries() != 3)) { if (tokens->GetEntries() < 2) {
error = true; error = true;
} else { } else {
for (int i=1; i<tokens->GetEntries(); i++) { for (int i=1; i<tokens->GetEntries(); i++) {
ostr = dynamic_cast<TObjString*>(tokens->At(i)); ostr = dynamic_cast<TObjString*>(tokens->At(i));
str = ostr->GetString(); str = ostr->GetString();
if (str.IsDigit()) if (str.IsDigit())
param.fT0[i-1] = str.Atoi(); param.fT0.push_back(str.Atoi());
else else
error = true; error = true;
} }
@ -1664,7 +1698,7 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines)
found = false; found = false;
} }
if (!found) { if (!found) {
cout << endl << ">> PMsrHandler::HandleRunEntry: **ERROR** for run " << fRuns[i].fRunName << ", forward " << fRuns[i].fForwardHistoNo; cout << endl << ">> PMsrHandler::HandleRunEntry: **ERROR** for run " << fRuns[i].fRunName[0].Data() << ", forward " << fRuns[i].fForwardHistoNo;
cout << endl << " no background information found!"; cout << endl << " no background information found!";
cout << endl << " Either of the tags 'backgr.fit', 'backgr.fix', 'background'"; cout << endl << " Either of the tags 'backgr.fit', 'backgr.fix', 'background'";
cout << endl << " with data is needed."; cout << endl << " with data is needed.";
@ -1687,10 +1721,10 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines)
*/ */
void PMsrHandler::InitRunParameterStructure(PMsrRunStructure &param) void PMsrHandler::InitRunParameterStructure(PMsrRunStructure &param)
{ {
param.fRunName = ""; param.fRunName.clear();
param.fBeamline = ""; param.fBeamline.clear();
param.fInstitute = ""; param.fInstitute.clear();
param.fFileFormat = ""; param.fFileFormat.clear();
param.fFitType = -1; param.fFitType = -1;
param.fAlphaParamNo = -1; param.fAlphaParamNo = -1;
param.fBetaParamNo = -1; param.fBetaParamNo = -1;
@ -1710,8 +1744,7 @@ void PMsrHandler::InitRunParameterStructure(PMsrRunStructure &param)
param.fBkgRange[i] = -1; param.fBkgRange[i] = -1;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
param.fDataRange[i] = -1; param.fDataRange[i] = -1;
for (int i=0; i<2; i++) param.fT0.clear();
param.fT0[i] = -1;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
param.fFitRange[i] = -1; param.fFitRange[i] = -1;
param.fPacking = 1; param.fPacking = 1;

View File

@ -512,7 +512,7 @@ void PMusrCanvas::UpdateInfoPad()
for (unsigned int i=0; i<fData.size(); i++) { for (unsigned int i=0; i<fData.size(); i++) {
// run label = run_name/histo/T=0K/B=0G/E=0keV/... // run label = run_name/histo/T=0K/B=0G/E=0keV/...
runNo = (unsigned int)plotInfo.fRuns[i].Re()-1; runNo = (unsigned int)plotInfo.fRuns[i].Re()-1;
tstr = runs[runNo].fRunName + TString(","); // run_name tstr = runs[runNo].fRunName[0] + TString(","); // run_name
// histo info (depending on the fittype // histo info (depending on the fittype
if (runs[runNo].fFitType == MSR_FITTYPE_SINGLE_HISTO) { if (runs[runNo].fFitType == MSR_FITTYPE_SINGLE_HISTO) {
tstr += TString("h:"); tstr += TString("h:");
@ -527,7 +527,7 @@ void PMusrCanvas::UpdateInfoPad()
} }
// temperature if present // temperature if present
tstr += TString("T="); tstr += TString("T=");
dval = fRunList->GetTemp(runs[runNo].fRunName); dval = fRunList->GetTemp(runs[runNo].fRunName[0]);
if (dval == -9.9e99) { if (dval == -9.9e99) {
tstr += TString("??,"); tstr += TString("??,");
} else { } else {
@ -536,7 +536,7 @@ void PMusrCanvas::UpdateInfoPad()
} }
// field if present // field if present
tstr += TString("B="); tstr += TString("B=");
dval = fRunList->GetField(runs[runNo].fRunName); dval = fRunList->GetField(runs[runNo].fRunName[0]);
if (dval == -9.9e99) { if (dval == -9.9e99) {
tstr += TString("??,"); tstr += TString("??,");
} else { } else {
@ -545,7 +545,7 @@ void PMusrCanvas::UpdateInfoPad()
} }
// energy if present // energy if present
tstr += TString("E="); tstr += TString("E=");
dval = fRunList->GetEnergy(runs[runNo].fRunName); dval = fRunList->GetEnergy(runs[runNo].fRunName[0]);
//cout << endl << ">> dval = " << dval << " (Engery)"; //cout << endl << ">> dval = " << dval << " (Engery)";
if (dval == -9.9e99) { if (dval == -9.9e99) {
tstr += TString("??,"); tstr += TString("??,");
@ -554,7 +554,7 @@ void PMusrCanvas::UpdateInfoPad()
tstr += TString(sval) + TString("(keV),"); tstr += TString(sval) + TString("(keV),");
} }
// setup if present // setup if present
tstr += fRunList->GetSetup(runs[runNo].fRunName); tstr += fRunList->GetSetup(runs[runNo].fRunName[0]);
// add entry // add entry
fInfoPad->AddEntry(fData[i].data, tstr.Data(), "p"); fInfoPad->AddEntry(fData[i].data, tstr.Data(), "p");
} }
@ -1303,7 +1303,7 @@ void PMusrCanvas::HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunDat
// dataHisto ------------------------------------------------------------- // dataHisto -------------------------------------------------------------
// create histo specific infos // create histo specific infos
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_DataRunNo"; name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName[0] + "_DataRunNo";
name += (int)runNo; name += (int)runNo;
start = data->fDataTimeStart - data->fDataTimeStep/2.0; start = data->fDataTimeStart - data->fDataTimeStep/2.0;
end = data->fDataTimeStart + data->fValue.size()*data->fDataTimeStep + data->fDataTimeStep/2.0; end = data->fDataTimeStart + data->fValue.size()*data->fDataTimeStep + data->fDataTimeStep/2.0;
@ -1339,7 +1339,7 @@ void PMusrCanvas::HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunDat
// theoHisto ------------------------------------------------------------- // theoHisto -------------------------------------------------------------
// create histo specific infos // create histo specific infos
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_TheoRunNo"; name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName[0] + "_TheoRunNo";
name += (int)runNo; name += (int)runNo;
start = data->fTheoryTimeStart - data->fTheoryTimeStep/2.0; start = data->fTheoryTimeStart - data->fTheoryTimeStep/2.0;
end = data->fTheoryTimeStart + data->fTheory.size()*data->fTheoryTimeStep + data->fTheoryTimeStep/2.0; end = data->fTheoryTimeStart + data->fTheory.size()*data->fTheoryTimeStep + data->fTheoryTimeStep/2.0;
@ -2166,8 +2166,8 @@ void PMusrCanvas::PlotData()
PMsrRunList runs = *fMsrHandler->GetMsrRunList(); PMsrRunList runs = *fMsrHandler->GetMsrRunList();
PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber); PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber);
unsigned int runNo = (unsigned int)plotInfo.fRuns[0].Re()-1; unsigned int runNo = (unsigned int)plotInfo.fRuns[0].Re()-1;
TString xAxisTitle = fRunList->GetXAxisTitle(runs[runNo].fRunName, runNo); TString xAxisTitle = fRunList->GetXAxisTitle(runs[runNo].fRunName[0], runNo);
TString yAxisTitle = fRunList->GetYAxisTitle(runs[runNo].fRunName, runNo); TString yAxisTitle = fRunList->GetYAxisTitle(runs[runNo].fRunName[0], runNo);
if (fNonMusrData.size() > 0) { if (fNonMusrData.size() > 0) {
// check if fMultiGraphData needs to be created, and if yes add all data and theory // check if fMultiGraphData needs to be created, and if yes add all data and theory
@ -2250,7 +2250,7 @@ void PMusrCanvas::PlotDifference()
PMsrRunList runs = *fMsrHandler->GetMsrRunList(); PMsrRunList runs = *fMsrHandler->GetMsrRunList();
PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber); PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber);
unsigned int runNo = (unsigned int)plotInfo.fRuns[0].Re()-1; unsigned int runNo = (unsigned int)plotInfo.fRuns[0].Re()-1;
TString xAxisTitle = fRunList->GetXAxisTitle(runs[runNo].fRunName, runNo); TString xAxisTitle = fRunList->GetXAxisTitle(runs[runNo].fRunName[0], runNo);
// if fMultiGraphDiff is not present create it and add the diff data // if fMultiGraphDiff is not present create it and add the diff data
if (!fMultiGraphDiff) { if (!fMultiGraphDiff) {

View File

@ -280,9 +280,9 @@ bool PRunAsymmetry::PrepareData()
// get forward/backward histo from PRunDataHandler object ------------------------ // get forward/backward histo from PRunDataHandler object ------------------------
// get the correct run // get the correct run
PRawRunData *runData = fRawData->GetRunData(fRunInfo->fRunName); PRawRunData *runData = fRawData->GetRunData(fRunInfo->fRunName[0]);
if (!runData) { // run not found if (!runData) { // run not found
cout << endl << "PRunAsymmetry::PrepareData(): Couldn't get run " << fRunInfo->fRunName.Data() << "!"; cout << endl << "PRunAsymmetry::PrepareData(): Couldn't get run " << fRunInfo->fRunName[0].Data() << "!";
return false; return false;
} }
@ -332,7 +332,7 @@ bool PRunAsymmetry::PrepareData()
// check if post pile up data shall be used // check if post pile up data shall be used
unsigned int histoNo[2]; // forward/backward unsigned int histoNo[2]; // forward/backward
if (fRunInfo->fFileFormat.Contains("ppc")) { if (fRunInfo->fFileFormat[0].Contains("ppc")) {
histoNo[0] = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1; histoNo[0] = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1;
histoNo[1] = runData->fDataBin.size()/2 + fRunInfo->fBackwardHistoNo-1; histoNo[1] = runData->fDataBin.size()/2 + fRunInfo->fBackwardHistoNo-1;
} else { } else {
@ -349,12 +349,92 @@ bool PRunAsymmetry::PrepareData()
cout << endl; cout << endl;
return false; return false;
} }
// get raw forward/backward histo data // get raw forward/backward histo data
for (unsigned int i=0; i<runData->fDataBin[histoNo[0]].size(); i++) { for (unsigned int i=0; i<runData->fDataBin[histoNo[0]].size(); i++) {
fForward.push_back(runData->fDataBin[histoNo[0]][i]); fForward.push_back(runData->fDataBin[histoNo[0]][i]);
fBackward.push_back(runData->fDataBin[histoNo[1]][i]); fBackward.push_back(runData->fDataBin[histoNo[1]][i]);
} }
// check if addrun's are present, and if yes add data
// check if there are runs to be added to the current one
if (fRunInfo->fRunName.size() > 1) { // runs to be added present
PRawRunData *addRunData;
for (unsigned int i=1; i<fRunInfo->fRunName.size(); i++) {
// get run to be added to the main one
addRunData = fRawData->GetRunData(fRunInfo->fRunName[i]);
if (addRunData == 0) { // couldn't get run
cout << endl << "PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->fRunName[i].Data() << "!";
return false;
}
// get T0's of the to be added run
int t0Add[2] = {0, 0};
// check if the t0's are given in the msr-file
if (fRunInfo->fT0[0] == -1) { // t0's are NOT in the msr-file
// check if the t0's are in the data file
if (addRunData->fT0s.size() != 0) { // t0's in the run data
// keep the proper t0's. For asymmetry runs, forward/backward are holding the histo no
// fForwardHistoNo starts with 1 not with 0 etc. ;-)
t0Add[0] = addRunData->fT0s[fRunInfo->fForwardHistoNo-1]; // forward t0
t0Add[1] = addRunData->fT0s[fRunInfo->fBackwardHistoNo-1]; // backward t0
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
cout << endl << "PRunAsymmetry::PrepareData(): NO t0's found, neither in the addrun (" << fRunInfo->fRunName[i].Data() << ") data nor in the msr-file!";
return false;
}
} else { // t0's in the msr-file
// check if t0's are given in the data file
if (addRunData->fT0s.size() != 0) {
// compare t0's of the msr-file with the one in the data file
if (fabs(t0Add[0]-addRunData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!!
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo";
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fForwardHistoNo-1];
cout << endl << " This is quite a deviation! Is this done intentionally??";
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
cout << endl;
}
if (fabs(t0Add[1]-addRunData->fT0s[fRunInfo->fBackwardHistoNo-1])>5.0) { // given in bins!!
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING**: backward histo";
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[1];
cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fBackwardHistoNo-1];
cout << endl << " This is quite a deviation! Is this done intentionally??";
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
cout << endl;
}
}
if (2*i+1 < fRunInfo->fT0.size()) {
t0Add[0] = fRunInfo->fT0[2*i];
t0Add[1] = fRunInfo->fT0[2*i+1];
} else {
cout << endl << "PRunAsymmetry::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
cout << fRunInfo->fRunName[i].Data();
cout << "), nor in the msr-file! Will try to use the T0 of the run data (";
cout << fRunInfo->fRunName[i].Data();
cout << ") without any warranty!";
t0Add[0] = fRunInfo->fT0[0];
t0Add[1] = fRunInfo->fT0[1];
}
}
// add forward run
for (unsigned int j=0; j<runData->fDataBin[histoNo[0]].size(); j++) {
// make sure that the index stays in the proper range
if ((j-t0Add[0]+fT0s[0] >= 0) && (j-t0Add[0]+fT0s[0] < addRunData->fDataBin[histoNo[0]].size())) {
fForward[j] += addRunData->fDataBin[histoNo[0]][j-t0Add[0]+fT0s[0]];
}
}
// add backward run
for (unsigned int j=0; j<runData->fDataBin[histoNo[1]].size(); j++) {
// make sure that the index stays in the proper range
if ((j-t0Add[1]+fT0s[1] >= 0) && (j-t0Add[1]+fT0s[1] < addRunData->fDataBin[histoNo[1]].size())) {
fBackward[j] += addRunData->fDataBin[histoNo[1]][j-t0Add[1]+fT0s[1]];
}
}
}
}
// subtract background from histogramms ------------------------------------------ // subtract background from histogramms ------------------------------------------
if (!fRunInfo->fBkgFixPresent[0]) { // no fixed background given if (!fRunInfo->fBkgFixPresent[0]) { // no fixed background given
if (fRunInfo->fBkgRange[0] != 0) { if (fRunInfo->fBkgRange[0] != 0) {
@ -435,11 +515,11 @@ bool PRunAsymmetry::SubtractEstimatedBkg()
double beamPeriod = 0.0; double beamPeriod = 0.0;
// check if data are from PSI, RAL, or TRIUMF // check if data are from PSI, RAL, or TRIUMF
if (fRunInfo->fInstitute.Contains("psi")) if (fRunInfo->fInstitute[0].Contains("psi"))
beamPeriod = ACCEL_PERIOD_PSI; beamPeriod = ACCEL_PERIOD_PSI;
else if (fRunInfo->fInstitute.Contains("ral")) else if (fRunInfo->fInstitute[0].Contains("ral"))
beamPeriod = ACCEL_PERIOD_RAL; beamPeriod = ACCEL_PERIOD_RAL;
else if (fRunInfo->fInstitute.Contains("triumf")) else if (fRunInfo->fInstitute[0].Contains("triumf"))
beamPeriod = ACCEL_PERIOD_TRIUMF; beamPeriod = ACCEL_PERIOD_TRIUMF;
else else
beamPeriod = 0.0; beamPeriod = 0.0;
@ -642,15 +722,6 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
fData.fError.push_back(error); fData.fError.push_back(error);
} }
/*
FILE *fp = fopen("asym.dat", "w");
for (unsigned int i=0; i<fData.fValue.size(); i++) {
fprintf(fp, "%lf, %lf, %lf\n", fData.fDataTimeStart+(double)i*fData.fDataTimeStep, fData.fValue[i], fData.fError[i]);
}
fclose(fp);
return false;
*/
// count the number of bins to be fitted // count the number of bins to be fitted
double time; double time;
fNoOfFitBins=0; fNoOfFitBins=0;

View File

@ -149,35 +149,36 @@ bool PRunDataHandler::ReadFile()
return false; return false;
} }
PMsrRunList::iterator run_it; for (unsigned int i=0; i<runList->size(); i++) {
for (run_it = runList->begin(); run_it != runList->end(); ++run_it) { for (unsigned int j=0; j<runList->at(i).fRunName.size(); j++) {
//cout << endl << "run : " << run_it->fRunName.Data(); // cout << endl << "run : " << runList->at(i).fRunName[j].Data();
fRunName = run_it->fRunName; fRunName = runList->at(i).fRunName[j];
// check is file is already read // check is file is already read
if (FileAlreadyRead(*run_it)) if (FileAlreadyRead(runList->at(i).fRunName[j]))
continue; continue;
// check if file actually exists // check if file actually exists
if (!FileExistsCheck(*run_it)) if (!FileExistsCheck(runList->at(i), j))
return false; return false;
// everything looks fine, hence try to read the data file // everything looks fine, hence try to read the data file
if (!run_it->fFileFormat.CompareTo("root-npp")) // not post pile up corrected histos if (!runList->at(i).fFileFormat[j].CompareTo("root-npp")) // not post pile up corrected histos
success = ReadRootFile(true); success = ReadRootFile(true);
else if (!run_it->fFileFormat.CompareTo("root-ppc")) // post pile up corrected histos else if (!runList->at(i).fFileFormat[j].CompareTo("root-ppc")) // post pile up corrected histos
success = ReadRootFile(false); success = ReadRootFile(false);
else if (!run_it->fFileFormat.CompareTo("nexus")) else if (!runList->at(i).fFileFormat[j].CompareTo("nexus"))
success = ReadNexusFile(); success = ReadNexusFile();
else if (!run_it->fFileFormat.CompareTo("psi-bin")) else if (!runList->at(i).fFileFormat[j].CompareTo("psi-bin"))
success = ReadPsiBinFile(); success = ReadPsiBinFile();
else if (!run_it->fFileFormat.CompareTo("mud")) else if (!runList->at(i).fFileFormat[j].CompareTo("mud"))
success = ReadMudFile(); success = ReadMudFile();
else if (!run_it->fFileFormat.CompareTo("wkm")) else if (!runList->at(i).fFileFormat[j].CompareTo("wkm"))
success = ReadWkmFile(); success = ReadWkmFile();
else if (!run_it->fFileFormat.CompareTo("ascii")) else if (!runList->at(i).fFileFormat[j].CompareTo("ascii"))
success = ReadAsciiFile(); success = ReadAsciiFile();
else if (!run_it->fFileFormat.CompareTo("db")) else if (!runList->at(i).fFileFormat[j].CompareTo("db"))
success = ReadDBFile(); success = ReadDBFile();
else else
success = false; success = false;
}
} }
return success; return success;
@ -190,10 +191,10 @@ bool PRunDataHandler::ReadFile()
* <p> * <p>
* *
*/ */
bool PRunDataHandler::FileAlreadyRead(PMsrRunStructure &runInfo) bool PRunDataHandler::FileAlreadyRead(TString runName)
{ {
for (unsigned int i=0; i<fData.size(); i++) { for (unsigned int i=0; i<fData.size(); i++) {
if (!fData[i].fRunName.CompareTo(runInfo.fRunName)) { // run alread read if (!fData[i].fRunName.CompareTo(runName)) { // run alread read
return true; return true;
} }
} }
@ -208,7 +209,7 @@ bool PRunDataHandler::FileAlreadyRead(PMsrRunStructure &runInfo)
* <p> * <p>
* *
*/ */
bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo) bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned int idx)
{ {
bool success = true; bool success = true;
@ -218,37 +219,37 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo)
TString str; TString str;
TString ext; TString ext;
runInfo.fBeamline.ToLower(); runInfo.fBeamline[idx].ToLower();
runInfo.fInstitute.ToLower(); runInfo.fInstitute[idx].ToLower();
runInfo.fFileFormat.ToLower(); runInfo.fFileFormat[idx].ToLower();
// file extensions for the various formats // file extensions for the various formats
if (!runInfo.fFileFormat.CompareTo("root-npp")) // not post pile up corrected histos if (!runInfo.fFileFormat[idx].CompareTo("root-npp")) // not post pile up corrected histos
ext = TString("root"); ext = TString("root");
else if (!runInfo.fFileFormat.CompareTo("root-ppc")) // post pile up corrected histos else if (!runInfo.fFileFormat[idx].CompareTo("root-ppc")) // post pile up corrected histos
ext = TString("root"); ext = TString("root");
else if (!runInfo.fFileFormat.CompareTo("nexus")) else if (!runInfo.fFileFormat[idx].CompareTo("nexus"))
ext = TString("nexus"); ext = TString("nexus");
else if (!runInfo.fFileFormat.CompareTo("psi-bin")) else if (!runInfo.fFileFormat[idx].CompareTo("psi-bin"))
ext = TString("bin"); ext = TString("bin");
else if (!runInfo.fFileFormat.CompareTo("mud")) else if (!runInfo.fFileFormat[idx].CompareTo("mud"))
ext = TString("mud"); ext = TString("mud");
else if (!runInfo.fFileFormat.CompareTo("wkm")) { else if (!runInfo.fFileFormat[idx].CompareTo("wkm")) {
if (!runInfo.fBeamline.CompareTo("mue4")) if (!runInfo.fBeamline[idx].CompareTo("mue4"))
ext = TString("nemu"); ext = TString("nemu");
else else
ext = runInfo.fBeamline; ext = runInfo.fBeamline[idx];
} }
else if (!runInfo.fFileFormat.CompareTo("ascii")) else if (!runInfo.fFileFormat[idx].CompareTo("ascii"))
ext = TString("dat"); ext = TString("dat");
else if (!runInfo.fFileFormat.CompareTo("db")) else if (!runInfo.fFileFormat[idx].CompareTo("db"))
ext = TString("db"); ext = TString("db");
else else
success = false; success = false;
// unkown file format found // unkown file format found
if (!success) { if (!success) {
str = runInfo.fFileFormat; str = runInfo.fFileFormat[idx];
str.ToUpper(); str.ToUpper();
cout << endl << "File Format '" << str.Data() << "' unsupported."; cout << endl << "File Format '" << str.Data() << "' unsupported.";
cout << endl << " support file formats are:"; cout << endl << " support file formats are:";
@ -265,7 +266,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo)
} }
// check if the file is in the local directory // check if the file is in the local directory
str = runInfo.fRunName + TString(".") + ext; str = runInfo.fRunName[idx] + TString(".") + ext;
if (gSystem->AccessPathName(str.Data())!=true) { // found in the local dir if (gSystem->AccessPathName(str.Data())!=true) { // found in the local dir
pathName = str; pathName = str;
} }
@ -273,7 +274,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo)
// check if the file is found in the directory given in the startup file // check if the file is found in the directory given in the startup file
if (pathName.CompareTo("???") == 0) { // not found in local directory search if (pathName.CompareTo("???") == 0) { // not found in local directory search
for (unsigned int i=0; i<fDataPath.size(); i++) { for (unsigned int i=0; i<fDataPath.size(); i++) {
str = fDataPath[i] + TString("/") + runInfo.fRunName + TString(".") + ext; str = fDataPath[i] + TString("/") + runInfo.fRunName[idx] + TString(".") + ext;
if (gSystem->AccessPathName(str.Data())!=true) { // found if (gSystem->AccessPathName(str.Data())!=true) { // found
pathName = str; pathName = str;
break; break;
@ -290,7 +291,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo)
TObjString *ostr; TObjString *ostr;
for (int i=0; i<tokens->GetEntries(); i++) { for (int i=0; i<tokens->GetEntries(); i++) {
ostr = dynamic_cast<TObjString*>(tokens->At(i)); ostr = dynamic_cast<TObjString*>(tokens->At(i));
str = ostr->GetString() + TString("/") + runInfo.fRunName + TString(".") + ext; str = ostr->GetString() + TString("/") + runInfo.fRunName[idx] + TString(".") + ext;
if (gSystem->AccessPathName(str.Data())!=true) { // found if (gSystem->AccessPathName(str.Data())!=true) { // found
pathName = str; pathName = str;
break; break;
@ -304,18 +305,18 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo)
// WKMFULLDATAPATH has the structure: path_1:path_2:...:path_n // WKMFULLDATAPATH has the structure: path_1:path_2:...:path_n
TObjArray *tokens = str.Tokenize(":"); TObjArray *tokens = str.Tokenize(":");
TObjString *ostr; TObjString *ostr;
runInfo.fInstitute.ToUpper(); runInfo.fInstitute[idx].ToUpper();
runInfo.fBeamline.ToUpper(); runInfo.fBeamline[idx].ToUpper();
TDatime datetime; TDatime datetime;
TString dt; TString dt;
dt += datetime.GetYear(); dt += datetime.GetYear();
for (int i=0; i<tokens->GetEntries(); i++) { for (int i=0; i<tokens->GetEntries(); i++) {
ostr = dynamic_cast<TObjString*>(tokens->At(i)); ostr = dynamic_cast<TObjString*>(tokens->At(i));
str = ostr->GetString() + TString("/DATA/") + str = ostr->GetString() + TString("/DATA/") +
runInfo.fInstitute + TString("/") + runInfo.fInstitute[idx] + TString("/") +
runInfo.fBeamline + TString("/") + runInfo.fBeamline[idx] + TString("/") +
dt + TString("/") + dt + TString("/") +
runInfo.fRunName + TString(".") + ext; runInfo.fRunName[idx] + TString(".") + ext;
cout << endl << ">> generated path: " << str.Data() << endl; cout << endl << ">> generated path: " << str.Data() << endl;
if (gSystem->AccessPathName(str.Data())!=true) { // found if (gSystem->AccessPathName(str.Data())!=true) { // found
pathName = str; pathName = str;
@ -326,7 +327,7 @@ cout << endl << ">> generated path: " << str.Data() << endl;
// no proper path name found // no proper path name found
if (pathName.CompareTo("???") == 0) { if (pathName.CompareTo("???") == 0) {
cout << endl << "**ERROR** Couldn't find '" << runInfo.fRunName << "' in any standard path."; cout << endl << "**ERROR** Couldn't find '" << runInfo.fRunName[idx] << "' in any standard path.";
cout << endl << " standard search pathes are:"; cout << endl << " standard search pathes are:";
cout << endl << " 1. the local directory"; cout << endl << " 1. the local directory";
cout << endl << " 2. the data directory given in the startup XML file"; cout << endl << " 2. the data directory given in the startup XML file";
@ -355,6 +356,7 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
PRawRunData runData; PRawRunData runData;
//cout << endl << ">> in ReadRootFile() ..."; //cout << endl << ">> in ReadRootFile() ...";
//cout << endl << ">> fRunPathName = " << fRunPathName.Data();
TFile f(fRunPathName.Data()); TFile f(fRunPathName.Data());
if (f.IsZombie()) { if (f.IsZombie()) {
return false; return false;
@ -402,8 +404,9 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
// check if t0's are there // check if t0's are there
if (t0[0] != -1) { // ugly, but at the moment there is no other way if (t0[0] != -1) { // ugly, but at the moment there is no other way
// copy t0's so they are not lost // copy t0's so they are not lost
for (int i=0; i<noOfHistos; i++) for (int i=0; i<noOfHistos; i++) {
runData.fT0s.push_back(t0[i]); runData.fT0s.push_back((int)t0[i]);
}
} }
// read data --------------------------------------------------------- // read data ---------------------------------------------------------
@ -843,7 +846,7 @@ cout << endl;
return false; return false;
} }
for (unsigned int i=0; i<ivec.size(); i++) for (unsigned int i=0; i<ivec.size(); i++)
runData.fT0s.push_back((double)ivec[i]); runData.fT0s.push_back(ivec[i]);
// fill raw data // fill raw data
PDoubleVector histoData; PDoubleVector histoData;

View File

@ -63,7 +63,7 @@ PRunNonMusr::PRunNonMusr() : PRunBase()
PRunNonMusr::PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag) PRunNonMusr::PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag)
{ {
// get the proper run // get the proper run
fRawRunData = fRawData->GetRunData(fRunInfo->fRunName); fRawRunData = fRawData->GetRunData(fRunInfo->fRunName[0]);
if (!fRawRunData) { // couldn't get run if (!fRawRunData) { // couldn't get run
cout << endl << "PRunNonMusr::PRunNonMusr(): **ERROR** Couldn't get raw run data!"; cout << endl << "PRunNonMusr::PRunNonMusr(): **ERROR** Couldn't get raw run data!";
fValid = false; fValid = false;
@ -237,7 +237,7 @@ bool PRunNonMusr::PrepareViewData()
{ {
bool success = true; bool success = true;
cout << endl << ">> fRunInfo->fRunName = " << fRunInfo->fRunName.Data(); cout << endl << ">> fRunInfo->fRunName = " << fRunInfo->fRunName[0].Data();
// get x-, y-index // get x-, y-index
unsigned int xIndex = GetXIndex(); unsigned int xIndex = GetXIndex();

View File

@ -307,12 +307,133 @@ bool PRunSingleHisto::PrepareData()
// cout << endl << "in PRunSingleHisto::PrepareData(): will feed fData"; // cout << endl << "in PRunSingleHisto::PrepareData(): will feed fData";
bool success = true; bool success = true;
// get the proper run
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName[0]);
if (!runData) { // couldn't get run
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->fRunName[0].Data() << "!";
return false;
}
// check if post pile up data shall be used
unsigned int histoNo;
if (fRunInfo->fFileFormat[0].Contains("ppc")) {
histoNo = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1;
} else {
histoNo = fRunInfo->fForwardHistoNo-1;
}
if ((runData->fDataBin.size() < histoNo) || (histoNo < 0)) {
cout << endl << "PRunSingleHisto::PrepareData(): **PANIC ERROR**:";
cout << endl << " histoNo found = " << histoNo << ", but there are only " << runData->fDataBin.size() << " runs!?!?";
cout << endl << " Will quite :-(";
cout << endl;
return false;
}
// check if the t0's are given in the msr-file
if (fRunInfo->fT0[0] == -1) { // t0's are NOT in the msr-file
// check if the t0's are in the data file
if (runData->fT0s.size() != 0) { // t0's in the run data
// keep the proper t0's. For single histo runs, forward is holding the histo no
// fForwardHistoNo starts with 1 not with 0 ;-)
fT0s.push_back(runData->fT0s[fRunInfo->fForwardHistoNo-1]);
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
cout << endl << " run: " << fRunInfo->fRunName[0].Data();
return false;
}
} else { // t0's in the msr-file
// check if t0's are given in the data file
if (runData->fT0s.size() != 0) {
// compare t0's of the msr-file with the one in the data file
if (fabs(fRunInfo->fT0[0]-runData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!!
cout << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
cout << endl << " t0 from the data file is " << runData->fT0s[fRunInfo->fForwardHistoNo-1];
cout << endl << " This is quite a deviation! Is this done intentionally??";
cout << endl;
}
}
fT0s.push_back(fRunInfo->fT0[0]);
}
// check if t0 is within proper bounds
int t0 = fT0s[0];
if ((t0 < 0) || (t0 > (int)runData->fDataBin[histoNo].size())) {
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** t0 data bin doesn't make any sense!";
return false;
}
// check if there are runs to be added to the current one
if (fRunInfo->fRunName.size() > 1) { // runs to be added present
PRawRunData *addRunData;
for (unsigned int i=1; i<fRunInfo->fRunName.size(); i++) {
// get run to be added to the main one
addRunData = fRawData->GetRunData(fRunInfo->fRunName[i]);
if (addRunData == 0) { // couldn't get run
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->fRunName[i].Data() << "!";
return false;
}
// get T0's of the to be added run
int t0Add;
// check if the t0's are given in the msr-file
if (fRunInfo->fT0[i] == -1) { // t0's are NOT in the msr-file
// check if the t0's are in the data file
if (addRunData->fT0s.size() != 0) { // t0's in the run data
// keep the proper t0's. For single histo runs, forward is holding the histo no
// fForwardHistoNo starts with 1 not with 0 ;-)
t0Add = addRunData->fT0s[fRunInfo->fForwardHistoNo-1];
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the addrun data nor in the msr-file!";
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
return false;
}
} else { // t0's in the msr-file
// check if t0's are given in the data file
if (addRunData->fT0s.size() != 0) {
// compare t0's of the msr-file with the one in the data file
if (fabs(fRunInfo->fT0[i]-addRunData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!!
cout << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[i];
cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fForwardHistoNo-1];
cout << endl << " This is quite a deviation! Is this done intentionally??";
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
cout << endl;
}
}
if (i < fRunInfo->fT0.size()) {
t0Add = fRunInfo->fT0[i];
} else {
cout << endl << "PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
cout << fRunInfo->fRunName[i].Data();
cout << "), nor in the msr-file! Will try to use the T0 of the run data (";
cout << fRunInfo->fRunName[i].Data();
cout << ") without any warranty!";
t0Add = fRunInfo->fT0[0];
}
}
// add run
for (unsigned int j=0; j<runData->fDataBin[histoNo].size(); j++) {
// make sure that the index stays in the proper range
if ((j-t0Add+t0 >= 0) && (j-t0Add+t0 < addRunData->fDataBin[histoNo].size())) {
runData->fDataBin[histoNo][j] += addRunData->fDataBin[histoNo][j-t0Add+t0];
}
}
}
}
// keep the time resolution in (us)
fTimeResolution = runData->fTimeResolution/1.0e3;
if (fHandleTag == kFit) if (fHandleTag == kFit)
success = PrepareFitData(); success = PrepareFitData(runData, histoNo);
else if ((fHandleTag == kView) && !fRunInfo->fLifetimeCorrection) else if ((fHandleTag == kView) && !fRunInfo->fLifetimeCorrection)
success = PrepareRawViewData(); success = PrepareRawViewData(runData, histoNo);
else if ((fHandleTag == kView) && fRunInfo->fLifetimeCorrection) else if ((fHandleTag == kView) && fRunInfo->fLifetimeCorrection)
success = PrepareViewData(); success = PrepareViewData(runData, histoNo);
else else
success = false; success = false;
@ -326,23 +447,31 @@ bool PRunSingleHisto::PrepareData()
* <p> * <p>
* *
*/ */
bool PRunSingleHisto::PrepareFitData() bool PRunSingleHisto::PrepareFitData(PRawRunData* runData, const unsigned int histoNo)
{ {
/*
// get the proper run // get the proper run
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName); PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName[0]);
if (!runData) { // couldn't get run if (runData == 0) { // couldn't get run
cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** Couldn't get run " << fRunInfo->fRunName.Data() << "!"; cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** Couldn't get run " << fRunInfo->fRunName[0].Data() << "!";
return false; return false;
} }
// keep the time resolution in (us) // get the proper histo number and check if post pile up data shall be used (LEM)
fTimeResolution = runData->fTimeResolution/1.0e3; unsigned int histoNo;
if (fRunInfo->fFileFormat[0].Contains("ppc")) {
// keep start/stop time for fit histoNo = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1;
fFitStartTime = fRunInfo->fFitRange[0]; } else {
fFitStopTime = fRunInfo->fFitRange[1]; histoNo = fRunInfo->fForwardHistoNo-1;
//cout << endl << "start/stop (fit): " << fFitStartTime << ", " << fFitStopTime; }
if ((runData->fDataBin.size() < histoNo) || (histoNo < 0)) {
cout << endl << "PRunSingleHisto::PrepareFitData(): **PANIC ERROR**:";
cout << endl << " histoNo found = " << histoNo << ", but there are only " << runData->fDataBin.size() << " runs!?!?";
cout << endl << " Will quit :-(";
cout << endl;
return false;
}
// check if the t0's are given in the msr-file // check if the t0's are given in the msr-file
if (fRunInfo->fT0[0] == -1) { // t0's are NOT in the msr-file if (fRunInfo->fT0[0] == -1) { // t0's are NOT in the msr-file
@ -352,7 +481,8 @@ bool PRunSingleHisto::PrepareFitData()
// fForwardHistoNo starts with 1 not with 0 ;-) // fForwardHistoNo starts with 1 not with 0 ;-)
fT0s.push_back(runData->fT0s[fRunInfo->fForwardHistoNo-1]); fT0s.push_back(runData->fT0s[fRunInfo->fForwardHistoNo-1]);
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable! } else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
cout << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!"; cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
cout << endl << " run: " << fRunInfo->fRunName[0].Data();
return false; return false;
} }
} else { // t0's in the msr-file } else { // t0's in the msr-file
@ -370,28 +500,88 @@ bool PRunSingleHisto::PrepareFitData()
fT0s.push_back(fRunInfo->fT0[0]); fT0s.push_back(fRunInfo->fT0[0]);
} }
// check if post pile up data shall be used // check if t0 is within proper bounds
unsigned int histoNo; int t0 = fT0s[0];
if (fRunInfo->fFileFormat.Contains("ppc")) { if ((t0 < 0) || (t0 > (int)runData->fDataBin[histoNo].size())) {
histoNo = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1; cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** t0 data bin doesn't make any sense!";
} else {
histoNo = fRunInfo->fForwardHistoNo-1;
}
if ((runData->fDataBin.size() < histoNo) || (histoNo < 0)) {
cout << endl << "PRunSingleHisto::PrepareFitData(): **PANIC ERROR**:";
cout << endl << " histoNo found = " << histoNo << ", but there are only " << runData->fDataBin.size() << " runs!?!?";
cout << endl << " Will quite :-(";
cout << endl;
return false; return false;
} }
// check if there are runs to be added to the current one
if (fRunInfo->fRunName.size() > 1) { // runs to be added present
PRawRunData *addRunData;
for (unsigned int i=1; i<fRunInfo->fRunName.size(); i++) {
// get run to be added to the main one
addRunData = fRawData->GetRunData(fRunInfo->fRunName[i]);
if (addRunData == 0) { // couldn't get run
cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** Couldn't get addrun " << fRunInfo->fRunName[i].Data() << "!";
return false;
}
// get T0's of the to be added run
int t0Add;
// check if the t0's are given in the msr-file
if (fRunInfo->fT0[i] == -1) { // t0's are NOT in the msr-file
// check if the t0's are in the data file
if (addRunData->fT0s.size() != 0) { // t0's in the run data
// keep the proper t0's. For single histo runs, forward is holding the histo no
// fForwardHistoNo starts with 1 not with 0 ;-)
t0Add = addRunData->fT0s[fRunInfo->fForwardHistoNo-1];
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** NO t0's found, neither in the addrun data nor in the msr-file!";
cout << endl << " addrun: " << fRunInfo->fRunName[i].Data();
return false;
}
} else { // t0's in the msr-file
// check if t0's are given in the data file
if (addRunData->fT0s.size() != 0) {
// compare t0's of the msr-file with the one in the data file
if (fabs(fRunInfo->fT0[i]-addRunData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!!
cout << endl << "PRunSingleHisto::PrepareFitData(): **WARNING**:";
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[i];
cout << endl << " t0 from the data file is " << addRunData->fT0s[fRunInfo->fForwardHistoNo-1];
cout << endl << " This is quite a deviation! Is this done intentionally??";
cout << endl;
}
}
if (i < fRunInfo->fT0.size()) {
t0Add = fRunInfo->fT0[i];
} else {
cout << endl << "PRunSingleHisto::PrepareFitData(): **WARNING** NO t0's found, neither in the addrun data (";
cout << fRunInfo->fRunName[i].Data();
cout << "), nor in the msr-file! Will try to use the T0 of the run data (";
cout << fRunInfo->fRunName[i].Data();
cout << ") without any warranty!";
t0Add = fRunInfo->fT0[0];
}
}
// add run
for (unsigned int j=0; j<runData->fDataBin[histoNo].size(); j++) {
// make sure that the index stays in the proper range
if ((j-t0Add+t0 >= 0) && (j-t0Add+t0 < addRunData->fDataBin[histoNo].size())) {
runData->fDataBin[histoNo][j] += addRunData->fDataBin[histoNo][j-t0Add+t0];
}
}
}
}
// keep the time resolution in (us)
fTimeResolution = runData->fTimeResolution/1.0e3;
*/
// keep start/stop time for fit
fFitStartTime = fRunInfo->fFitRange[0];
fFitStopTime = fRunInfo->fFitRange[1];
//cout << endl << "start/stop (fit): " << fFitStartTime << ", " << fFitStopTime;
// transform raw histo data. This is done the following way (for details see the manual): // transform raw histo data. This is done the following way (for details see the manual):
// for the single histo fit, just the rebinned raw data are copied // for the single histo fit, just the rebinned raw data are copied
// first get start data, end data, and t0 // first get start data, end data, and t0
unsigned int start; unsigned int start;
unsigned int end; unsigned int end;
double t0 = fT0s[0];
start = fRunInfo->fDataRange[0]; start = fRunInfo->fDataRange[0];
end = fRunInfo->fDataRange[1]; end = fRunInfo->fDataRange[1];
// check if start, end, and t0 make any sense // check if start, end, and t0 make any sense
@ -411,11 +601,6 @@ bool PRunSingleHisto::PrepareFitData()
cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** end data bin doesn't make any sense!"; cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** end data bin doesn't make any sense!";
return false; return false;
} }
// 4th check if t0 is within proper bounds
if ((t0 < 0) || (t0 > runData->fDataBin[histoNo].size())) {
cout << endl << "PRunSingleHisto::PrepareFitData(): **ERROR** t0 data bin doesn't make any sense!";
return false;
}
// check how the background shall be handled // check how the background shall be handled
if (fRunInfo->fBkgFitParamNo == -1) { // bkg shall **NOT** be fitted if (fRunInfo->fBkgFitParamNo == -1) { // bkg shall **NOT** be fitted
@ -433,11 +618,12 @@ bool PRunSingleHisto::PrepareFitData()
} }
// everything looks fine, hence fill data set // everything looks fine, hence fill data set
int t0 = fT0s[0];
double value = 0.0; double value = 0.0;
double normalizer = 1.0; double normalizer = 1.0;
// data start at data_start-t0 // data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing // time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.fDataTimeStart = fTimeResolution*(((double)start-t0)+(double)fRunInfo->fPacking/2.0); fData.fDataTimeStart = fTimeResolution*((double)(start-t0)+(double)(fRunInfo->fPacking-1)/2.0);
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking; fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
for (unsigned i=start; i<end; i++) { for (unsigned i=start; i<end; i++) {
if (fRunInfo->fPacking == 1) { if (fRunInfo->fPacking == 1) {
@ -485,69 +671,16 @@ bool PRunSingleHisto::PrepareFitData()
* <p> Muon raw data * <p> Muon raw data
* *
*/ */
bool PRunSingleHisto::PrepareRawViewData() bool PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const unsigned int histoNo)
{ {
// get the proper run
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName);
if (!runData) { // couldn't get run
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** Couldn't get run " << fRunInfo->fRunName.Data() << "!";
return false;
}
// keep the time resolution in (us)
fTimeResolution = runData->fTimeResolution/1.0e3;
// check if the t0's are given in the msr-file
if (fRunInfo->fT0[0] == -1) { // t0's are NOT in the msr-file
// check if the t0's are in the data file
if (runData->fT0s.size() != 0) { // t0's in the run data
// keep the proper t0's. For single histo runs, forward is holding the histo no
// fForwardHistoNo starts with 1 not with 0 ;-)
fT0s.push_back(runData->fT0s[fRunInfo->fForwardHistoNo-1]);
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
return false;
}
} else { // t0's in the msr-file
// check if t0's are given in the data file
if (runData->fT0s.size() != 0) {
// compare t0's of the msr-file with the one in the data file
if (fabs(fRunInfo->fT0[0]-runData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!!
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **WARNING**:";
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
cout << endl << " t0 from the data file is " << runData->fT0s[fRunInfo->fForwardHistoNo-1];
cout << endl << " This is quite a deviation! Is this done intentionally??";
cout << endl;
}
}
fT0s.push_back(fRunInfo->fT0[0]);
}
// check if post pile up data shall be used
unsigned int histoNo;
if (fRunInfo->fFileFormat.Contains("ppc")) {
histoNo = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1;
} else {
histoNo = fRunInfo->fForwardHistoNo-1;
}
if ((runData->fDataBin.size() < histoNo) || (histoNo < 0)) {
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **PANIC ERROR**:";
cout << endl << " histoNo found = " << histoNo << ", but there are only " << runData->fDataBin.size() << " runs!?!?";
cout << endl << " Will quite :-(";
cout << endl;
return false;
}
// transform raw histo data. This is done the following way (for details see the manual): // transform raw histo data. This is done the following way (for details see the manual):
// for the single histo fit, just the rebinned raw data are copied // for the single histo fit, just the rebinned raw data are copied
// first get start data, end data, and t0 // first get start data, end data, and t0
unsigned int start; unsigned int start;
unsigned int end; unsigned int end;
double t0 = fT0s[0];
// raw data, since PMusrCanvas is doing ranging etc. // raw data, since PMusrCanvas is doing ranging etc.
// start = the first bin which is a multiple of packing backward from t0 // start = the first bin which is a multiple of packing backward from first good data bin
start = (int)t0 - ((int)t0/fRunInfo->fPacking)*fRunInfo->fPacking; start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/fRunInfo->fPacking)*fRunInfo->fPacking;
// end = last bin starting from start which is a multipl of packing and still within the data // end = last bin starting from start which is a multipl of packing and still within the data
end = start + ((runData->fDataBin[histoNo].size()-start-1)/fRunInfo->fPacking)*fRunInfo->fPacking; end = start + ((runData->fDataBin[histoNo].size()-start-1)/fRunInfo->fPacking)*fRunInfo->fPacking;
// check if start, end, and t0 make any sense // check if start, end, and t0 make any sense
@ -567,24 +700,21 @@ bool PRunSingleHisto::PrepareRawViewData()
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!"; cout << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
return false; return false;
} }
// 4th check if t0 is within proper bounds
if ((t0 < 0) || (t0 > runData->fDataBin[histoNo].size())) {
cout << endl << "PRunSingleHisto::PrepareRawViewData(): **ERROR** t0 data bin doesn't make any sense!";
return false;
}
// everything looks fine, hence fill data set // everything looks fine, hence fill data set
int t0 = fT0s[0];
double value = 0.0; double value = 0.0;
// data start at data_start-t0 // data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing // time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.fDataTimeStart = fTimeResolution*((double)start-t0+(double)fRunInfo->fPacking/2.0); fData.fDataTimeStart = fTimeResolution*((double)start-(double)t0+(double)(fRunInfo->fPacking-1)/2.0);
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
/* /*
cout << endl << ">> time resolution = " << fTimeResolution; cout << endl << ">> time resolution = " << fTimeResolution;
cout << endl << ">> start = " << start << ", t0 = " << t0 << ", packing = " << fRunInfo->fPacking; cout << endl << ">> start = " << start << ", t0 = " << t0 << ", packing = " << fRunInfo->fPacking;
cout << endl << ">> data start time = " << fData.fDataTimeStart; cout << endl << ">> data start time = " << fData.fDataTimeStart;
*/ */
double normalizer = 1.0; double normalizer = 1.0;
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
for (unsigned i=start; i<end; i++) { for (unsigned i=start; i<end; i++) {
if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data
// in order that after rebinning the fit does not need to be redone (important for plots) // in order that after rebinning the fit does not need to be redone (important for plots)
@ -659,13 +789,11 @@ cout << endl << ">> data start time = " << fData.fDataTimeStart;
// calculate theory // calculate theory
unsigned int size = runData->fDataBin[histoNo].size(); unsigned int size = runData->fDataBin[histoNo].size();
double startTime = -fT0s[0]*fTimeResolution;
double theoryValue; double theoryValue;
fData.fTheoryTimeStart = startTime; fData.fTheoryTimeStart = fData.fDataTimeStart;
//cout << endl << ">> theory start time = " << fData.fTheoryTimeStart;
fData.fTheoryTimeStep = fTimeResolution; fData.fTheoryTimeStep = fTimeResolution;
for (unsigned int i=0; i<size; i++) { for (unsigned int i=0; i<size; i++) {
time = startTime + (double)i*fTimeResolution; time = fData.fTheoryTimeStart + i*fTimeResolution;
theoryValue = fTheory->Func(time, par, fFuncValues); theoryValue = fTheory->Func(time, par, fFuncValues);
if (theoryValue > 10.0) { // dirty hack needs to be fixed!! if (theoryValue > 10.0) { // dirty hack needs to be fixed!!
theoryValue = 0.0; theoryValue = 0.0;
@ -693,71 +821,20 @@ cout << endl << ">> data start time = " << fData.fDataTimeStart;
* \f[ N(t_i) = \frac{1}{p}\, \sum_{j=i}^{i+p} n_j \f] * \f[ N(t_i) = \frac{1}{p}\, \sum_{j=i}^{i+p} n_j \f]
* with \f$ n_j \f$ the raw histogram data bins. * with \f$ n_j \f$ the raw histogram data bins.
*/ */
bool PRunSingleHisto::PrepareViewData() bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int histoNo)
{ {
// get the proper run
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName);
if (!runData) { // couldn't get run
cout << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** Couldn't get run " << fRunInfo->fRunName.Data() << "!";
return false;
}
// keep the time resolution in (us)
fTimeResolution = runData->fTimeResolution/1.0e3;
// check if the t0's are given in the msr-file
if (fRunInfo->fT0[0] == -1) { // t0's are NOT in the msr-file
// check if the t0's are in the data file
if (runData->fT0s.size() != 0) { // t0's in the run data
// keep the proper t0's. For single histo runs, forward is holding the histo no
// fForwardHistoNo starts with 1 not with 0 ;-)
fT0s.push_back(runData->fT0s[fRunInfo->fForwardHistoNo-1]);
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
cout << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
return false;
}
} else { // t0's in the msr-file
// check if t0's are given in the data file
if (runData->fT0s.size() != 0) {
// compare t0's of the msr-file with the one in the data file
if (fabs(fRunInfo->fT0[0]-runData->fT0s[fRunInfo->fForwardHistoNo-1])>5.0) { // given in bins!!
cout << endl << "PRunSingleHisto::PrepareViewData(): **WARNING**:";
cout << endl << " t0 from the msr-file is " << fRunInfo->fT0[0];
cout << endl << " t0 from the data file is " << runData->fT0s[fRunInfo->fForwardHistoNo-1];
cout << endl << " This is quite a deviation! Is this done intentionally??";
cout << endl;
}
}
fT0s.push_back(fRunInfo->fT0[0]);
}
// check if post pile up data shall be used
unsigned int histoNo;
if (fRunInfo->fFileFormat.Contains("ppc")) {
histoNo = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1;
} else {
histoNo = fRunInfo->fForwardHistoNo-1;
}
if ((runData->fDataBin.size() < histoNo) || (histoNo < 0)) {
cout << endl << "PRunSingleHisto::PrepareViewData(): **PANIC ERROR**:";
cout << endl << " histoNo found = " << histoNo << ", but there are only " << runData->fDataBin.size() << " runs!?!?";
cout << endl << " Will quite :-(";
cout << endl;
return false;
}
// transform raw histo data. This is done the following way (for details see the manual): // transform raw histo data. This is done the following way (for details see the manual):
// for the single histo fit, just the rebinned raw data are copied // for the single histo fit, just the rebinned raw data are copied
// first get start data, end data, and t0 // first get start data, end data, and t0
unsigned int start; unsigned int start;
unsigned int end; unsigned int end;
double t0 = fT0s[0]; int t0 = fT0s[0];
// raw data, since PMusrCanvas is doing ranging etc.
// start = the first bin which is a multiple of packing backward from t0 // start = the first bin which is a multiple of packing backward from first good data bin
start = (int)t0 - ((int)t0/fRunInfo->fPacking)*fRunInfo->fPacking; start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/fRunInfo->fPacking)*fRunInfo->fPacking;
// end = last bin starting from start which is a multipl of packing and still within the data // end = last bin starting from start which is a multipl of packing and still within the data
end = start + ((runData->fDataBin[histoNo].size()-start-1)/fRunInfo->fPacking)*fRunInfo->fPacking; end = start + ((runData->fDataBin[histoNo].size()-start-1)/fRunInfo->fPacking)*fRunInfo->fPacking;
// check if start, end, and t0 make any sense // check if start, end, and t0 make any sense
// 1st check if start and end are in proper order // 1st check if start and end are in proper order
if (end < start) { // need to swap them if (end < start) { // need to swap them
@ -775,11 +852,6 @@ bool PRunSingleHisto::PrepareViewData()
cout << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!"; cout << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
return false; return false;
} }
// 4th check if t0 is within proper bounds
if ((t0 < 0) || (t0 > runData->fDataBin[histoNo].size())) {
cout << endl << "PRunSingleHisto::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
return false;
}
// everything looks fine, hence fill data set // everything looks fine, hence fill data set
@ -831,7 +903,7 @@ bool PRunSingleHisto::PrepareViewData()
// data start at data_start-t0 // data start at data_start-t0
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing // time shifted so that packing is included correctly, i.e. t0 == t0 after packing
fData.fDataTimeStart = fTimeResolution*((double)start-t0+(double)fRunInfo->fPacking/2.0); fData.fDataTimeStart = fTimeResolution*((double)start-(double)t0+(double)(fRunInfo->fPacking-1)/2.0);
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking; fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
/* /*
cout << endl << ">> start time = " << fData.fDataTimeStart << ", step = " << fData.fDataTimeStep; cout << endl << ">> start time = " << fData.fDataTimeStart << ", step = " << fData.fDataTimeStep;
@ -873,13 +945,12 @@ cout << endl << "--------------------------------";
// calculate theory // calculate theory
unsigned int size = runData->fDataBin[histoNo].size(); unsigned int size = runData->fDataBin[histoNo].size();
double startTime = -fT0s[0]*fTimeResolution;
double theoryValue; double theoryValue;
fData.fTheoryTimeStart = startTime; fData.fTheoryTimeStart = fData.fDataTimeStart;
fData.fTheoryTimeStep = fTimeResolution; fData.fTheoryTimeStep = fTimeResolution;
//cout << endl << ">> size=" << size << ", startTime=" << startTime << ", fTimeResolution=" << fTimeResolution; //cout << endl << ">> size=" << size << ", startTime=" << startTime << ", fTimeResolution=" << fTimeResolution;
for (unsigned int i=0; i<size; i++) { for (unsigned int i=0; i<size; i++) {
time = startTime + (double)i*fTimeResolution; time = fData.fTheoryTimeStart + (double)i*fTimeResolution;
theoryValue = fTheory->Func(time, par, fFuncValues); theoryValue = fTheory->Func(time, par, fFuncValues);
if (theoryValue > 10.0) { // dirty hack needs to be fixed!! if (theoryValue > 10.0) { // dirty hack needs to be fixed!!
theoryValue = 0.0; theoryValue = 0.0;
@ -904,11 +975,11 @@ bool PRunSingleHisto::EstimateBkg(unsigned int histoNo)
double beamPeriod = 0.0; double beamPeriod = 0.0;
// check if data are from PSI, RAL, or TRIUMF // check if data are from PSI, RAL, or TRIUMF
if (fRunInfo->fInstitute.Contains("psi")) if (fRunInfo->fInstitute[0].Contains("psi"))
beamPeriod = ACCEL_PERIOD_PSI; beamPeriod = ACCEL_PERIOD_PSI;
else if (fRunInfo->fInstitute.Contains("ral")) else if (fRunInfo->fInstitute[0].Contains("ral"))
beamPeriod = ACCEL_PERIOD_RAL; beamPeriod = ACCEL_PERIOD_RAL;
else if (fRunInfo->fInstitute.Contains("triumf")) else if (fRunInfo->fInstitute[0].Contains("triumf"))
beamPeriod = ACCEL_PERIOD_TRIUMF; beamPeriod = ACCEL_PERIOD_TRIUMF;
else else
beamPeriod = 0.0; beamPeriod = 0.0;
@ -934,7 +1005,7 @@ bool PRunSingleHisto::EstimateBkg(unsigned int histoNo)
} }
// get the proper run // get the proper run
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName); PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName[0]);
// check if start is within histogram bounds // check if start is within histogram bounds
if ((start < 0) || (start >= runData->fDataBin[histoNo].size())) { if ((start < 0) || (start >= runData->fDataBin[histoNo].size())) {
@ -963,7 +1034,7 @@ bool PRunSingleHisto::EstimateBkg(unsigned int histoNo)
fBackground = bkg / (fTimeResolution * 1e3); // keep background (per 1 nsec) for chisq, max.log.likelihood, fTimeResolution us->ns fBackground = bkg / (fTimeResolution * 1e3); // keep background (per 1 nsec) for chisq, max.log.likelihood, fTimeResolution us->ns
cout << endl << ">> fRunInfo->fRunName=" << fRunInfo->fRunName.Data() << ", histNo=" << histoNo << ", fBackground=" << fBackground; cout << endl << ">> fRunInfo->fRunName=" << fRunInfo->fRunName[0].Data() << ", histNo=" << histoNo << ", fBackground=" << fBackground;
return true; return true;
} }

View File

@ -186,7 +186,7 @@ typedef struct {
double fTemp; ///< temperature during the run double fTemp; ///< temperature during the run
double fEnergy; ///< implantation energy of the muon double fEnergy; ///< implantation energy of the muon
double fTimeResolution; ///< time resolution of the run double fTimeResolution; ///< time resolution of the run
PDoubleVector fT0s; ///< vector of t0's of a run PIntVector fT0s; ///< vector of t0's of a run
vector<PDoubleVector> fDataBin; ///< vector of all histos of a run vector<PDoubleVector> fDataBin; ///< vector of all histos of a run
PNonMusrRawRunData fDataNonMusr; ///< keeps all ascii- or db-file info in case of nonMusr fit PNonMusrRawRunData fDataNonMusr; ///< keeps all ascii- or db-file info in case of nonMusr fit
} PRawRunData; } PRawRunData;
@ -242,36 +242,36 @@ typedef vector<PMsrParamStructure> PMsrParamList;
* *
*/ */
typedef struct { typedef struct {
TString fRunName; ///< name of the run file PStringVector fRunName; ///< name of the run file
TString fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type) PStringVector fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type)
TString fInstitute; ///< e.g. psi, ral, triumf (former: run format) PStringVector fInstitute; ///< e.g. psi, ral, triumf (former: run format)
TString fFileFormat; ///< e.g. root, nexus, psi-bin, mud, ascii, db PStringVector 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 fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR
int fAlphaParamNo; ///< alpha int fAlphaParamNo; ///< alpha parameter number (fit type 2, 4)
int fBetaParamNo; ///< int fBetaParamNo; ///< beta parameter number (fit type 2, 4)
int fNormParamNo; ///< int fNormParamNo; ///< N0 parameter number (fit type 0)
int fBkgFitParamNo; ///< int fBkgFitParamNo; ///< background fit parameter number (fit type 0)
int fPhaseParamNo; ///< int fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!!
int fLifetimeParamNo; ///< int fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0)
bool fLifetimeCorrection; ///< bool fLifetimeCorrection; ///< lifetime correction flag for viewing (fit type 0)
PIntVector fMap; ///< PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory
int fForwardHistoNo; ///< int fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
int fBackwardHistoNo; ///< int fBackwardHistoNo; ///< backward histogram number (fit type 2, 4)
bool fBkgFixPresent[2]; ///< flag showing if a fixed background is present bool fBkgFixPresent[2]; ///< flag showing if a fixed background is present (fit type 0, 2, 4).
double fBkgFix[2]; ///< double fBkgFix[2]; ///< fixed background in (1/ns) (fit type 0, 2, 4)
int fBkgRange[4]; ///< int fBkgRange[4]; ///< background bin range (fit type 0, 2, 4)
int fDataRange[4]; ///< int fDataRange[4]; ///< data bin range (fit type 0, 2, 4)
int fT0[2]; ///< PIntVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
double fFitRange[2]; ///< double fFitRange[2]; ///< fit range in (us)
int fPacking; ///< int fPacking; ///< packing/rebinning
double fRRFFreq; ///< rotating reference frequency double fRRFFreq; ///< rotating reference frequency (fit type 4)
int fRRFPacking; ///< rotating reference packing int fRRFPacking; ///< rotating reference packing (fit type 4)
int fAlpha2ParamNo; ///< int fAlpha2ParamNo; ///< rotating reference alpha2 (fit type 4)
int fBeta2ParamNo; ///< int fBeta2ParamNo; ///< rotating reference beta2 (fit type 4)
int fRightHistoNo; ///< int fRightHistoNo; ///< rotating reference right histogram number (fit type 4)
int fLeftHistoNo; ///< int fLeftHistoNo; ///< rotating reference left histogram number (fit type 4)
int fXYDataIndex[2]; ///< used to get the data indices when using db-files int fXYDataIndex[2]; ///< used to get the data indices when using db-files (fit type 8)
TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files (fit type 8)
} PMsrRunStructure; } PMsrRunStructure;
//------------------------------------------------------------- //-------------------------------------------------------------

View File

@ -88,7 +88,7 @@ class PRunBase
PRunData fData; ///< data to be fitted, viewed, i.e. binned data PRunData fData; ///< data to be fitted, viewed, i.e. binned data
double fTimeResolution; ///< time resolution double fTimeResolution; ///< time resolution
PDoubleVector fT0s; ///< all t0's of a run! The derived classes will handle it PIntVector fT0s; ///< all t0's of a run! The derived classes will handle it
virtual bool PrepareData() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!! virtual bool PrepareData() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!

View File

@ -60,8 +60,8 @@ class PRunDataHandler
PRawRunDataList fData; ///< keeping all the raw data PRawRunDataList fData; ///< keeping all the raw data
virtual bool ReadFile(); virtual bool ReadFile();
virtual bool FileAlreadyRead(PMsrRunStructure &runInfo); virtual bool FileAlreadyRead(TString runName);
virtual bool FileExistsCheck(PMsrRunStructure &runInfo); virtual bool FileExistsCheck(PMsrRunStructure &runInfo, const unsigned int idx);
virtual bool ReadRootFile(bool notPostPileup); virtual bool ReadRootFile(bool notPostPileup);
virtual bool ReadNexusFile(); virtual bool ReadNexusFile();
virtual bool ReadWkmFile(); virtual bool ReadWkmFile();

View File

@ -49,9 +49,9 @@ class PRunSingleHisto : public PRunBase
protected: protected:
virtual bool PrepareData(); virtual bool PrepareData();
virtual bool PrepareFitData(); virtual bool PrepareFitData(PRawRunData* runData, const unsigned int histoNo);
virtual bool PrepareRawViewData(); virtual bool PrepareRawViewData(PRawRunData* runData, const unsigned int histoNo);
virtual bool PrepareViewData(); virtual bool PrepareViewData(PRawRunData* runData, const unsigned int histoNo);
private: private:
double fFitStartTime; double fFitStartTime;

View File

@ -133,7 +133,13 @@ void musrfit_debug_info(PMsrHandler* msrHandler)
cout << endl << "******"; cout << endl << "******";
cout << endl << "run no " << runNo++; cout << endl << "run no " << runNo++;
cout << endl << "run (name, beamline, institute, data-file-format): "; cout << endl << "run (name, beamline, institute, data-file-format): ";
cout << endl << " " << runs_it->fRunName << ", " << runs_it->fBeamline << ", " << runs_it->fInstitute << ", " << runs_it->fFileFormat; cout << endl << " " << runs_it->fRunName[0] << ", " << runs_it->fBeamline[0] << ", " << runs_it->fInstitute[0] << ", " << runs_it->fFileFormat[0];
if (runs_it->fRunName.size() > 1) {
for (unsigned int i=1; i<runs_it->fRunName.size(); i++) {
cout << endl << "runadd (name, beamline, institute, data-file-format): ";
cout << endl << " " << runs_it->fRunName[i] << ", " << runs_it->fBeamline[i] << ", " << runs_it->fInstitute[i] << ", " << runs_it->fFileFormat[i];
}
}
cout << endl << "fittype " << runs_it->fFitType; cout << endl << "fittype " << runs_it->fFitType;
cout << endl << "alpha " << runs_it->fAlphaParamNo; cout << endl << "alpha " << runs_it->fAlphaParamNo;
cout << endl << "beta " << runs_it->fBetaParamNo; cout << endl << "beta " << runs_it->fBetaParamNo;
@ -623,7 +629,7 @@ int main(int argc, char *argv[])
success = runListCollection->Add(i, kFit); success = runListCollection->Add(i, kFit);
if (!success) { if (!success) {
cout << endl << "**ERROR** Couldn't handle run no " << i << " "; cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
cout << (*msrHandler->GetMsrRunList())[i].fRunName.Data(); cout << (*msrHandler->GetMsrRunList())[i].fRunName[0].Data();
break; break;
} }
} }

View File

@ -209,7 +209,7 @@ cout << endl;
success = runListCollection->Add(i, kView); success = runListCollection->Add(i, kView);
if (!success) { if (!success) {
cout << endl << "**ERROR** Couldn't handle run no " << i << " "; cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
cout << (*msrHandler->GetMsrRunList())[i].fRunName.Data(); cout << (*msrHandler->GetMsrRunList())[i].fRunName[0].Data();
break; break;
} }
} }