From c6912f2efe02be2f3b8f07a30bdbd80279d4bb38 Mon Sep 17 00:00:00 2001 From: "Bastian M. Wojek" Date: Mon, 23 May 2011 12:44:18 +0000 Subject: [PATCH] Small cosmetic changes --- src/classes/PRunAsymmetry.cpp | 2 +- src/classes/PRunSingleHisto.cpp | 6 +++--- src/classes/PTheory.cpp | 30 +++++++++++++++--------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index e99b475f3..dd2986b24 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -171,7 +171,7 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector& par) if (startTimeBin < 0) startTimeBin = 0; Int_t endTimeBin = static_cast(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1; - if (endTimeBin >= N) + if (endTimeBin > N) endTimeBin = N; // Calculate the theory function once to ensure one function evaluation for the current set of parameters. diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index fa7b98bba..f1454f3e0 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -155,7 +155,7 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector& par) if (startTimeBin < 0) startTimeBin = 0; Int_t endTimeBin = static_cast(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1; - if (endTimeBin >= N) + if (endTimeBin > N) endTimeBin = N; // Calculate the theory function once to ensure one function evaluation for the current set of parameters. @@ -254,7 +254,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector& par) if (startTimeBin < 0) startTimeBin = 0; Int_t endTimeBin = static_cast(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1; - if (endTimeBin >= N) + if (endTimeBin > N) endTimeBin = N; // Calculate the theory function once to ensure one function evaluation for the current set of parameters. @@ -343,7 +343,7 @@ void PRunSingleHisto::CalcTheory() Double_t time; for (UInt_t i=0; iFunc(time, par, fFuncValues))+bkg); + fData.AppendTheoryValue(N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg); } // clean up diff --git a/src/classes/PTheory.cpp b/src/classes/PTheory.cpp index c609c4b6a..307038399 100644 --- a/src/classes/PTheory.cpp +++ b/src/classes/PTheory.cpp @@ -2228,16 +2228,16 @@ void PTheory::CalculateLorentzLFIntegral(const Double_t *val) const */ Double_t PTheory::GetLFIntegralValue(const Double_t t) const { - UInt_t idx = static_cast(t/fSamplingTime); - - if (idx < 0) + if (t < 0.0) return 0.0; - if (idx > fLFIntegral.size()-2) - return fLFIntegral[fLFIntegral.size()-1]; + UInt_t idx = static_cast(t/fSamplingTime); - // liniarly interpolate between the two relvant function bins - Double_t df = (fLFIntegral[idx+1]-fLFIntegral[idx])/fSamplingTime*(t-idx*fSamplingTime); + if (idx + 2 > fLFIntegral.size()) + return fLFIntegral.back(); + + // linearly interpolate between the two relvant function bins + Double_t df = (fLFIntegral[idx+1]-fLFIntegral[idx])*(t/fSamplingTime-static_cast(idx)); return fLFIntegral[idx]+df; } @@ -2278,7 +2278,7 @@ void PTheory::CalculateDynKTLF(const Double_t *val, Int_t tag) const } } - if (N < 300) // if too view points, i.e. nu0 very small, take 300 points + if (N < 300) // if too few points, i.e. nu0 very small, take 300 points N = 300; // allocate memory for dyn KT LF function vector @@ -2386,16 +2386,16 @@ void PTheory::CalculateDynKTLF(const Double_t *val, Int_t tag) const */ Double_t PTheory::GetDynKTLFValue(const Double_t t) const { - Int_t idx = static_cast(t/fDynLFdt); - - if (idx < 0) + if (t < 0.0) return 0.0; - if (idx > static_cast(fDynLFFuncValue.size())-2) - return fDynLFFuncValue[fDynLFFuncValue.size()-1]; + UInt_t idx = static_cast(t/fDynLFdt); - // liniarly interpolate between the two relvant function bins - Double_t df = (fDynLFFuncValue[idx+1]-fDynLFFuncValue[idx])*(t-idx*fDynLFdt)/fDynLFdt; + if (idx + 2 > fDynLFFuncValue.size()) + return fDynLFFuncValue.back(); + + // linearly interpolate between the two relvant function bins + Double_t df = (fDynLFFuncValue[idx+1]-fDynLFFuncValue[idx])*(t/fDynLFdt-static_cast(idx)); return fDynLFFuncValue[idx]+df; }