simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TSRespFunc.h
1 /*
2  * TSRespFunc.h
3  *
4  * Created on: Oct 2, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  *
8  */
9 
10 #ifndef TSRESPFUNC_H_
11 #define TSRESPFUNC_H_
12 
13 #include <TGraph.h>
14 #include <TMultiGraph.h>
15 
16 #include "TSNamed.h"
17 
18 
19 #include "TSVariable.h"
20 #include "TSPhaseSpaceVolume.h"
21 
22 #include "TSArgList.h"
23 
24 /*
25  *
26  */
27 
28 class TSRespFunc: public TSNamed {
29 
30 public:
31 
32  TSRespFunc();
33  TSRespFunc(const TSRespFunc&);
34  virtual ~TSRespFunc();
35 
36 
37 
38  void AddControlVar(const TSVariable &, double min, double max);
39 
40  TSRespFunc* Clone(TString ="") const;
41 
42  void Copy(const TSRespFunc &);
43 
44  void Disable() { SetActive(false); }
45  void Enable() { SetActive(true); }
46 
47  void EnableControlVars();
48  void DisableControlVars();
49 
50  double Eval(double x) const;
51 
52  double* GetArrayX() const { return fX; }
53  double* GetArrayY() const { return fY; }
54 
55  TGraph& GetGraph();
56  TGraph* GetGraph(TString) const;
57 
58  double GetAxisShiftX() const {return fShift[0];}
59  double GetAxisShiftY() const {return fShift[1];}
60 
61 
62  int GetN() const {return fN;}
63  bool HasControlVars() const {return fHasControlVars;}
64  void Init();
65  bool IsActive() const {return fIsActive;}
66  bool IsEnabled() const {return IsActive();}
67  bool IsParab() const {return fIsParab;}
68  bool IsLinear() const {return fIsLinear;}
69  bool IsUnit() const {return fIsUnit;}
70  bool IsAnalytic() const;
71 
72  void Print() const;
73 
74  void SetActive(bool b) { fIsActive=b; }
75 
76  void Set(int N, double* x, double* y, double dx=0, double dy=0);
77  void Set(int N, float* x, float* y, float dx=0, float dy=0);
78 
79  void Set(int N, double *x, double *y, TSArgList& control_var_list, double dx=0, double dy=0);
80  void Set(int N, float *x, float *y, TSArgList& control_var_list, float dx=0, float dy=0);
81 
82  void ShiftAxis(double dx, double dy=0);
83 
84  void SetControlVarsVolume(const TSPhaseSpaceVolume& );
85  const TSPhaseSpaceVolume& GetControlVarsVolume() const;
86 
87  double Tweak(double central, double x) const;
88 
89 private:
90 
91  void fCheckAnalytic();
92  void fCheckLinearity();
93  void fCheckParab();
94  void fClear();
95  void fFillGraph();
96  void fShitAxis();
97  double fCalcSpline3Sigma(double, int opt=0) const ;
98 
99  int fN;
100  double *fX;
101  double *fY;
102  double fShift[2];
103  double fXRange[2];
104  double fYRange[2];
105  double fParsPoly[3];
106  bool fIsActive;
107  bool fIsParab;
108  bool fIsLinear;
109  bool fIsUnit;
110 
111 
112  static double kToleranceToUnity;
113 
114  TGraph fGraph;
115 
116  bool fHasControlVars;
117  int fNumOfControlVars;
118 
119  TSPhaseSpaceVolume fVarsVolume;
120 
121 };
122 
123 #endif /* TSRESPFUNC_H_ */
Definition: TSRespFunc.h:28
Definition: TSArgList.h:30
Definition: TSVariable.h:55
Definition: TSNamed.h:38
Definition: TSPhaseSpaceVolume.h:28