00001 // $Header: /nfs/slac/g/glast/ground/cvs/FluxSvc/src/CompositeSource.h,v 1.11 2002/10/07 23:42:20 srobinsn Exp $ 00002 00003 #ifndef CompositeSource_h 00004 #define CompositeSource_h 1 00005 00016 #include "FluxSvc/EventSource.h" 00017 #include <vector> 00018 00019 class FluxSource; 00020 00021 class CompositeSource : public EventSource { 00022 public: 00024 CompositeSource (double aRate = 1.0); 00025 virtual ~CompositeSource(); 00026 00027 00029 virtual void addSource (EventSource* aSource); 00030 void rmvSource (EventSource* aSource); 00031 00034 virtual FluxSource* event (double time); 00035 00037 virtual double rate (double time)const; 00038 virtual void setRate ( double ); 00039 00041 virtual double flux(double time)const{ 00042 return rate(time)/totalArea();} 00043 00045 virtual std::string fullTitle () const; 00046 00048 virtual std::string displayTitle () const; 00049 00051 void printOn(std::ostream& out)const; 00052 00054 std::string findSource()const; 00055 00057 int numSource()const; 00058 00059 00061 std::vector< EventSource* >& sourceList (); 00062 const std::vector< EventSource* >& sourceList () const; 00063 void sourceList (const std::vector< EventSource* >& value); 00064 00066 double interval (double){return m_interval;} 00067 00069 double setInterval (double interval){return (m_interval = interval);} 00070 00072 double m_interval; 00073 00075 int howManySources(){return m_sourceList.size();} 00076 00077 00078 protected: 00079 virtual void setupXML (const DOM_Element&); 00080 00081 //number of times we've iterated the front() pointer into sourcelist 00082 //to get the current particle - represents the source 00083 int m_numofiters; 00084 00085 //private: 00086 std::vector< EventSource* > m_sourceList; 00087 //vector of flags, holds whether or not the current source has a remaining unused particle. 00088 std::vector<int> m_unusedSource; 00089 //vector of recorded intervals of held sources. 00090 std::vector<double> m_sourceInterval; 00091 EventSource* m_recent; 00092 }; 00093 00094 inline std::vector< EventSource* >& CompositeSource::sourceList () 00095 { 00096 return m_sourceList; 00097 } 00098 00099 inline const std::vector< EventSource* >& CompositeSource::sourceList () const 00100 { 00101 return m_sourceList; 00102 } 00103 00104 inline void CompositeSource::sourceList (const std::vector< EventSource* >& value) 00105 { 00106 m_sourceList = value; 00107 } 00108 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001