00001 // $Header: /nfs/slac/g/glast/ground/cvs/FluxSvc/src/Flux.cxx,v 1.23 2002/10/07 23:42:20 srobinsn Exp $ 00002 00003 // Original author: T. Burnett 00004 00005 #include "Flux.h" 00006 00007 #include "FluxSvc/FluxSource.h" 00008 #include "FluxSvc/EventSource.h" 00009 #include "FluxMgr.h" 00010 #include "GPS.h" 00011 00012 Flux::Flux(std::string name) 00013 : m_time(0) 00014 , m_flux(0) 00015 { 00016 m_event = s_mgr->source(name); 00017 } 00018 Flux::~Flux() 00019 { 00020 delete m_flux; 00021 } 00022 00023 FluxMgr* Flux::s_mgr=0; 00024 00025 void Flux::mgr(FluxMgr* m){ s_mgr=m;} 00026 // name of the flux 00027 std::string Flux::name() const 00028 { 00029 return m_flux->name(); 00030 } 00031 00033 std::string Flux::title()const 00034 { 00035 return m_event->fullTitle(); 00036 } 00037 00038 00039 void Flux::generate() 00040 { 00041 // Purpose and Method: generate a new entry trajectory, set FluxSource, increment local time 00042 // Inputs - none 00043 // Outputs - none 00044 00045 m_flux = m_event->event(time()); 00046 double timepass = m_event->interval(time()); 00047 m_time+= timepass; 00048 pass(timepass); 00049 } 00050 00051 // the particle generated 00052 std::string Flux::particleName()const{ 00053 return std::string(m_flux->spectrum()->particleName()); 00054 } 00055 00056 // its kinetic energy 00057 double Flux::energy()const 00058 { 00059 return m_flux->energy(); 00060 } 00061 00062 // starting point 00063 HepPoint3D Flux::launchPoint()const 00064 { 00065 return m_flux->launchPoint(); 00066 } 00067 00068 double Flux::time()const 00069 { 00070 return m_time ; 00071 } 00072 00073 00075 void Flux::pass ( double t){ 00076 s_mgr->pass(t); 00077 } 00078 00080 /*GPStime*//*int*/double Flux::gpsTime () const{ 00081 return s_mgr->time(); 00082 } 00083 00084 00085 // direction 00086 HepVector3D Flux::launchDir()const 00087 { 00088 return m_flux->launchDir(); 00089 } 00090 00091 // rate ( /mm**2 /s) 00092 double Flux::rate()const 00093 { 00094 return m_event->rate(time()); 00095 } 00096 00098 void Flux::setTargetArea( double area) 00099 { 00100 m_event->totalArea(area); 00101 } 00102 00103 double Flux::targetArea()const 00104 { 00105 return m_event->totalArea(); 00106 } 00107 00108 00110 std::string Flux::findSource()const 00111 { 00112 return m_event->findSource(); 00113 } 00114 00116 int Flux::numSource()const 00117 { 00118 return m_event->numSource(); 00119 00120 } 00121 00122 #if 0 00123 void Flux::addFactory( const IFactory* factory ) { 00124 FactoryTable::instance()->addFactory( factory ); 00125 } 00126 #endif 00127 00128 void Flux::addFactory(std::string name, const ISpectrumFactory* factory ) { 00129 SpectrumFactoryTable::instance()->addFactory(name,factory); 00130 } 00131 00132 00133 Rotation Flux::CELTransform(double time)const{ 00134 return s_mgr->CELTransform(time); 00135 } 00136 00137 Rotation Flux::orientTransform(double time)const{ 00138 return s_mgr->orientTransform(time); 00139 } 00140 00141 Rotation Flux::transformGlastToGalactic(double time)const{ 00142 00143 return s_mgr->transformGlastToGalactic(time); 00144 } 00145 00146 void Flux::writeSourceCharacteristic(std::ostream& out){ 00147 m_event->writeSourceCharacteristic(out); 00148 }
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001