Ignore:
Timestamp:
08/08/06 17:51:35 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r7829 r7867  
    8484
    8585#include "MArrayD.h"
     86#include "MMath.h"    // MMath::GaussProb
    8687
    8788#define kItemsLegend 48 // see SetPalette(1,0)
     
    312313    for (Int_t idx=0; idx<fNcells-2; idx++)
    313314        arr[idx] ? SetUsed(idx) : ResetUsed(idx);
     315}
     316
     317// ------------------------------------------------------------------------
     318//
     319// Return the median value on the y-axis (profile option is correctly taken
     320// into account)
     321//
     322Stat_t MHCamera::GetMedian() const
     323{
     324    // Just for speed reasons
     325    if (!TestBit(kProfile))
     326        return TMath::Median(GetSize()-2, GetArray()+1);
     327
     328    // Copy profiled data into new array (FIXME: Should we take errors into account?)
     329    TArrayD arr(fNcells-2);
     330    for (int i=1; i<fNcells-1; i++)
     331        arr[i-1] = GetBinContent(i);
     332
     333    // return Median of the profile data
     334    return TMath::Median(arr.GetSize(), arr.GetArray());
     335}
     336
     337// ------------------------------------------------------------------------
     338//
     339// Return the median value (divided by MMath::GausProb(1.0)) of the
     340// distribution of abs(y[i]-Median). This is my Median equivalent of the RMS
     341//
     342Stat_t MHCamera::GetMedianDev() const
     343{
     344    // Just for speed reasons
     345    if (!TestBit(kProfile))
     346        return MMath::MedianDev(GetSize()-2, GetArray()+1);
     347
     348    // Copy profiled data into new array (FIXME: Should we take errors into account?)
     349    TArrayD arr(fNcells-2);
     350    for (int i=1; i<fNcells-1; i++)
     351        arr[i-1] = GetBinContent(i);
     352
     353    // return MedianDev of the profile data
     354    return MMath::MedianDev(arr.GetSize(), arr.GetArray())/MMath::GaussProb(1.0);
    314355}
    315356
Note: See TracChangeset for help on using the changeset viewer.