Changeset 9845


Ignore:
Timestamp:
Aug 11, 2010, 5:05:32 PM (10 years ago)
Author:
tbretz
Message:
Implemented new parameters to describe the time spread in MHillasExt.
Location:
trunk/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/Changelog

    r9829 r9845  
    2626     - improved/fixed error calculation/display
    2727
     28   * mimage/MHillasExt.[h,cc]:
     29     - added new data members fTimeSpread and fTimeSpreadWeighted
     30     - added new data members fSlopeSpread and fSlopeSpreadWeighted (not yet used)
     31     - implemented code to calculate the time spreads
     32     - increased class version id by 1
     33
    2834
    2935
  • trunk/Mars/NEWS

    r9822 r9845  
    5151     ns anymore, but in ns/deg. This means that the values for MAGIC
    5252     have to be scaled by a factor of 10.
     53
     54   * Star now calculates new timing parameters, namely:
     55
     56   ** MHillasExt.fTimeSpread:
     57      This is the time spread (rms) around the mean of the arrival times.
     58      It is calulated as
     59         <math>\sqrt{\sum{t_i}/n}</math>
     60   ** MHillasExt.fTimeSpreadWeighted:
     61      This is the weighted time spread (rms) around the weighted mean of the arrival times.
     62      It is calulated as
     63         <math>\frac{1}{\sum{n_i}}\sqrt{\sum{n_i^2(t_i-<wt>)^2}}}</math>
     64            or
     65         <math>\frac{1}{\sum{n_i}}\sqrt{\sum{n_i^2t_i^2}+<wt>^2\sum{n_i^2}-2<wt>\sum{t_in_i^2}}</math>
    5366
    5467 ;trainenergy.C:
  • trunk/Mars/mimage/MHillasExt.cc

    r9369 r9845  
    2020!   Author(s): Wolfgang Wittek 06/2002 <mailto:wittek@mppmu.mpg.de>
    2121!
    22 !   Copyright: MAGIC Software Development, 2000-2007
     22!   Copyright: MAGIC Software Development, 2000-2010
    2323!
    2424!
     
    5656// fSlopeLong    added
    5757// fSlopeTrans   added
     58//
     59// Version 5:
     60// ----------
     61// fTimeSpread           added
     62// fTimeSpreadWeighted   added
     63//
     64// fSlopeSpread          added
     65// fSlopeSpreadWeighted  added
    5866//
    5967//
     
    138146    UInt_t cnt = 0;
    139147
    140     Double_t sumx   = 0;
    141     Double_t sumy   = 0;
    142     Double_t sumt   = 0;
    143     Double_t sumxy  = 0;
    144     Double_t sumxt  = 0;
    145     Double_t sumyt  = 0;
    146     Double_t sumx2  = 0;
    147     Double_t sumy2  = 0;
    148     Double_t sumx3  = 0;
    149     Double_t sumy3  = 0;
    150     Double_t sumx2y = 0;
    151     Double_t sumxy2 = 0;
     148    Double_t sumx    = 0;
     149    Double_t sumy    = 0;
     150    Double_t sumt    = 0;
     151    Double_t sumw    = 0;
     152    Double_t sumxy   = 0;
     153    Double_t sumxt   = 0;
     154    Double_t sumyt   = 0;
     155    Double_t sumtw   = 0;
     156    Double_t sumx2   = 0;
     157    Double_t sumy2   = 0;
     158    Double_t sumw2   = 0;
     159    Double_t sumt2   = 0;
     160    Double_t sumx3   = 0;
     161    Double_t sumy3   = 0;
     162    Double_t sumtw2  = 0;
     163    Double_t sumx2y  = 0;
     164    Double_t sumxy2  = 0;
     165    Double_t sumt2w2 = 0;
    152166
    153167    const UInt_t npix = evt.GetNumPixels();
     
    167181        const Double_t t = pix.GetArrivalTime();
    168182
     183        Double_t nphot = pix.GetNumPhotons();        // [1]
     184
    169185        // --- time slope ----
    170         sumx  += x;
    171         sumy  += y;
    172         sumt  += t;
     186        sumx    += x;
     187        sumy    += y;
     188
     189        sumt    += t;
     190        sumt2   += t*t;
     191
     192        sumtw   += t*nphot;
     193        sumtw2  += t*nphot*nphot;
     194        sumt2w2 += t*t*nphot*nphot;
     195
     196        sumw    += nphot;
     197        sumw2   += nphot*nphot;
    173198
    174199        sumx2 += x*x;
     
    181206        const Double_t dx = x - hil.GetMeanX();      // [mm]
    182207        const Double_t dy = y - hil.GetMeanY();      // [mm]
    183 
    184         Double_t nphot = pix.GetNumPhotons();        // [1]
    185208
    186209        sumx3  += nphot * dx*dx*dx;
     
    209232
    210233    //
     234    // Time spread
     235    //
     236    fTimeSpread         = TMath::Sqrt(sumt2/cnt - sumt*sumt/cnt/cnt);
     237    fTimeSpreadWeighted = TMath::Sqrt(sumt2w2 + sumw2*sumtw/sumw - 2*sumtw/sum2*sumtw2)/sumw;
     238
     239    //
    211240    // Time slope
    212241    //
     
    225254    fSlopeLong  = detx==0 ? 0 : (cnt*dxt - sumt*dx)/detx;
    226255    fSlopeTrans = dety==0 ? 0 : (cnt*dyt - sumt*dy)/dety;
     256
     257    //
     258    // FIXME: Missing Time spread along slope
     259    //
    227260
    228261    //
  • trunk/Mars/mimage/MHillasExt.h

    r8619 r9845  
    2020    Float_t fM3Trans; // [mm] 3rd moment (e-weighted) along minor axis
    2121
    22     Float_t fSlopeLong;
    23     Float_t fSlopeTrans;
     22    Float_t fSlopeLong;   // [ns/mm] Slope of the arrival time along the major axis
     23    Float_t fSlopeTrans;  // [ns/mm] Slope of the arrival time along the minor axis
     24
     25    // FIXME: We could try to use the Medians!
     26    Float_t fTimeSpread;          // [ns] Spread (RMS) of the arrival times around the mean arrival time
     27    Float_t fTimeSpreadWeighted;  // [ns] Weighted spread (RMS) of the arrival times around the weighted mean arrival time
     28
     29    Float_t fSlopeSpread;         // [ns] Spread (RMS) of the arrival time around the slope along the major axis
     30    Float_t fSlopeSpreadWeighted; // [ns] Weighted spread (RMS) of the arrival time around the slope along the major axis
    2431
    2532public:
     
    2835    void Reset();
    2936
    30     Float_t GetAsym() const       { return fAsym; }
    31     Float_t GetM3Long() const     { return fM3Long; }
    32     Float_t GetM3Trans() const    { return fM3Trans; }
    33     Float_t GetSlopeLong() const  { return fSlopeLong; }
    34     Float_t GetSlopeTrans() const { return fSlopeTrans; }
     37    Float_t GetAsym() const               { return fAsym; }
     38    Float_t GetM3Long() const             { return fM3Long; }
     39    Float_t GetM3Trans() const            { return fM3Trans; }
     40    Float_t GetSlopeLong() const          { return fSlopeLong; }
     41    Float_t GetSlopeTrans() const         { return fSlopeTrans; }
     42    Float_t GetTimeSpread() const         { return fTimeSpread; }
     43    Float_t GetTimeSpreadWeighted() const { return fTimeSpreadWeighted; }
    3544
    3645    Int_t Calc(const MGeomCam &geom, const MSignalCam &pix,
     
    4453    void Set(const TArrayF &arr);
    4554
    46     ClassDef(MHillasExt, 4) // Storage Container for extended Hillas Parameter
     55    ClassDef(MHillasExt, 5) // Storage Container for extended Hillas Parameter
    4756};
    4857#endif
Note: See TracChangeset for help on using the changeset viewer.