GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
gtestPREM.cxx File Reference
#include <TFile.h>
#include <TNtuple.h>
#include "Framework/Conventions/Constants.h"
#include "Framework/Conventions/Units.h"
#include "Framework/Utils/PREM.h"
Include dependency graph for gtestPREM.cxx:

Go to the source code of this file.

Functions

int main (int, char **)
 

Function Documentation

int main ( int  ,
char **   
)

Definition at line 29 of file gtestPREM.cxx.

References genie::utils::prem::Density(), genie::units::g_cm3, genie::units::km, and genie::constants::kREarth.

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 }
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