Changeset 19917 for trunk/Mars/mbase


Ignore:
Timestamp:
12/17/19 17:26:49 (5 years ago)
Author:
tbretz
Message:
Added a possibility to produce a pre-defined wavelength distirbution.
Location:
trunk/Mars/mbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mbase/MSpline3.cc

    r19128 r19917  
    234234    }
    235235
    236     return TMath::TwoPi()*MSpline3(x.GetArray(), y.GetArray(), n).Integral();
    237 }
     236    return MSpline3(x.GetArray(), y.GetArray(), n).Integral();
     237}
     238
     239MSpline3 MSpline3::GetIntegralSpline() const
     240{
     241    const Int_t n = GetNp();
     242
     243    MArrayD x(n+2);
     244    MArrayD y(n+2);
     245
     246    GetKnot(0, x[0], y[0]);
     247
     248    y[0] = 0;
     249
     250    GetKnot(0, x[1], y[1]);
     251
     252    y[1] = 0;
     253
     254    for (int i=0; i<n-1; i++)
     255    {
     256        GetKnot(i+1, x[i+2], y[i+2]);
     257        y[i+2] = y[i+1]+IntegralBin(i, x[i+2]);
     258    }
     259
     260    for (int i=2; i<=n; i++)
     261        y[i] /= y[n];
     262
     263    y[n+1] = 1;
     264
     265    x[0]   = x[1]  -(x[2]-x[1]);
     266    x[n+1] = x[n]  +(x[n]-x[n-1]);
     267
     268    return MSpline3(x.GetArray(), y.GetArray(), n+2, "b1 e1");
     269}
     270
    238271
    239272
  • trunk/Mars/mbase/MSpline3.h

    r19128 r19917  
    6464    Double_t IntegralSolidAngle() const;
    6565
     66    MSpline3 GetIntegralSpline() const;
     67
    6668    void Scale(double=1);
    6769
Note: See TracChangeset for help on using the changeset viewer.