Changeset 14854 for trunk


Ignore:
Timestamp:
02/04/13 10:00:19 (12 years ago)
Author:
tbretz
Message:
Added a few more options of what to extract, including width of pulse.
Location:
trunk/Mars/mextralgo
Files:
2 edited

Legend:

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

    r13003 r14854  
    263263}
    264264
     265Float_t MExtralgoSpline::CalcIntegral(Float_t beg, Float_t width) const
     266{
     267    Float_t end = beg + width;
     268
     269    if (beg<0)
     270    {
     271        end -= beg;
     272        beg = 0;
     273    }
     274
     275    if (end>fNum-1)
     276    {
     277        beg -= (end-fNum-1);
     278        end  = fNum-1;
     279    }
     280
     281    return EvalInteg(beg, end);
     282}
     283
    265284MArrayF MExtralgoSpline::GetIntegral(bool norm) const
    266285{
     
    320339    // --- End NEW ---
    321340
     341    //kDynWidth     = kTimeRel|kDynWidth,   // Integrate between leading edge and falling edge
     342    //    kFixedWidth   = kTimeRel|kFixedWidth, // Integrate between leading edge and edge plus fRiseTime+fFallTime
     343
    322344    if (fExtractionType&kIntegral)
    323345    {
     
    325347        fSignalDev = 0;  // means: is valid
    326348    }
    327     else
     349
     350    if (!(fExtractionType&kIntegralDyn) && !(fExtractionType&kIntegralFixed))
    328351    {
    329352        fSignal    = fHeight;
     
    346369    fTime      = SearchYdn(maxpos, h);
    347370    fTimeDev   = 0;
    348     if (width)
     371    if (width || fExtractionType&kIntegralDyn)
    349372    {
    350373        fWidth    = SearchYup(maxpos, h)-fTime;
    351374        fWidthDev = 0;
    352375    }
    353 }
     376
     377    if (fExtractionType&kIntegralDyn)
     378    {
     379        fSignal    = CalcIntegral(fTime, fWidth);
     380        fSignalDev = 0;
     381    }
     382    if (fExtractionType&kIntegralFixed)
     383    {
     384        fSignal    = CalcIntegral(fTime-fRiseTime, fRiseTime+fFallTime);
     385        fSignalDev = 0;
     386    }
     387}
  • trunk/Mars/mextralgo/MExtralgoSpline.h

    r13003 r14854  
    1414    enum ExtractionType_t
    1515    {
    16         kIntegral = BIT(0),
    17         kTimeRel  = BIT(1),
    18         kMaximum  = BIT(2),
     16        kIntegral   = BIT(0),
     17        kTimeRel    = BIT(1),
     18        kMaximum    = BIT(2),
     19        kDynWidth   = BIT(3),
     20        kFixedWidth = BIT(4),
    1921
    2022        // For backward compatibility
    21         kAmplitudeAbs = 0,                   // Height of maximum, absolute height leading edge
    22         kAmplitudeRel = kTimeRel,            // Height of maximum, relative height leading edge
    23         kAmplitude    = kMaximum,            // Position and height of maximum
    24         kIntegralAbs  = kIntegral,           // Integral, absolute height leading edge
    25         kIntegralRel  = kIntegral|kTimeRel,  // Integral, relative height leading edge
     23        kAmplitudeAbs  = 0,                    // Height of maximum, absolute height leading edge
     24        kAmplitudeRel  = kTimeRel,             // Height of maximum, relative height leading edge
     25        kAmplitude     = kMaximum,             // Position and height of maximum
     26        kIntegralAbs   = kIntegral,            // Integral, absolute height leading edge
     27        kIntegralRel   = kIntegral|kTimeRel,   // Integral, relative height leading edge
     28        kIntegralDyn   = kTimeRel|kDynWidth,   // Integrate between leading edge and falling edge
     29        kIntegralFixed = kTimeRel|kFixedWidth, // Integrate between leading edge minus fRiseTime and plus fFallTime
    2630    };
    2731
     
    311315    void InitDerivatives() const;
    312316    Float_t CalcIntegral(Float_t start) const;
     317    Float_t CalcIntegral(Float_t beg, Float_t width) const;
    313318
    314319public:
Note: See TracChangeset for help on using the changeset viewer.