96#include "Framework/Conventions/GBuild.h"
123using namespace genie;
159int main(
int argc,
char ** argv)
165 LOG(
"gmkspl",
pFATAL) <<
" No TuneId in RunOption";
179 LOG(
"gevgen_hadron",
pNOTICE) <<
"finish setup";
192 LOG(
"gevgen_hadron",
pNOTICE) <<
"ready to generate events";
201 <<
" *** Generating event............ " << ievent;
216 mcjmonitor.
Update(ievent,evrec);
242 if (
gOptMode.compare(
"hA") == 0 ) {
243 sname =
"genie::HAIntranuke";
245 }
else if (
gOptMode.compare(
"hN") == 0 ) {
246 sname =
"genie::HNIntranuke";
248 }
else if (
gOptMode.compare(
"hA2025") == 0 ) {
249 sname =
"genie::HAIntranuke2025";
251 }
else if (
gOptMode.compare(
"hN2025") == 0 ) {
252 sname =
"genie::HNIntranuke2025";
254 }
else if (
gOptMode.compare(
"hA2018") == 0 ) {
255 sname =
"genie::HAIntranuke2018";
257 }
else if (
gOptMode.compare(
"hN2018") == 0 ) {
258 sname =
"genie::HNIntranuke2018";
260#ifdef __GENIE_INCL_ENABLED__
261 }
else if (
gOptMode.compare(
"HINCL") == 0 ) {
262 sname =
"genie::HINCLCascadeIntranuke";
265#ifdef __GENIE_GEANT4_INTERFACE_ENABLED__
266 }
else if (
gOptMode.compare(
"HG4BertCasc") == 0 ) {
267 sname =
"genie::HG4BertCascIntranuke";
271 LOG(
"gevgen_hadron",
pFATAL) <<
"Invalid Intranuke mode - Exiting";
293 TLorentzVector x4null(0.,0.,0.,0.);
305 double pzh = TMath::Sqrt(TMath::Max(0.,Eh*Eh-mh*mh));
306 TLorentzVector p4h (0.,0.,pzh,Eh);
307 TLorentzVector p4tgt (0.,0.,0., M);
336 <<
"Generating a flux histogram ... ";
339 int flux_entries = 1000000;
342 double dke = ke_max - ke_min;
343 assert(dke>0 && ke_min>=0.);
347 "spectrum",
"hadron kinetic energy spectrum", flux_bins, ke_min, ke_max);
350 bool input_is_file = ! gSystem->AccessPathName(
gOptFlux.c_str());
356 double ke_step = (ke_max-ke_min)/(n-1);
357 double ymax = -1, ry = -1, gy = -1, ke = -1;
358 for(
int i=0; i<n; i++) {
359 ke = ke_min + i*ke_step;
360 ymax = TMath::Max(ymax, input_flux->
Evaluate(ke));
366 for(
int ientry=0; ientry<flux_entries; ientry++) {
373 <<
"Couldn't generate a flux histogram";
377 ke = ke_min + dke * r->
RndGen().Rndm();
378 gy = ymax * r->
RndGen().Rndm();
388 TF1 * input_func =
new TF1(
"input_func",
gOptFlux.c_str(), ke_min, ke_max);
389 gSpectrum->FillRandom(
"input_func", flux_entries);
392 TFile f(
"./input-hadron-flux.root",
"recreate");
399 LOG(
"gevgen_hadron",
pINFO) <<
"Parsing command line arguments";
410 LOG(
"gevgen_hadron",
pINFO) <<
"Reading number of events to generate";
414 <<
"Unspecified number of events to generate - Using default";
420 LOG(
"gevgen_hadron",
pINFO) <<
"Reading MC run number";
423 LOG(
"gevgen_hadron",
pINFO) <<
"Unspecified run number - Using default";
429 LOG(
"gevgen_hadron",
pINFO) <<
"Reading rescattering particle PDG code";
432 LOG(
"gevgen_hadron",
pFATAL) <<
"Unspecified PDG code - Exiting";
440 LOG(
"gevgen_hadron",
pINFO) <<
"Reading target PDG code";
443 LOG(
"gevgen_hadron",
pFATAL) <<
"Unspecified target PDG code - Exiting";
451 LOG(
"gevgen_hadron",
pINFO) <<
"Reading mode";
454 LOG(
"gevgen_hadron",
pFATAL) <<
"Unspecified mode - Using default";
460 LOG(
"gevgen_hadron",
pINFO) <<
"Reading hadron's kinetic energy spectrum";
467 LOG(
"gevgen_hadron",
pINFO) <<
"Reading probe kinetic energy";
470 if(ke.find(
",") != string::npos) {
473 assert(kerange.size() == 2);
474 double kemin = atof(kerange[0].c_str());
475 double kemax = atof(kerange[1].c_str());
476 assert(kemax>kemin && kemin>0);
491 <<
"You specified an input flux without a kinetic energy range";
498 LOG(
"gevgen_hadron",
pFATAL) <<
"Unspecified kinetic energy - Exiting";
506 LOG(
"gevgen_hadron",
pINFO) <<
"Reading the event filename prefix";
510 <<
"Will set the default event filename prefix";
516 LOG(
"gevgen_hadron",
pINFO) <<
"Reading mode";
520 <<
"Unspecified mode - Using default";
526 LOG(
"gevgen_hadron",
pINFO) <<
"Reading random number seed";
529 LOG(
"gevgen_hadron",
pINFO) <<
"Unspecified random number seed - Using default";
549 <<
"Hadron input KE range = ["
567 <<
" gevgen_hadron [-r run] [-n nev] -p hadron_pdg -t tgt_pdg -k KE [-m mode] "
569 <<
" [--seed random_number_seed]"
570 <<
" [--message-thresholds xml_file]"
571 <<
" [--event-record-print-level level]"
572 <<
" [--mc-job-status-refresh-rate rate]"
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
The GENIE Algorithm Factory.
const Algorithm * GetAlgorithm(const AlgId &algid)
static AlgFactory * Instance()
Command line argument parser.
string ArgAsString(char opt)
bool OptionExists(char opt)
was option set?
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
virtual void AttachSummary(Interaction *interaction)
virtual void AddParticle(const GHepParticle &p)
static void SetPrintLevel(int print_level)
Simple class to create & update MC job status files and env. vars. This is used to be able to keep tr...
void Update(int iev, const EventRecord *event)
Summary information for an interaction.
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records.
void Initialize(void)
add event
void Save(void)
get the even tree
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
void CustomizeFilenamePrefix(string prefix)
Singleton class to load & serve a TDatabasePDG.
static PDGLibrary * Instance(void)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
static RandomGen * Instance()
Access instance.
TRandom3 & RndGen(void) const
rnd number generator for generic usage
void ReadFromCommandLine(int argc, char **argv)
void BuildTune()
build tune and inform XSecSplineList
static RunOpt * Instance(void)
A numeric analysis tool class for interpolating 1-D functions.
double Evaluate(double x) const
string kDefOptEvFilePrefix
double GenProbeKineticEnergy(void)
void GetCommandLineArgs(int argc, char **argv)
EventRecord * InitializeEvent(void)
const EventRecordVisitorI * GetIntranuke(void)
Misc GENIE control constants.
static const unsigned int kRjMaxIterations
void RandGen(long int seed)
void MesgThresholds(string inpfile)
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f=' *')
vector< string > Split(string input, string delim)
THE MAIN GENIE PROJECT NAMESPACE
enum genie::EGHepStatus GHepStatus_t