gtestPREM.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \program gtestPREM
5 
6 \brief Test tehe PREM model
7 
8 \author Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
9  University of Liverpool & STFC Rutherford Appleton Laboratory
10 
11 \created Aug 25, 2009
12 
13 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15 
16 */
17 //____________________________________________________________________________
18 
19 #include <TFile.h>
20 #include <TNtuple.h>
21 
24 #include "Framework/Utils/PREM.h"
25 
26 using namespace genie;
27 
28 //____________________________________________________________________________
29 int main(int /*argc*/, char ** /*argv*/)
30 {
31  TNtuple * earth_density = new TNtuple("earth_density","","r:rho");
32 
33  const double dr = 1. * units::km;
34  const double rmax = constants::kREarth;
35 
36  double r = 0;
37  while(r < rmax) {
38  double rho = utils::prem::Density(r);
39  earth_density->Fill(r/units::km, rho/units::g_cm3);
40  r += dr;
41  }
42 
43  TFile f("./prem.root","recreate");
44  earth_density->Write();
45  f.Close();
46 
47  return 0;
48 }
49 //____________________________________________________________________________
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
static constexpr double km
Definition: Units.h:64
static constexpr double g_cm3
Definition: Units.h:153
static const double kREarth
Definition: Constants.h:110
int main(int, char **)
Definition: gtestPREM.cxx:29
double Density(double r)
Definition: PREM.cxx:18