minor changes
This commit is contained in:
parent
0ee32cf526
commit
fb8e96b2ee
@ -118,6 +118,7 @@ PRawRunData* PRunDataHandler::GetRunData(TString runName)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0; i<fData.size(); i++) {
|
for (i=0; i<fData.size(); i++) {
|
||||||
|
cout << endl << ">> run name = " << fData[i].fRunName.Data();
|
||||||
if (!fData[i].fRunName.CompareTo(runName)) // run found
|
if (!fData[i].fRunName.CompareTo(runName)) // run found
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -299,6 +300,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo)
|
|||||||
runInfo.fInstitute + TString("/") +
|
runInfo.fInstitute + TString("/") +
|
||||||
runInfo.fBeamline + TString("/") +
|
runInfo.fBeamline + TString("/") +
|
||||||
runInfo.fRunName + TString(".") + ext;
|
runInfo.fRunName + TString(".") + ext;
|
||||||
|
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;
|
||||||
break;
|
break;
|
||||||
@ -798,7 +800,7 @@ bool PRunDataHandler::ReadMudFile()
|
|||||||
// ReadAsciiFile
|
// ReadAsciiFile
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>Reads ascii files. Intended for the No-muSR data.
|
* <p>Reads ascii files. Intended for the nonMuSR data.
|
||||||
*
|
*
|
||||||
* The file format definition is:
|
* The file format definition is:
|
||||||
* Comment lines start with a '#' or '%' character.
|
* Comment lines start with a '#' or '%' character.
|
||||||
@ -843,6 +845,8 @@ bool PRunDataHandler::ReadAsciiFile()
|
|||||||
|
|
||||||
PRawRunData runData;
|
PRawRunData runData;
|
||||||
|
|
||||||
|
runData.fRunName = fRunName; // keep the run name
|
||||||
|
|
||||||
int lineNo = 0;
|
int lineNo = 0;
|
||||||
char instr[512];
|
char instr[512];
|
||||||
TString line, workStr;
|
TString line, workStr;
|
||||||
|
@ -60,12 +60,9 @@ 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)
|
||||||
{
|
{
|
||||||
bool success;
|
// calculate fData
|
||||||
|
if (!PrepareData())
|
||||||
// calculate fFitData
|
fValid = false;
|
||||||
if (success) {
|
|
||||||
success = PrepareData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -92,6 +89,23 @@ double PRunNonMusr::CalcChiSquare(const std::vector<double>& par)
|
|||||||
double chisq = 0.0;
|
double chisq = 0.0;
|
||||||
double diff = 0.0;
|
double diff = 0.0;
|
||||||
|
|
||||||
|
// calculate functions
|
||||||
|
for (int i=0; i<fMsrInfo->GetNoOfFuncs(); i++) {
|
||||||
|
fFuncValues[i] = fMsrInfo->EvalFunc(fMsrInfo->GetFuncNo(i), fRunInfo->fMap, par);
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate chi square
|
||||||
|
double x;
|
||||||
|
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
||||||
|
x = fData.fX[i];
|
||||||
|
if ((x>=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;
|
return chisq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,8 +183,11 @@ bool PRunNonMusr::PrepareFitData()
|
|||||||
// pack the raw data
|
// pack the raw data
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
double err = 0.0;
|
double err = 0.0;
|
||||||
|
cout << endl << ">> runData->fXData.size()=" << runData->fXData.size();
|
||||||
for (unsigned int i=0; i<runData->fXData.size(); i++) {
|
for (unsigned int i=0; i<runData->fXData.size(); i++) {
|
||||||
|
cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
|
||||||
if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data
|
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.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0);
|
||||||
fData.fValue.push_back(value);
|
fData.fValue.push_back(value);
|
||||||
fData.fError.push_back(TMath::Sqrt(err));
|
fData.fError.push_back(TMath::Sqrt(err));
|
||||||
@ -181,9 +198,17 @@ bool PRunNonMusr::PrepareFitData()
|
|||||||
value += runData->fYData[i];
|
value += runData->fYData[i];
|
||||||
err += runData->fErrYData[i]*runData->fErrYData[i];
|
err += runData->fErrYData[i]*runData->fErrYData[i];
|
||||||
}
|
}
|
||||||
|
cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();
|
||||||
|
|
||||||
// count the number of bins to be fitted
|
// count the number of bins to be fitted
|
||||||
fNoOfFitBins=0; // STILL MISSING!!
|
fNoOfFitBins=0;
|
||||||
|
double x;
|
||||||
|
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
||||||
|
x = fData.fX[i];
|
||||||
|
if ((x >= fFitStartTime) && (x <= fFitStopTime))
|
||||||
|
fNoOfFitBins++;
|
||||||
|
}
|
||||||
|
cout << endl << ">> fNoOfFitBins=" << fNoOfFitBins;
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user