simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TH1FAuto.h
1 /*
2  * TH1FAuto.h
3  *
4  * Created on: May 12, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  */
8 
32 #ifndef TH1FAUTO_H_
33 #define TH1FAUTO_H_
34 
35 #include <vector>
36 #include <TObject.h>
37 #include <TH1F.h>
38 
39 
40 
41 class TH1FAuto: public TH1F {
42 
43 public:
44 
45  TH1FAuto();
46  TH1FAuto(const char* name, const char* title);
47  TH1FAuto(const char* name, const char* title, double low, double up);
48  TH1FAuto(const char* name, const char* title, int, double xmin, double xmax);
49  TH1FAuto(const char* name, const char* title, int, double* bins);
50 
51  TH1FAuto(const TH1FAuto &);
52 
53  virtual ~TH1FAuto();
54 
55  int BufferEmpty(int);
56 
57  void Copy(const TH1FAuto &);
58  TObject* Clone(const char* newname = "") const;
59 
60  void Draw(Option_t* opt);
61 
62  int Fill(double);
63  void FillBufferTo(TH1FAuto &);
64  void FillBufferTo(double *);
65  void FlushBuffer();
66  int GetBufferSize() const;
67  double GetMean(int axis=1);
68  double GetRMS(int axis=1);
69  double GetLowRangeLimitX() const;
70  double GetUpRangeLimitX() const;
71  TH1F* GetTH1F() { return static_cast<TH1F*>(this); }
72  bool HasLowRangeLimitX() const;
73  bool HasUpRangeLimitX() const;
74  bool IsAuto() const {return fIsAuto;}
75  bool IsBuilt() const {return fIsBuilt;}
76  void Reset();
77  void ResetBuffer();
78  void SetAutoRangeNumOfBins(int);
79  void SetMaxBufferSize(int);
80  void SetLowRangeLimitX(double);
81  void SetRangeLimitsX(double, double);
82  void SetStrategy(int);
83  void SetUpRangeLimitX(double);
84 
85  int Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0);
86 
87 private:
88 
89  void fClearRangeLimits();
90  void fFillBuffer(double);
91  void fInit();
92 
93  bool fIsAuto;
94  bool fIsBuilt;
95  int fAutoRangeNBins;
96  int fMaxBufferSize;
97  int fStrategy;
98  bool fRangeHasLimit[2];
99  double fRangeLimit[2];
100 
101  std::vector<double> fBufferX;
102  std::vector<double> fBufferXOut;
103 
104  double fBufferMinMax[2];
105 
106 
107  //ClassDef(TH1FAuto,1);
108 };
109 
110 #endif /* TH1FAUTO_H_ */
Definition: TH1FAuto.h:41
int Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Definition: TH1FAuto.cc:534