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

GalElSpectrum Class Reference

A quick and dirty implementation of the high-energy (galactic) cosmic ray spectrum. The spectrum is the power law found in Barwick et al., ApJ 498, 779 (1998). The low-energy rollover is ignored. Also ignored are the east-west effect and the gradual nature of the geomagnetic cutoff. The power law is cut off sharply at the cutoff energy and directions are isotropic above the horizon. The cutoff energy is obtained by querying a CHIMESpectrum object and adjusting for the smaller mass of the electron. (Actually the electron mass is assumed to be zero.). More...

#include <GalElSpectrum.h>

Inheritance diagram for GalElSpectrum::

Spectrum ISpectrum List of all members.

Public Methods

 GalElSpectrum (const std::string &params)
 ctor. More...

virtual ~GalElSpectrum ()
virtual double calculate_rate (double old_rate)
virtual double flux (double) const
 calculate flux for the current cutoff. More...

virtual double solidAngle () const
 calcualte effective solid angle for the given energy. More...

float flux (float cut) const
 Total flux in electrons / m^2 sec ster. More...

virtual float flux (float lat, float lon) const
virtual float flux (std::pair< double, double > coords) const
virtual float operator() (float) const
float cutoff () const
virtual void setPosition (float lat, float lon)
virtual void setPosition (std::pair< double, double > coords)
int askGPS ()
 this one asks the GPS for position. More...

float findCutoff (float rflux) const
 determine the cutoff value which will produce the desired flux. More...

float findCutoff (float lat, float lon) const
 determine the cutoff value at a geographical location. More...

float findCutoff (std::pair< double, double > coords) const
virtual std::pair< float,
float > 
dir (float energy) const
 return solid angle pair (costh, phi) for the given energy. More...

virtual std::string title () const
 return a title describing the spectrum. More...

virtual const char * particleName () const
 subclasses need to specify correct particle type. More...

const char * nameOf () const
void setParticleName (std::string name)
 set the particle name. (default is "p"). More...


Private Methods

void init (float lat, float lon)

Private Attributes

CHIMESpectrum m_pspec
float m_expo
float m_norm
float m_normfact
float m_cutoff
float m_coscutoff
float m_flux
std::string m_particle_name
ObserverAdapter< GalElSpectrum > m_observer

Static Private Attributes

const float m_rearth = 6371.f
const float m_altitude = 600.f

Detailed Description

A quick and dirty implementation of the high-energy (galactic) cosmic ray spectrum. The spectrum is the power law found in Barwick et al., ApJ 498, 779 (1998). The low-energy rollover is ignored. Also ignored are the east-west effect and the gradual nature of the geomagnetic cutoff. The power law is cut off sharply at the cutoff energy and directions are isotropic above the horizon. The cutoff energy is obtained by querying a CHIMESpectrum object and adjusting for the smaller mass of the electron. (Actually the electron mass is assumed to be zero.).

As with CHIMESpectrum, the flux normalization is handled in a screwy way. We should come up with a better way to handle this. The value returned is in electrons/(m^2 sec ster), as if it was isotropic. This value is obtained by taking the observed isotropic flux and multiplying by a correction factor for the fraction of the sky blocked by the earth. Thus the total integrated flux in electrons/(m^2 sec) can be obtained by multiplying by 4*pi.

Author:
P. L. Nolan, April 1999
$Header $

Definition at line 43 of file GalElSpectrum.h.


Constructor & Destructor Documentation

GalElSpectrum::GalElSpectrum const std::string &    paramstring
 

ctor.

Definition at line 23 of file GalElSpectrum.cxx.

References init(), and Spectrum::parseParamList().

00023                                                         :m_pspec(paramstring) {
00024     std::vector<float> params;
00025     
00026     parseParamList(paramstring,params);
00027     
00028     float lat = params.size()>0? params[0] : 0;
00029     float lon = params.size()>1? params[1] : 0;
00030     init(lat, lon); 
00031 }

GalElSpectrum::~GalElSpectrum   [virtual]
 

Definition at line 34 of file GalElSpectrum.cxx.

00034 {};


Member Function Documentation

int GalElSpectrum::askGPS  
 

this one asks the GPS for position.

Definition at line 77 of file GalElSpectrum.cxx.

References GPS::instance(), and setPosition().

Referenced by init().

00077                           {
00078     setPosition(GPS::instance()->lat(), GPS::instance()->lon());
00079     return 0;
00080 }

double GalElSpectrum::calculate_rate double    old_rate [virtual]
 

Definition at line 36 of file GalElSpectrum.cxx.

References flux(), and GPS::instance().

00036                                                     {
00037     return flux(GPS::instance()->lat(), GPS::instance()->lon());
00038 }

float GalElSpectrum::cutoff   const [inline]
 

Definition at line 67 of file GalElSpectrum.h.

References m_cutoff.

00067 {return m_cutoff;};

std::pair< float, float > GalElSpectrum::dir float    energy const [virtual]
 

return solid angle pair (costh, phi) for the given energy.

Reimplemented from Spectrum.

Definition at line 95 of file GalElSpectrum.cxx.

References m_coscutoff.

00095                                                           {
00096     float earthazi = 2.*M_PI* HepRandom::getTheGenerator()->flat();
00097     float coszenith = m_coscutoff + (1.-m_coscutoff)*
00098         HepRandom::getTheGenerator()->flat();
00099     return std::make_pair<float,float>(coszenith, earthazi);
00100 }

float GalElSpectrum::findCutoff std::pair< double, double >    coords const
 

Definition at line 91 of file GalElSpectrum.cxx.

References findCutoff().

00091                                                                    {
00092     return findCutoff(coords.first, coords.second);
00093 }

float GalElSpectrum::findCutoff float    lat,
float    lon
const
 

determine the cutoff value at a geographical location.

Definition at line 86 of file GalElSpectrum.cxx.

References CHIMESpectrum::findCutoff(), and m_pspec.

00086                                                           {
00087     float ProtonCut = m_pspec.findCutoff(lat,lon);
00088     return sqrt(ProtonCut*(ProtonCut+2.*0.938));
00089 }

float GalElSpectrum::findCutoff float    rflux const
 

determine the cutoff value which will produce the desired flux.

Definition at line 82 of file GalElSpectrum.cxx.

References m_expo, and m_norm.

Referenced by findCutoff(), flux(), and setPosition().

00082                                                  {
00083     return pow(-m_expo*rflux/m_norm, 1./m_expo);
00084 }

float GalElSpectrum::flux std::pair< double, double >    coords const [virtual]
 

Definition at line 57 of file GalElSpectrum.cxx.

References flux().

00057                                                              {
00058     return flux(coords.first, coords.second);
00059 }

float GalElSpectrum::flux float    lat,
float    lon
const [virtual]
 

Definition at line 52 of file GalElSpectrum.cxx.

References findCutoff(), and flux().

00052                                                     {
00053     float Ecut = findCutoff(lat,lon);
00054     return flux(Ecut);
00055 }

float GalElSpectrum::flux float    cut const
 

Total flux in electrons / m^2 sec ster.

Definition at line 48 of file GalElSpectrum.cxx.

References m_expo, m_norm, and m_normfact.

00048                                          {
00049     return -m_normfact * (m_norm / m_expo) * pow(cut, m_expo);
00050 }

double GalElSpectrum::flux double    time const [virtual]
 

calculate flux for the current cutoff.

Reimplemented from Spectrum.

Definition at line 40 of file GalElSpectrum.cxx.

References m_cutoff, m_expo, m_norm, and m_normfact.

Referenced by calculate_rate(), flux(), and setPosition().

00040                                        {
00041     return -m_normfact * (m_norm / m_expo) * pow(m_cutoff, m_expo);
00042 }

void GalElSpectrum::init float    lat,
float    lon
[private]
 

Definition at line 114 of file GalElSpectrum.cxx.

References askGPS(), GPS::instance(), m_altitude, m_coscutoff, m_expo, m_norm, m_normfact, m_observer, m_particle_name, m_rearth, GPS::notification(), and setPosition().

Referenced by GalElSpectrum().

00114                                              {
00115     m_normfact = .5*(1.+sqrt(m_altitude*(m_altitude+2.*m_rearth)) /
00116         (m_rearth+m_altitude));
00117     m_expo = static_cast<float>(-3.086 + 1.);
00118     m_norm = 227.f;
00119     setPosition(lat, lon);
00120     m_coscutoff = -sqrt(m_altitude*m_altitude+2.*m_altitude*m_rearth)
00121         / (m_altitude+m_rearth);
00122     m_particle_name = "e-";
00123     m_observer.setAdapter( new ActionAdapter<GalElSpectrum>(this,
00124                                            &GalElSpectrum::askGPS) );
00125     GPS::instance()->notification().attach( &m_observer );
00126 }

const char* GalElSpectrum::nameOf   const [inline]
 

Definition at line 88 of file GalElSpectrum.h.

00088 {return "GalElSpectrum";}

float GalElSpectrum::operator() float    x const [virtual]
 

Reimplemented from Spectrum.

Definition at line 61 of file GalElSpectrum.cxx.

References m_cutoff, and m_expo.

00061                                              {
00062     return m_cutoff * pow(1.-x, 1./m_expo);
00063 }

const char * GalElSpectrum::particleName   const [virtual]
 

subclasses need to specify correct particle type.

Reimplemented from Spectrum.

Definition at line 106 of file GalElSpectrum.cxx.

References m_particle_name.

00106                                                {
00107     return m_particle_name.c_str();
00108 }

void GalElSpectrum::setParticleName std::string    name
 

set the particle name. (default is "p").

Definition at line 110 of file GalElSpectrum.cxx.

References m_particle_name.

00110                                                   {
00111     m_particle_name = name;
00112 }

void GalElSpectrum::setPosition std::pair< double, double >    coords [virtual]
 

Definition at line 73 of file GalElSpectrum.cxx.

References setPosition().

00073                                                              {
00074     GalElSpectrum::setPosition(coords.first, coords.second);
00075 }

void GalElSpectrum::setPosition float    lat,
float    lon
[virtual]
 

Definition at line 65 of file GalElSpectrum.cxx.

References findCutoff(), flux(), m_cutoff, m_flux, Spectrum::m_lat, Spectrum::m_lon, m_pspec, and CHIMESpectrum::setPosition().

Referenced by askGPS(), init(), and setPosition().

00065                                                     {
00066     m_pspec.setPosition(lat, lon);
00067     m_lat = lat;
00068     m_lon = lon;
00069     m_cutoff = findCutoff(lat,lon);
00070     m_flux = flux(m_cutoff);
00071 }

double GalElSpectrum::solidAngle   const [virtual]
 

calcualte effective solid angle for the given energy.

Reimplemented from Spectrum.

Definition at line 44 of file GalElSpectrum.cxx.

00044                                        {
00045     return 4. * M_PI;
00046 }

std::string GalElSpectrum::title   const [virtual]
 

return a title describing the spectrum.

Reimplemented from Spectrum.

Definition at line 102 of file GalElSpectrum.cxx.

00102                                      {
00103     return "GalElSpectrum";
00104 }


Member Data Documentation

const float GalElSpectrum::m_altitude = 600.f [static, private]
 

Definition at line 21 of file GalElSpectrum.cxx.

Referenced by init().

float GalElSpectrum::m_coscutoff [private]
 

Definition at line 101 of file GalElSpectrum.h.

Referenced by dir(), and init().

float GalElSpectrum::m_cutoff [private]
 

Definition at line 100 of file GalElSpectrum.h.

Referenced by cutoff(), flux(), operator()(), and setPosition().

float GalElSpectrum::m_expo [private]
 

Definition at line 97 of file GalElSpectrum.h.

Referenced by findCutoff(), flux(), init(), and operator()().

float GalElSpectrum::m_flux [private]
 

Definition at line 102 of file GalElSpectrum.h.

Referenced by setPosition().

float GalElSpectrum::m_norm [private]
 

Definition at line 98 of file GalElSpectrum.h.

Referenced by findCutoff(), flux(), and init().

float GalElSpectrum::m_normfact [private]
 

Definition at line 99 of file GalElSpectrum.h.

Referenced by flux(), and init().

ObserverAdapter< GalElSpectrum > GalElSpectrum::m_observer [private]
 

Definition at line 108 of file GalElSpectrum.h.

Referenced by init().

std::string GalElSpectrum::m_particle_name [private]
 

Definition at line 107 of file GalElSpectrum.h.

Referenced by init(), particleName(), and setParticleName().

CHIMESpectrum GalElSpectrum::m_pspec [private]
 

Definition at line 95 of file GalElSpectrum.h.

Referenced by findCutoff(), and setPosition().

const float GalElSpectrum::m_rearth = 6371.f [static, private]
 

Definition at line 20 of file GalElSpectrum.cxx.

Referenced by init().


The documentation for this class was generated from the following files:
Generated on Wed Oct 16 14:01:34 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001