earthmodel.hh
1 #ifndef EARTHMODEL_H
2 #define EARTHMODEL_H
3 
4 #include <string>
5 #include <cstdlib>
6 //#include "Primaries.h"
7 
8 class Primaries;
9 class Position;
10 class Vector;
11 class Interaction;
12 class IceModel;
13 using std::string;
14 
15 
16 
17 
19 //class EarthModel
20 //This class contains a model of the physical structure of the Earth, with information on shape,
21 //density at all points inside, and depth of water and ice on the surface.
22 //
23 // methods:
24 //
25 //IceThickness : Returns the thickness of ice in meters at a given Position or lon/lat.
26 //WaterDepth : Returns the depth of water in meters at a given Position or lon/lat.
27 //Surface : Returns the distance in meters from the center of the Earth to the surface,
28 // i.e. to the start of air.
29 //SurfaceAboveGeoid : Returns the distance in meters from the local geoid to the start of air.
30 //Geoid : Returns the height in meters of the geoid at a given Position or lon/lat.
31 //RockSurface : Returns the distance in meters from the center of the Earth to the end of rock
32 // (the begninning of the ice/water/air)
33 //GetSurfaceNormal : Returns a unit vector pointing in the direction of the surface normal at
34 // a given Position.
35 //Getchord
36 //
38 
40 class EarthModel {
41 
42 public:
43  EarthModel(int model = 0,int WEIGHTABSORPTION_SETTING=1);
44  virtual ~EarthModel();
45 // properties of the Earth
46  static constexpr double R_EARTH=6.378140E6; // radius of Earth in m at bulge
47 
48 
49  double radii[3];
50  // = {1.2e13,(EarthModel::R_EARTH-4.0E4)*(EarthModel::R_EARTH-4.0E4),EarthModel::R_EARTH*EarthModel::R_EARTH}; // average radii of boundaries between earth layers
51 
52  double volume; // sums the volume of medium (ice or salt)
53  double ice_area; // sums the area of the earth's surface that has antarctic ice underneath
54  double max_icevol_perbin; // maximum ice volume in any bin
55  double max_icethk_perbin;
56  virtual double Geoid(double latitude) ;
57  virtual double Geoid(const Position &pos) ;
58  virtual double IceThickness(double lon,double lat) ;
59  virtual double IceThickness(const Position& pos) ;
60  virtual double Surface(double lon,double lat) ;
61  virtual double Surface(const Position& pos) ;
62  virtual int InFirn(const Position& pos) ;
63  virtual double SurfaceDeepIce(const Position& pos) ;
64  virtual double SurfaceAboveGeoid(double lon,double lat) ;
65  virtual double SurfaceAboveGeoid(const Position& pos) ;
66  virtual double WaterDepth(double lon,double lat) ;
67  virtual double WaterDepth(const Position& pos) ;
68  virtual double RockSurface(double lon,double lat) ;
69  virtual double RockSurface(const Position& pos) ;
70  double GetDensity(double altitude, const Position earth_in, int& crust_entered, bool * inice = 0);
71  int Getchord( bool unbiased_selection,
72  double len_int_kgm2,
73  const Position &earth_in, // place where neutrino entered the earth
74  double distance_in_ice,
75  bool include_ice_absorption,
76  const Position &posnu, // position of the interaction
77  int inu,
78  double& chord, // chord length
79  double& probability_tmp, // weight
80  double& weight1_tmp,
81  double& nearthlayers, // core, mantle, crust
82  double myair,
83  double& total_kgm2, // length in kg m^2
84  int& crust_entered, // 1 or 0
85  int& mantle_entered, // 1 or 0
86  int& core_entered);
87 
88  Vector GetSurfaceNormal(const Position &r_out) ;
89  static double LongtoPhi_0isPrimeMeridian(double longitude); // convert longitude to phiwith 0 longitude being the prime meridian
90  static double LongtoPhi_0is180thMeridian(double longitude); // convert longitude to phi with 0 longitude being at the 180th meridian
91  void EarthCurvature(double *array,double depth_temp); // adjusts coordinates within the mine to account for the curvature of the earth.
92  Position WhereDoesItEnter(const Position &posnu,const Vector &nnu);
93 
94  /*Finds where we intersect the Geoid */
95  int GeoidIntersection(Vector x0,Vector p0, Position * int1, Position * int2, double extra_height = 5500, double * ds =0) const;
96 
97 
98 private:
99 
100 protected:
101  int EARTH_MODEL;
102  int CONSTANTICETHICKNESS;
103  int CONSTANTCRUST;
104  int FIXEDELEVATION;
105  int FLATSURFACE;
106  int weightabsorption;
107 
108 
109  // pick method to step neutrino through the earth and get attenuation length
110  static constexpr int getchord_method=2; // 1=core,mantle,crust; 2=crust 2.0 model
111 
112  static const double GEOID_MAX; // parameters of geoid model
113  static const double GEOID_MIN;
114  static const double COASTLINE; // if the rf leaves from beyond this "coastline" (in degrees of latitude relative to south pole) it's not in antarctica. Real coastline is always closer than this.
115 
116  // parameters of the Crust 2.0 earth model
117  static constexpr int NLON=180; // number of bins in longitude for crust 2.0
118  static constexpr int NLAT=90; // number of bins in latitude
119  static constexpr int NPHI=180; // bins in longitude for visible ice in horizon
120  static const double MAXTHETA; // maximum value of theta in degrees in polar coordinates
121  double thetastep; // how big do you step in theta-> always 2deg with Crust 2.0
122  double phistep; // how big do you step in phi->always 2deg in Crust 2.0
123  static const int ILAT_COASTLINE;
124  double surfacer[NLON][NLAT]; // elevation at the surface (top of ice) compared to geoid (in meters)
125  double icer[NLON][NLAT]; // elevation at the *bottom* of ice layer (in meters)
126  double waterr[NLON][NLAT]; // elevation at the bottom of water layer (in meters)
127  double softsedr[NLON][NLAT]; // elevation at the bottom of soft set layer (in meters)
128  double hardsedr[NLON][NLAT]; // elev at bottom of hard sed layer (in meters)
129  double uppercrustr[NLON][NLAT]; // elev at bottom of upper crust layer (in meters)
130  double middlecrustr[NLON][NLAT]; // elev at bottom of middle crust layer (in meters)
131  double lowercrustr[NLON][NLAT]; // elev at bottom of lower crust layer (in meters)
132  double geoid[NLAT]; // realistic shape of earth-radius at each latitude (in meters)
133  double MIN_ALTITUDE_CRUST; // maximum depth of crust- determines when to start stepping
134  //double MAX_VOL; // maximum volume of ice in a bin in Crust 2.0 - not used
135  double elevationarray[NLON][NLAT]; // If no water, measures the elevation (relative to geoid, in meters) of the top of the ice or rock (i.e., air interface). If there is water, measures elevation to bottom of water. (There may or may not be ice on top of the water.)
136  double waterthkarray[NLON][NLAT]; // thickness of water layer (in km)
137  double icethkarray[NLON][NLAT]; // thickness of ice layer (in km)
138  double softsedthkarray[NLON][NLAT]; // thickness of soft sed layer (in km)
139  double hardsedthkarray[NLON][NLAT]; // thickness of hard sed layer (in km)
140  double uppercrustthkarray[NLON][NLAT]; // thickness of upper crust layer (in km)
141  double middlecrustthkarray[NLON][NLAT]; // thickness of middle crust layer (in km)
142  double lowercrustthkarray[NLON][NLAT]; // thickness of lower crust layer (in km)
143  double crustthkarray[NLON][NLAT]; // total thickness of crust (in km)
144  double waterdensityarray[NLON][NLAT]; // density of water layer bin by bin
145  double icedensityarray[NLON][NLAT]; // density of ice layer bin by bin
146  double softseddensityarray[NLON][NLAT]; // density of soft sed layer
147  double hardseddensityarray[NLON][NLAT]; // density of hard sed layer
148  double uppercrustdensityarray[NLON][NLAT]; // density of upper crust layer
149  double middlecrustdensityarray[NLON][NLAT]; // density of middle crust layer
150  double lowercrustdensityarray[NLON][NLAT]; // density of lower crust layer
151  double area[NLAT]; // area of a bin at a given latitude- calculated once
152  double average_iceth; // average ice thickness over the continent-calculated once
153 
155  //methods
156  void ReadCrust(string);
157  double SmearPhi(int ilon, double rand);
158  double SmearTheta(int ilat, double rand) ;
159  double dGetTheta(int itheta) ;
160  double dGetPhi(int ilon) ;
161  void GetILonILat(const Position&,int& ilon,int& ilat) ;
162  double GetLat(double theta) ;
163  double GetLon(double phi) ;
164  Vector PickPosnuForaLonLat(double lon,double lat,double theta,double phi); // given that an interaction occurs at a lon and lat, pick an interaction position in the ice
165 
166 }; //class EarthModel
167 
168 
169 constexpr double densities[3]={14000.,3400.,2900.}; // average density of each earth layer
170 
171 #endif
Functions you need to generate a primary interaction including cross sections and picking charged cur...
Definition: Primaries.h:83
This class is a 3-vector that represents a position on the Earth&#39;s surface.
Definition: position.hh:26
Stores everything about a particular neutrino interaction. Interaction.
Definition: Primaries.h:135
int GeoidIntersection(Vector x0, Vector p0, Position *int1, Position *int2, double extra_height=5500, double *ds=0) const
Definition: earthmodel.cc:1083
Shape of the earth, ice thicknesses, profiles of earth layers, densities, neutrino absorption...
Definition: earthmodel.hh:40
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
Definition: vector.hh:27
Ice thicknesses and water depth.
Definition: icemodel.hh:103