simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TSVariable.h
1 /*
2  * TSVariable.h
3  *
4  * Created on: May 26, 2014
5  * Author: sdiluise
6  */
7 
8 
35 #ifndef TSVARIABLE_H_
36 #define TSVARIABLE_H_
37 
38 #include <iostream>
39 #include <string>
40 #include <TObject.h>
41 #include <TString.h>
42 
43 #include "MessageMgr.h"
44 
45 #include "TSNamed.h"
46 
47 #include "ServerClientMgr.h"
48 
49 
50 using std::cout;
51 using std::endl;
52 
53 
54 
55 
56 class TSVariable: public TSNamed , public ServerClientMgr {
57 
58 
59 public:
60 
61  TSVariable();
62  TSVariable(TString name, TString label, TString title, TString unit="");
63  TSVariable(const TSVariable&);
64  virtual ~TSVariable();
65 
66  void Clear();
67  bool ContainsRange(double min, double max) const;
68  bool ContainsRange(const TSVariable &) const;
69  void Copy(const TSVariable &);
70  TSVariable* Clone(TString name="") const;
71  void ForceToRange(bool);
72  double GetMin() const {return fMin;}
73  double GetMax() const {return fMax;}
74  TString GetAxisTitle() const {return fAxisTitle;}
75  TString GetAxisUnit() const {return fAxisUnit;}
76  TString GetDefinition() const {return fDefinition;}
77  TString GetDescription() const {return fDescription;}
78  TString GetRange() const {return fRange;}
79  double GetRangeCenter() const {return 0.5*(fMin+fMax);}
80  TString GetLabelAndRange() const {return fLabelAndRange;}
81  TString GetLabelAndValue() const;
82  TString GetLabelAndValue(double ) const;
83  TString GetTitleXY(TString tity="entries") const;//def tity is "entries"
84  TString GetUnit() const {return fUnit;}
85  virtual double GetValue() const {return fVal;}
86  bool HasRange() const {return fHasRange;}
87  bool HasRangeForced() const {return fHasRangeForced;}
88  bool HasUnit() const {return fHasUnit;}
89  bool HasValue() const {return fHasValue;}
90 
91  bool IsInside(double) const;
92  void Print() const;
93  bool RangeIsContained(double min,double max) const;
94  bool RangeIsContained(const TSVariable &) const;
95  bool RangesOverlap(double min,double max) const;
96  bool RangesOverlap(const TSVariable &) const;
97  void RemoveRange();
98  bool SameRange(double min,double max) const;
99  bool SameRange(const TSVariable &) const;
100  void SetLabel(TString);
101  int SetRange(double, double);
102  void SetTitle(TString);
103  void SetUnit(TString);
104  void SetValue(double);
105 
106 
107 private:
108 
109  void fBuildStrAxisTitle();
110  void fBuildStrAxisUnit();
111  void fBuildStrDefinition();
112  void fBuildStrDescription();
113  void fBuildStrLabelAndRange();
114  void fBuildStrRange();
115 
116  void fBuildStrsWithLabel();
117  void fBuildStrsWithRange();
118  void fBuildStrsWithTitle();
119  void fBuildStrsWithUnit();
120 
121 
122  double fVal;
123  double fMin;
124  double fMax;
125 
126  bool fHasRange;
127  bool fHasRangeForced;
128  bool fHasUnit;
129  bool fHasValue;
130 
131 
132  TString fAxisUnit;
133  TString fAxisTitle;
134  TString fDefinition;
135  TString fDescription;
136  TString fLabelAndRange;
137  TString fRange;
138  TString fUnit;
139 
140 
141 
142 // ClassDef(TSVariable,1);
143 };
144 
145 #endif /* TSVARIABLE_H_ */
bool RangesOverlap(double min, double max) const
Definition: TSVariable.cc:218
Definition: TSVariable.h:55
bool ContainsRange(double min, double max) const
Definition: TSVariable.cc:81
Definition: TSNamed.h:38
Definition: ServerClientMgr.h:22
bool RangeIsContained(double min, double max) const
Definition: TSVariable.cc:264