diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index 6c33b1a8..f5d5baff 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -118,6 +118,7 @@ PRawRunData* PRunDataHandler::GetRunData(TString runName) unsigned int i; for (i=0; i> run name = " << fData[i].fRunName.Data(); if (!fData[i].fRunName.CompareTo(runName)) // run found break; } @@ -299,6 +300,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo) runInfo.fInstitute + TString("/") + runInfo.fBeamline + TString("/") + runInfo.fRunName + TString(".") + ext; +cout << endl << ">> generated path: " << str.Data() << endl; if (gSystem->AccessPathName(str.Data())!=true) { // found pathName = str; break; @@ -798,7 +800,7 @@ bool PRunDataHandler::ReadMudFile() // ReadAsciiFile //-------------------------------------------------------------------------- /** - *

Reads ascii files. Intended for the No-muSR data. + *

Reads ascii files. Intended for the nonMuSR data. * * The file format definition is: * Comment lines start with a '#' or '%' character. @@ -843,6 +845,8 @@ bool PRunDataHandler::ReadAsciiFile() PRawRunData runData; + runData.fRunName = fRunName; // keep the run name + int lineNo = 0; char instr[512]; TString line, workStr; diff --git a/src/classes/PRunNonMusr.cpp b/src/classes/PRunNonMusr.cpp index 166dd2e7..b7736a79 100644 --- a/src/classes/PRunNonMusr.cpp +++ b/src/classes/PRunNonMusr.cpp @@ -60,12 +60,9 @@ PRunNonMusr::PRunNonMusr() : PRunBase() */ PRunNonMusr::PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int runNo, EPMusrHandleTag tag) : PRunBase(msrInfo, rawData, runNo, tag) { - bool success; - - // calculate fFitData - if (success) { - success = PrepareData(); - } + // calculate fData + if (!PrepareData()) + fValid = false; } //-------------------------------------------------------------------------- @@ -92,6 +89,23 @@ double PRunNonMusr::CalcChiSquare(const std::vector& par) double chisq = 0.0; double diff = 0.0; + // calculate functions + for (int i=0; iGetNoOfFuncs(); i++) { + fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par); + } + + // calculate chi square + double x; + for (unsigned int i=0; i=fFitStartTime) && (x<=fFitStopTime)) { + diff = fData.fValue[i] - fTheory->Func(x, par, fFuncValues); + chisq += diff*diff / (fData.fError[i]*fData.fError[i]); + } + } + +//cout << endl << ">> chisq=" << chisq; + return chisq; } @@ -169,8 +183,11 @@ bool PRunNonMusr::PrepareFitData() // pack the raw data double value = 0.0; double err = 0.0; +cout << endl << ">> runData->fXData.size()=" << runData->fXData.size(); for (unsigned int i=0; ifXData.size(); i++) { +cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking; if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data +cout << endl << "-> i=" << i; fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0); fData.fValue.push_back(value); fData.fError.push_back(TMath::Sqrt(err)); @@ -181,9 +198,17 @@ bool PRunNonMusr::PrepareFitData() value += runData->fYData[i]; err += runData->fErrYData[i]*runData->fErrYData[i]; } +cout << endl << ">> fData.fValue.size()=" << fData.fValue.size(); // count the number of bins to be fitted - fNoOfFitBins=0; // STILL MISSING!! + fNoOfFitBins=0; + double x; + for (unsigned int i=0; i= fFitStartTime) && (x <= fFitStopTime)) + fNoOfFitBins++; + } +cout << endl << ">> fNoOfFitBins=" << fNoOfFitBins; return success; }