Functions | Variables
gtestFluxAstro.cxx File Reference
#include <TFile.h>
#include <TNtuple.h>
#include "Framework/Conventions/Constants.h"
#include "Framework/Conventions/Units.h"
#include "Tools/Flux/GAstroFlux.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/ParticleData/PDGCodes.h"

Go to the source code of this file.

Functions

int main (int, char **)
 

Variables

const unsigned int kNEvents = 1000000
 

Function Documentation

int main ( int  ,
char **   
)

Definition at line 34 of file gtestFluxAstro.cxx.

35 {
36  const double pi = constants::kPi;
37 
38  const double latitude = pi/5;
39  const double longitude = pi/4;
40  const double depth = 3.0*units::km;
41  const double size = 2.0*units::km;
42 
43  GDiffuseAstroFlux * difflx = new GDiffuseAstroFlux;
44 
45  difflx->ForceMinEnergy(1E+2);
46  difflx->ForceMaxEnergy(1E+8);
47  difflx->GenerateWeighted(true);
48  difflx->SetDetectorPosition(latitude,longitude,depth,size);
49  difflx->SetRelNuPopulations(1,2,0,1,2,0);
50  difflx->SetEnergyPowLawIdx(3.5);
51 
52  TNtuple * fluxntp =
53  new TNtuple("fluxntp", "flux", "x:y:z:t:px:py:pz:E:pdgc:wght");
54 
55  unsigned int ievent = 0;
56  while(ievent++ < kNEvents) {
57  LOG("test", pINFO) << "Event number: " << ievent;
58  difflx->GenerateNext();
59  int pdgc = difflx->PdgCode();
60  double wght = difflx->Weight();
61  const TLorentzVector & x4 = difflx->Position();
62  const TLorentzVector & p4 = difflx->Momentum();
63  fluxntp->Fill(
64  x4.X(), x4.Y(), x4.Z(), x4.T(),
65  p4.Px(), p4.Py(), p4.Pz(), p4.E(), pdgc, wght);
66  }
67 
68  TFile f("./genie-astro-flux.root","recreate");
69  fluxntp->Write();
70  f.Close();
71 
72  LOG("test", pINFO) << "Done!";
73 
74  return 0;
75 }
virtual const TLorentzVector & Momentum(void)
returns the flux neutrino 4-momentum
Definition: GAstroFlux.h:139
void ForceMinEnergy(double emin)
Definition: GAstroFlux.cxx:138
void SetEnergyPowLawIdx(double n)
Definition: GAstroFlux.cxx:258
void ForceMaxEnergy(double emax)
Definition: GAstroFlux.cxx:144
static constexpr double km
Definition: Units.h:64
virtual bool GenerateNext(void)
generate the next flux neutrino (return false in err)
Definition: GAstroFlux.cxx:47
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
virtual double Weight(void)
returns the flux neutrino weight (if any)
Definition: GAstroFlux.h:138
const unsigned int kNEvents
#define pINFO
Definition: Messenger.h:62
void SetDetectorPosition(double latitude, double longitude, double depth, double size)
Definition: GAstroFlux.cxx:162
virtual const TLorentzVector & Position(void)
returns the flux neutrino 4-position (note: expect SI rather than physical units) ...
Definition: GAstroFlux.h:140
virtual void GenerateWeighted(bool gen_weighted)
set whether to generate weighted or unweighted neutrinos
Definition: GAstroFlux.cxx:157
float pi
Definition: units.py:11
static const double kPi
Definition: Constants.h:37
virtual int PdgCode(void)
returns the flux neutrino pdg code
Definition: GAstroFlux.h:137
void SetRelNuPopulations(double nnue=1, double nnumu=2, double nnutau=0, double nnuebar=1, double nnumubar=2, double nnutaubar=0)
Definition: GAstroFlux.cxx:208

Variable Documentation

const unsigned int kNEvents = 1000000

Definition at line 31 of file gtestFluxAstro.cxx.