CMS 3D CMS Logo

GFHistManager.h
Go to the documentation of this file.
1 #ifndef __GFHISTMANAGER_H
2 #define __GFHISTMANAGER_H
3 
4  // ROOT includes
5 #include <TObject.h>
6 #include <TArrayI.h>
7 #include <TArrayC.h>
8 #include <TH1.h> // for type Color_t etc.
9 
10 class TObjArray;
11 class TCollection;
12 // class TH1;
13 class TCanvas;
14 class TVirtualPad;
15 class TFile;
16 class TLegend;
17 class TLegendEntry;
18 class GFHistArray;
19 
20 class GFHistManager : public TObject{
21 public:
22  GFHistManager();
23  explicit GFHistManager(TH1* hist);
24  explicit GFHistManager(TCollection* hists);
25  virtual ~GFHistManager();
26 
27  virtual TLegendEntry* AddHist(TH1* hist, Int_t layer = 0, const char* legendTitle = NULL,
28  const char* legOpt = NULL);
29  virtual void AddHists(TCollection* hists, Int_t layer = 0,
30  const char* legendTitle = NULL, const char* legOpt = NULL);
31  virtual TLegendEntry* AddHistSame(TH1* hist, Int_t layer, Int_t nPad,
32  const char* legendTitle=NULL, const char* legOpt=NULL);
33  virtual void AddHistsSame(GFHistArray* hists, Int_t layer,
34  const char* legendTitle = NULL, const char* legOpt = NULL);
35  virtual void AddHistsSame(GFHistArray* hists, Int_t layer, Int_t nPad);
36  virtual void AddLayers(GFHistManager* other);
37  virtual void AddLayer(GFHistManager* other, Int_t layer);
38  virtual void Overlay(GFHistManager* other, Int_t otherLayer, Int_t myLayer,
39  const char* legendTitle);
40  virtual TLegend* AddLegend(Int_t layer, Int_t nPad, const char* header = NULL,
41  Bool_t referAll = kTRUE);
42  virtual Bool_t RemoveLegend(Int_t layer, Int_t nPad);
43  virtual void AddLegend(TLegend* leg, Int_t layer, Int_t nPad);
44  virtual void AddObject(TObject* obj, Int_t layer, Int_t histoNum, Option_t* opt = NULL);
45 
46  virtual void Draw(Option_t * opt = "");
47  virtual void Draw(Int_t layer);
48  using TObject::Print;
49  virtual void Print(const char* filename, Bool_t add = kFALSE);
50 // virtual void Print(const char* filename, Int_t layer);
51  virtual void Clear(Bool_t deleteHists);
52  void Clear(Option_t * = "") {this->Clear(kFALSE);}
53  void Delete(Option_t * = "") {this->Clear(kTRUE);}
54  virtual void SetLegendX1Y1X2Y2(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
55  virtual void SetLegendX1(Double_t x1);// {fLegendX1 = x1;}
56  virtual void SetLegendY1(Double_t y1);// {fLegendY1 = y1;}
57  virtual void SetLegendX2(Double_t x2);// {fLegendX2 = x2;}
58  virtual void SetLegendY2(Double_t y2);// {fLegendY2 = y2;}
59  virtual void SetStatsX1Y1X2Y2(Double_t x1, Double_t y1, Double_t x2, Double_t y2);
60  virtual void SetNumHistsX(UInt_t numX);
61  virtual void SetNumHistsX(UInt_t numX, Int_t layer);
62  virtual void SetNumHistsY(UInt_t numY);
63  virtual void SetNumHistsY(UInt_t numY, Int_t layer);
64  virtual void SetNumHistsXY(UInt_t numX, UInt_t numY);
65  virtual void SetNumHistsXY(UInt_t numX, UInt_t numY, Int_t layer);
66  virtual void SetLogY(Bool_t yesNo = kTRUE);
67  virtual void SetLogY(Int_t layer, Bool_t yesNo = kTRUE);
68  void SetCanvasName(const TString& name);
69  virtual void SetCanvasWidth(Int_t w) {fCanvasWidth = w;}
70  virtual void SetCanvasHeight(Int_t h) {fCanvasHeight = h;}
71  virtual void SetHistsOption(Option_t* option);
72  virtual void SetHistsOption(Option_t* option, Int_t layer);
73  virtual void SetHistsMinMax(Double_t minMax, Bool_t min);
74  virtual void SetHistsMinMax(Double_t minMax, Bool_t min, Int_t layer);
75  static void SetLegendEntryOption(const char* option) {fgLegendEntryOption = option;} // some of "lpf"
76  virtual void AddHistsOption(Option_t* option);
77  virtual void AddHistsOption(Option_t* option, Int_t layer);
78  virtual void SetHistsXTitle(const char* title);
79  virtual void SetHistsXTitle(const char* title, Int_t layer);
80  virtual void SetHistsYTitle(const char* title);
81  virtual void SetHistsYTitle(const char* title, Int_t layer);
82  virtual void SetHistsFillColor(Color_t color);
83  virtual void SetHistsFillColor(Color_t color, Int_t layer);
84  virtual void SetHistsLineWidth(Width_t width);
85  virtual void SetHistsLineWidth(Width_t width, Int_t layer);
86  virtual void SetHistsLineStyle(Int_t style);
87  virtual void SetHistsLineStyle(Int_t style, Int_t layer, Int_t numHistInPad = -1);
88  virtual void SetHistsLineColor(Color_t color);
89  virtual void SetHistsLineColor(Color_t color, Int_t layer);
90  virtual void WriteCanvases(TFile* file);
91  virtual void WriteHistos(TFile* file);
92  virtual void Update();
93  virtual void Update(Int_t layer);
94  virtual Bool_t SetBatch(Bool_t set = kTRUE) {Bool_t r = fBatch; fBatch = set; return r;}
95  virtual Bool_t IsBatch() const {return fBatch;}
96  virtual void ExpandTo(Int_t newDepth);
97 
98  virtual GFHistArray* GetHistsOf(Int_t layer, Int_t histNum, Bool_t mayExpand = kFALSE);
99  virtual TList* GetObjectsOf(Int_t layer, Int_t histNum);
100  virtual Int_t GetNumHistsOf(Int_t layer);
101  virtual TLegend* GetLegendOf(Int_t layer, Int_t nPad);
102  virtual Int_t GetCanvasWidth() const {return fCanvasWidth;}
103  virtual Int_t GetCanvasHeight() const {return fCanvasHeight;}
104  virtual Int_t GetNumHistsX(Int_t layer) const;
105  virtual Int_t GetNumHistsY(Int_t layer) const;
106  virtual Double_t MaxOfHist(const TH1* h) const;
107  virtual Double_t MaxOfHists(const TObjArray* hists) const;
108  virtual Double_t MinOfHist(const TH1* h) const;
109  virtual Double_t MinOfHists(const TObjArray* hists) const;
110  virtual TVirtualPad* GetPad(Int_t layer, Int_t histNum);
111  virtual TCanvas* GetCanvas(Int_t layer, Int_t number = 0);// after draw!!
112  Int_t GetNumLayers() const {return fDepth;}
113  virtual void GetLegendX1Y1X2Y2(Double_t& x1, Double_t& y1, Double_t& x2, Double_t& y2) const;
114 
115  static const Int_t kDefaultPadsPerCanX;// = 2; Doesn't work! Why ???
116  static const Int_t kDefaultPadsPerCanY;// = 2; It should. And it DOES, if we make
117  static const Int_t kDefaultDepth;// = 1; these static const datamembers protected!
118 
119  static Int_t NumberOfSubPadsOf(TCanvas* can);
120  static void MakeDifferentStyle(GFHistArray* hists);
121  Bool_t DrawDiffStyle(Bool_t yesNo) {
122  const Bool_t old = fDrawDiffStyle; fDrawDiffStyle = yesNo; return old;}
123  Bool_t SameWithStats(Bool_t yesNo) {
124  const Bool_t old = fSameWithStats; fSameWithStats = yesNo; return old;}
125 
126 protected:
127  virtual void DrawReally(Int_t layer);
128  virtual void DrawLegend(Int_t layer, Int_t histNo);
129  virtual void DrawObjects(Int_t layer, Int_t histNo);
130  virtual void MakeCanvases(Int_t layer);
131  virtual TObjArray* MakeLegends(Int_t layer);
132  virtual TList* MakeObjList(Int_t layer, Int_t histoNum);
133  virtual void Initialise();
134  virtual Bool_t CheckDepth(const char* method, Int_t layer, Bool_t mayExpand = kTRUE);
135  virtual Bool_t CheckHistNum(const char* method, Int_t layer, Int_t histNum,
136  Bool_t mayExpand = kFALSE);
137  void DrawFuncs(const TH1* hist) const;
138  void ColourStatsBoxes(GFHistArray *hists) const;
139  void ColourFuncs(GFHistArray *hists) const;
140 
141 private:
142  Int_t fDepth; // how many layers of histograms in arrays?
143  TArrayI fNoX; // how many hists in x...
144  TArrayI fNoY; // ... and in y in each canvas array
145  TArrayC fLogY; // whether or not a layer should be plotted in log(y)
146  Double_t fLegendX1; // default position
147  Double_t fLegendY1; // ...of TLegends
148  Double_t fLegendX2; // ... in x
149  Double_t fLegendY2; // .. and y
150  Double_t fStatsX1; // default positions in x and y
151  Double_t fStatsX2; // ...of first statsbox in case
152  Double_t fStatsY1; // ... many have to be drawn
153  Double_t fStatsY2; // ... (subsequent boxes are shifted)
154  TString fCanvasName;
155  Int_t fCanvasWidth; // pixel width
156  Int_t fCanvasHeight; // height of canvases (maybe relativly manipulated...)
157  static TString fgLegendEntryOption; // option used for legend entry style
158  TObjArray* fHistArrays; // array of arrays of arrays of histograms
159  TObjArray* fLegendArrays; // array of arrays to hold potential TLegend's
160  TObjArray* fObjLists; // array of array of lists to hold potential objects
161  TObjArray* fCanArrays; // array of arrays to hold canvases for drawing
162  Bool_t fBatch; // if true: ignore Draw()
163  Bool_t fDrawDiffStyle; // if true(default): call MakeDifferentStyle while Draw
164  Bool_t fSameWithStats; // if true(non-default): use SAMES option to add all stats boxes
165 
166  ClassDef(GFHistManager, 0) // Gero's histogram manager (not writable!)
167 };
168 
169 #endif
GFHistManager::RemoveLegend
virtual Bool_t RemoveLegend(Int_t layer, Int_t nPad)
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
GFHistManager::kDefaultPadsPerCanY
static const Int_t kDefaultPadsPerCanY
Definition: GFHistManager.h:116
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
GFHistManager::GetNumHistsX
virtual Int_t GetNumHistsX(Int_t layer) const
GFHistManager::AddLayer
virtual void AddLayer(GFHistManager *other, Int_t layer)
GFHistManager::ColourStatsBoxes
void ColourStatsBoxes(GFHistArray *hists) const
GFHistManager
Definition: GFHistManager.h:20
min
T min(T a, T b)
Definition: MathUtil.h:58
GFHistManager::MakeObjList
virtual TList * MakeObjList(Int_t layer, Int_t histoNum)
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
AlcaSiPixelAliHarvester0T_cff.method
method
Definition: AlcaSiPixelAliHarvester0T_cff.py:41
GFHistManager::GetLegendX1Y1X2Y2
virtual void GetLegendX1Y1X2Y2(Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2) const
GFHistManager::fgLegendEntryOption
static TString fgLegendEntryOption
Definition: GFHistManager.h:157
GFHistManager::Clear
virtual void Clear(Bool_t deleteHists)
GFHistManager::fObjLists
TObjArray * fObjLists
Definition: GFHistManager.h:160
GFHistManager::SetLegendEntryOption
static void SetLegendEntryOption(const char *option)
Definition: GFHistManager.h:75
GFHistManager::SetCanvasHeight
virtual void SetCanvasHeight(Int_t h)
Definition: GFHistManager.h:70
GFHistManager::GetObjectsOf
virtual TList * GetObjectsOf(Int_t layer, Int_t histNum)
compare.hists
hists
Definition: compare.py:318
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
GFHistManager::GetCanvasWidth
virtual Int_t GetCanvasWidth() const
Definition: GFHistManager.h:102
GFHistManager::GetNumLayers
Int_t GetNumLayers() const
Definition: GFHistManager.h:112
GFHistManager::fStatsX2
Double_t fStatsX2
Definition: GFHistManager.h:151
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:94
runTheMatrix.opt
opt
Definition: runTheMatrix.py:307
GFHistManager::SetNumHistsY
virtual void SetNumHistsY(UInt_t numY)
GFHistManager::fLegendY1
Double_t fLegendY1
Definition: GFHistManager.h:147
GFHistManager::ExpandTo
virtual void ExpandTo(Int_t newDepth)
GFHistManager::SetStatsX1Y1X2Y2
virtual void SetStatsX1Y1X2Y2(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
GFHistManager::NumberOfSubPadsOf
static Int_t NumberOfSubPadsOf(TCanvas *can)
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
GFHistManager::SetHistsMinMax
virtual void SetHistsMinMax(Double_t minMax, Bool_t min)
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
GFHistManager::AddLayers
virtual void AddLayers(GFHistManager *other)
GFHistManager::fCanvasHeight
Int_t fCanvasHeight
Definition: GFHistManager.h:156
GFHistManager::Clear
void Clear(Option_t *="")
Definition: GFHistManager.h:52
GFHistManager::Update
virtual void Update()
GFHistManager::fBatch
Bool_t fBatch
Definition: GFHistManager.h:162
GFHistManager::GFHistManager
GFHistManager()
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
GFHistManager::GetNumHistsY
virtual Int_t GetNumHistsY(Int_t layer) const
GFHistManager::SetHistsLineStyle
virtual void SetHistsLineStyle(Int_t style)
GFHistManager::SetHistsFillColor
virtual void SetHistsFillColor(Color_t color)
GFHistManager::SetNumHistsX
virtual void SetNumHistsX(UInt_t numX)
w
const double w
Definition: UKUtility.cc:23
GFHistManager::AddObject
virtual void AddObject(TObject *obj, Int_t layer, Int_t histoNum, Option_t *opt=NULL)
GFHistManager::MaxOfHist
virtual Double_t MaxOfHist(const TH1 *h) const
GFHistManager::GetLegendOf
virtual TLegend * GetLegendOf(Int_t layer, Int_t nPad)
GFHistManager::IsBatch
virtual Bool_t IsBatch() const
Definition: GFHistManager.h:95
GFHistManager::MakeDifferentStyle
static void MakeDifferentStyle(GFHistArray *hists)
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
trackingPlots.other
other
Definition: trackingPlots.py:1464
GFHistManager::Draw
virtual void Draw(Option_t *opt="")
h
GFHistManager::SetBatch
virtual Bool_t SetBatch(Bool_t set=kTRUE)
Definition: GFHistManager.h:94
GFHistManager::fCanArrays
TObjArray * fCanArrays
Definition: GFHistManager.h:161
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
GFHistManager::AddHistsSame
virtual void AddHistsSame(GFHistArray *hists, Int_t layer, const char *legendTitle=NULL, const char *legOpt=NULL)
style
Definition: style.py:1
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
GFHistManager::AddHistSame
virtual TLegendEntry * AddHistSame(TH1 *hist, Int_t layer, Int_t nPad, const char *legendTitle=NULL, const char *legOpt=NULL)
GFHistManager::AddHistsOption
virtual void AddHistsOption(Option_t *option)
GFHistManager::DrawObjects
virtual void DrawObjects(Int_t layer, Int_t histNo)
GFHistManager::Overlay
virtual void Overlay(GFHistManager *other, Int_t otherLayer, Int_t myLayer, const char *legendTitle)
geometryDiff.file
file
Definition: geometryDiff.py:13
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
GFHistManager::fLegendX2
Double_t fLegendX2
Definition: GFHistManager.h:148
GFHistManager::MinOfHists
virtual Double_t MinOfHists(const TObjArray *hists) const
GFHistManager::SetHistsYTitle
virtual void SetHistsYTitle(const char *title)
GFHistManager::fDrawDiffStyle
Bool_t fDrawDiffStyle
Definition: GFHistManager.h:163
GFHistManager::fHistArrays
TObjArray * fHistArrays
Definition: GFHistManager.h:158
GFHistManager::AddHists
virtual void AddHists(TCollection *hists, Int_t layer=0, const char *legendTitle=NULL, const char *legOpt=NULL)
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
GFHistManager::ColourFuncs
void ColourFuncs(GFHistArray *hists) const
GFHistManager::SetNumHistsXY
virtual void SetNumHistsXY(UInt_t numX, UInt_t numY)
GFHistManager::Delete
void Delete(Option_t *="")
Definition: GFHistManager.h:53
GFHistManager::fCanvasName
TString fCanvasName
Definition: GFHistManager.h:154
GFHistManager::AddLegend
virtual TLegend * AddLegend(Int_t layer, Int_t nPad, const char *header=NULL, Bool_t referAll=kTRUE)
GFHistManager::SetHistsLineWidth
virtual void SetHistsLineWidth(Width_t width)
GFHistManager::DrawLegend
virtual void DrawLegend(Int_t layer, Int_t histNo)
GFHistManager::Print
virtual void Print(const char *filename, Bool_t add=kFALSE)
GFHistManager::fDepth
Int_t fDepth
Definition: GFHistManager.h:142
GFHistManager::DrawReally
virtual void DrawReally(Int_t layer)
GFHistManager::SetHistsLineColor
virtual void SetHistsLineColor(Color_t color)
GFHistManager::SetCanvasName
void SetCanvasName(const TString &name)
GFHistManager::SetLegendX1Y1X2Y2
virtual void SetLegendX1Y1X2Y2(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
GFHistManager::fCanvasWidth
Int_t fCanvasWidth
Definition: GFHistManager.h:155
NULL
#define NULL
Definition: scimark2.h:8
alignCSCRings.r
r
Definition: alignCSCRings.py:93
GFHistManager::SetLogY
virtual void SetLogY(Bool_t yesNo=kTRUE)
GFHistManager::GetPad
virtual TVirtualPad * GetPad(Int_t layer, Int_t histNum)
GFHistManager::CheckDepth
virtual Bool_t CheckDepth(const char *method, Int_t layer, Bool_t mayExpand=kTRUE)
timingPdfMaker.can
can
Definition: timingPdfMaker.py:310
GFHistManager::SetLegendX1
virtual void SetLegendX1(Double_t x1)
GFHistManager::fStatsY2
Double_t fStatsY2
Definition: GFHistManager.h:153
GFHistManager::GetNumHistsOf
virtual Int_t GetNumHistsOf(Int_t layer)
GFHistManager::WriteHistos
virtual void WriteHistos(TFile *file)
GFHistManager::MakeLegends
virtual TObjArray * MakeLegends(Int_t layer)
GFHistManager::DrawDiffStyle
Bool_t DrawDiffStyle(Bool_t yesNo)
Definition: GFHistManager.h:121
GFHistManager::WriteCanvases
virtual void WriteCanvases(TFile *file)
GFHistManager::SetLegendY2
virtual void SetLegendY2(Double_t y2)
GFHistManager::fStatsY1
Double_t fStatsY1
Definition: GFHistManager.h:152
GFHistManager::GetCanvas
virtual TCanvas * GetCanvas(Int_t layer, Int_t number=0)
GFHistManager::SetLegendX2
virtual void SetLegendX2(Double_t x2)
GFHistManager::fNoX
TArrayI fNoX
Definition: GFHistManager.h:143
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
GFHistManager::MaxOfHists
virtual Double_t MaxOfHists(const TObjArray *hists) const
GFHistManager::fLogY
TArrayC fLogY
Definition: GFHistManager.h:145
GFHistManager::GetHistsOf
virtual GFHistArray * GetHistsOf(Int_t layer, Int_t histNum, Bool_t mayExpand=kFALSE)
GFHistManager::CheckHistNum
virtual Bool_t CheckHistNum(const char *method, Int_t layer, Int_t histNum, Bool_t mayExpand=kFALSE)
GFHistManager::SetHistsXTitle
virtual void SetHistsXTitle(const char *title)
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
GFHistManager::SetCanvasWidth
virtual void SetCanvasWidth(Int_t w)
Definition: GFHistManager.h:69
GFHistManager::SetHistsOption
virtual void SetHistsOption(Option_t *option)
GFHistManager::~GFHistManager
virtual ~GFHistManager()
GFHistManager::MinOfHist
virtual Double_t MinOfHist(const TH1 *h) const
GFHistManager::fStatsX1
Double_t fStatsX1
Definition: GFHistManager.h:150
GFHistManager::AddHist
virtual TLegendEntry * AddHist(TH1 *hist, Int_t layer=0, const char *legendTitle=NULL, const char *legOpt=NULL)
GFHistManager::fLegendY2
Double_t fLegendY2
Definition: GFHistManager.h:149
GFHistManager::fNoY
TArrayI fNoY
Definition: GFHistManager.h:144
GFHistManager::kDefaultPadsPerCanX
static const Int_t kDefaultPadsPerCanX
Definition: GFHistManager.h:115
GFHistManager::GetCanvasHeight
virtual Int_t GetCanvasHeight() const
Definition: GFHistManager.h:103
GFHistManager::DrawFuncs
void DrawFuncs(const TH1 *hist) const
GFHistManager::SetLegendY1
virtual void SetLegendY1(Double_t y1)
GFHistManager::fLegendX1
Double_t fLegendX1
Definition: GFHistManager.h:146
GFHistArray
Definition: GFHistArray.h:10
GFHistManager::fLegendArrays
TObjArray * fLegendArrays
Definition: GFHistManager.h:159
GFHistManager::kDefaultDepth
static const Int_t kDefaultDepth
Definition: GFHistManager.h:117
GFHistManager::fSameWithStats
Bool_t fSameWithStats
Definition: GFHistManager.h:164
GFHistManager::SameWithStats
Bool_t SameWithStats(Bool_t yesNo)
Definition: GFHistManager.h:123
GFHistManager::MakeCanvases
virtual void MakeCanvases(Int_t layer)
GFHistManager::Initialise
virtual void Initialise()