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