00001
00002
00003 #ifndef FluxSource_h
00004 #define FluxSource_h 1
00005
00014 #include "FluxSvc/EventSource.h"
00015 #include "FluxSvc/ISpectrum.h"
00016 #include "geometry/Point.h"
00017
00018
00019 class Box;
00020 class DOM_Element;
00021
00022
00024
00025
00026 class FluxSource : public EventSource
00027 {
00028 public:
00030 FluxSource ( ISpectrum* aSpec = 0, double aFlux = 0 );
00031 FluxSource ( const DOM_Element& xelem );
00032 FluxSource::FluxSource(double aFlux, ISpectrum* aSpec, double l, double b);
00033
00035 virtual ~FluxSource();
00036
00038 virtual FluxSource* event(double time);
00039
00041 virtual std::string fullTitle () const;
00042
00044 virtual std::string displayTitle () const;
00045
00047 virtual void computeLaunch (double time=0);
00048
00049 virtual double flux(double time)const;
00050
00052 double solidAngle()const;
00053
00055 void setPhiRange(double min_phi, double max_phi);
00056 void setCosThetaRange(double min_cos, double max_cos);
00057
00061 void useSpectrumDirection();
00062
00063 void setAcceptance ();
00064
00067 void setLaunch(const Vector& dir, const Point& pos);
00068 void setLaunch(const Vector& dir);
00069 void setLaunch(double theta, double phi);
00070 void setLaunch(double xMax, double xMin, double yMax, double yMin,
00071 double zTop, double zBot, bool fan);
00072 void FluxSource::setLaunch(double theta, double phi, double xMax,
00073 double xMin, double yMax, double yMin,
00074 double zTop, double zBot);
00075
00076 void unSetLaunch();
00077
00078
00079 double minPhi() const {return _minPhi;}
00080 double maxPhi() const {return _maxPhi;}
00081 double minCosTheta() const {return _minCos;}
00082 double maxCosTheta() const {return _maxCos;}
00083 double phi() const {return _phi;}
00084 double theta() const {return _theta;}
00085
00086
00087 void getSurfacePosDir();
00088
00090 std::string title()const;
00091
00093 void printOn ( std::ostream& ) {}
00094
00096 void spectrum(ISpectrum* s, double emax=-1);
00097 ISpectrum* spectrum() const{ return m_spectrum; }
00098
00099
00100 double calculateInterval (double time);
00101 double interval(double ){return m_interval;}
00102
00103 void FluxSource::getGalacticDir(double l,double b);
00104
00106 double maxEnergy()const { return m_maxEnergy;}
00107 void setMaxEnergy(double e) { m_maxEnergy = e; }
00108
00109
00111 void FluxSource::correctForTiltAngle();
00112
00114 void spreadTheDirection();
00115
00117 enum LaunchType {
00118 NONE,
00119 POINT,
00120 DIRECTION ,
00121 SURFACE,
00122 SPECTRUM,
00123 SPECGAL,
00124 PATCHFIXED,
00125 GALACTIC,
00126 SPREAD
00127 } m_launch;
00128
00129 enum PointType {
00130 NOPOINT,
00131 SINGLE,
00132 PATCH
00133 } m_pointtype;
00134
00137 enum EnergyScale {
00138 MeV,
00139 GeV
00140 } m_energyscale;
00141
00143 bool occluded();
00144
00145 virtual int eventNumber()const;
00146
00147 double energy()const { return m_energy;}
00148 const Vector& rawDir()const {return m_launchDir;}
00149 const Vector& launchDir()const {return m_correctedDir;}
00150 const Point& launchPoint()const { return m_launchPoint;}
00151
00152 void refLaunch(LaunchType launch);
00153 void refPoint(PointType point);
00154 int refLaunch()const {return m_launch;}
00155 int refPoint()const {return m_pointtype;}
00156
00157 private:
00158
00159 static double s_radius, s_backoff;
00160
00161 ISpectrum* m_spectrum;
00162
00163 double m_maxEnergy;
00164
00165 double _minCos, _maxCos, _minPhi, _maxPhi;
00166
00167
00168 double m_rmin, m_rmax;
00169
00170
00171 double _phi, _theta;
00172
00173
00174
00175 double m_galb, m_gall;
00176
00177 double patchHeight, patchBottom, patchTop, patchXmax, patchXmin;
00178 double patchYmax, patchYmin, patchWidX, patchWidY, Fratio;
00179 double patchRange, patchOffset;
00180
00181
00182 bool sidePatch, fanBeam;
00183 Box* illumBox;
00184 double m_interval;
00185
00188
00189
00190 Vector m_launchDir;
00191
00192
00193 Point m_launchPoint;
00194 double m_energy;
00195
00196
00198 double m_degreespread;
00199
00201 Rotation m_correctForTilt;
00202
00204 Vector m_correctedDir;
00206 double m_extime;
00207
00208 void randomLaunchPoint();
00209
00210
00212 double FluxSource::explicitInterval (double time);
00213 };
00214 #endif