ROOT logo
// @(#)root/hist:$Id$
// Author: Rene Brun   10/12/2001

/*************************************************************************
 * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_THStack
#define ROOT_THStack


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// THStack                                                              //
//                                                                      //
// A collection of histograms                                           //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TH1
#include "TH1.h"
#endif
#ifndef ROOT_TObjArray
#include "TObjArray.h"
#endif


class TBrowser;
class TFileMergeInfo;

class THStack : public TNamed {
private:
   THStack& operator=(const THStack&); // Not implemented

protected:
   TList      *fHists;      //Pointer to array of TH1
   TObjArray  *fStack;      //!Pointer to array of sums of TH1
   TH1        *fHistogram;  //Pointer to histogram used for drawing axis
   Double_t    fMaximum;    //Maximum value for plotting along y
   Double_t    fMinimum;    //Minimum value for plotting along y

   void BuildStack();

public:

   THStack();
   THStack(const char *name, const char *title);
   THStack(const TH1* hist, Option_t *axis="x",
           const char *name=0, const char *title=0,
           Int_t firstbin=1, Int_t lastbin=-1,
           Int_t firstbin2=1, Int_t lastbin2=-1,
           Option_t* proj_option="", Option_t* draw_option="");
   THStack(const THStack &hstack);
   virtual ~THStack();
   virtual void     Add(TH1 *h, Option_t *option="");
   virtual void     Browse(TBrowser *b);
   virtual Int_t    DistancetoPrimitive(Int_t px, Int_t py);
   virtual void     Draw(Option_t *chopt="");
   TH1             *GetHistogram() const;
   TList           *GetHists()  const { return fHists; }
   Int_t            GetNhists() const;
   TObjArray       *GetStack();
   virtual Double_t GetMaximum(Option_t *option="");
   virtual Double_t GetMinimum(Option_t *option="");
   TAxis           *GetXaxis() const;
   TAxis           *GetYaxis() const;
   virtual void     ls(Option_t *option="") const;
   virtual Long64_t Merge(TCollection* li, TFileMergeInfo *info);
   virtual void     Modified();
   virtual void     Paint(Option_t *chopt="");
   virtual void     Print(Option_t *chopt="") const;
   virtual void     RecursiveRemove(TObject *obj);
   virtual void     SavePrimitive(ostream &out, Option_t *option = "");
   virtual void     SetHistogram(TH1 *h) {fHistogram = h;}
   virtual void     SetMaximum(Double_t maximum=-1111); // *MENU*
   virtual void     SetMinimum(Double_t minimum=-1111); // *MENU*

   ClassDef(THStack,2)  //A collection of histograms
};

#endif

 THStack.h:1
 THStack.h:2
 THStack.h:3
 THStack.h:4
 THStack.h:5
 THStack.h:6
 THStack.h:7
 THStack.h:8
 THStack.h:9
 THStack.h:10
 THStack.h:11
 THStack.h:12
 THStack.h:13
 THStack.h:14
 THStack.h:15
 THStack.h:16
 THStack.h:17
 THStack.h:18
 THStack.h:19
 THStack.h:20
 THStack.h:21
 THStack.h:22
 THStack.h:23
 THStack.h:24
 THStack.h:25
 THStack.h:26
 THStack.h:27
 THStack.h:28
 THStack.h:29
 THStack.h:30
 THStack.h:31
 THStack.h:32
 THStack.h:33
 THStack.h:34
 THStack.h:35
 THStack.h:36
 THStack.h:37
 THStack.h:38
 THStack.h:39
 THStack.h:40
 THStack.h:41
 THStack.h:42
 THStack.h:43
 THStack.h:44
 THStack.h:45
 THStack.h:46
 THStack.h:47
 THStack.h:48
 THStack.h:49
 THStack.h:50
 THStack.h:51
 THStack.h:52
 THStack.h:53
 THStack.h:54
 THStack.h:55
 THStack.h:56
 THStack.h:57
 THStack.h:58
 THStack.h:59
 THStack.h:60
 THStack.h:61
 THStack.h:62
 THStack.h:63
 THStack.h:64
 THStack.h:65
 THStack.h:66
 THStack.h:67
 THStack.h:68
 THStack.h:69
 THStack.h:70
 THStack.h:71
 THStack.h:72
 THStack.h:73
 THStack.h:74
 THStack.h:75
 THStack.h:76
 THStack.h:77
 THStack.h:78
 THStack.h:79
 THStack.h:80
 THStack.h:81
 THStack.h:82
 THStack.h:83
 THStack.h:84
 THStack.h:85
 THStack.h:86