29 using namespace genie;
30 using namespace genie::flux;
40 LOG(
"test",
pINFO) <<
"Running GCylindTH1Flux driver test";
42 ntcylh1f->SetTitle(
"GCylindTH1Flux driver data");
44 LOG(
"test",
pINFO) <<
"Saving flux ntuples";
46 TFile f(
"./genie-flux-drivers.root",
"recreate");
47 ntcylh1f ->
Write(
"ntcylh1f");
59 LOG(
"test",
pINFO) <<
"Creating GCylindTH1Flux flux driver";
63 LOG(
"test",
pINFO) <<
"Setting configuration data";
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);
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);
73 TVector3 direction(0,0,1);
74 TVector3 beam_spot(0,0,-10);
76 double Rtransverse = 0.5;
78 LOG(
"test",
pINFO) <<
"Configuring GCylindTH1Flux flux driver";
80 flux -> SetNuDirection (direction);
81 flux -> SetBeamSpot (beam_spot);
82 flux -> SetTransverseRadius (Rtransverse);
83 flux -> AddEnergySpectrum (
kPdgNuMu, spectrum1);
86 LOG(
"test",
pINFO) <<
"Creating flux ntuple";
101 new TNtuple(
"fluxntp",
102 "flux data",
"x:y:z:t:px:py:pz:E:pdgc");
104 LOG(
"test",
pINFO) <<
"Generating flux neutrinos";
106 unsigned int ievent = 0;
112 const TLorentzVector & x4 = flux->
Position();
113 const TLorentzVector & p4 = flux->
Momentum();
115 fluxntp->Fill( x4.X(), x4.Y(), x4.Z(), x4.T(),
116 p4.Px(), p4.Py(), p4.Pz(), p4.E(), pdgc);
TNtuple * runGCylindTH1FluxDriver(void)
virtual const TLorentzVector & Position(void)=0
returns the flux neutrino 4-position (note: expect SI rather than physical units) ...
int main(int argc, char **argv)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
A generic GENIE flux driver. Generates a 'cylindrical' neutrino beam along the input direction...
const unsigned int kNEvents
TNtuple * createFluxNtuple(GFluxI *flux)
virtual bool GenerateNext(void)=0
generate the next flux neutrino (return false in err)
virtual int PdgCode(void)=0
returns the flux neutrino pdg code
virtual const TLorentzVector & Momentum(void)=0
returns the flux neutrino 4-momentum
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
GENIE Interface for user-defined flux classes.