fixed a problem with the general exponential for negative times
This commit is contained in:
parent
1b35506339
commit
fa47ee966e
@ -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 {
|
||||
|
@ -146,7 +146,15 @@ double PRunSingleHisto::CalcChiSquare(const std::vector<double>& 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<fData.fValue.size(); i++) {
|
||||
time = fData.fDataTimeStart + (double)i*fData.fDataTimeStep;
|
||||
if ((time >= 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; i<size; i++) {
|
||||
time = startTime + (double)i*fTimeResolution;
|
||||
theoryValue = fTheory->Func(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; i<end; i++)
|
||||
bkg += runData->fDataBin[histoNo][i];
|
||||
bkg /= static_cast<double>(end - start + 1);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user