Changeset 8918


Ignore:
Timestamp:
06/03/08 12:34:58 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mextralgo
Files:
2 edited

Legend:

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

    r8500 r8918  
    1919!   Author(s): Thomas Bretz, 08/2006 <mailto:tbretz@astro.uni-wuerzburg.de>
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2006
     21!   Copyright: MAGIC Software Development, 2000-2008
    2222!
    2323!
     
    3131#include "MExtralgoDigitalFilter.h"
    3232
     33#include <TMath.h>
    3334#include <TRandom.h>
    3435
     
    139140}
    140141
    141 #include <iostream>
     142Int_t MExtralgoDigitalFilter::AlignExtractionWindow(Int_t &maxp, Int_t &frac, const Double_t ampsum)
     143{
     144    // Align extraction window to signal position
     145
     146    const Double_t timesum = Eval(fWeightsTime, maxp, frac);
     147
     148    // Because fWeightsPerBin/2 doesn't correspond to the center
     149    // of a bin the time-values extracted are slightly positive.
     150    // They are roughly between -0.45 and 0.55
     151    const Double_t binoffset = TMath::Even(fWeightsPerBin) ? 0.5 : 0;
     152
     153    // This is the time offset from the extraction position
     154    Double_t tmoffset = (frac+binoffset)/fWeightsPerBin + timesum/ampsum;
     155
     156    // Convert the residual fraction of one slice into an
     157    // offset position in the extraction weights
     158    const Int_t integ = TMath::FloorNint(tmoffset+0.5);
     159
     160    /*
     161    if (integ>0)
     162        tmoffset=0.49-0.05;
     163    if (integ<0)
     164        tmoffset=-0.49-0.05;
     165    integ=0;
     166    */
     167
     168    // move the extractor by an offset number of slices
     169    // determined by the extracted time
     170    maxp -= integ;
     171
     172    frac  = TMath::FloorNint((tmoffset-integ)*fWeightsPerBin);
     173
     174    // Align maxp into available range (TO BE CHECKED)
     175    AlignIntoLimits(maxp, frac);
     176
     177    return integ;
     178}
     179
    142180void MExtralgoDigitalFilter::Extract(Int_t maxpos)
    143181{
  • trunk/MagicSoft/Mars/mextralgo/MExtralgoDigitalFilter.h

    r8500 r8918  
    1111class TH2F;
    1212class TArrayF;
    13 
    14 //#include <TMatrix.h>
    1513
    1614class MExtralgoDigitalFilter
     
    9795    }
    9896
    99     inline Int_t AlignExtractionWindow(Int_t &maxp, Int_t &frac, const Double_t ampsum)
    100     {
    101         // Align extraction window to signal position
    102 
    103         const Double_t timesum = Eval(fWeightsTime, maxp, frac);
    104 
    105         // Because fWeightsPerBin/2 doesn't correspond to the center
    106         // of a bin the time-values extracted are slightly positive.
    107         // They are roughly between -0.45 and 0.55
    108         const Double_t binoffset = TMath::Even(fWeightsPerBin) ? 0.5 : 0;
    109 
    110         // This is the time offset from the extraction position
    111         Double_t tmoffset = (frac+binoffset)/fWeightsPerBin + timesum/ampsum;
    112 
    113         // Convert the residual fraction of one slice into an
    114         // offset position in the extraction weights
    115         const Int_t integ = TMath::FloorNint(tmoffset+0.5);
    116 
    117         /*
    118         if (integ>0)
    119             tmoffset=0.49-0.05;
    120         if (integ<0)
    121             tmoffset=-0.49-0.05;
    122         integ=0;
    123         */
    124 
    125         // move the extractor by an offset number of slices
    126         // determined by the extracted time
    127         maxp -= integ;
    128 
    129         frac  = TMath::FloorNint((tmoffset-integ)*fWeightsPerBin);
    130 
    131         // Align maxp into available range (TO BE CHECKED)
    132         AlignIntoLimits(maxp, frac);
    133 
    134         return integ;
    135     }
    136 
    137     inline void AlignExtractionWindow(Int_t &maxp, Int_t &frac)
     97    inline Int_t AlignExtractionWindow(Int_t &maxp, Int_t &frac, const Double_t ampsum);
     98    inline void  AlignExtractionWindow(Int_t &maxp, Int_t &frac)
    13899    {
    139100        const Double_t amp = Eval(fWeightsAmp, maxp, frac);
Note: See TracChangeset for help on using the changeset viewer.