Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/THStack.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/hist:$Id$
0002 // Author: Rene Brun   10/12/2001
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2001, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_THStack
0013 #define ROOT_THStack
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // THStack                                                              //
0019 //                                                                      //
0020 // A collection of histograms                                           //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TNamed.h"
0025 #include "TObjArray.h"
0026 
0027 #ifdef R__LESS_INCLUDES
0028 class TH1;
0029 class TList;
0030 class TAxis;
0031 #else
0032 #include "TH1.h"
0033 #endif
0034 
0035 #include <limits>
0036 
0037 class TBrowser;
0038 class TFileMergeInfo;
0039 
0040 class THStack : public TNamed {
0041 private:
0042    THStack& operator=(const THStack&) = delete;
0043 
0044 protected:
0045    TList      *fHists{nullptr};      ///<  Pointer to array of TH1
0046    TObjArray  *fStack{nullptr};      ///<! Pointer to array of sums of TH1
0047    TH1        *fHistogram{nullptr};  ///<  Pointer to histogram used for drawing axis
0048    Double_t    fMaximum{-1111};      ///<  Maximum value for plotting along y
0049    Double_t    fMinimum{-1111};      ///<  Minimum value for plotting along y
0050 
0051    void BuildStack();
0052 
0053    void BuildAndPaint(Option_t *chopt, Bool_t paint);
0054 
0055 public:
0056 
0057    THStack() {}
0058    THStack(const char *name, const char *title);
0059    THStack(TH1* hist, Option_t *axis="x",
0060            const char *name = nullptr, const char *title = nullptr,
0061            Int_t firstbin = 1, Int_t lastbin = -1,
0062            Int_t firstbin2 = 1, Int_t lastbin2 = -1,
0063            Option_t *proj_option = "", Option_t *draw_option = "");
0064    THStack(const THStack &hstack);
0065    ~THStack() override;
0066    virtual void     Add(TH1 *h, Option_t *option="");
0067    void             BuildPrimitives(Option_t *chopt = "") { BuildAndPaint(chopt, kFALSE); }
0068    void             Browse(TBrowser *b)  override;
0069    Int_t            DistancetoPrimitive(Int_t px, Int_t py) override;
0070    void             Draw(Option_t *chopt="")  override;
0071    TH1             *GetHistogram() const;
0072    TList           *GetHists()  const { return fHists; }
0073    TIter            begin() const;
0074    TIter            end() const { return TIter::End(); }
0075    Int_t            GetNhists() const;
0076    TObjArray       *GetStack();
0077    virtual Double_t GetMaximum(Option_t *option = "", Double_t maxval = std::numeric_limits<Double_t>::max());
0078    virtual Double_t GetMinimum(Option_t *option = "", Double_t minval = -std::numeric_limits<Double_t>::max());
0079    TAxis           *GetXaxis() const;
0080    TAxis           *GetYaxis() const;
0081    TAxis           *GetZaxis() const;
0082    void             ls(Option_t *option="") const  override;
0083    virtual Long64_t Merge(TCollection* li, TFileMergeInfo *info);
0084    virtual void     Modified();
0085    void             Paint(Option_t *chopt = "") override;
0086    void             Print(Option_t *chopt = "") const override;
0087    void             RecursiveRemove(TObject *obj)  override;
0088    void             SavePrimitive(std::ostream &out, Option_t *option = "")  override;
0089    virtual void     SetHistogram(TH1 *h) { fHistogram = h; }
0090    virtual void     SetMaximum(Double_t maximum=-1111); // *MENU*
0091    virtual void     SetMinimum(Double_t minimum=-1111); // *MENU*
0092 
0093    ClassDefOverride(THStack,2)  //A collection of histograms
0094 };
0095 
0096 #endif
0097