Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 10/12/2001
5 * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
12#ifndef ROOT_THStack
13#define ROOT_THStack
17// //
18// THStack //
19// //
20// A collection of histograms //
21// //
24#include "TNamed.h"
25#include "TObjArray.h"
28class TH1;
29class TList;
30class TAxis;
32#include "TH1.h"
35class TBrowser;
36class TFileMergeInfo;
38class THStack : public TNamed {
40 THStack& operator=(const THStack&); // Not implemented
43 TList *fHists; ///< Pointer to array of TH1
44 TObjArray *fStack; ///<! Pointer to array of sums of TH1
45 TH1 *fHistogram; ///< Pointer to histogram used for drawing axis
46 Double_t fMaximum; ///< Maximum value for plotting along y
47 Double_t fMinimum; ///< Minimum value for plotting along y
49 void BuildStack();
53 THStack();
54 THStack(const char *name, const char *title);
55 THStack(TH1* hist, Option_t *axis="x",
56 const char *name=0, const char *title=0,
57 Int_t firstbin=1, Int_t lastbin=-1,
58 Int_t firstbin2=1, Int_t lastbin2=-1,
59 Option_t* proj_option="", Option_t* draw_option="");
60 THStack(const THStack &hstack);
61 virtual ~THStack();
62 virtual void Add(TH1 *h, Option_t *option="");
63 virtual void Browse(TBrowser *b);
64 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
65 virtual void Draw(Option_t *chopt="");
66 TH1 *GetHistogram() const;
67 TList *GetHists() const { return fHists; }
68 TIter begin() const;
69 TIter end() const { return TIter::End(); }
70 Int_t GetNhists() const;
72 virtual Double_t GetMaximum(Option_t *option="");
73 virtual Double_t GetMinimum(Option_t *option="");
74 TAxis *GetXaxis() const;
75 TAxis *GetYaxis() const;
76 TAxis *GetZaxis() const;
77 virtual void ls(Option_t *option="") const;
78 virtual Long64_t Merge(TCollection* li, TFileMergeInfo *info);
79 virtual void Modified();
80 virtual void Paint(Option_t *chopt="");
81 virtual void Print(Option_t *chopt="") const;
82 virtual void RecursiveRemove(TObject *obj);
83 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
84 virtual void SetHistogram(TH1 *h) {fHistogram = h;}
85 virtual void SetMaximum(Double_t maximum=-1111); // *MENU*
86 virtual void SetMinimum(Double_t minimum=-1111); // *MENU*
88 ClassDef(THStack,2) //A collection of histograms
#define b(i)
Definition: RSha256.hxx:100
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:45
double Double_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:80
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
char name[80]
Definition: TGX11.cxx:110
Class to manage histogram axis.
Definition: TAxis.h:30
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Collection abstract base class.
Definition: TCollection.h:65
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
The Histogram stack class.
Definition: THStack.h:38
virtual void Print(Option_t *chopt="") const
Print the list of histograms.
Definition: THStack.cxx:1006
TIter begin() const
Get iterator over internal hists list.
Definition: THStack.cxx:1101
virtual ~THStack()
THStack destructor.
Definition: THStack.cxx:342
THStack default constructor.
Definition: THStack.cxx:135
virtual void ls(Option_t *option="") const
List histograms in the stack.
Definition: THStack.cxx:670
TObjArray * fStack
! Pointer to array of sums of TH1
Definition: THStack.h:44
Double_t fMinimum
Minimum value for plotting along y.
Definition: THStack.h:47
virtual void Draw(Option_t *chopt="")
Draw this multihist with its current attributes.
Definition: THStack.cxx:467
void BuildStack()
build sum of all histograms Build a separate list fStack containing the running sum of all histograms
Definition: THStack.cxx:406
TList * GetHists() const
Definition: THStack.h:67
TAxis * GetYaxis() const
Get y axis of the histogram used to draw the stack.
Definition: THStack.cxx:643
virtual Long64_t Merge(TCollection *li, TFileMergeInfo *info)
Merge the THStack in the TList into this stack.
Definition: THStack.cxx:683
virtual void Paint(Option_t *chopt="")
Paint the list of histograms.
Definition: THStack.cxx:719
TH1 * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
Definition: THStack.cxx:498
virtual Double_t GetMaximum(Option_t *option="")
returns the maximum of all added histograms returns the maximum of all histograms if option "nostack"...
Definition: THStack.cxx:513
virtual void SetHistogram(TH1 *h)
Definition: THStack.h:84
virtual void Add(TH1 *h, Option_t *option="")
add a new histogram to the list Only 1-d and 2-d histograms currently supported.
Definition: THStack.cxx:381
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream out.
Definition: THStack.cxx:1030
TObjArray * GetStack()
Return pointer to Stack. Build it if not yet done.
Definition: THStack.cxx:615
Int_t GetNhists() const
Return the number of histograms in the stack.
Definition: THStack.cxx:606
virtual Double_t GetMinimum(Option_t *option="")
returns the minimum of all added histograms returns the minimum of all histograms if option "nostack"...
Definition: THStack.cxx:562
TIter end() const
Definition: THStack.h:69
TList * fHists
Pointer to array of TH1.
Definition: THStack.h:43
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum.
Definition: THStack.cxx:1083
TH1 * fHistogram
Pointer to histogram used for drawing axis.
Definition: THStack.h:45
TAxis * GetZaxis() const
Get z axis of the histogram used to draw the stack.
Definition: THStack.cxx:658
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from the list of histograms.
Definition: THStack.cxx:1020
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to each graph.
Definition: THStack.cxx:429
virtual void Modified()
invalidate sum of histograms
Definition: THStack.cxx:706
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum.
Definition: THStack.cxx:1092
virtual void Browse(TBrowser *b)
Definition: THStack.cxx:396
THStack & operator=(const THStack &)
TAxis * GetXaxis() const
Get x axis of the histogram used to draw the stack.
Definition: THStack.cxx:628
Double_t fMaximum
Maximum value for plotting along y.
Definition: THStack.h:46
static TIter End()
Pointing to the element after the last - to a nullptr value in our case.
A doubly linked list.
Definition: TList.h:44
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
An array of TObjects.
Definition: TObjArray.h:37
Mother of all ROOT objects.
Definition: TObject.h:37