simple-tof-analysis
 All Classes Namespaces Functions Variables Groups Pages
TSFunction1D.h
1 /*
2  * TSFunction1D.h
3  *
4  * Created on: Aug 4, 2014
5  * Author: Silvestro di Luise
6  * Silvestro.Di.Luise@cern.ch
7  *
8  *
9  *
10  * BaseFunction +
11  * DIM=1
12  * fX variable and cache
13  * Eval method ?
14  * TGraph (1D) builder
15  *
16  *
17  *
18  */
19 
20 #ifndef TSFUNCTION1D_H_
21 #define TSFUNCTION1D_H_
22 
23 #include <iostream>
24 #include <vector>
25 
26 #include <TF1.h>
27 #include <TGraph.h>
28 
29 #include "TSVariable.h"
30 #include "TSParameter.h"
31 
32 
33 #include "TSBaseFunction.h"
34 
35 
36 using std::cout;
37 using std::endl;
38 
39 /*
40  *
41  */
42 
44 
45 
46 public:
47  TSFunction1D() {};
48  TSFunction1D(TString name,TString title);
49  TSFunction1D(TString name, TString title, const TSVariable &var_x);
50  virtual ~TSFunction1D();
51 
52 
53  //
54  virtual double Eval(double x, double y=0) const;
55  virtual double Eval() const;
56  virtual double Evaluate() const {return 0;}; //-------///
57  virtual double EvalFunc(double *x, double *p) const {return Eval(x[0]);}
58 
59  TGraph* BuildGraphX(double xmin, double xmax, int npts=300) const;
60  TGraph* BuildGraphX(int npts=300, double y=0) const;
61  TF1* BuildTF1(TString name="",int npx=300) const;
62 
63  virtual double ComputeIntegral() const;
64  virtual double ComputeIntegral(double xmin, double xmax) const;
65 
66  TString GetAxisTitles() const;
67 
68  void InitFuncs();
69 
70  virtual void SetVarX(const TSVariable &);
71  const TSVariable* GetVariableX() const;
72 
73  virtual double GetSigmaSpread() const {/*cout<<"sig spr: "<<this<<endl;*/ return 0;}
74 
75 
76 private:
77  const TSVariable *fX;
78 
79 protected:
80  void fCacheX(double val) const {/*cout<<"caching x for: "<<this->Name()<<" "<<val<<endl;*/cached_x=val;}
81  double fGetCachedX() const {return cached_x;}
82 
83 protected:
84  mutable double cached_x;
85 
86  mutable TF1* fTF1;
87 };
88 
89 #endif /* TS1DFUNCTION_H_ */
Definition: TSVariable.h:55
Definition: TSFunction1D.h:43
Definition: TSBaseFunction.h:48
TGraph * BuildGraphX(double xmin, double xmax, int npts=300) const
Definition: TSFunction1D.cc:122