simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TH2FAuto.h
1 /*
2  * TH2FAuto.h
3  *
4  * Created on: May 12, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  *
8  *
9  *
10  *
11  *
12  */
13 
36 #ifndef TH2FAUTO_H_
37 #define TH2FAUTO_H_
38 
39 #include <vector>
40 
41 #include <TH2F.h>
42 
43 class TH2FAuto: public TH2F {
44 
45 public:
46 
47  TH2FAuto();
48  TH2FAuto(const char* name, const char* title);
49  TH2FAuto(const char* name, const char* title, double xlow, double xup, double ylow, double yup);
50  TH2FAuto(const char* name, const char* title, int, double, double, int, double, double);
51  TH2FAuto(const char* name, const char* title, int,double*, int, double*);
52 
53  TH2FAuto(const TH2FAuto &);
54 
55  virtual ~TH2FAuto();
56 
57  int BufferEmpty(int);
58 
59  void Copy(const TH2FAuto &);
60  TObject* Clone(const char* newname = "") const;
61 
62  void Draw(Option_t* opt);
63 
64  int Fill(double,double);
65  int FillBufferTo(TH2FAuto &);
66  void FixBinningX(int n, double low, double up);
67  void FixBinningY(int n, double low, double up);
68  void FixBinningX(int n, const double* bins);
69  void FixBinningY(int n, const double* bins);
70  void FlushBuffer();
71  int GetBufferSize();
72  double GetMean(int axis=1);
73  double GetRMS(int axis=1);
74 
75  int GetFixedNbinsX() const;
76  int GetFixedNbinsY() const;
77  const double* GetFixedBinsArrayX() const;
78  const double* GetFixedBinsArrayY() const;
79 
80  double GetLowRangeLimitX() const;
81  double GetLowRangeLimitY() const;
82  double GetUpRangeLimitX() const;
83  double GetUpRangeLimitY() const;
84 
85  bool HasLowRangeLimitX() const;
86  bool HasLowRangeLimitY() const;
87  bool HasUpRangeLimitX() const;
88  bool HasUpRangeLimitY() const;
89 
90 
91  bool IsAuto() const {return fIsAuto;}
92  bool IsBuilt() const {return fIsBuilt;}
93  bool IsBinningXFix() const {return fFixBinningX;}
94  bool IsBinningYFix() const {return fFixBinningY;}
95  void Reset();
96  void ResetBuffer();
97  void SetAutoRangeNumOfBins(int,int);
98  void SetMaxBufferSize(int);
99  void SetLowRangeLimitX(double);
100  void SetLowRangeLimitY(double);
101  void SetRangeLimits(double xlow, double xup, double ylow, double yup);
102  void SetRangeLimitsX(double low, double up);
103  void SetRangeLimitsY(double low, double up);
104  void SetStrategy(int);
105  void SetUpRangeLimitX(double);
106  void SetUpRangeLimitY(double);
107 
108 
109  int Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0);
110 
111 private:
112 
113  void fClearRangeLimits();
114  void fFillBuffer(double,double);
115  void fInit();
116  void fSetBuffer();
117 
118  bool fIsAuto;
119 
120  int fAutoRangeNBins[2];
121 
122  bool fIsBuilt;
123  int fMaxBufferSize;
124  int fStrategy;
125  bool fFixBinningX;
126  bool fFixBinningY;
127  bool fFixAxisVariableBins[2];
128  int fFixNumOfBins[2];
129  double fFixLimitsX[2];
130  double fFixLimitsY[2];
131 
132  TAxis fFixedAxisX;
133  TAxis fFixedAxisY;
134 
135  bool fXRangeHasLimit[2];
136  bool fYRangeHasLimit[2];
137  double fXRangeLimit[2];
138  double fYRangeLimit[2];
139 
140 
141  std::vector<double> fBufferX;
142  std::vector<double> fBufferY;
143  std::vector<double> fBufferXOut;
144  std::vector<double> fBufferYOut;
145 
146 
147  double fBufferXMinMax[2];
148  double fBufferYMinMax[2];
149 
150 
151 
152 };
153 
154 #endif /* TH2FAUTO_H_ */
int Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Definition: TH2FAuto.cc:743
Definition: TH2FAuto.h:44