1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: Interpolate.hh 1767 2005-04-19 22:33:30Z thea $ |
---|
3 | // Author: D.DeMarco |
---|
4 | |
---|
5 | #ifndef __INTERPOLATE_HH__ |
---|
6 | #define __INTERPOLATE_HH__ |
---|
7 | |
---|
8 | #include <vector> |
---|
9 | #include "NumbersFileParser.hh" |
---|
10 | #include "EsafMsgSource.hh" |
---|
11 | |
---|
12 | //////////////////////////////////////////////////////////////////////////////// |
---|
13 | // // |
---|
14 | // Interpolate // |
---|
15 | // // |
---|
16 | // **TO BE UPDATED** // |
---|
17 | // Helper class used to access parameters that depend on the wavelength of the// |
---|
18 | // interacting photon. During construction it reads from file some pairs // |
---|
19 | // wavelength-parametervalue and then it returns the parameter at the // |
---|
20 | // wavelength requested by the user (via getValue(wavelength)) doing // |
---|
21 | // interpolation between the points read previously. // |
---|
22 | // // |
---|
23 | //////////////////////////////////////////////////////////////////////////////// |
---|
24 | |
---|
25 | class Interpolate : public EsafMsgSource { |
---|
26 | public: |
---|
27 | Interpolate(const string &fn, size_t nval = 1); |
---|
28 | virtual ~Interpolate(); |
---|
29 | |
---|
30 | Double_t GetUnit(size_t col = 0); |
---|
31 | Double_t GetValue(Double_t x, size_t col = 0); |
---|
32 | inline Double_t GetXmin() { return fXmin; } |
---|
33 | inline Double_t GetXmax() { return fXmax; } |
---|
34 | Double_t GetXUnit(); |
---|
35 | |
---|
36 | void SetUnit(Double_t unit, size_t col = 0); |
---|
37 | void SetXUnit(Double_t unit); |
---|
38 | |
---|
39 | private: |
---|
40 | vector< vector<Double_t> > fValues; |
---|
41 | string fFilename; |
---|
42 | vector< Double_t > fUnits; |
---|
43 | |
---|
44 | Double_t fXmin; |
---|
45 | Double_t fXmax; |
---|
46 | |
---|
47 | ClassDef(Interpolate,0) |
---|
48 | }; |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | inline Double_t Interpolate::GetXUnit() { |
---|
53 | return fUnits[0]; |
---|
54 | } |
---|
55 | |
---|
56 | inline Double_t Interpolate::GetUnit(size_t nval) { |
---|
57 | if ( nval >= fValues[0].size() ) |
---|
58 | Msg(EsafMsg::Panic) << "GetUnit: variable number out of range " << MsgDispatch; |
---|
59 | |
---|
60 | return fUnits[nval+1]; |
---|
61 | } |
---|
62 | #endif /* __INTERPOLATE_HH__ */ |
---|