1from __future__
import print_function
2from __future__
import division
3import ROOT, os, sys, time
4from subprocess
import call
8 """returns name of TH1D p spectrum as stored in input files:
9 example: nue: 12 -> 1012, anue: -12 -> 2012
11 x = ROOT.TMath.Abs(nupdg)
19 """returns name of TH2D p-pt flux as stored in input files:
20 ie for nue: 12 -> 1212, anue: -12 -> 2212
23 x = ROOT.TMath.Abs(nupdg)
31 """prepare splines with neutrino interaction cross sections
32 nupdg = list of input neutrino pdgs
33 targetcode = string with target material in GENIE code
34 outputfile = path of outputfile
37 for ipdg, nupdg
in enumerate(nupdglist):
39 inputnupdg = inputnupdg +
","
40 inputnupdg = inputnupdg + str(nupdg)
53 print(
"Starting GENIE with the following command: ")
70 """make Genie simulation, parameters:
71 events = number of events to generate
73 targetcode = string with target material in GENIE code
74 emin, emax = min and max neutrino energy to generate
75 process = simulate a specific neutrino process (CCDIS, CCQE, CC, NC, CCRES, NCRES, etc.),
76 if not set, GENIE's comprehensive collection of event generators will be used.
77 inputflux = input neutrino flux
78 spline = input neutrino spline
99 +
" --cross-sections "
103 if process
is not None:
104 cmd = cmd +
" --event-generator-list " + process
106 cmd = cmd +
" --seed " + str(seed)
108 cmd = cmd +
" --run " + str(irun)
110 print(
"Starting GENIE with the following command: ")
112 call(cmd, shell=
True)
116 """convert gntp GENIE file to gst general ROOT file
117 inputfile = path of gntp inputfile (gntp.0.ghep.root)
118 outputfile = path of gst outputfile
121 cmd =
"gntpc -i " + inputfile +
" -f gst -o " + outputfile
122 print(
"Starting GENIE conversion with the following command: ")
124 call(cmd, shell=
True)
128 """add histogram with p-pt flux to simulation file
129 inputflux = path of neutrino inputflux
130 simfile = path of simulation file to UPDATE
133 inputfile = ROOT.TFile(inputflux,
"read")
134 simfile = ROOT.TFile(simfile,
"update")
make_ntuples(inputfile, outputfile)
make_splines(nupdglist, targetcode, emax, nknots, outputfile)
generate_genie_events(nevents, nupdg, emin, emax, targetcode, inputflux, spline, process=None, seed=None, irun=None)
add_hists(inputflux, simfile, nupdg)