00001
00011 #ifndef GRB_OBS_SPECTRUM_H
00012 #define GRB_OBS_SPECTRUM_H
00013
00014 #include <vector>
00015 #include <string>
00016 #include <functional>
00017
00018 #include "FluxSvc/ISpectrum.h"
00019
00020 #include "CLHEP/Random/RandomEngine.h"
00021
00022 class GRBurst;
00023
00024
00025
00026 class GRBobsSpectrum : public ISpectrum
00027 {
00028 public:
00031 GRBobsSpectrum(const std::string &filename);
00032
00035 GRBobsSpectrum(const double duration, const int npuls, const double flux,
00036 const double fraction, const double alpha, const double beta,
00037 const double epeak, const double specnorm, const bool flag);
00038
00039
00042 virtual ~GRBobsSpectrum();
00043
00044
00047 GRBobsSpectrum(const GRBobsSpectrum &right);
00048
00049
00052 GRBobsSpectrum &operator=(const GRBobsSpectrum &right);
00053
00054
00055
00056
00057 virtual std::string title() const { return m_title; }
00058 const char * particleName() const { return m_particleName.c_str(); }
00059
00060
00061
00065 virtual double flux(double time=0) const;
00066
00069 float fraction(float energy);
00070
00072 std::pair<float,float> dir(float energy) const;
00073
00075 std::pair<double,double> dir(double energy, HepRandomEngine *engine);
00076
00085 double energySrc(HepRandomEngine *engine, double time=0);
00086
00090 virtual float operator() (float randomNumber) const;
00091
00094 virtual double interval(double time);
00095
00096 private:
00099 double nextEnergy() const;
00100
00103 double nextTime() const;
00104
00107 void parseParamList(const std::string &input,
00108 std::vector<std::string>& output) const;
00109
00112 void swap(GRBobsSpectrum &other) throw();
00113
00114
00115 std::string m_title;
00116 std::string m_particleName;
00117 GRBurst *m_grb;
00118
00119 };
00120 #endif // GRB_OBS_SPECTRUM_H
00121