MINT2
HistogramBase.h
Go to the documentation of this file.
1 
11 #ifndef HISTOGRAMBASE_HH
12 #define HISTOGRAMBASE_HH
13 
14 // HyperPlot includes
15 #include "Mint/RootPlotter1D.h"
16 #include "Mint/RootPlotter2D.h"
17 #include "Mint/MessageService.h"
18 
19 // Root includes
20 #include "TTree.h"
21 #include "TFile.h"
22 #include "TH1D.h"
23 #include "TH2D.h"
24 #include "TRandom3.h"
25 #include "TMath.h"
26 
27 // std includes
28 
29 
31 
32  protected:
33 
34  int _nBins;
35  std::vector<double> _binContents;
36  std::vector<double> _sumW2;
38  double _min;
39  double _max;
40  double _minDensity;
41  double _maxDensity;
43  public:
44 
45  HistogramBase(int nBins);
46  virtual ~HistogramBase();
47 
48  int checkBinNumber(int bin) const;
49 
50  void resetBinContents(int nBins);
51  void clear();
52 
53  void fillBase(int binNum, double weight);
54 
55  void setBinContent(int bin, double val);
56  void setBinError (int bin, double val);
57 
58  virtual void merge( const HistogramBase& other );
59 
60  double getBinContent(int bin) const;
61  double getBinError (int bin) const;
62 
63  int getNBins() const{return _nBins;}
66  void divide(const HistogramBase& other);
67  void multiply(const HistogramBase& other);
68  void add(const HistogramBase& other);
69  void minus(const HistogramBase& other);
70 
71  void pulls(const HistogramBase& other);
72  void pulls(const HistogramBase& other1, const HistogramBase& other2);
73  void asymmetry(const HistogramBase& other);
74  void asymmetry(const HistogramBase& other1, const HistogramBase& other2);
75 
76  void drawPullHistogram(const HistogramBase& other, TString name, int nBins = 50, double pmLimits = 3.5) const;
77  double chi2(const HistogramBase& other) const;
78  double pvalue(const HistogramBase& other, int ndof = -1) const;
79  double chi2sig(const HistogramBase& other, int ndof = -1) const;
80 
81 
82  double integral() const;
83  double integralError() const;
84 
85  void randomiseWithinErrors(int seed);
86 
87  double getMin() const;
88  double getMax() const;
89 
90  void setMin(double min){_min = min;}
91  void setMax(double max){_max = max;}
93  double getMinDensity() const;
94  double getMaxDensity() const;
95  void setMinDensity(double min){_minDensity = min;}
96  void setMaxDensity(double max){_maxDensity = max;}
98  void saveBase();
99  void saveBase(TString filename);
100 
101  void loadBase(TString filename);
102 
103  void normalise(double area = 1.0);
104 
105  virtual double getBinVolume(int bin) const;
106  double getFrequencyDensity(int bin) const;
107 
108  void reserveCapacity(int nElements);
109 
110  void makeFrequencyDensity();
111 
112  void print();
113 
114 };
115 
116 
117 
118 #endif
119 
void loadBase(TString filename)
double chi2(const HistogramBase &other) const
double getMaxDensity() const
double getBinError(int bin) const
int getNBins() const
Definition: HistogramBase.h:63
virtual void merge(const HistogramBase &other)
std::vector< double > _binContents
Definition: HistogramBase.h:35
void asymmetry(const HistogramBase &other)
virtual ~HistogramBase()
void setBinError(int bin, double val)
std::vector< double > _sumW2
Definition: HistogramBase.h:36
void setMin(double min)
Definition: HistogramBase.h:90
virtual double getBinVolume(int bin) const
HistogramBase(int nBins)
double getBinContent(int bin) const
void setBinContent(int bin, double val)
double getMin() const
void fillBase(int binNum, double weight)
void makeFrequencyDensity()
double chi2sig(const HistogramBase &other, int ndof=-1) const
double getFrequencyDensity(int bin) const
void setMax(double max)
Definition: HistogramBase.h:91
double getMax() const
void resetBinContents(int nBins)
void multiply(const HistogramBase &other)
void drawPullHistogram(const HistogramBase &other, TString name, int nBins=50, double pmLimits=3.5) const
void reserveCapacity(int nElements)
void minus(const HistogramBase &other)
void setMinDensity(double min)
Definition: HistogramBase.h:95
void randomiseWithinErrors(int seed)
double _minDensity
Definition: HistogramBase.h:40
void divide(const HistogramBase &other)
int checkBinNumber(int bin) const
void normalise(double area=1.0)
void pulls(const HistogramBase &other)
double pvalue(const HistogramBase &other, int ndof=-1) const
double integral() const
double _maxDensity
Definition: HistogramBase.h:41
void setMaxDensity(double max)
Definition: HistogramBase.h:96
double integralError() const
double getMinDensity() const
void add(const HistogramBase &other)