Ignore:
Timestamp:
02/06/07 09:10:59 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r8165 r8308  
    126126        x = x3;
    127127
    128     return x<0 ? -1 : x+i;
     128    return x<0 ? -2 : x+i;
    129129}
    130130
     
    132132//
    133133// Search analytically downward for the value y of the spline, starting
    134 // at x, until x==0. If y is not found -1 is returned.
     134// at x, until x==0. If y is not found -2 is returned.
    135135//
    136136Double_t MExtralgoSpline::SearchY(Float_t x, Float_t y) const
     
    142142    Double_t rc = FindY(i, y, 0, x-i);
    143143    while (--i>=0 && rc<0)
     144        rc = FindY(i, y);
     145
     146    return rc;
     147}
     148
     149Double_t MExtralgoSpline::SearchYup(Float_t x, Float_t y) const
     150{
     151    if (x<0)
     152        x = 0.0001;
     153
     154    Int_t i = TMath::FloorNint(x);
     155    Double_t rc = FindY(i, y, x-i, 1.);
     156    while (i++<fNum-1 && rc<0)
    144157        rc = FindY(i, y);
    145158
     
    227240}
    228241
    229 void MExtralgoSpline::Extract(Byte_t sat, Int_t maxbin)
     242void MExtralgoSpline::Extract(Byte_t sat, Int_t maxbin, Bool_t width)
    230243{
    231244    fSignal    =  0;
    232245    fTime      =  0;
     246    fWidth     =  0;
    233247    fSignalDev = -1;
    234248    fTimeDev   = -1;
     249    fWidthDev  = -1;
    235250
    236251    if (fNum<2)
     
    381396    }*/
    382397
    383     Float_t maxpos, maxval;
     398    Float_t maxpos;
    384399    // FIXME: Check the default if no maximum found!!!
    385     GetMaxAroundI(maxbin, maxpos, maxval);
     400    GetMaxAroundI(maxbin, maxpos, fHeight);
    386401
    387402    // --- End NEW ---
     
    391406        fTime      = maxpos;
    392407        fTimeDev   = 0;
    393         fSignal    = maxval;
     408        fSignal    = fHeight;
    394409        fSignalDev = 0;  // means: is valid
    395410        return;
    396411    }
    397412
    398     // Search downwards for maxval/2
     413    const Float_t h = fExtractionType==kIntegralAbs ? fHeightTm : fHeight*fHeightTm;
     414
     415    // Search downwards for fHeight/2
    399416    // By doing also a search upwards we could extract the pulse width
    400     const Double_t x1 = SearchY(maxpos, maxval/2);
    401 
    402     fTime      = x1;
     417    fTime      = SearchY(maxpos, h);
    403418    fTimeDev   = 0;
     419    if (width)
     420    {
     421        fWidth    = SearchYup(maxpos, h)-fTime;
     422        fWidthDev = 0;
     423    }
    404424    fSignal    = CalcIntegral(maxpos);
    405425    fSignalDev = 0;  // means: is valid
Note: See TracChangeset for help on using the changeset viewer.