Ignore:
Timestamp:
08/19/07 22:40:04 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhbase
Files:
4 edited

Legend:

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

    r8106 r8679  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MBinning.cc,v 1.17 2006-10-17 17:16:00 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MBinning.cc,v 1.18 2007-08-19 21:35:00 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    134134// --------------------------------------------------------------------------
    135135//
     136// Initialize Binning from TArrayD.
     137//
     138MBinning::MBinning(const TArrayD &axis, const char *name, const char *title)
     139{
     140    fName  = name  ? name : gsDefName.Data();
     141    fTitle = title ? title : gsDefTitle.Data();
     142
     143    SetEdges(axis);
     144}
     145
     146// --------------------------------------------------------------------------
     147//
    136148// Search in the parameter list for the binning with name "name". If found,
    137149// set the edges and title accordingly. Default is name of object.
  • trunk/MagicSoft/Mars/mhbase/MBinning.h

    r8398 r8679  
    4343    MBinning(const TH1 &h, const Char_t axis='x', const char *name=0, const char *title=0);
    4444    MBinning(const TAxis &a, const char *name=0, const char *title=0);
     45    MBinning(const TArrayD &a, const char *name=0, const char *title=0);
    4546
    4647    void Copy(TObject &named) const
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r8657 r8679  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.33 2007-08-06 14:44:13 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.34 2007-08-19 21:36:00 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    2020!   Author(s): Thomas Bretz  07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
    2121!
    22 !   Copyright: MAGIC Software Development, 2000-2002
     22!   Copyright: MAGIC Software Development, 2000-2007
    2323!
    2424!
     
    14091409// --------------------------------------------------------------------------
    14101410//
     1411// Return the first and last bin of the histogram which is not 0
     1412//
     1413void MH::GetRange(const TH1 &h, Int_t &lo, Int_t &hi)
     1414{
     1415    lo = 0;
     1416    hi = 1;
     1417
     1418    for (int i=2; i<=h.GetNbinsX(); i++)
     1419    {
     1420        if (lo==0 && h.GetBinContent(i)>0)
     1421            lo = i;
     1422
     1423        if (h.GetBinContent(i)>0)
     1424            hi = i;
     1425    }
     1426}
     1427
     1428// --------------------------------------------------------------------------
     1429//
     1430// Return the lower edge of the first and the upper edge of the last bin
     1431// of the histogram which is not 0
     1432//
     1433void MH::GetRangeUser(const TH1 &h, Axis_t &lo, Axis_t &hi)
     1434{
     1435    Int_t f, l;
     1436    GetRange(h, f, l);
     1437
     1438    lo = h.GetBinLowEdge(f);
     1439    hi = h.GetBinLowEdge(l+1);
     1440}
     1441
     1442// --------------------------------------------------------------------------
     1443//
    14111444// See MTask::PrintSkipped
    14121445//
  • trunk/MagicSoft/Mars/mhbase/MH.h

    r8657 r8679  
    119119    static void ProjectionY(TH1D &dest, const TH2 &src, Int_t firstxbin=-1, Int_t lastxbin=9999);
    120120
     121    static void GetRangeUser(const TH1 &hist, Axis_t &lo, Axis_t &hi);
     122    static void GetRange(const TH1 &hist, Int_t &lo, Int_t &hi);
     123
    121124    static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL);
    122125
Note: See TracChangeset for help on using the changeset viewer.