icemc
 All Classes Namespaces Files Functions Variables Friends Macros Pages
earthmodel.hh
Go to the documentation of this file.
1 #ifndef EARTHMODEL_H
2 #define EARTHMODEL_H
3 
4 #include <string>
5 #include <cstdlib>
6 //#include "Primaries.h"
7 class Primaries;
8 class Position;
9 class Vector;
10 class TRandom3;
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  double radii[3];
49  // = {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
50 
51  double volume; // sums the volume of medium (ice or salt)
52  double ice_area; // sums the area of the earth's surface that has antarctic ice underneath
53  double max_icevol_perbin; // maximum ice volume in any bin
55  virtual double Geoid(double latitude) ;
56  virtual double Geoid(const Position &pos) ;
57  virtual double IceThickness(double lon,double lat) ;
58  virtual double IceThickness(const Position& pos) ;
59  virtual double Surface(double lon,double lat) ;
60  virtual double Surface(const Position& pos) ;
61  virtual int InFirn(const Position& pos) ;
62  virtual double SurfaceDeepIce(const Position& pos) ;
63  virtual double SurfaceAboveGeoid(double lon,double lat) ;
64  virtual double SurfaceAboveGeoid(const Position& pos) ;
65  virtual double WaterDepth(double lon,double lat) ;
66  virtual double WaterDepth(const Position& pos) ;
67  virtual double RockSurface(double lon,double lat) ;
68  virtual double RockSurface(const Position& pos) ;
69 double GetDensity(double altitude, const Position earth_in, const Position posnu, int& crust_entered,
70  int& mantle_entered, int& core_entered);
71  int Getchord(Primaries *primary1, Settings *settings1,IceModel *antarctica1, Secondaries *sec1,
72  double len_int_kgm2,
73  const Position &earth_in, // place where neutrino entered the earth
74  const Position &r_enterice,
75  const Position &nuexitice,
76 
77  const Position &posnu, // position of the interaction
78  int inu,
79  double& chord, // chord length
80  double& probability_tmp, // weight
81  double& weight1_tmp,
82  double& nearthlayers, // core, mantle, crust
83  double myair,
84  double& total_kgm2, // length in kg m^2
85  int& crust_entered, // 1 or 0
86  int& mantle_entered, // 1 or 0
87  int& core_entered);
88 
89  Vector GetSurfaceNormal(const Position &r_out) ;
90  static double LongtoPhi_0isPrimeMeridian(double longitude); // convert longitude to phiwith 0 longitude being the prime meridian
91  static double LongtoPhi_0is180thMeridian(double longitude); // convert longitude to phi with 0 longitude being at the 180th meridian
92  void EarthCurvature(double *array,double depth_temp); // adjusts coordinates within the mine to account for the curvature of the earth.
93  Position WhereDoesItEnter(const Position &posnu,const Vector &nnu);
94 
95 private:
96  TRandom3 Rand3;
97 
98 
99 protected:
106 
107 
108  // pick method to step neutrino through the earth and get attenuation length
109  static constexpr int getchord_method=2; // 1=core,mantle,crust; 2=crust 2.0 model
110 
111  static const double GEOID_MAX; // parameters of geoid model
112  static const double GEOID_MIN;
113  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.
114 
115  // parameters of the Crust 2.0 earth model
116  static constexpr int NLON=180; // number of bins in longitude for crust 2.0
117  static constexpr int NLAT=90; // number of bins in latitude
118  static constexpr int NPHI=180; // bins in longitude for visible ice in horizon
119  static const double MAXTHETA; // maximum value of theta in degrees in polar coordinates
120  double thetastep; // how big do you step in theta-> always 2deg with Crust 2.0
121  double phistep; // how big do you step in phi->always 2deg in Crust 2.0
122  static const int ILAT_COASTLINE;
123  double surfacer[NLON][NLAT]; // elevation at the surface (top of ice) compared to geoid (in meters)
124  double icer[NLON][NLAT]; // elevation at the *bottom* of ice layer (in meters)
125  double waterr[NLON][NLAT]; // elevation at the bottom of water layer (in meters)
126  double softsedr[NLON][NLAT]; // elevation at the bottom of soft set layer (in meters)
127  double hardsedr[NLON][NLAT]; // elev at bottom of hard sed layer (in meters)
128  double uppercrustr[NLON][NLAT]; // elev at bottom of upper crust layer (in meters)
129  double middlecrustr[NLON][NLAT]; // elev at bottom of middle crust layer (in meters)
130  double lowercrustr[NLON][NLAT]; // elev at bottom of lower crust layer (in meters)
131  double geoid[NLAT]; // realistic shape of earth-radius at each latitude (in meters)
132  double MIN_ALTITUDE_CRUST; // maximum depth of crust- determines when to start stepping
133  //double MAX_VOL; // maximum volume of ice in a bin in Crust 2.0 - not used
134  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.)
135  double waterthkarray[NLON][NLAT]; // thickness of water layer (in km)
136  double icethkarray[NLON][NLAT]; // thickness of ice layer (in km)
137  double softsedthkarray[NLON][NLAT]; // thickness of soft sed layer (in km)
138  double hardsedthkarray[NLON][NLAT]; // thickness of hard sed layer (in km)
139  double uppercrustthkarray[NLON][NLAT]; // thickness of upper crust layer (in km)
140  double middlecrustthkarray[NLON][NLAT]; // thickness of middle crust layer (in km)
141  double lowercrustthkarray[NLON][NLAT]; // thickness of lower crust layer (in km)
142  double crustthkarray[NLON][NLAT]; // total thickness of crust (in km)
143  double waterdensityarray[NLON][NLAT]; // density of water layer bin by bin
144  double icedensityarray[NLON][NLAT]; // density of ice layer bin by bin
145  double softseddensityarray[NLON][NLAT]; // density of soft sed layer
146  double hardseddensityarray[NLON][NLAT]; // density of hard sed layer
147  double uppercrustdensityarray[NLON][NLAT]; // density of upper crust layer
148  double middlecrustdensityarray[NLON][NLAT]; // density of middle crust layer
149  double lowercrustdensityarray[NLON][NLAT]; // density of lower crust layer
150  double area[NLAT]; // area of a bin at a given latitude- calculated once
151  double average_iceth; // average ice thickness over the continent-calculated once
152 
154  //methods
155  void ReadCrust(string);
156  double SmearPhi(int ilon);
157  double SmearTheta(int ilat) ;
158  double dGetTheta(int itheta) ;
159  double dGetPhi(int ilon) ;
160  void GetILonILat(const Position&,int& ilon,int& ilat) ;
161  double GetLat(double theta) ;
162  double GetLon(double phi) ;
163  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
164 
165 }; //class EarthModel
166 
167 
168 constexpr double densities[3]={14000.,3400.,2900.}; // average density of each earth layer
169 
170 #endif