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 
40 #include <TH2F.h>
41 #include <TTree.h>
42 
43 
44 class TH2FAuto: public TH2F {
45 
46 public:
47 
48  TH2FAuto();
49  TH2FAuto(const char* name, const char* title);
50  TH2FAuto(const char* name, const char* title, double xlow, double xup, double ylow, double yup);
51  TH2FAuto(const char* name, const char* title, int,double, double, int, double, double);
52  TH2FAuto(const char* name, const char* title, int,double*, int, double*);
53 
54  TH2FAuto(const TH2FAuto &);
55 
56  virtual ~TH2FAuto();
57 
58  int BufferEmpty(int);
59 
60  void Copy(const TH2FAuto &);
61  TObject* Clone(const char* newname = "") const;
62 
63  void Draw(Option_t* opt);
64 
65  int Fill(double,double);
66  int FillBufferTo(TH2FAuto &);
67  void FixBinningX(int n, double low, double up);
68  void FixBinningY(int n, double low, double up);
69  void FixBinningX(int n, const double* bins);
70  void FixBinningY(int n, const double* bins);
71  void FlushBuffer();
72  int GetBufferSize();
73  double GetMean(int axis=1);
74  double GetRMS(int axis=1);
75 
76  int GetFixedNbinsX() const;
77  int GetFixedNbinsY() const;
78  const double* GetFixedBinsArrayX() const;
79  const double* GetFixedBinsArrayY() const;
80 
81  double GetLowRangeLimitX() const;
82  double GetLowRangeLimitY() const;
83  double GetUpRangeLimitX() const;
84  double GetUpRangeLimitY() const;
85 
86  bool HasLowRangeLimitX() const;
87  bool HasLowRangeLimitY() const;
88  bool HasUpRangeLimitX() const;
89  bool HasUpRangeLimitY() const;
90 
91 
92  bool IsAuto() const {return fIsAuto;}
93  bool IsBuilt() const {return fIsBuilt;}
94  bool IsBinningXFix() const {return fFixBinningX;}
95  bool IsBinningYFix() const {return fFixBinningY;}
96  void Reset();
97  void ResetBuffer();
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  TTree fBuffer;
119  TTree fBufferOut;
120 
121  bool fIsAuto;
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  double fX;
142  double fY;
143 
144 };
145 
146 #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