GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
gtestFluxSimple.cxx File Reference
#include <TFile.h>
#include <TNtuple.h>
#include <TSystem.h>
#include <TH1D.h>
#include <TF1.h>
#include "Tools/Flux/GCylindTH1Flux.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/ParticleData/PDGCodes.h"
Include dependency graph for gtestFluxSimple.cxx:

Go to the source code of this file.

Functions

TNtuple * runGCylindTH1FluxDriver (void)
 
TNtuple * createFluxNtuple (GFluxI *flux)
 
int main (int, char **)
 

Variables

const unsigned int kNEvents = 10000
 

Function Documentation

TNtuple* createFluxNtuple ( GFluxI flux)
int main ( int  ,
char **   
)

Definition at line 38 of file gtestFluxSimple.cxx.

References LOG, pINFO, runGCylindTH1FluxDriver(), and Write().

39 {
40  LOG("test", pINFO) << "Running GCylindTH1Flux driver test";
41  TNtuple * ntcylh1f = runGCylindTH1FluxDriver();
42  ntcylh1f->SetTitle("GCylindTH1Flux driver data");
43 
44  LOG("test", pINFO) << "Saving flux ntuples";
45 
46  TFile f("./genie-flux-drivers.root","recreate");
47  ntcylh1f -> Write("ntcylh1f");
48  f.Close();
49 
50  delete ntcylh1f;
51 
52  LOG("test", pINFO) << "Done!";
53 
54  return 0;
55 }
TNtuple * runGCylindTH1FluxDriver(void)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
hadnt Write("hadnt")
TNtuple * runGCylindTH1FluxDriver ( void  )

Definition at line 57 of file gtestFluxSimple.cxx.

References createFluxNtuple(), genie::kPdgAntiNuMu, genie::kPdgNuMu, LOG, and pINFO.

Referenced by main().

58 {
59  LOG("test", pINFO) << "Creating GCylindTH1Flux flux driver";
60 
61  GCylindTH1Flux * flux = new GCylindTH1Flux;
62 
63  LOG("test", pINFO) << "Setting configuration data";
64 
65  TF1 * f1 = new TF1("f1","1./x",0.5,5.0);
66  TH1D * spectrum1 = new TH1D("spectrum1","numu E", 20,0.5,5);
67  spectrum1->FillRandom("f1",100000);
68 
69  TF1 * f2 = new TF1("f2","x",0.5,5.0);
70  TH1D * spectrum2 = new TH1D("spectrum2","numubar E", 20,0.5,5);
71  spectrum2->FillRandom("f2",10000);
72 
73  TVector3 direction(0,0,1);
74  TVector3 beam_spot(0,0,-10);
75 
76  double Rtransverse = 0.5;
77 
78  LOG("test", pINFO) << "Configuring GCylindTH1Flux flux driver";
79 
80  flux -> SetNuDirection (direction);
81  flux -> SetBeamSpot (beam_spot);
82  flux -> SetTransverseRadius (Rtransverse);
83  flux -> AddEnergySpectrum (kPdgNuMu, spectrum1);
84  flux -> AddEnergySpectrum (kPdgAntiNuMu, spectrum2);
85 
86  LOG("test", pINFO) << "Creating flux ntuple";
87  GFluxI * fluxi = dynamic_cast<GFluxI*>(flux);
88 
89  TNtuple * fluxntp = createFluxNtuple(fluxi);
90 
91  delete f1;
92  delete f2;
93  delete flux;
94 
95  return fluxntp;
96 }
const int kPdgNuMu
Definition: PDGCodes.h:30
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
A generic GENIE flux driver. Generates a &#39;cylindrical&#39; neutrino beam along the input direction...
#define pINFO
Definition: Messenger.h:62
TNtuple * createFluxNtuple(GFluxI *flux)
const int kPdgAntiNuMu
Definition: PDGCodes.h:31
GENIE Interface for user-defined flux classes.
Definition: GFluxI.h:29

Variable Documentation

const unsigned int kNEvents = 10000

Definition at line 32 of file gtestFluxSimple.cxx.