GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
genie::utils::prem Namespace Reference

Preliminary Earth Model. More...

Functions

double Density (double r)
 

Detailed Description

Preliminary Earth Model.

Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Created:
August 07, 2009
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Function Documentation

double genie::utils::prem::Density ( double  r)

Definition at line 18 of file PREM.cxx.

References genie::units::g_cm3, genie::units::km, and genie::constants::kREarth.

Referenced by genie::NievesQELCCPXSec::CNCTCLimUcalc(), and main().

19 {
20 // Return the Earth density according to the PREM model
21 // Inputs: r, Distance from the centre of the Earth (in std GENIE units)
22 // Outputs: rho, Earth density (in std GENIE units)
23 //
24 
25  r = TMath::Max(0., r/units::km); // convert to km
26 
27  double rE = constants::kREarth/units::km;
28  double rho = 0.;
29  double x = r / rE;
30 
31  if (r <= 1221.5 )
32  {
33  rho = 13.0885 - 8.8381*x*x;
34  }
35  else if (r > 1221.5 && r <= 3480.0 )
36  {
37  rho = 12.5815 - 1.2638*x - 3.6426*x*x - 5.5281*x*x*x;
38  }
39  else if (r > 3480.0 && r <= 5701.0 )
40  {
41  rho = 7.9565 - 6.4761*x + 5.5283*x*x - 3.0807*x*x*x;
42  }
43  else if (r > 5701.0 && r <= 5771.0 )
44  {
45  rho = 5.3197 - 1.4836*x;
46  }
47  else if (r > 5771.0 && r <= 5971.0 )
48  {
49  rho = 11.2494 - 8.0298*x;
50  }
51  else if (r > 5971.0 && r <= 6151.0 )
52  {
53  rho = 7.1089 - 3.8045*x;
54  }
55  else if (r > 6151.0 && r <= 6346.6 )
56  {
57  rho = 2.691 + 0.6924*x;
58  }
59  else if (r > 6346.6 && r <= 6356.0 )
60  {
61  rho = 2.90;
62  }
63  else if (r > 6356.0 && r <= 6368.0 )
64  {
65  rho = 2.60;
66  }
67  else if (r > 6368.0 && r <= rE)
68  {
69  rho = 1.02;
70  }
71 
72  rho = rho * units::g_cm3;
73 
74  return rho;
75 }
static constexpr double km
Definition: Units.h:64
static constexpr double g_cm3
Definition: Units.h:153