Changeset 9850 for trunk/Mars/mimage


Ignore:
Timestamp:
08/12/10 09:34:13 (14 years ago)
Author:
tbretz
Message:
Adapted MHillasExt member functions. Fixed code to calculate weighted time spread.
Location:
trunk/Mars/mimage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mimage/MHillasExt.cc

    r9849 r9850  
    121121    fSlopeLong  =  0;
    122122    fSlopeTrans =  0;
     123
     124    fTimeSpread          = -1;
     125    fTimeSpreadWeighted  = -1;
     126    fSlopeSpread         = -1;
     127    fSlopeSpreadWeighted = -1;
    123128}
    124129
     
    202207
    203208        sumxw   += x*nphot;
    204         sumyw   += x*nphot;
     209        sumyw   += y*nphot;
    205210        sumtw   += t*nphot;
    206211
     
    250255    // Time spread
    251256    //
    252     fTimeSpread         = TMath::Sqrt(sumt2/cnt - sumt*sumt/cnt/cnt);
    253     fTimeSpreadWeighted = TMath::Sqrt(sumt2w2 + (sumw2 - 2*sumtw2)*sumtw/sumw)/sumw;
     257    fTimeSpread         = TMath::Sqrt(sumt2*cnt - sumt*sumt)/cnt;
     258    fTimeSpreadWeighted = TMath::Sqrt(sumt2w2 + sumw2*sumtw*sumtw/sumw/sumw - 2*sumtw2*sumtw/sumw)/sumw;
    254259
    255260    //
     
    280285    const Double_t sumdt2w2  = sumt2w2 - 2*fSlopeLong*(c*sumtxw2 + s*sumtyw2) + fSlopeLong*fSlopeLong * (c*c*sumx2 + s*s*sumy2 + 2*c*s*sumxy) * sumw2;
    281286
    282     fSlopeSpread         = TMath::Sqrt(sumdt2/cnt - sumdt*sumdt/cnt/cnt);
    283     fSlopeSpreadWeighted = TMath::Sqrt(sumdt2w2 + (sumw2 - 2*sumdtw2)*sumdtw/sumw)/sumw;
    284 
    285     //
    286     // FIXME: Missing Time spread along slope
    287     //
     287    fSlopeSpread         = TMath::Sqrt(sumdt2*cnt - sumdt*sumdt)/cnt;
     288    fSlopeSpreadWeighted = TMath::Sqrt(sumdt2w2 + sumw2*sumdtw*sumdtw/sumw/sumw - 2*sumdtw2*sumdtw/sumw)/sumw;
    288289
    289290    //
     
    314315void MHillasExt::Set(const TArrayF &arr)
    315316{
    316     if (arr.GetSize() != 5)
     317    if (arr.GetSize() != 9)
    317318        return;
    318319
     
    322323    fSlopeLong  = arr.At(3);
    323324    fSlopeTrans = arr.At(4);
     325
     326    fTimeSpread          = arr.At(5);
     327    fTimeSpreadWeighted  = arr.At(6);
     328    fSlopeSpread         = arr.At(7);
     329    fSlopeSpreadWeighted = arr.At(8);
    324330}
    325331
     
    341347    if (showtrans)
    342348        *fLog << " - Slope Trans    [mm]  = " << fSlopeTrans << endl;
     349    *fLog << " - Time Spread    [ns]  = " << fTimeSpread << endl;
     350    *fLog << " - Slope Spread   [ns]  = " << fSlopeSpread << endl;
     351    *fLog << " - Time Spread W  [ns]  = " << fTimeSpreadWeighted << endl;
     352    *fLog << " - Slope Spread W [ns]  = " << fSlopeSpreadWeighted << endl;
    343353}
    344354
     
    357367    *fLog << " - Slope Long     [mm]  = " << fSlopeLong*geom.GetConvMm2Deg()  << endl;
    358368    *fLog << " - Slope Trans    [mm]  = " << fSlopeTrans*geom.GetConvMm2Deg() << endl;
     369    *fLog << " - Slope Spread   [ns]  = " << fSlopeSpread << endl;
     370    *fLog << " - Time Spread W  [ns]  = " << fTimeSpreadWeighted << endl;
     371    *fLog << " - Slope Spread W [ns]  = " << fSlopeSpreadWeighted << endl;
    359372}
    360373
  • trunk/Mars/mimage/MHillasExt.h

    r9845 r9850  
    3535    void Reset();
    3636
    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; }
     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; }
     44    Float_t GetSlopeSpread() const         { return fSlopeSpread; }
     45    Float_t GetSlopeSpreadWeighted() const { return fSlopeSpreadWeighted; }
    4446
    4547    Int_t Calc(const MGeomCam &geom, const MSignalCam &pix,
Note: See TracChangeset for help on using the changeset viewer.