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 
36 #include <TObject.h>
37 #include <TH1F.h>
38 #include <TTree.h>
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 SetMaxBufferSize(int);
79  void SetLowRangeLimitX(double);
80  void SetRangeLimitsX(double, double);
81  void SetStrategy(int);
82  void SetUpRangeLimitX(double);
83 
84  int Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0);
85 
86 private:
87 
88  void fClearRangeLimits();
89  void fFillBuffer(double);
90  void fInit();
91  void fSetBuffer();
92 
93  TTree fBuffer;
94  TTree fBufferOutLow;
95  TTree fBufferOutUp;
96 
97  bool fIsAuto;
98  bool fIsBuilt;
99  int fMaxBufferSize;
100  int fStrategy;
101  bool fRangeHasLimit[2];
102  double fRangeLimit[2];
103  double fX;
104 
105  //ClassDef(TH1FAuto,1);
106 };
107 
108 #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