library: libHist #include "THLimitsFinder.h"

# THLimitsFinder

class description - source file - inheritance tree (.pdf)

## class THLimitsFinder : public TObject

| Inheritance Chart:
`TObject`
| <- | `THLimitsFinder` |

        public:

                                 THLimitsFinder()
                                 THLimitsFinder(const THLimitsFinder&)
                         virtual ~THLimitsFinder()
                  static TClass* Class()
                   virtual Int_t FindGoodLimits(TH1* h, Axis_t xmin, Axis_t xmax)
                   virtual Int_t FindGoodLimits(TH1* h, Axis_t xmin, Axis_t xmax, Axis_t ymin, Axis_t ymax)
                   virtual Int_t FindGoodLimits(TH1* h, Axis_t xmin, Axis_t xmax, Axis_t ymin, Axis_t ymax, Axis_t zmin, Axis_t zmax)
          static THLimitsFinder* GetLimitsFinder()
                 virtual TClass* IsA() const
                 THLimitsFinder& operator=(const THLimitsFinder&)
                     static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t& BinLow, Double_t& BinHigh, Int_t& nbins, Double_t& BWID, Option_t* option = "")
                     static void OptimizeLimits(Int_t nbins, Int_t& newbins, Axis_t& xmin, Axis_t& xmax, Bool_t isInteger)
                     static void SetLimitsFinder(THLimitsFinder* finder)
                    virtual void ShowMembers(TMemberInspector& insp, char* parent)
                    virtual void Streamer(TBuffer& b)
                            void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          static THLimitsFinder* fgLimitsFinder  !Pointer to hist limits finder

## Class Description

     THLimitsFinder

     Class to compute nice axis limits.

     This class is called by default by the histograming system
     and also by TTree::Draw, TTreePlayer::DrawSelect.

     A different finder may be specified via THLimitsFinder::SetFinder.

THLimitsFinder()

~THLimitsFinder()

Int_t FindGoodLimits(TH1 *h, Axis_t xmin, Axis_t xmax)

     compute the best axis limits for the X axis.
     If the bit kIsInteger is set, the number of channels is also recomputed.
     The axis parameters are replaced by the optimized parameters
     example:
      With the input parameters xmin=-1.467 and xmax=2.344, the function
      will compute better limits -1.8 and 2.7 and store them in the axis.

OptimizeLimits(xaxis->GetNbins(), newbins,xmin,xmax, xaxis->TestBit(TAxis::kIsInteger)); h->SetBins(newbins,xmin,xmax); return 0; } //______________________________________________________________________________ Int_t THLimitsFinder::FindGoodLimits(TH1 *h, Axis_t xmin, Axis_t xmax, Axis_t ymin, Axis_t ymax)

     compute the best axis limits for the X and Y axis.
     If the bit kIsInteger is set, the number of channels is also recomputed.
     The axis parameters are replaced by the optimized parameters

OptimizeLimits(xaxis->GetNbins(), newbinsx,xmin,xmax, xaxis->TestBit(TAxis::kIsInteger)); THLimitsFinder::OptimizeLimits(yaxis->GetNbins(), newbinsy,ymin,ymax, yaxis->TestBit(TAxis::kIsInteger)); h->SetBins(newbinsx,xmin,xmax,newbinsy,ymin,ymax); return 0; } //______________________________________________________________________________ Int_t THLimitsFinder::FindGoodLimits(TH1 *h, Axis_t xmin, Axis_t xmax, Axis_t ymin, Axis_t ymax, Axis_t zmin, Axis_t zmax)

     compute the best axis limits for the X, Y and Z axis.
     If the bit kIsInteger is set, the number of channels is also recomputed.
     The axis parameters are replaced by the optimized parameters

OptimizeLimits(xaxis->GetNbins(), newbinsx,xmin,xmax, xaxis->TestBit(TAxis::kIsInteger)); THLimitsFinder::OptimizeLimits(yaxis->GetNbins(), newbinsy,ymin,ymax, yaxis->TestBit(TAxis::kIsInteger)); THLimitsFinder::OptimizeLimits(zaxis->GetNbins(), newbinsz,zmin,zmax, zaxis->TestBit(TAxis::kIsInteger)); h->SetBins(newbinsx,xmin,xmax,newbinsy,ymin,ymax,newbinsz,zmin,zmax); return 0; } //______________________________________________________________________________ THLimitsFinder *THLimitsFinder::GetLimitsFinder()

     Return pointer to the current finder.
     Create one if none exists
     Use SetLimitsFinder to set a user defined finder.

void SetLimitsFinder(THLimitsFinder *finder)

     This static function can be used to specify a finder derived from THLimitsFinder.
     The finder may redefine the functions FindGoodLimits.
     Note that the redefined functions may call THLimitsFinder::FindGoodLimits.

void Optimize(Double_t A1, Double_t A2, Int_t nold ,Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BinWidth, Option_t *option)

     static function to compute reasonable axis limits

     Input parameters:

      A1,A2 : Old WMIN,WMAX .
      BinLow,BinHigh : New WMIN,WMAX .
      nold   : Old NDIV .
      nbins    : New NDIV .

void OptimizeLimits(Int_t nbins, Int_t &newbins, Axis_t &xmin, Axis_t &xmax, Bool_t isInteger)

     Optimize axis limits.
     When isInter=kTRUE, the function makes an integer binwidth
     and recompute the number of bins accordingly.

### Inline Functions

                      Int_t FindGoodLimits(TH1* h, Axis_t xmin, Axis_t xmax, Axis_t ymin, Axis_t ymax)
                      Int_t FindGoodLimits(TH1* h, Axis_t xmin, Axis_t xmax, Axis_t ymin, Axis_t ymax, Axis_t zmin, Axis_t zmax)
            THLimitsFinder* GetLimitsFinder()
                    TClass* Class()
                    TClass* IsA() const
                       void ShowMembers(TMemberInspector& insp, char* parent)
                       void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
             THLimitsFinder THLimitsFinder(const THLimitsFinder&)
            THLimitsFinder& operator=(const THLimitsFinder&)

Author: Rene Brun 14/01/2002
Last update: root/hist:$Name: $:$Id: THLimitsFinder.cxx,v 1.8 2003/12/12 17:57:05 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *