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

Spectrum.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/flux/flux/Spectrum.h,v 1.10 2001/10/20 07:20:35 srobinsn Exp $
00002 //
00003 //
00004 // Spectrum: base class for energy spectrum objects
00005 // SimpleSpectrum: define a particle and spectral index
00006 //
00007 
00008 #ifndef GLAST_SPECTRUM_H
00009 #define GLAST_SPECTRUM_H
00010 
00011 #include <string>
00012 #include <utility>
00013 #include <vector>
00014 
00015 //forward declaration
00016 class HepRandomEngine;
00017 
00018 
00021 class Spectrum {
00022 public:
00023     
00024     //    class  Direction : public std::pair<float,float> {
00025     //    public:
00026     //        double costh()const{return this.first;}
00027     //        double phi()const {return this.second;}
00028     //    };
00029     
00030     virtual float operator()(float /*r*/)const{return 0;};
00031     // this is all that these objects do. Must be virtual for
00032     // polymorphism
00033     // returns kinetic energy for random number r in [0,1). 
00034     // requried that it be monatonic
00035     // NB. Default is to return zero, an indicator that the actual Spectrum object
00036     //     implements a method that makes direct use of the random generator
00037     
00038     //virtual double calculate_rate (double old_rate) = 0;
00039     
00041     virtual const char * particleName()const=0;
00042     
00044     virtual double    flux ( ) const;
00045     
00046     
00048     virtual double solidAngle()const;
00049     
00051     virtual void        setPosition ( double lat, double lon , double time=0);
00052     
00054     virtual std::string title()const=0;
00055     
00058     float fraction(float energy);
00059     
00060     
00061     //   virtual Direction dir(float energy)const;
00062     // return solid angle pair (costh, phi) for the given energy
00063     
00064     virtual ~Spectrum();
00065     
00066     
00067     virtual std::pair<float,float> dir(float energy)const;
00068     
00070     virtual double energySrc(HepRandomEngine* engine);
00071     virtual std::pair<double,double> dir(double energy, HepRandomEngine* engine);
00072     
00073     
00074 protected:
00075     Spectrum(const std::vector<float>& /*params*/){};
00076     Spectrum(/* double lat = 0, double lon = 0, double time=0*/) 
00077         : m_lat(0), m_lon(0), m_time(0){}
00078     // all constructors protected to ensure an abstract class
00079     
00080     virtual void parseParamList(std::string input, std::vector<float>& output) const;
00081     
00082     double    m_lat, m_lon;   // latitude and longitudinal coordinates
00083     double    m_time;
00084 };
00085 
00086 #endif    

Generated at Wed Nov 21 12:20:34 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000