Ignore:
Timestamp:
01/06/09 13:07:00 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.h

    r8928 r9212  
    5858
    5959    // Evaluate first derivative of spline in the interval i with x=[0;1[
    60     inline Double_t EvalDeriv1(const Float_t x, const Int_t i) const
     60    inline Double_t EvalDeriv1(const Int_t i, const Float_t x) const
    6161    {
    6262        // x := [0; 1[
     
    6464        const Double_t difder = fDer2[i+1]-fDer2[i];
    6565
    66         return 3*difder*x*x + 6*fDer2[i]*x - 2*fDer2[i] - fDer2[i+1] + difval;
     66        //return 3*difder*x*x + 6*fDer2[i]*x - 2*fDer2[i] - fDer2[i+1] + difval;
     67        return 3*difder*x*x + (6*x - 2)*fDer2[i] - fDer2[i+1] + difval;
    6768    }
    6869
    6970    // Evaluate second derivative of spline in the interval i with x=[0;1[
    70     inline Double_t EvalDeriv2(const Float_t x, const Int_t i) const
     71    inline Double_t EvalDeriv2(const Int_t i, const Float_t x) const
    7172    {
    7273        // x := [0; 1[
     
    7576
    7677    Double_t FindY(Int_t i, Bool_t downwards, Double_t y=0, Double_t min=0, Double_t max=1) const;
    77     Double_t SearchY(Float_t maxpos, Float_t y) const;
    78     Double_t SearchYup(Float_t maxpos, Float_t y) const;
    7978
    8079    Int_t EvalDerivEq0(const Int_t i, Double_t &x1, Double_t &x2) const;
     
    141140
    142141    // Calculate the intgeral of the Eval-function in
    143     // bin i from a=[0;1[ to b=[0;1[
     142    // bin i from 0 <= a < b < 1
    144143    inline Double_t EvalInteg(Int_t i, Float_t a, Float_t b) const
    145144    {
     
    268267            return kFALSE;
    269268
    270         const Bool_t ismax1 = x1>=min && x1<max && EvalDeriv2(x1, i)<0;
    271         const Bool_t ismax2 = x2>=min && x2<max && EvalDeriv2(x2, i)<0;
     269        const Bool_t ismax1 = x1>=min && x1<max && EvalDeriv2(i, x1)<0;
     270        const Bool_t ismax2 = x2>=min && x2<max && EvalDeriv2(i, x2)<0;
    272271
    273272        if (!ismax1 && !ismax2)
     
    323322
    324323    Float_t EvalAt(const Float_t x) const;
     324    Float_t Deriv1(const Float_t x) const;
     325
     326    Double_t SearchYdn(Float_t maxpos, Float_t y) const;
     327    Double_t SearchYup(Float_t maxpos, Float_t y) const;
     328
     329    Double_t SearchYdn(Float_t y) const { return SearchYdn(fNum, y); }
     330    Double_t SearchYup(Float_t y) const { return SearchYup(0,    y); }
    325331};
    326332
     
    335341}
    336342
     343inline Float_t MExtralgoSpline::Deriv1(const Float_t x) const
     344{
     345    Int_t   i = TMath::FloorNint(x);
     346    Float_t f = x-i;
     347
     348    Align(i, f);
     349
     350    return EvalDeriv1(i, f);
     351}
     352
    337353#endif
Note: See TracChangeset for help on using the changeset viewer.