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 
43 class TSFunction1D: public TSBaseFunction {
44 
45 
46 public:
47  TSFunction1D(TString name,TString title);
48  TSFunction1D(TString name, TString title, const TSVariable &var_x);
49  virtual ~TSFunction1D();
50 
51 
52  //
53  virtual double Eval(double x, double y=0) const;
54  virtual double Eval() const;
55  virtual double Evaluate() const {return 0;}; //-------///
56  virtual double EvalFunc(double *x, double *p) const {return Eval(x[0]);}
57 
58  TGraph* BuildGraphX(double xmin, double xmax, int npts=300) const;
59  TGraph* BuildGraphX(int npts=300, double y=0) const;
60  TF1* BuildTF1(TString name="",int npx=300) const;
61 
62  virtual double ComputeIntegral() const;
63  virtual double ComputeIntegral(double xmin, double xmax) const;
64 
65  TString GetAxisTitles() const;
66 
67  void InitFuncs();
68 
69  virtual void SetVarX(const TSVariable &);
70  const TSVariable* GetVariableX() const;
71 
72  virtual double GetSigmaSpread() const {/*cout<<"sig spr: "<<this<<endl;*/ return 0;}
73 
74 
75 private:
76  const TSVariable *fX;
77 
78 protected:
79  void fCacheX(double val) const {/*cout<<"caching x for: "<<this->Name()<<" "<<val<<endl;*/cached_x=val;}
80  double fGetCachedX() const {return cached_x;}
81 
82 protected:
83  mutable double cached_x;
84 
85  mutable TF1* fTF1;
86 };
87 
88 #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