#include <AlbedoPSpectrum.h>
Inheritance diagram for AlbedoPSpectrum::

Public Methods | |
| AlbedoPSpectrum (const std::string ¶ms) | |
| Constructor. Initial geographic lat and lon in degrees. More... | |
| virtual double | calculate_rate (double old_rate) |
| Ask GPS where we are and find the flux at that point. More... | |
| virtual double | flux (double) const |
| calculate flux for the current position. More... | |
| virtual double | solidAngle () const |
| effective solid angle for the given energy. More... | |
| virtual float | flux (float lat, float lon) const |
| flux as a function of latitude and longitude in 600 km orbit. More... | |
| virtual float | flux (std::pair< double, double > coords) const |
| Flux for a specified position, packaged as a pair. More... | |
| virtual float | operator() (float) const |
| sample a single particle energy from the spectrum. More... | |
| virtual void | setPosition (float lat, float lon) |
| move to a new position and do the necessary initialization. More... | |
| virtual void | setPosition (std::pair< double, double > coords) |
| Do the initialization necessary when moving to a new position. More... | |
| int | askGPS () |
| Ask the GPS where we are located. More... | |
| virtual std::pair< float, float > | dir (float energy) const |
| sample a solid angle pair (costh,phi) from angular distribution. More... | |
| virtual std::string | title () const |
| What's my name? More... | |
| virtual const char * | particleName () const |
| What kind of particle do I make? (p for proton). More... | |
| const char * | nameOf () const |
| void | setParticleName (std::string name) |
| set the particle name. (default is "p"). More... | |
Private Methods | |
| void | init (const std::vector< float > ¶ms) |
| Initializes parameters during construction. More... | |
| void | fitParams (const double lat, const double lon, double &alf1, double &alf2, double &emin, double &emax, double &v1, double &v2, double &Ejoin) const |
| Evaluate the coefficients of the broken power law albedo proton model. More... | |
Private Attributes | |
| float | m_flux |
| current flux (set when cutoff changes). More... | |
| std::string | m_particle_name |
| ObserverAdapter< AlbedoPSpectrum > | m_observer |
Interface: The constructor arguments specify the satellite position (latitude, longitude) in degrees. The position can be changed by use of the setPosition() member. The total flux in protons/(m^2 sec ster) is returned by the flux() member. There are 3 ways to call flux(): With no arguments it uses the current cutoff energy. If there is one argument, it is assumed to be a cutoff. Two arguments are assumed to be latitude and longitude, and the corresponding cutoff is looked up. The stored current value is not changed. The operator() function returns a sampled energy value. The argument must be a float value between 0 and 1. The dir() member returns a sampled particle's direction. The argument is the particle energy, as produced by ().
Definition at line 38 of file AlbedoPSpectrum.h.
|
|
Constructor. Initial geographic lat and lon in degrees.
Definition at line 39 of file AlbedoPSpectrum.cxx. References init(), and Spectrum::parseParamList().
00039 {
00040 std::vector<float> params;
00041
00042 parseParamList(paramstring,params);
00043
00044 init(params);
00045 }
|
|
|
Ask the GPS where we are located.
Definition at line 125 of file AlbedoPSpectrum.cxx. References GPS::instance(), and setPosition(). Referenced by init().
00126 {
00127 setPosition(GPS::instance()->lat(), GPS::instance()->lon());
00128 return 0; // can't be void in observer pattern
00129 }
|
|
|
Ask GPS where we are and find the flux at that point.
Definition at line 147 of file AlbedoPSpectrum.cxx. References GPS::instance().
00148 {
00149 return flux(GPS::instance()->lat(), GPS::instance()->lon());
00150 }
|
|
|
sample a solid angle pair (costh,phi) from angular distribution.
Reimplemented from Spectrum. Definition at line 155 of file AlbedoPSpectrum.cxx.
00156 {
00157 // Random particle direction
00158
00159 float coszenith, earthazi,dens,v;
00160 const int try_max = 1000;
00161 static int max_tried = 0;
00162 int trial = 0;
00163 earthazi = 2. * M_PI * HepRandom::getTheGenerator()->flat();
00164 do {
00165 coszenith = 2. * HepRandom::getTheGenerator()->flat() - 1.;
00166 dens = 1. + 0.6 * sqrt(1.-coszenith*coszenith);
00167 v = 1.6 * HepRandom::getTheGenerator()->flat();
00168 } while (v > dens && trial++ < try_max);
00169
00170 max_tried = std::max(trial, max_tried);
00171
00172 return std::make_pair<float,float>(coszenith, earthazi);
00173 }
|
|
||||||||||||||||||||||||||||||||||||||||
|
Evaluate the coefficients of the broken power law albedo proton model. Input: lat Magnetic latitude in degrees Output: alf1,alf2 Slopes of the two power laws emin,emax Artificial upper and lower cutoff energies v1,v2 Integrated fluxes of the two power laws Ejoin Energy at which the two power laws meet flux (protons / m^s sec ster MeV) = a1 * (e/e1)^(-alf1) if emin < e < Ejoin a2 * (e/e2)^(-alf2> if Ejoin < e < emax when e is measured in GeV (following the AMS convention) Definition at line 188 of file AlbedoPSpectrum.cxx. Referenced by flux(), and operator()().
00191 {
00192 double theta = abs(Geomag::geolat(lat,lon)) * M_PI / 180.;
00193 double e1 = .2; // pivot point of lower power law
00194 double e2 = 1.; // pivot point of higher power law
00195 emin = .01;
00196 emax = 10.;
00197 // normalization values of the two power laws
00198 double a1 = 0.142 + theta * (-.4809 + theta * .5517);
00199 double a2 = .0499 + theta * (-.3239 + theta * (.8077 + theta * (-.8800 +
00200 theta * .3607)));
00201 alf1 = .4913 + theta * (2.017 + theta * (-.6941 - 1.49 * theta));
00202 alf2 = 2.85 - .875 * theta;
00203 Ejoin = pow(a1*pow(e1,alf1) / (a2*pow(e2,alf2)), 1./(alf1-alf2));
00204 v1 = 1000.*a1*pow(e1,alf1)*(pow(Ejoin,1.-alf1)-pow(emin,1.-alf1))
00205 /(1.-alf1); // integral of lower power law
00206 v2 = 1000.*a2*pow(e2,alf2)*(pow(emax,1.-alf2)-pow(Ejoin,1.-alf2))
00207 /(1.-alf2); // integral of upper power law
00208 }
|
|
|
Flux for a specified position, packaged as a pair.
Definition at line 100 of file AlbedoPSpectrum.cxx. References flux().
00100 {
00101 return flux(coords.first, coords.second);
00102 }
|
|
||||||||||||
|
flux as a function of latitude and longitude in 600 km orbit.
Definition at line 90 of file AlbedoPSpectrum.cxx. References fitParams().
00090 {
00091 double v1,v2, alf1, alf2, emin, emax, Ejoin;
00092 fitParams(lat, lon, alf1, alf2, emin, emax, v1, v2, Ejoin);
00093 // The factor 1.47 is induced by the assumed angular dependence.
00094 return 1.47 * (v1+v2);
00095 }
|
|
|
calculate flux for the current position.
Reimplemented from Spectrum. Definition at line 73 of file AlbedoPSpectrum.cxx. References m_flux. Referenced by flux().
00073 {
00074 return m_flux;
00075 }
|
|
|
Initializes parameters during construction.
Definition at line 19 of file AlbedoPSpectrum.cxx. References askGPS(), GPS::instance(), m_observer, m_particle_name, GPS::notification(), and setPosition(). Referenced by AlbedoPSpectrum().
00019 {
00020
00021 float lat = params.size()>0? params[0]: 0.0f;
00022 float lon = params.size()>1? params[1]: 0.0f;
00023 setPosition(lat, lon);
00024
00025 m_particle_name = "p";
00026
00027 // set callback to be notified when the position changes
00028 m_observer.setAdapter( new ActionAdapter<AlbedoPSpectrum>
00029 (this, &AlbedoPSpectrum::askGPS) );
00030
00031 GPS::instance()->notification().attach( &m_observer );
00032
00033 }
|
|
|
Definition at line 69 of file AlbedoPSpectrum.h.
00069 {return "AlbedoPSpectrum";}
|
|
|
sample a single particle energy from the spectrum.
Reimplemented from Spectrum. Definition at line 109 of file AlbedoPSpectrum.cxx. References fitParams(), Spectrum::m_lat, and Spectrum::m_lon.
00109 {
00110 double v1,v2, alf1, alf2, emin, emax, Ejoin;
00111 fitParams(m_lat, m_lon, alf1, alf2, emin, emax, v1, v2, Ejoin);
00112 double split = v1/(v1+v2);
00113 if (x > split) {
00114 return pow((pow(Ejoin,1.-alf2)+((1.-x)/(1.-split))*(pow(emax,1.-alf2)
00115 -pow(Ejoin,1.-alf2))), 1./(1.-alf2));
00116 } else {
00117 return pow((pow(emin,1.-alf1)+(x/split)*(pow(Ejoin,1.-alf1)
00118 -pow(emin,1.-alf1))), 1./(1.-alf1));
00119 }
00120 }
|
|
|
What kind of particle do I make? (p for proton).
Reimplemented from Spectrum. Definition at line 58 of file AlbedoPSpectrum.cxx. References m_particle_name.
00058 {
00059 return m_particle_name.c_str();
00060 }
|
|
|
set the particle name. (default is "p").
Definition at line 65 of file AlbedoPSpectrum.cxx. References m_particle_name.
00066 {
00067 m_particle_name = name;
00068 }
|
|
|
Do the initialization necessary when moving to a new position.
Definition at line 141 of file AlbedoPSpectrum.cxx.
00141 {
00142 AlbedoPSpectrum::setPosition(coords.first, coords.second);
00143 }
|
|
||||||||||||
|
move to a new position and do the necessary initialization.
Definition at line 133 of file AlbedoPSpectrum.cxx. Referenced by askGPS(), and init().
|
|
|
effective solid angle for the given energy.
Reimplemented from Spectrum. Definition at line 80 of file AlbedoPSpectrum.cxx.
00081 {
00082 return 4.*M_PI;
00083 }
|
|
|
What's my name?
Reimplemented from Spectrum. Definition at line 51 of file AlbedoPSpectrum.cxx.
00051 {
00052 return "AlbedoPSpectrum";
00053 }
|
|
|
current flux (set when cutoff changes).
Definition at line 81 of file AlbedoPSpectrum.h. Referenced by flux(). |
|
|
Definition at line 84 of file AlbedoPSpectrum.h. Referenced by init(). |
|
|
Definition at line 83 of file AlbedoPSpectrum.h. Referenced by init(), particleName(), and setParticleName(). |
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001