From 09278f2baacffbf0a76b5056c6062916d97fdc45 Mon Sep 17 00:00:00 2001 From: nemu Date: Tue, 29 Apr 2008 19:20:16 +0000 Subject: [PATCH] some new stuff, some bug fixing --- src/ToDo.txt | 6 ++++ src/classes/PMsrHandler.cpp | 5 +-- src/classes/PMusrCanvas.cpp | 34 ++++++++++++-------- src/classes/PRunNonMusr.cpp | 64 +++++++++++++++++++++++++++++++++++++ src/include/PMusr.h | 7 ++-- src/include/PRunNonMusr.h | 2 ++ 6 files changed, 99 insertions(+), 19 deletions(-) diff --git a/src/ToDo.txt b/src/ToDo.txt index 266b5098..32f2cfb3 100644 --- a/src/ToDo.txt +++ b/src/ToDo.txt @@ -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: --------------------- diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index b7646b5b..cf7a998c 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -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 + * + */ +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; ifXData.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 +//-------------------------------------------------------------------------- +/** + *

+ * + */ +bool PRunNonMusr::PrepareViewData() +{ + bool success = true; + + return success; +} diff --git a/src/include/PMusr.h b/src/include/PMusr.h index 54fcf38e..9629271c 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -130,12 +130,13 @@ typedef struct { // data related info double fDataTimeStart; double fDataTimeStep; - vector fValue; - vector fError; + PDoubleVector fX; // only used for non-muSR + PDoubleVector fValue; + PDoubleVector fError; // theory related info double fTheoryTimeStart; double fTheoryTimeStep; - vector fTheory; + PDoubleVector fTheory; } PRunData; //------------------------------------------------------------- diff --git a/src/include/PRunNonMusr.h b/src/include/PRunNonMusr.h index bf51836d..15aca2c0 100644 --- a/src/include/PRunNonMusr.h +++ b/src/include/PRunNonMusr.h @@ -49,6 +49,8 @@ class PRunNonMusr : public PRunBase protected: virtual bool PrepareData(); + virtual bool PrepareFitData(); + virtual bool PrepareViewData(); private: double fFitStartTime;