00001
00002
00003
00004
00005 #ifndef FluxSource_h
00006 #define FluxSource_h 1
00007
00008 #include "flux/EventSource.h"
00009 #include "flux/Spectrum.h"
00010 #include "geometry/Point.h"
00011
00012
00013 class Box;
00014 class DOM_Element;
00015
00016
00018
00019
00020 class FluxSource : public EventSource
00021 {
00022 public:
00024 FluxSource ( Spectrum* aSpec = 0, double aFlux = 1 );
00025 FluxSource ( const DOM_Element& xelem );
00026
00028 virtual ~FluxSource();
00029
00031 virtual FluxSource* event();
00032
00034 virtual std::string fullTitle () const;
00035
00037 virtual std::string displayTitle () const;
00038
00040 virtual void computeLaunch ();
00041
00042 virtual double flux()const;
00043
00045 double solidAngle()const;
00046
00048 void setPhiRange(double min_phi, double max_phi);
00049 void setCosThetaRange(double min_cos, double max_cos);
00050
00054 void useSpectrumDirection();
00055
00056 void setAcceptance ();
00057
00060 void setLaunch(const Vector& dir, const Point& pos);
00061 void setLaunch(const Vector& dir);
00062 void setLaunch(double theta, double phi);
00063 void setLaunch(double xMax, double xMin, double yMax, double yMin,
00064 double zTop, double zBot, bool fan);
00065 void FluxSource::setLaunch(double theta, double phi, double xMax,
00066 double xMin, double yMax, double yMin,
00067 double zTop, double zBot);
00068
00069 void unSetLaunch();
00070
00071
00072 double minPhi() const {return _minPhi;}
00073 double maxPhi() const {return _maxPhi;}
00074 double minCosTheta() const {return _minCos;}
00075 double maxCosTheta() const {return _maxCos;}
00076 double phi() const {return _phi;}
00077 double theta() const {return _theta;}
00078
00079
00080 void getSurfacePosDir();
00081
00083 std::string title()const;
00084
00086 void printOn ( std::ostream& out ) {}
00087
00089 void spectrum(Spectrum* s, double emax=-1);
00090 Spectrum* spectrum() const{ return m_spectrum; }
00091
00092
00093
00094 void FluxSource::getGalacticDir(double l,double b);
00095
00097 double maxEnergy()const { return m_maxEnergy;}
00098 void setMaxEnergy(double e) { m_maxEnergy = e; }
00099
00100
00102 enum LaunchType {
00103 NONE,
00104 POINT,
00105 DIRECTION ,
00106 SURFACE,
00107 SPECTRUM,
00108 PATCHFIXED,
00109 GALACTIC
00110 } m_launch;
00111
00112 enum PointType {
00113 NOPOINT,
00114 SINGLE,
00115 PATCH
00116 } m_pointtype;
00117
00118
00119
00120
00121
00122 virtual int eventNumber()const;
00123
00124 double energy()const { return m_energy;}
00125 const Vector& launchDir()const {return m_launchDir;}
00126 const Point& launchPoint()const { return m_launchPoint;}
00127
00128 void refLaunch(LaunchType launch);
00129 void refPoint(PointType point);
00130 int refLaunch()const {return m_launch;}
00131 int refPoint()const {return m_pointtype;}
00132
00133 private:
00134
00135 static double s_radius, s_backoff;
00136
00137 Spectrum* m_spectrum;
00138
00139 double m_maxEnergy;
00140
00141 double _minCos, _maxCos, _minPhi, _maxPhi;
00142
00143
00144 double m_rmin, m_rmax;
00145
00146
00147 double _phi, _theta;
00148
00149
00150
00151 double m_galb, m_gall;
00152
00153 double patchHeight, patchBottom, patchTop, patchXmax, patchXmin;
00154 double patchYmax, patchYmin, patchWidX, patchWidY, Fratio;
00155 double patchRange, patchOffset;
00156
00157
00158 bool sidePatch, fanBeam;
00159 Box* illumBox;
00160
00161
00162 Vector m_launchDir;
00163 Point m_launchPoint;
00164 double m_energy;
00165
00166
00167 void randomLaunchPoint();
00168
00169
00170 };
00171 #endif