Ignore:
Timestamp:
09/10/04 14:06:46 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhbase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhbase/MBinning.cc

    r4891 r4920  
    7272
    7373}
     74
    7475void MBinning::SetEdges(const TAxis &axe)
    7576{
    76     const TArrayD &arr = *((TAxis&)axe).GetXbins();
     77    const TArrayD &arr = *axe.GetXbins();
    7778    if (arr.GetSize()>0)
    7879    {
     
    8283
    8384    SetEdges(axe.GetNbins(), axe.GetXmin(), axe.GetXmax());
     85}
     86
     87void MBinning::AddEdge(Axis_t up)
     88{
     89    const Int_t n = fEdges.GetSize();
     90
     91    if (up<=fEdges[n-1])
     92    {
     93        *fLog << warn << dbginf << "WARNING - New upper edge not greater than old upper edge... ignored." << endl;
     94        return;
     95    }
     96
     97    fEdges.Set(n+1);
     98    fEdges[n] = up;
     99
     100    fType = kIsUserArray;
    84101}
    85102
     
    111128void MBinning::SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up)
    112129{
    113     const Double_t binsize = (up-lo)/nbins;
     130    const Double_t binsize = nbins<=0 ? 0 : (up-lo)/nbins;
    114131    fEdges.Set(nbins+1);
    115132    for (int i=0; i<=nbins; i++)
    116             fEdges[i] = binsize*i + lo;
     133        fEdges[i] = binsize*i + lo;
    117134
    118135    fType = kIsLinear;
  • trunk/MagicSoft/Mars/mhbase/MBinning.h

    r4891 r4920  
    7979    Double_t *GetEdges() const { return (Double_t*)fEdges.GetArray(); }
    8080
     81    void AddEdge(Axis_t up);
     82
    8183    Bool_t IsLinear() const { return fType==kIsLinear; }
    8284    Bool_t IsLogarithmic() const { return fType==kIsLogarithmic; }
Note: See TracChangeset for help on using the changeset viewer.