SND@LHC Software
Loading...
Searching...
No Matches
makeGenieEvents Namespace Reference

Functions

 get_arguments ()
 
 makeSplines ()
 
 makeEvents (nevents=100)
 
 makeNtuples ()
 
 addHists ()
 

Variables

str xsec = "gxspl-FNAL-nuSHiP-minimal.xml"
 
str hfile = "pythia8_Geant4_1.0_withCharm_nu.root"
 
str defaultsplinedir = '/eos/experiment/ship/user/aiuliano/GENIE_FNAL_nu_splines'
 
str defaultfiledir = '/eos/experiment/ship/data/Mbias/background-prod-2018'
 
 args = get_arguments()
 
str targetcode = '1000260560'
 
str splines = args.splinedir+'/'+xsec
 
str neutrinos = args.filedir+'/'+hfile
 
 pdg = ROOT.TDatabasePDG()
 
dict pDict = {}
 
dict sDict = {}
 
dict nuOverNubar = {}
 
 f = ROOT.TFile(neutrinos)
 

Function Documentation

◆ addHists()

makeGenieEvents.addHists ( )

Definition at line 104 of file makeGenieEvents.py.

104def addHists():
105 for p in pDict:
106 os.chdir('./'+sDict[p])
107 genie_interface.add_hists(neutrinos, "genie-"+sDict[p]+".root", p)
108 os.chdir('../')
109
add_hists(inputflux, simfile, nupdg)

◆ get_arguments()

makeGenieEvents.get_arguments ( )

Definition at line 35 of file makeGenieEvents.py.

35def get_arguments(): #available options
36
37 parser = argparse.ArgumentParser(
38 description='Run GENIE neutrino" simulation')
39 subparsers = parser.add_subparsers()
40 ap = subparsers.add_parser('sim',help="make genie simulation file")
41
42 ap.add_argument('-s', '--seed', type=int, dest='seed', default=65539) #default seed in $GENIE/src/Conventions/Controls.h
43 ap.add_argument('-o','--output' , type=str, help="output directory", dest='work_dir', default=None)
44 ap.add_argument('-f','--filedir', type=str, help="directory with neutrino fluxes", dest='filedir', default=defaultfiledir)
45 ap.add_argument('-c','--crosssectiondir', type=str, help="directory with neutrino splines crosssection", dest='splinedir', default=defaultsplinedir)
46 ap.add_argument('-t', '--target', type=str, help="target material", dest='target', default='iron')
47 ap.add_argument('-n', '--nevents', type=int, help="number of events", dest='nevents', default=100)
48 ap.add_argument('-e', '--event-generator-list', type=str, help="event generator list", dest='evtype', default=None) # Possbile evtypes: CC, CCDIS, CCQE, CharmCCDIS, RES, CCRES, see other evtypes in $GENIE/config/EventGeneratorListAssembler.xml
49 ap.add_argument("--nudet", dest="nudet", help="option for neutrino detector", required=False, action="store_true")
50
51 ap1 = subparsers.add_parser('spline',help="make a new cross section spline file")
52 ap1.add_argument('-t', '--target', type=str, help="target material", dest='target', default='iron')
53 ap1.add_argument('-o','--output' , type=str, help="output directory", dest='work_dir', default=None)
54 args = parser.parse_args()
55 return args
56

◆ makeEvents()

makeGenieEvents.makeEvents (   nevents = 100)

Definition at line 83 of file makeGenieEvents.py.

83def makeEvents(nevents = 100):
84 run = 11
85 for p in pDict:
86 if p<0: print("scale number of "+sDict[p]+" events with %5.2F"%(1./nuOverNubar[abs(p)]))
87 if not sDict[p] in os.listdir('.'): call('mkdir '+sDict[p],shell = True)
88 os.chdir('./'+sDict[p])
89 # stop at 350 GeV, otherwise strange warning about "Lower energy neutrinos have a higher probability of
90 # interacting than those at higher energy. pmaxLow(E=386.715)=2.157e-13 and pmaxHigh(E=388.044)=2.15623e-13"
91 N = nevents
92 if p<0: N = int(nevents / nuOverNubar[abs(p)])
93 genie_interface.generate_genie_events(nevents = N, nupdg = p, targetcode = targetcode, emin = 0.5, emax = 350,\
94 inputflux = neutrinos, spline = splines, seed = args.seed, process = args.evtype, irun = run)
95 run +=1
96 os.chdir('../')
generate_genie_events(nevents, nupdg, emin, emax, targetcode, inputflux, spline, process=None, seed=None, irun=None)

◆ makeNtuples()

makeGenieEvents.makeNtuples ( )

Definition at line 97 of file makeGenieEvents.py.

97def makeNtuples():
98 for p in pDict:
99 os.chdir('./'+sDict[p])
100 genie_interface.make_ntuples("gntp.0.ghep.root","genie-"+sDict[p]+".root")
101 genie_interface.add_hists(neutrinos, "genie-"+sDict[p]+".root", p)
102 os.chdir('../')
103
make_ntuples(inputfile, outputfile)

◆ makeSplines()

makeGenieEvents.makeSplines ( )
first step, make cross section splines if not exist

Definition at line 78 of file makeGenieEvents.py.

78def makeSplines():
79 '''first step, make cross section splines if not exist'''
80 nupdglist = [16,-16,14,-14,12,-12]
81 genie_interface.make_splines(nupdglist, targetcode, 400, nknots = 500, outputfile = "xsec_splines.xml")
82
make_splines(nupdglist, targetcode, emax, nknots, outputfile)

Variable Documentation

◆ args

makeGenieEvents.args = get_arguments()

Definition at line 57 of file makeGenieEvents.py.

◆ defaultfiledir

str makeGenieEvents.defaultfiledir = '/eos/experiment/ship/data/Mbias/background-prod-2018'

Definition at line 28 of file makeGenieEvents.py.

◆ defaultsplinedir

str makeGenieEvents.defaultsplinedir = '/eos/experiment/ship/user/aiuliano/GENIE_FNAL_nu_splines'

Definition at line 27 of file makeGenieEvents.py.

◆ f

makeGenieEvents.f = ROOT.TFile(neutrinos)

Definition at line 130 of file makeGenieEvents.py.

◆ hfile

str makeGenieEvents.hfile = "pythia8_Geant4_1.0_withCharm_nu.root"

Definition at line 22 of file makeGenieEvents.py.

◆ neutrinos

str makeGenieEvents.neutrinos = args.filedir+'/'+hfile

Definition at line 121 of file makeGenieEvents.py.

◆ nuOverNubar

dict makeGenieEvents.nuOverNubar = {}

Definition at line 129 of file makeGenieEvents.py.

◆ pdg

makeGenieEvents.pdg = ROOT.TDatabasePDG()

Definition at line 126 of file makeGenieEvents.py.

◆ pDict

dict makeGenieEvents.pDict = {}

Definition at line 127 of file makeGenieEvents.py.

◆ sDict

dict makeGenieEvents.sDict = {}

Definition at line 128 of file makeGenieEvents.py.

◆ splines

str makeGenieEvents.splines = args.splinedir+'/'+xsec

Definition at line 120 of file makeGenieEvents.py.

◆ targetcode

str makeGenieEvents.targetcode = '1000260560'

Definition at line 62 of file makeGenieEvents.py.

◆ xsec

str makeGenieEvents.xsec = "gxspl-FNAL-nuSHiP-minimal.xml"

Definition at line 21 of file makeGenieEvents.py.