From fa47ee966e4896196164bb72952c0fdfcff9d480 Mon Sep 17 00:00:00 2001 From: nemu Date: Tue, 30 Sep 2008 08:09:08 +0000 Subject: [PATCH] fixed a problem with the general exponential for negative times --- src/classes/PMusrCanvas.cpp | 6 +++--- src/classes/PRunSingleHisto.cpp | 13 ++++++++++++- src/classes/PTheory.cpp | 12 ++++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index f174e75f..8338b911 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -274,8 +274,8 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) // cout << ">fMainCanvas " << fMainCanvas << endl; // cout << ">selected " << selected << endl; // -cout << "x : " << (char)x << endl; -cout << "px: " << (char)fMainCanvas->GetEventX() << endl; +//cout << "x : " << (char)x << endl; +//cout << "px: " << (char)fMainCanvas->GetEventX() << endl; if (x == 'q') { Done(0); @@ -612,7 +612,7 @@ void PMusrCanvas::UpdateInfoPad() // energy if present tstr += TString("E="); dval = fRunList->GetEnergy(runs[runNo].fRunName); -cout << endl << ">> dval = " << dval << " (Engery)"; +//cout << endl << ">> dval = " << dval << " (Engery)"; if (dval == -9.9e99) { tstr += TString("??,"); } else { diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index 14ebb96f..6e528966 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -146,7 +146,15 @@ double PRunSingleHisto::CalcChiSquare(const std::vector& par) } } -//cout << endl << "chisq=" << chisq*fRunInfo->fPacking; +/* +static int firstTime = 0; +if (firstTime < 4) { +firstTime++; +cout << endl << "size=" << fData.fValue.size() << ", fDataTimeStart=" << fData.fDataTimeStart << ", fDataTimeStep=" << fData.fDataTimeStep << ", fFitStartTime=" << fFitStartTime << ", fFitStopTime=" << fFitStopTime; +cout << endl << "chisq=" << chisq*fRunInfo->fPacking; +cout << endl << "----"; +} +*/ return chisq; } @@ -458,6 +466,7 @@ bool PRunSingleHisto::PrepareFitData() // count the number of bins to be fitted fNoOfFitBins=0; double time; +//cout << endl << ">> size=" << fData.fValue.size() << ", fDataTimeStart=" << fData.fDataTimeStart << ", fDataTimeStep=" << fData.fDataTimeStep << ", fFitStartTime=" << fFitStartTime << ", fFitStopTime=" << fFitStopTime; for (unsigned int i=0; i= fFitStartTime) && (time <= fFitStopTime)) @@ -862,6 +871,7 @@ cout << endl << "--------------------------------"; double theoryValue; fData.fTheoryTimeStart = startTime; fData.fTheoryTimeStep = fTimeResolution; +//cout << endl << ">> size=" << size << ", startTime=" << startTime << ", fTimeResolution=" << fTimeResolution; for (unsigned int i=0; iFunc(time, par, fFuncValues); @@ -940,6 +950,7 @@ bool PRunSingleHisto::EstimateBkg(unsigned int histoNo) double bkg = 0.0; // forward +//cout << endl << ">> bkg start=" << start << ", end=" << end; for (unsigned int i=start; ifDataBin[histoNo][i]; bkg /= static_cast(end - start + 1); diff --git a/src/classes/PTheory.cpp b/src/classes/PTheory.cpp index 653ddac3..34745f52 100644 --- a/src/classes/PTheory.cpp +++ b/src/classes/PTheory.cpp @@ -684,7 +684,7 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock) line = &(*fullTheoryBlock)[i]; // copy line content to str in order to remove comments str = line->fLine.Copy(); -cout << endl << ">> str = " << str.Data(); +//cout << endl << ">> str = " << str.Data(); // remove theory line comment if present, i.e. something starting with '(' int index = str.Index("("); if (index > 0) // theory line comment present @@ -913,6 +913,7 @@ double PTheory::GeneralExp(register double t, const PDoubleVector& paramValues, // expected parameters: lambda beta [tshift] double val[3]; + double result; assert(fParamNo.size() <= 3); @@ -931,7 +932,14 @@ double PTheory::GeneralExp(register double t, const PDoubleVector& paramValues, else // tshift present tt = t-val[2]; - return TMath::Exp(-TMath::Power(tt*val[0], val[1]));; + // check if tt*val[0] < 0 and + if ((tt*val[0] < 0) && (trunc(val[1])-val[1] != 0.0)) { + result = 0.0; + } else { + result = TMath::Exp(-TMath::Power(tt*val[0], val[1])); + } + + return result; } //--------------------------------------------------------------------------