some new stuff, some bug fixing

This commit is contained in:
nemu 2008-04-29 19:20:16 +00:00
parent a0532c3b44
commit 09278f2baa
6 changed files with 99 additions and 19 deletions

View File

@ -80,6 +80,12 @@ long term:
* implement FFT with msr-interface
* switch from qmake to cmake
---------------------
bugs:
---------------------
* when having multiple plots: closing some of the plots and finally pressing 'q' will lead to a crash
since root already eliminated the closed canvas plot.
---------------------
problems:
---------------------

View File

@ -329,10 +329,10 @@ int PMsrHandler::WriteMsrLogFile()
f << left << fParam[i].fUpperBoundary;
f << " ";
}
CheckAndWriteComment(f, ++lineNo);
// terminate parameter line if not the last line
if (i != fParam.size()-1)
f << endl;
CheckAndWriteComment(f, ++lineNo);
}
// write theory block
@ -2266,8 +2266,9 @@ void PMsrHandler::CheckAndWriteComment(ofstream &f, int &lineNo)
// check if lineNo is present
for (i=0; i<fComments.size(); i++) {
if (fComments[i].fLineNo == lineNo)
if (fComments[i].fLineNo == lineNo) {
break;
}
}
if (i<fComments.size()) {

View File

@ -316,31 +316,37 @@ void PMusrCanvas::UpdateParamTheoryPad()
str += " ";
// parameter value
if (round(param[i].fValue)-param[i].fValue==0)
sprintf(cnum, "%.1lf", param[i].fValue);
sprintf(cnum, "%.1lg", param[i].fValue);
else
sprintf(cnum, "%.6lf", param[i].fValue);
sprintf(cnum, "%.6lg", param[i].fValue);
str += cnum;
for (int j=0; j<9-(int)strlen(cnum); j++) // fill spaces
str += " ";
str += " "; // to make sure that at least 1 space is placed
// parameter error
if (param[i].fPosErrorPresent) { // minos was used
if (round(param[i].fStep)-param[i].fStep==0)
sprintf(cnum, "%.1lf", param[i].fStep);
else
sprintf(cnum, "%.6lf", param[i].fStep);
str += cnum;
str += "/";
if (round(param[i].fPosError)-param[i].fPosError==0)
sprintf(cnum, "%.1lf", param[i].fPosError);
else
sprintf(cnum, "%.6lf", param[i].fPosError);
// calculate the arithmetic average of the pos. and neg. error
double err;
err = param[i].fPosError - param[i].fStep / 2.0;
// check if the pos. and neg. error within 10%
if ((fabs(fabs(param[i].fStep) - param[i].fPosError) < 0.1*fabs(param[i].fStep)) &&
(fabs(fabs(param[i].fStep) - param[i].fPosError) < 0.1*param[i].fPosError)) {
if (round(err)-err==0)
sprintf(cnum, "%.1lg", err);
else
sprintf(cnum, "%.6lg", err);
} else {
if (round(err)-err==0)
sprintf(cnum, "%.1lg!!", err);
else
sprintf(cnum, "%.6lg!!", err);
}
str += cnum;
} else { // minos was not used
if (round(param[i].fStep)-param[i].fStep==0)
sprintf(cnum, "%.1lf", param[i].fStep);
sprintf(cnum, "%.1lg", param[i].fStep);
else
sprintf(cnum, "%.6lf", param[i].fStep);
sprintf(cnum, "%.6lg", param[i].fStep);
str += cnum;
}
ypos = 0.925-i*0.025;

View File

@ -134,6 +134,70 @@ bool PRunNonMusr::PrepareData()
cout << endl << "in PRunNonMusr::PrepareData(): will feed fFitData";
if (fHandleTag == kFit)
success = PrepareFitData();
else if (fHandleTag == kView)
success = PrepareViewData();
else
success = false;
return success;
}
//--------------------------------------------------------------------------
// PrepareFitData
//--------------------------------------------------------------------------
/**
* <p>
*
*/
bool PRunNonMusr::PrepareFitData()
{
bool success = true;
// get the proper run
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName);
if (!runData) { // couldn't get run
cout << endl << "PRunNonMusr::PrepareFitData(): **ERROR** Couldn't get run " << fRunInfo->fRunName.Data() << "!";
return false;
}
// keep start/stop time for fit: here the meaning is of course start x, stop x
fFitStartTime = fRunInfo->fFitRange[0];
fFitStopTime = fRunInfo->fFitRange[1];
// pack the raw data
double value = 0.0;
double err = 0.0;
for (unsigned int i=0; i<runData->fXData.size(); i++) {
if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data
fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0);
fData.fValue.push_back(value);
fData.fError.push_back(TMath::Sqrt(err));
value = 0.0;
err = 0.0;
}
// sum raw data values
value += runData->fYData[i];
err += runData->fErrYData[i]*runData->fErrYData[i];
}
// count the number of bins to be fitted
fNoOfFitBins=0; // STILL MISSING!!
return success;
}
//--------------------------------------------------------------------------
// PrepareViewData
//--------------------------------------------------------------------------
/**
* <p>
*
*/
bool PRunNonMusr::PrepareViewData()
{
bool success = true;
return success;
}

View File

@ -130,12 +130,13 @@ typedef struct {
// data related info
double fDataTimeStart;
double fDataTimeStep;
vector<double> fValue;
vector<double> fError;
PDoubleVector fX; // only used for non-muSR
PDoubleVector fValue;
PDoubleVector fError;
// theory related info
double fTheoryTimeStart;
double fTheoryTimeStep;
vector<double> fTheory;
PDoubleVector fTheory;
} PRunData;
//-------------------------------------------------------------

View File

@ -49,6 +49,8 @@ class PRunNonMusr : public PRunBase
protected:
virtual bool PrepareData();
virtual bool PrepareFitData();
virtual bool PrepareViewData();
private:
double fFitStartTime;