00001
00002
00004
00005 #include "flux/Spectrum.h"
00006 #include <cmath>
00007
00008
00009 #include "CLHEP/Random/RandomEngine.h"
00010 #include "CLHEP/Random/RandGeneral.h"
00011
00013
00015
00016 Spectrum::~Spectrum(){}
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 double Spectrum::flux ( ) const {
00045 return 0.;
00046 }
00047
00048 double Spectrum::solidAngle( )const
00049 {
00050 return 1.0;
00051 }
00052
00053 void Spectrum::setPosition ( double lat, double lon, double time ) {
00054 m_lat = lat;
00055 m_lon = lon;
00056 m_time = time;
00057 }
00058
00059
00060 std::pair<float,float> Spectrum::dir(float energy)const
00061 {
00062
00063
00064
00065
00066
00067
00068 return std::make_pair(((rand()/32767.0)*1.4)-0.4,(rand()/32767.0)*2*M_PI);
00069
00070 }
00071
00072
00073
00074 const char * Spectrum::particleName()const{
00075 static const char x='p';
00076 return &x;
00077 }
00078
00079 double Spectrum::energySrc(HepRandomEngine* engine)
00080 {
00081
00082 return (*this)(engine->flat());
00083 }
00084
00085 std::pair<double,double> Spectrum::dir(double energy, HepRandomEngine* engine)
00086 {
00087
00088 return dir(energy);
00089 }
00090
00091 void Spectrum::parseParamList(std::string input, std::vector<float>& output) const
00092 {
00093
00094 int i=0;
00095 for(;!input.empty() && i!=std::string::npos;){
00096 float f = ::atof( input.c_str() );
00097 output.push_back(f);
00098 i=input.find_first_of(",");
00099 input= input.substr(i+1);
00100 }
00101 }