GENIEGenerator
Loading...
Searching...
No Matches
gtestFermiP.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*!
3
4\program gtestFermiP
5
6\brief Program used for testing / debugging the Fermi momentum distribution
7 models
8
9\author Costas Andreopoulos <c.andreopoulos \at cern.ch>
10 University of Liverpool
11
12\created June 20, 2004
13
14\cpright Copyright (c) 2003-2025, The GENIE Collaboration
15 For the full text of the license visit http://copyright.genie-mc.org
16
17*/
18//____________________________________________________________________________
19
20#include <TFile.h>
21#include <TNtuple.h>
22#include <TMath.h>
23#include <TVector3.h>
24
31
32using namespace genie;
33
34int main(int /*argc*/, char ** /*argv*/)
35{
36 const unsigned int kNTargets = 2;
37 const unsigned int kNModels = 4;
38 const unsigned int kNEvents = 3000;
39
40 //-- Get nuclear models
42
43 const NuclearModelI * bodritch =
44 dynamic_cast<const NuclearModelI *> (algf->GetAlgorithm(
45 "genie::FGMBodekRitchie","Default"));
46 const NuclearModelI * benhsf1d =
47 dynamic_cast<const NuclearModelI *> (
48 algf->GetAlgorithm("genie::BenharSpectralFunc1D","Default"));
49 const NuclearModelI * benhsf2d =
50 dynamic_cast<const NuclearModelI *> (
51 algf->GetAlgorithm("genie::BenharSpectralFunc","Default"));
52 const NuclearModelI * effsf =
53 dynamic_cast<const NuclearModelI *> (
54 algf->GetAlgorithm("genie::EffectiveSF","Default"));
55
56 const NuclearModelI * nuclmodel[kNModels] = { bodritch, benhsf1d, benhsf2d, effsf };
57
58 //-- Create nuclear targets
59 Target * nucltgt[kNTargets];
60 nucltgt[0] = new Target ( 6, 12); // C12
61 nucltgt[1] = new Target (26, 56); // Fe56
62
63 //-- Output ntuple
64
65 TNtuple * nuclnt = new TNtuple("nuclnt","","target:model:p:px:py:pz:w");
66
67 //-- Loop over targets/models & generate 'target nucleons'
68 for(unsigned int it = 0; it < kNTargets; it++) {
69 nucltgt[it]->SetHitNucPdg(kPdgProton);
70 const Target & target = *nucltgt[it];
71 LOG("test", pNOTICE) << "** Using target : " << target;;
72 for(unsigned int im = 0; im < kNModels; im++) {
73 LOG("test", pNOTICE) << "Running model : " << nuclmodel[im]->Id();
74 for(unsigned int iev = 0; iev < kNEvents; iev++) {
75 nuclmodel[im]->GenerateNucleon(target);
76 double w = nuclmodel[im]->RemovalEnergy();
77 TVector3 p3 = nuclmodel[im]->Momentum3();
78 double px = p3.Px();
79 double py = p3.Py();
80 double pz = p3.Pz();
81 double p = p3.Mag();
82 LOG("test", pDEBUG)
83 << "Nucleon 4-P = " << utils::print::Vec3AsString(&p3);
84 nuclnt->Fill(it,im,p,px,py,pz,w);
85 }//ievents
86 }//immodels
87 }//itargets
88
89 //-- Save ntuple
90 TFile f("./fermip.root","recreate");
91 nuclnt->Write();
92 f.Close();
93
94 //-- Clean-up
95 delete nucltgt[0];
96 delete nucltgt[1];
97 delete nuclnt;
98
99 return 0;
100}
101//____________________________________________________________________________
#define pNOTICE
Definition Messenger.h:61
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
int main()
The GENIE Algorithm Factory.
Definition AlgFactory.h:39
const Algorithm * GetAlgorithm(const AlgId &algid)
static AlgFactory * Instance()
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition Algorithm.h:98
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
const TVector3 & Momentum3(void) const
virtual bool GenerateNucleon(const Target &) const =0
double RemovalEnergy(void) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition Target.h:40
void SetHitNucPdg(int pdgc)
Definition Target.cxx:171
const unsigned int kNEvents
string Vec3AsString(const TVector3 *vec)
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
const int kPdgProton
Definition PDGCodes.h:81