Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

GrbGlobalData.h

00001 
00013 #ifndef GRB_GLOBAL_DATA_H
00014 #define GRB_GLOBAL_DATA_H
00015 
00016 #include <vector>
00017 #include <string>
00018 #include <functional>  // for unary_function
00019 
00020 class HepRandomEngine;
00021 
00022 
00023 
00024 class GrbGlobalData
00025 {
00026 public:
00030     static GrbGlobalData        *instance(HepRandomEngine *engine);
00031 
00035     static void            kill ();
00036     
00037     
00038     
00039     // Accessors
00040     const std::vector<double> duration() const      { return m_duration; }
00041     const std::vector<double> flux() const          { return m_flux; }
00042     const std::vector<double> fraction() const      { return m_fraction; };
00043     const std::vector<double> alpha() const                 { return m_alpha; }
00044     const std::vector<double> beta() const                      { return m_beta; }
00045     const std::vector<double> epeak() const                 { return m_epeak; }
00046     
00047     
00048 protected:
00052     GrbGlobalData(HepRandomEngine *engine);
00053     virtual ~GrbGlobalData();
00054     
00055     
00056 private:
00060     static GrbGlobalData* s_instance;
00061     
00062     
00066     double computeFlux(HepRandomEngine *engine, const long diff, 
00067         const long minval, const std::vector<long> &in,
00068         const std::vector<double> &v) const;
00069     
00073     double evaluate(HepRandomEngine *engine, const long diff, const long minval,
00074         const std::vector<long> &in, const std::vector<double> &v) const;
00075     
00079     void grbGlobal(HepRandomEngine *engine);
00080     
00084     long index(HepRandomEngine *engine, const long diff, const long minval, 
00085         const std::vector<long> &in) const;
00086     
00095     void getDuration(HepRandomEngine *engine, long &nlong);
00096     
00111     void getFlux(HepRandomEngine *engine, long nlong);
00112     
00116     void getPowerLawIndex(HepRandomEngine *engine);
00117     
00121     //void powerLawIndex(HepRandomEngine *engine, const std::vector<int> &histpl, 
00122     //    const std::vector<double> &loEdges,
00123     //    const double factor, std::vector<double> &vect);
00124     void powerLawIndex(HepRandomEngine *engine, const std::vector<int> &histpl, const double factor, std::vector<double> &vect);
00125     
00126     
00127     
00128     // data members
00129     std::vector<double>   m_duration;
00130     std::vector<double>   m_flux;
00131     std::vector<double>   m_fraction;
00132     std::vector<double>   m_alpha;
00133     std::vector<double>   m_beta;
00134     std::vector<double>   m_epeak;
00135     
00136     
00140     struct calcEpeak : public std::unary_function<double, double>
00141     {
00142         calcEpeak(HepRandomEngine *engine) : m_engine(engine) {}
00143         double operator() (double x); 
00144         
00145         HepRandomEngine *m_engine;
00146     };
00147 };
00148 
00149 
00150 
00151 #endif // GRB_GLOBAL_DATA_H

Generated on Mon Jan 27 11:43:32 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001