A THStack is a collection of TH1 (or derived) objects Use THStack::Add to add a new histogram to the list. The THStack does not own the objects in the list. By default (if option "nostack" is not specified), histograms will be paint stacked on top of each other. Example; THStack hs("hs","test stacked histograms"); TH1F *h1 = new TH1F("h1","test hstack",100,-4,4); h1->FillRandom("gaus",20000); h1->SetFillColor(kRed); hs.Add(h1); TH1F *h2 = new TH1F("h2","test hstack",100,-4,4); h2->FillRandom("gaus",15000); h2->SetFillColor(kBlue); hs.Add(h2); TH1F *h3 = new TH1F("h3","test hstack",100,-4,4); h3->FillRandom("gaus",10000); h3->SetFillColor(kGreen); hs.Add(h3); TCanvas c1("c1","stacked hists",10,10,700,900); c1.Divide(1,2); c1.cd(1); hs.Draw(); c1.cd(2); hs.Draw("nostack"); See a more complex example in $ROOTSYS/tutorials/hist/hstack.C Note that picking is supported for all drawing modes.
virtual | ~THStack() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | Add(TH1* h, Option_t* option = "") |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | TNamed::Copy(TObject& named) const |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | Draw(Option_t* chopt = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
TH1* | GetHistogram() const |
TList* | GetHists() const |
virtual const char* | TObject::GetIconName() const |
virtual Double_t | GetMaximum(Option_t* option = "") |
virtual Double_t | GetMinimum(Option_t* option = "") |
virtual const char* | TNamed::GetName() const |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
TObjArray* | GetStack() |
virtual const char* | TNamed::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
TAxis* | GetXaxis() const |
TAxis* | GetYaxis() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | TObject::IsZombie() const |
virtual void | ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Long64_t | Merge(TCollection* li, TFileMergeInfo* info) |
virtual void | Modified() |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
void | TObject::operator delete(void* ptr) |
void | TObject::operator delete(void* ptr, void* vp) |
void | TObject::operator delete[](void* ptr) |
void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
virtual void | Paint(Option_t* chopt = "") |
virtual void | TObject::Pop() |
virtual void | Print(Option_t* chopt = "") const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | RecursiveRemove(TObject* obj) |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | SavePrimitive(ostream& out, Option_t* option = "") |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual void | SetHistogram(TH1* h) |
virtual void | SetMaximum(Double_t maximum = -1111)MENU |
virtual void | SetMinimum(Double_t minimum = -1111)MENU |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector& insp) const |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
THStack() | |
THStack(const THStack& hstack) | |
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 = "") | |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
void | BuildStack() |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
void | TObject::MakeZombie() |
static TObject::<anonymous> | TObject::kBitMask | |
static TObject::EStatusBits | TObject::kCanDelete | |
static TObject::EStatusBits | TObject::kCannotPick | |
static TObject::EStatusBits | TObject::kHasUUID | |
static TObject::EStatusBits | TObject::kInvalidObject | |
static TObject::<anonymous> | TObject::kIsOnHeap | |
static TObject::EStatusBits | TObject::kIsReferenced | |
static TObject::EStatusBits | TObject::kMustCleanup | |
static TObject::EStatusBits | TObject::kNoContextMenu | |
static TObject::<anonymous> | TObject::kNotDeleted | |
static TObject::EStatusBits | TObject::kObjInCanvas | |
static TObject::<anonymous> | TObject::kOverwrite | |
static TObject::<anonymous> | TObject::kSingleKey | |
static TObject::<anonymous> | TObject::kWriteDelete | |
static TObject::<anonymous> | TObject::kZombie |
TH1* | fHistogram | Pointer to histogram used for drawing axis |
TList* | fHists | Pointer to array of TH1 |
Double_t | fMaximum | Maximum value for plotting along y |
Double_t | fMinimum | Minimum value for plotting along y |
TString | TNamed::fName | object identifier |
TObjArray* | fStack | !Pointer to array of sums of TH1 |
TString | TNamed::fTitle | object title |
Creates a new THStack from a TH2 or TH3 It is filled with the 1D histograms from GetProjectionX or GetProjectionY for each bin of the histogram. It illustrates the differences and total sum along an axis. Parameters: - hist: the histogram used for the projections. Can be an object deriving from TH2 or TH3. - axis: for TH2: "x" for ProjectionX, "y" for ProjectionY. for TH3: see TH3::Project3D. - name: fName is set to name if given, otherwise to histo's name with "_stack_<axis>" appended, where <axis> is the value of the parameter axis. - title: fTitle is set to title if given, otherwise to histo's title with ", stack of <axis> projections" appended. - firstbin, lastbin: for each bin within [firstbin,lastbin] a stack entry is created. See TH2::ProjectionX/Y for use overflow bins. Defaults to "all bins but under- / overflow" - firstbin2, lastbin2: Other axis range for TH3::Project3D, defaults to "all bins but under- / overflow". Ignored for TH2s - proj_option: option passed to TH2::ProjectionX/Y and TH3::Project3D (along with axis) - draw_option: option passed to THStack::Add.
add a new histogram to the list Only 1-d and 2-d histograms currently supported. A drawing option may be specified
build sum of all histograms Build a separate list fStack containing the running sum of all histograms
Draw this multihist with its current attributes. Options to draw histograms are described in THistPainter::Paint By default (if option "nostack" is not specified), histograms will be paint stacked on top of each other.
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases. 1- option 'A' was specified in THStack::Draw. Return fHistogram 2- user had called TPad::DrawFrame. return pointer to hframe histogram IMPORTANT NOTES - You must call Draw before calling this function. The returned histogram depends on the selected Draw options. - This function returns a pointer to an intermediate fixed bin size histogram used to set the range and for picking. You cannot use this histogram to return the bin information. You must get a pointer to one of the histograms in the stack, the first one, for example.
returns the maximum of all added histograms
returns the maximum of all histograms if option "nostack".
returns the minimum of all added histograms
returns the minimum of all histograms if option "nostack".
paint the list of histograms By default, histograms are shown stacked. -the first histogram is paint -then the sum of the first and second, etc If option "nostack" is specified, histograms are all paint in the same pad as if the option "same" had been specified. if option "pads" is specified, the current pad/canvas is subdivided into a number of pads equal to the number of histograms and each histogram is paint into a separate pad. By default the background of the histograms is erased before drawing the histograms. The option "noclear" avoid this behaviour. This is useful when drawing a THStack on top of an other plot. If the patterns used to draw the histograms in the stack are transparents, then the plot behind will be visible. See THistPainter::Paint for a list of valid options.
Save primitive as a C++ statement(s) on output stream out