00001
00002
00004
00005 #if !defined(AFX_GAMMASOURCE_H__A03408DA_6202_4ADF_8F8E_AFFF184A7AC2__INCLUDED_)
00006 #define AFX_GAMMASOURCE_H__A03408DA_6202_4ADF_8F8E_AFFF184A7AC2__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012
00013
00014 #include "flux/SimpleSpectrum.h"
00015 #include <cmath>
00016 #include <algorithm>
00017 #include <functional>
00018 #include "CLHEP/Random/Random.h"
00019 #include "flux/GPS.h"
00020 #include <vector>
00021
00024 class ExtraGalacticDiffuse : public SimpleSpectrum {
00025 public:
00026
00027
00028 #define maxnumofphotons 500 //maximum number of photons to ever send (the program continues sending even after all intensity is accounted for.
00029 #define lowthresholdofintensity 0.000000001 //defines the minimum source intensity considered
00030 #define highthresholdofintensity .0001 //for debugging and checking purposes
00031 #define threshold 0.000000001 //for determining when all intensity is accounted for.
00032 #define skysizex 10.0
00033 #define skysizey 10.0
00034 #define multiplierduetosizeofsky 1.0/(36.0*36.0)
00038 long double TotInt;
00039
00040 long double RemInt;
00041
00042 long double NewProb;
00043
00044
00045 typedef struct{
00046 long double x;
00047 long double y;
00048 }PHOTON;
00049
00050 PHOTON list[50000];
00051
00052 typedef struct{
00053 long double x;
00054 long double y;
00055 long double intensity;
00056 }SOURCE;
00057
00058 SOURCE ctlg[5000];
00059
00060
00061 typedef struct{
00062 long double x;
00063 long double y;
00064 }DELTAX;
00065
00066
00067 std::vector<std::pair<double,double> >::iterator srcpnt;
00068
00069 long double pofi(long double intensity);
00070
00071 long double random();
00072
00073 DELTAX gaussianspread();
00074
00075 void addtophotons(long double x,long double y);
00076
00077 void addtoctlg(long double x,long double y,long double intsty);
00078
00079 void findandaddnew();
00080
00081 void sendphotonfromcatalog();
00082
00083 PHOTON *create();
00084
00085 ~ExtraGalacticDiffuse();
00086
00088 ExtraGalacticDiffuse(){}
00089
00090 ExtraGalacticDiffuse(const char* name,float Emin, float Emax, float index);
00091
00092 std::pair<double,double> dir(double e);
00093
00094
00095 };
00096
00097 #endif // !defined(AFX_GAMMASOURCE_H__A03408DA_6202_4ADF_8F8E_AFFF184A7AC2__INCLUDED_)