BAT  0.9.4
The Bayesian analysis toolkit
 All Classes Namespaces Functions Variables Enumerations
BCH2D.h
1 #ifndef __BCH2D__H
2 #define __BCH2D__H
3 
15 /*
16  * Copyright (C) 2007-2014, the BAT core developer team
17  * All rights reserved.
18  *
19  * For the licensing terms see doc/COPYING.
20  * For documentation see http://mpp.mpg.de/bat
21  */
22 
23 // ---------------------------------------------------------
24 
25 #include <vector>
26 #include <string>
27 
28 // ROOT classes
29 
30 class TH1D;
31 class TH2D;
32 class TGraph;
33 class TObject;
34 
35 // ---------------------------------------------------------
36 
37 class BCH2D
38 {
39 
40 public:
41 
47  BCH2D(TH2D* h = 0);
48 
51  ~BCH2D();
52 
60  TH2D* GetHistogram()
61  { return fHistogram; };
62 
67  int GetColor(int index)
68  { return fColors.at(index); };
69 
83  void SetColorScheme(int scheme);
84 
87  void SetHistogram(TH2D* hist);
88 
92  void SetGlobalMode(double mode[2])
93  { fMode[0] = mode[0];
94  fMode[1] = mode[1];
95  fModeFlag =1; };
96 
111  void Print(const char* filename, std::string options="BTfB3CS1meangmode", std::vector<double> intervals=std::vector<double>(0), int ww=0, int wh=0);
112 
122  void Print(const char* filename, std::string options, double interval, int ww=0, int wh=0);
123 
124 
149  void Draw(std::string options="BTfB3CS1meangmodelmode", std::vector<double> intervals=std::vector<double>(0));
150 
157  void Draw(std::string options, double interval);
158 
163 
167  void PrintIntegratedHistogram(const char* filename);
168 
173  double GetLevel(double p);
174 
178  double GetArea(double p);
179 
185  std::vector<int> GetNIntervalsY(TH2D* h, int &nfoundmax);
186 
198  TGraph* CalculateProfileGraph(int axis, std::string options="mode");
199 
211  TGraph* DrawProfile(int axis, std::string options, std::string drawoptions="blacksolid");
212 
218  TGraph* DrawProfileX(std::string options, std::string drawoptions)
219  { return DrawProfile(0, options, drawoptions); };
220 
226  TGraph* DrawProfileY(std::string options, std::string drawoptions)
227  { return DrawProfile(1, options, drawoptions); };
228 
231 private:
232 
235  TH2D* fHistogram;
236 
239  TH1D* fIntegratedHistogram;
240 
243  double fMode[2];
244 
247  int fModeFlag;
248 
251  std::vector<int> fColors;
252 
255  std::vector<TObject*> fROOTObjects;
256 
258  static unsigned int getNextIndex()
259  { return ++fHCounter; }
260 
262  static unsigned int fHCounter;
263 };
264 
265 // ---------------------------------------------------------
266 
267 #endif
void Draw(std::string options="BTfB3CS1meangmodelmode", std::vector< double > intervals=std::vector< double >(0))
Definition: BCH2D.cxx:171
TGraph * DrawProfileX(std::string options, std::string drawoptions)
Definition: BCH2D.h:218
~BCH2D()
Definition: BCH2D.cxx:46
double GetArea(double p)
Definition: BCH2D.cxx:611
A class for handling 2D distributions.
Definition: BCH2D.h:37
double GetLevel(double p)
Definition: BCH2D.cxx:599
void SetGlobalMode(double mode[2])
Definition: BCH2D.h:92
void Print(const char *filename, std::string options="BTfB3CS1meangmode", std::vector< double > intervals=std::vector< double >(0), int ww=0, int wh=0)
Definition: BCH2D.cxx:107
TH2D * GetHistogram()
Definition: BCH2D.h:60
void SetHistogram(TH2D *hist)
Definition: BCH2D.cxx:99
std::vector< int > GetNIntervalsY(TH2D *h, int &nfoundmax)
Definition: BCH2D.cxx:656
int GetColor(int index)
Definition: BCH2D.h:67
void PrintIntegratedHistogram(const char *filename)
Definition: BCH2D.cxx:551
void CalculateIntegratedHistogram()
Definition: BCH2D.cxx:564
BCH2D(TH2D *h=0)
Definition: BCH2D.cxx:36
TGraph * DrawProfile(int axis, std::string options, std::string drawoptions="blacksolid")
Definition: BCH2D.cxx:802
TGraph * CalculateProfileGraph(int axis, std::string options="mode")
Definition: BCH2D.cxx:691
void SetColorScheme(int scheme)
Definition: BCH2D.cxx:56
TGraph * DrawProfileY(std::string options, std::string drawoptions)
Definition: BCH2D.h:226