From: kharlov Date: Thu, 4 Jun 2009 13:42:37 +0000 (+0000) Subject: Mods in QuadraticRoots X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=3312b1e58e8d06cb33b41ef80890f957d396e2c5;p=u%2Fmrichter%2FAliRoot.git Mods in QuadraticRoots --- diff --git a/PHOS/AliPHOSFastAltroFit.cxx b/PHOS/AliPHOSFastAltroFit.cxx index 5fcdd632e6a..86829c7d9fd 100644 --- a/PHOS/AliPHOSFastAltroFit.cxx +++ b/PHOS/AliPHOSFastAltroFit.cxx @@ -233,7 +233,8 @@ Double_t &, Double_t &eamp, Double_t &t0, Double_t &et0, Double_t &chi2) static Double_t f02, f12, f22; // functions static Double_t f02d, f12d, f22d; // functions derivations - chi2 = -1; + chi2 = -1.; + if(n<=0) { printf(" FastFit : n<=0 \n"); return; @@ -287,7 +288,7 @@ Double_t &, Double_t &eamp, Double_t &t0, Double_t &et0, Double_t &chi2) // DrawFastFunction(amp_1, t0_1, fUtils->GetPedestalValue(), "1"); // DrawFastFunction(amp_2, t0_2, fUtils->GetPedestalValue(), "2"); } else { - chi2 = -1.; // bad fit - negative chi2 + chi2 = t0_1; // no roots, bad fit - negative chi2 } } @@ -295,11 +296,13 @@ Bool_t AliPHOSFastAltroFit::QuadraticRoots(Double_t a, Double_t b, Double_t c, D { // Resolve quadratic equations a*x**2 + b*x + c //printf(" a %12.5e b %12.5e c %12.5e \n", a, b, c); - static Double_t dtmp = 0.0; + static Double_t dtmp = 0.0, dtmpCut = -1.e-6; + static Int_t ierr=0; dtmp = b*b - 4.*a*c; - if(dtmp>=-1.0e-7 && dtmp<0.0) { - printf("QuadraticRoots : small negative square : dtmp %f \n", dtmp); + if(dtmp>=dtmpCut && dtmp<0.0) { + if(ierr<5 || ierr%1000==0) + printf("QuadraticRoots : %i small negative square : dtmp %12.5e \n", ierr++, dtmp); dtmp = 0.0; } if(dtmp>=0.0) { @@ -310,7 +313,8 @@ Bool_t AliPHOSFastAltroFit::QuadraticRoots(Double_t a, Double_t b, Double_t c, D // printf(" x1 %f : x2 %f \n", x1, x2); return kTRUE; } else { - printf("QuadraticRoots : negative square : dtmp %f \n", dtmp); + x1 = dtmp; + printf("QuadraticRoots : negative square : dtmp %12.5e \n", dtmp); return kFALSE; } } @@ -350,6 +354,7 @@ void AliPHOSFastAltroFit::CalculateParsErrors(Double_t* t, Double_t* /*y*/, Int_ Double_t tau, Double_t &, Double_t &t0, Double_t &eamp, Double_t &et0) { + // Remember that fmax = exp(-n); // fmax_nk = (n/k)**n*exp(-n) => n=k=2 => exp(-n) = exp(-2.) static Double_t cc = exp(-2.); // static Double_t cc = exp(-fN); // mean(N)~1.5 ?? @@ -358,7 +363,7 @@ void AliPHOSFastAltroFit::CalculateParsErrors(Double_t* t, Double_t* /*y*/, Int_ for(Int_t i=0; i