GFHistManager


class description - source file - inheritance tree

class GFHistManager : public TObject


    protected:
virtual Bool_t CheckDepth(const char* method, Int_t layer, Bool_t mayExpand = kTRUE) virtual Bool_t CheckHistNum(const char* method, Int_t layer, Int_t histNum, Bool_t mayExpand = kFALSE) void DrawFuncs(const TH1* hist) const virtual void DrawLegend(Int_t layer, Int_t histNo) virtual void DrawObjects(Int_t layer, Int_t histNo) virtual void DrawReally(Int_t layer) virtual void Initialise() virtual void MakeCanvases(Int_t layer) virtual TObjArray* MakeLegends(Int_t layer) virtual TList* MakeObjList(Int_t layer, Int_t histoNum) public:
GFHistManager() GFHistManager(TH1* hist) GFHistManager(TCollection* hists) GFHistManager(const GFHistManager&) virtual ~GFHistManager() virtual TLegendEntry* AddHist(TH1* hist, Int_t layer = 0, const char* legendTitle = "0", const char* legOpt = "0") virtual void AddHists(TCollection* hists, Int_t layer = 0, const char* legendTitle = "0", const char* legOpt = "0") virtual TLegendEntry* AddHistSame(TH1* hist, Int_t layer, Int_t nPad, const char* legendTitle = "0", const char* legOpt = "0") virtual void AddHistsOption(Option_t* option) virtual void AddHistsOption(Option_t* option, Int_t layer) virtual void AddHistsSame(GFHistArray* hists, Int_t layer, const char* legendTitle = "0", const char* legOpt = "0") virtual void AddHistsSame(GFHistArray* hists, Int_t layer, Int_t nPad) virtual void AddLayer(GFHistManager* other, Int_t layer) virtual void AddLayers(GFHistManager* other) virtual TLegend* AddLegend(Int_t layer, Int_t nPad, const char* header = "0", Bool_t referAll = kTRUE) virtual void AddLegend(TLegend* leg, Int_t layer, Int_t nPad) virtual void AddObject(TObject* obj, Int_t layer, Int_t histoNum, Option_t* opt = "0") static TClass* Class() virtual void Clear(Bool_t deleteHists) void Clear() void Delete() virtual void Draw() virtual void Draw(Int_t layer) Bool_t DrawDiffStyle(Bool_t yesNo) virtual void ExpandTo(Int_t newDepth) virtual TCanvas* GetCanvas(Int_t layer, Int_t number = 0) virtual Int_t GetCanvasHeight() const virtual Int_t GetCanvasWidth() const virtual GFHistArray* GetHistsOf(Int_t layer, Int_t histNum, Bool_t mayExpand = kFALSE) virtual TLegend* GetLegendOf(Int_t layer, Int_t nPad) virtual void GetLegendX1Y1X2Y2(Double_t& x1, Double_t& y1, Double_t& x2, Double_t& y2) const virtual Int_t GetNumHistsOf(Int_t layer) virtual Int_t GetNumHistsX(Int_t layer) const virtual Int_t GetNumHistsY(Int_t layer) const Int_t GetNumLayers() const virtual TList* GetObjectsOf(Int_t layer, Int_t histNum) virtual TClass* IsA() const virtual Bool_t IsBatch() const static void MakeDifferentStyle(GFHistArray* hists) virtual Double_t MaxOfHist(const TH1* h) const virtual Double_t MaxOfHists(const TObjArray* hists) const virtual Double_t MinOfHists(const TObjArray* hists) const static Int_t NumberOfSubPadsOf(TCanvas* can) virtual void Print(const char* filename, Bool_t add = kFALSE) virtual Bool_t RemoveLegend(Int_t layer, Int_t nPad) virtual Bool_t SetBatch(Bool_t set = kTRUE) virtual void SetCanvasHeight(Int_t h) virtual void SetCanvasWidth(Int_t w) virtual void SetHistsFillColor(Color_t color) virtual void SetHistsFillColor(Color_t color, Int_t layer) virtual void SetHistsLineColor(Color_t color) virtual void SetHistsLineColor(Color_t color, Int_t layer) virtual void SetHistsLineStyle(Int_t style) virtual void SetHistsLineStyle(Int_t style, Int_t layer, Int_t numHistInPad = -1) virtual void SetHistsLineWidth(Width_t width) virtual void SetHistsLineWidth(Width_t width, Int_t layer) virtual void SetHistsMinMax(Double_t minMax, Bool_t min) virtual void SetHistsMinMax(Double_t minMax, Bool_t min, Int_t layer) virtual void SetHistsOption(Option_t* option) virtual void SetHistsOption(Option_t* option, Int_t layer) virtual void SetHistsXTitle(const char* title) virtual void SetHistsXTitle(const char* title, Int_t layer) virtual void SetHistsYTitle(const char* title) virtual void SetHistsYTitle(const char* title, Int_t layer) static void SetLegendEntryOption(const char* option) virtual void SetLegendX1(Double_t x1) virtual void SetLegendX1Y1X2Y2(Double_t x1, Double_t y1, Double_t x2, Double_t y2) virtual void SetLegendX2(Double_t x2) virtual void SetLegendY1(Double_t y1) virtual void SetLegendY2(Double_t y2) virtual void SetLogY(Bool_t yesNo = kTRUE) virtual void SetLogY(Int_t layer, Bool_t yesNo = kTRUE) virtual void SetNumHistsX(UInt_t numX) virtual void SetNumHistsX(UInt_t numX, Int_t layer) virtual void SetNumHistsXY(UInt_t numX, UInt_t numY) virtual void SetNumHistsXY(UInt_t numX, UInt_t numY, Int_t layer) virtual void SetNumHistsY(UInt_t numY) virtual void SetNumHistsY(UInt_t numY, Int_t layer) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void Update() virtual void Update(Int_t layer) virtual void WriteCanvases(TFile* file) virtual void WriteHistos(TFile* file)

Data Members

    private:
Int_t fDepth how many layers of histograms in arrays? TArrayI fNoX how many hists in x... TArrayI fNoY ... and in y in each canvas array TArrayC fLogY whether or not a layer should be plotted in log(y) Double_t fLegendX1 default position Double_t fLegendY1 ...of TLegends Double_t fLegendX2 ... in x Double_t fLegendY2 .. and y Int_t fCanvasWidth pixel width Int_t fCanvasHeight height of canvases (maybe relativly manipulated...) static TString fgLegendEntryOption option used for legend entry style TObjArray* fHistArrays array of arrays of arrays of histograms TObjArray* fLegendArrays array of arrays to hold potential TLegend's TObjArray* fObjLists array of array of lists to hold potential objects TObjArray* fCanArrays array of arrays to hold canvases for drawing Bool_t fBatch if true: ignore Draw() Bool_t fDrawDiffStyle if true(default): call MakeDifferentStyle while Draw public:
static const Int_t kDefaultPadsPerCanX = 2; Doesn't work! Why ??? static const Int_t kDefaultPadsPerCanY = 2; It should. And it DOES, if we make static const Int_t kDefaultDepth = 1; these static const datamembers protected!

Class Description

 GFHistManager
   Author:      Gero Flucke
   Date:        Feb. 10th, 2002
   last update: $Date: 2005/12/15 11:20:59 $
   by:          $Author: flucke $


GFHistManager()

GFHistManager(TH1* hist)
 constructing with hist as first histogram

GFHistManager(TCollection* hists)
 constructing with histos in 'hists' as first histogram

void Initialise()

~GFHistManager()
 destructor: delete stored arrays, legends and canvases, but not the hists and objects!

void Clear(Bool_t deleteHists)
 delete all canvases and clear the lists of hists stored in the manager
 (hists and objects are deleted if deleteHists is true [by default it is false])

void Draw()
 draw all layers of histograms (ignore if in batch mode)

void Draw(Int_t layer)

void DrawReally(Int_t layer)

void DrawLegend(Int_t layer, Int_t histNo)
 histNo starting at '0'
 We must already be in the correct pad, layer and histNo must exist

void DrawObjects(Int_t layer, Int_t histNo)
 histNo starting at '0'
 We must already be in the correct pad, layer and histNo must exist

void Print(const char* filename, Bool_t add)
 print all layers of histograms to ps-file 'filename'
 if 'add == true' puts '(' or ')' only if 'filename' ends with it,
 e.g. if i is loop variable
   GFHistManager *man = ...;
   TString name("XXX.ps");
   if(i == 0) man->Print(name + '(');
   else if(i == last) man->Print(name + ')');
   else man->Print(name, kTRUE);

void Update()
 call Update() to all canvases

void Update(Int_t layer)

TLegendEntry* AddHist(TH1* hist, Int_t layer, const char* legendTitle, const char* legOpt)
 add hist to 'layer'th list  of histos (expands, if layer does not already exist!)

void AddHists(TCollection* hists, Int_t layer, const char* legendTitle, const char* legOpt)
 add contents of 'hists' to 'layer'th list of histos (should be histograms!!!)

TLegendEntry* AddHistSame(TH1* hist, Int_t layer, Int_t histNum, const char* legendTitle, const char* legOpt)
 adds hist to layer to draw it in the same pad as histNum's histo of that layer

void AddHistsSame(GFHistArray* hists, Int_t layer, const char* legendTitle, const char* legOpt)
 adds hists to layer
 each hist is AddHistSame(hist, layer, pad = 0...n)

void AddHistsSame(GFHistArray* hists, Int_t layer, Int_t histNum)
 adds hists to layer to draw it in the same pad as histNum's histo of that layer

void AddLayers(GFHistManager* other)
 append the layers from other to this, hists are not cloned, but legends?

void AddLayer(GFHistManager* other, Int_t layer)
 append the layer 'layer' from other to this, hists are not cloned, but legends?

TLegend* AddLegend(Int_t layer, Int_t histoNum, const char* header, Bool_t referAll)
 adds a legend referencing all hists in same pad 'histoNum' of layer


Bool_t RemoveLegend(Int_t layer, Int_t nPad)
 true if there was a legend

void AddLegend(TLegend* leg, Int_t layer, Int_t histoNum)
 hist and layer must already exist

void AddObject(TObject* obj, Int_t layer, Int_t histoNum, Option_t* opt)
 hist and layer must already exist

void WriteCanvases(TFile* file)
 write canvases with their content to file  (overwrite)

void WriteHistos(TFile* file)
 write histos to file (overwrite)

void MakeCanvases(Int_t layer)
 no check done whether layer is consistent with depth...

Int_t NumberOfSubPadsOf(TCanvas* can)

void SetLegendX1Y1X2Y2(Double_t x1, Double_t y1, Double_t x2,Double_t y2)

void SetLegendX1(Double_t x1)
________________________________________________________

void SetLegendY1(Double_t y1)
________________________________________________________

void SetLegendX2(Double_t x2)
________________________________________________________

void SetLegendY2(Double_t y2)

void SetNumHistsX(UInt_t numX)

void SetNumHistsX(UInt_t numX, Int_t layer)

void SetNumHistsY(UInt_t numY)

void SetNumHistsY(UInt_t numY, Int_t layer)

void SetNumHistsXY(UInt_t numX, UInt_t numY)

void SetNumHistsXY(UInt_t numX, UInt_t numY, Int_t layer)

void SetLogY(Bool_t yesNo)

void SetLogY(Int_t layer, Bool_t yesNo)

void SetHistsOption(Option_t* option)

void SetHistsOption(Option_t* option, Int_t layer)

void SetHistsMinMax(Double_t minMax, Bool_t min)

void SetHistsMinMax(Double_t minMax, Bool_t min, Int_t layer)

void AddHistsOption(Option_t* option)

void AddHistsOption(Option_t* option, Int_t layer)
 if 'layer' exists, add 'option' to all hists so far existing in this layer
 (ignore option 'box' for 1-D histograms)

void SetHistsXTitle(const char* title)

void SetHistsXTitle(const char* title, Int_t layer)

void SetHistsYTitle(const char* title)

void SetHistsYTitle(const char* title, Int_t layer)

void SetHistsFillColor(Color_t color)

void SetHistsFillColor(Color_t color, Int_t layer)

void SetHistsLineWidth(Width_t width)

void SetHistsLineWidth(Width_t width, Int_t layer)

void SetHistsLineStyle(Int_t s)

void SetHistsLineStyle(Int_t s, Int_t layer, Int_t numHistInPad)
 sets style 's' toall hists in 'layer'.
 if numHistInPad >= 0: only the given histNum in each pad is changed in style
 (default is numHistInPad = -1)

void SetHistsLineColor(Color_t color)

void SetHistsLineColor(Color_t color, Int_t layer)

Bool_t CheckDepth(const char* method, Int_t layer, Bool_t mayExpand)
 true, if layer is possible, if (mayExpand) expands to layer >= 0

void ExpandTo(Int_t layer)

Bool_t CheckHistNum(const char* method, Int_t layer, Int_t histNum, Bool_t mayExpand)
 true if hist 'histNum' exists in 'layer'
 if(mayExpand == kTRUE) expands to this size if necessary! (default: kFALSE)

TObjArray* MakeLegends(Int_t layer)
  returns array of legends of 'layer' (to be called if 'layer' really exist!)
 creates if necessary

TList* MakeObjList(Int_t layer, Int_t histoNum)
 return list of objects to be drawn upon hists in pad histoNum of 'layer'
 (to be called if 'layer' really exist!)

GFHistArray* GetHistsOf(Int_t layer, Int_t histNum, Bool_t mayExpand)
  returns array of histograms for pad 'histNum' of 'layer'
 if(mayExpand) creates if necessary!

TList* GetObjectsOf(Int_t layer, Int_t histNo)

Int_t GetNumHistsOf(Int_t layer)

TLegend* GetLegendOf(Int_t layer, Int_t histoNum)
 if it already exists!

void MakeDifferentStyle(GFHistArray* hists)
 easy version: adjust the histogram lines to colors
 kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan (c.f. $ROOTSYS/include/Gtypes.h)
 1       2     3       4      5        6         7 (skip 3 and 5: kGreen hardly visible...)
                                                           (... kYellow dito)
 also set line style, set marker color to line color

Double_t MaxOfHist(const TH1* h) const
 Take bin with max content, adds error and returns (no *1.05 applied!),
 but cares that - together with an error bar - another bin might be higher...
 If the hists option contains nothing about errors: error is NOT added!

Double_t MaxOfHists(const TObjArray* hists) const

Double_t MinOfHists(const TObjArray* hists) const

TCanvas* GetCanvas(Int_t layer, Int_t number)
 after draw!!

Int_t GetNumHistsX(Int_t layer) const

Int_t GetNumHistsY(Int_t layer) const

void GetLegendX1Y1X2Y2(Double_t& x1, Double_t& y1, Double_t& x2, Double_t& y2) const

void DrawFuncs(const TH1* hist) const
 calls Draw("SAME") for all TF1 in hist's GetListOfFunctions if necessary



Inline Functions


                 void Clear()
                 void Delete()
                 void SetCanvasWidth(Int_t w)
                 void SetCanvasHeight(Int_t h)
                 void SetLegendEntryOption(const char* option)
               Bool_t SetBatch(Bool_t set = kTRUE)
               Bool_t IsBatch() const
                Int_t GetCanvasWidth() const
                Int_t GetCanvasHeight() const
                Int_t GetNumLayers() const
               Bool_t DrawDiffStyle(Bool_t yesNo)
              TClass* Class()
              TClass* IsA() const
                 void ShowMembers(TMemberInspector& insp, char* parent)
                 void Streamer(TBuffer& b)
                 void StreamerNVirtual(TBuffer& b)
        GFHistManager GFHistManager(const GFHistManager&)


Author: Gero Flucke
Last update: Wed Jan 11 14:05:57 2006


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.