// ESAF : Euso Simulation and Analysis Framework // $Id: Interpolate.hh,v 1.2 2005/04/19 22:33:30 thea Exp $ // Author: D.DeMarco #ifndef __INTERPOLATE_HH__ #define __INTERPOLATE_HH__ #include #include "NumbersFileParser.hh" #include "EsafMsgSource.hh" //////////////////////////////////////////////////////////////////////////////// // // // Interpolate // // // // **TO BE UPDATED** // // Helper class used to access parameters that depend on the wavelength of the// // interacting photon. During construction it reads from file some pairs // // wavelength-parametervalue and then it returns the parameter at the // // wavelength requested by the user (via getValue(wavelength)) doing // // interpolation between the points read previously. // // // //////////////////////////////////////////////////////////////////////////////// class Interpolate : public EsafMsgSource { public: Interpolate(const string &fn, size_t nval = 1); virtual ~Interpolate(); Double_t GetUnit(size_t col = 0); Double_t GetValue(Double_t x, size_t col = 0); inline Double_t GetXmin() { return fXmin; } inline Double_t GetXmax() { return fXmax; } Double_t GetXUnit(); void SetUnit(Double_t unit, size_t col = 0); void SetXUnit(Double_t unit); private: vector< vector > fValues; string fFilename; vector< Double_t > fUnits; Double_t fXmin; Double_t fXmax; ClassDef(Interpolate,0) }; inline Double_t Interpolate::GetXUnit() { return fUnits[0]; } inline Double_t Interpolate::GetUnit(size_t nval) { if ( nval >= fValues[0].size() ) Msg(EsafMsg::Panic) << "GetUnit: variable number out of range " << MsgDispatch; return fUnits[nval+1]; } #endif /* __INTERPOLATE_HH__ */