00001
00021 #include "GRBShock.h"
00022 #include "GRBConstants.h"
00023 #include "GRBengine.h"
00024 #include "SpectObj.h"
00025 #include "GRBSynchrotron.h"
00026 #include "GRBICompton.h"
00027 #include <vector>
00028
00029 #ifndef GRBSIM_H
00030 #define GRBSIM_H 1
00031
00032 class GRBSim
00033 {
00034 public:
00035
00037 GRBSim(long seed=0);
00038 GRBSim(const std::string& params);
00040 ~GRBSim();
00041
00043 GRBConstants *myParam;
00044
00050 void MakeGRB(double time_offset = 0.);
00051
00055 std::vector<double> ComputeFlux(const double time);
00057 inline void setSpectrum(std::vector<double> myspectrum)
00058 {m_spectrum=myspectrum;}
00060 inline std::pair<float,float> GRBdir() {return m_direction;}
00062 inline std::vector<double> Spectrum() {return m_spectrum;}
00066 inline std::vector<double> Energy() {return m_energy;}
00068 inline std::vector<double> DeltaE() {return m_de;}
00069
00071 inline double Tmax() {return m_duration;}
00072
00076 inline double Area() {return m_area;}
00077
00079 inline double Flux(int en) {return m_spectrum[en];}
00080
00082 inline double Energy(int en) {return m_energy[en];}
00083
00095 double IFlux( std::vector<double> spctrmVec,
00096 double enmin=cst::enmin,
00097 double enmax=cst::enmax);
00098
00109 double IRate(std::vector<double> spctrmVec,
00110 double enmin=cst::enmin,
00111 double enmax=cst::enmax);
00121 double DrawPhotonFromSpectrum(std::vector<double> spctrmVec,
00122 float u=0.0,
00123 double enmin=cst::enmin);
00125 inline double EnergyPh(){return m_enph;}
00127 long parseParamList(std::string input, int index);
00128 private:
00129
00130 std::vector<GRBShell> theShells;
00131 std::vector<GRBShock> theShocks;
00132 std::vector<double> m_energy, m_de, m_spectrum;
00133 std::vector<std::vector<double> > m_Fvt;
00134 std::pair<float,float> m_direction;
00135
00136 double m_duration;
00137 double m_ftot;
00138 double m_phtot;
00139 double m_distance;
00140 double m_area;
00141 double m_DeadTime;
00142 double m_enph;
00143 double m_jetangle;
00144 long m_seed;
00145 HepRandomEngine *m_engine;
00146 GRBSynchrotron m_synchrotron;
00147 GRBICompton m_icompton;
00148 SpectObj m_spectobj;
00149 };
00150
00151 #endif
00152
00153