GENIEGenerator
Loading...
Searching...
No Matches
PREM.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
11#include <TMath.h>
12
16
17//___________________________________________________________________________
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}
76//___________________________________________________________________________
static constexpr double km
Definition Units.h:64
static constexpr double g_cm3
Definition Units.h:153
double Density(double r)
Definition PREM.cxx:18