11 self.assertEqual(event_generator.required_parameters(), [
'nevents'])
18 self.assertEqual(egs5.bunches, 5e5)
21 egs5 =
EGS5(inputs=
"input/file.root", nevents=100)
22 self.assertEqual(egs5.nevents, 100)
23 self.assertEqual(egs5.inputs,
"input/file.root")
27 self.assertEqual(egs5.required_parameters(), [
'seed',
'target_thickness',
'beam_energy',
'num_electrons'])
31 self.assertEqual(egs5.optional_parameters(), [
'bunches'])
35 egs5_moller =
EGS5(name=
'moller')
36 self.assertEqual(egs5.output_files(), [
'beam.stdhep'])
37 self.assertEqual(egs5_moller.output_files(), [
'moller.stdhep'])
41 params = {
'seed': 1,
'target_thickness': 1.0,
'beam_energy': 1.0,
'num_electrons': 1}
42 egs5.set_parameters(params)
43 self.assertEqual(egs5.seed, 1)
44 self.assertEqual(egs5.target_thickness, 1.0)
45 self.assertEqual(egs5.beam_energy, 1.0)
46 self.assertEqual(egs5.num_electrons, 1)
50 params = {
'seed': 1,
'bunches': 1,
'target_thickness': 0.0004062,
'beam_energy': 1100.00,
'num_electrons': 625}
51 egs5.set_parameters(params)
53 egs5_dir = os.getenv(
"HPSMC_DIR",
None) +
'/share/generators/egs5'
54 self.assertEqual(egs5.egs5_dir, egs5_dir)
55 self.assertEqual(egs5.egs5_data_dir, egs5_dir +
'/data')
56 self.assertEqual(egs5.egs5_config_dir, egs5_dir +
'/config')
58 with open(
"seed.dat",
'r')
as seed_file:
59 seed_vals = [line.split()
for line
in seed_file]
60 self.assertEqual(seed_vals[0][0], str(1))
61 self.assertEqual(seed_vals[0][1], str(egs5.target_thickness))
62 self.assertEqual(seed_vals[0][2], str(egs5.beam_energy))
63 self.assertEqual(seed_vals[0][3], str(egs5.num_electrons * params[
'bunches']))
66 os.remove(os.getcwd() +
'/data')
67 os.remove(os.getcwd() +
'/pgs5job.pegs5inp')
68 os.remove(os.getcwd() +
'/seed.dat')
75 self.assertEqual(mg.param_card,
"param_card.dat")
76 self.assertEqual(mg.event_types, [
'unweighted',
'weighted'])
77 self.assertEqual(mg.name,
'mg')
81 self.assertEqual(mg.output_files(), [
'mg_unweighted_events.lhe.gz',
'mg_events.lhe.gz'])
85 self.assertEqual(mg.required_parameters(), [
'nevents',
'run_params'])
89 self.assertEqual(mg.optional_parameters(), [
'seed',
'param_card',
'apmass',
'map',
'mpid',
'mrhod'])
93 params = {
'nevents': 1,
'run_params':
'1pt1',
'seed': 1,
'param_card':
'param_card.dat',
'apmass': 1,
'map': 1,
'mpid': 1,
'mrhod': 1}
94 mg.set_parameters(params)
95 self.assertEqual(mg.nevents, 1)
96 self.assertEqual(mg.run_params,
'1pt1')
97 self.assertEqual(mg.seed, 1)
98 self.assertEqual(mg.param_card,
'param_card.dat')
99 self.assertEqual(mg.apmass, 1)
100 self.assertEqual(mg.map, 1)
101 self.assertEqual(mg.mpid, 1)
102 self.assertEqual(mg.mrhod, 1)
103 self.assertEqual(mg.run_card,
'run_card_' + params[
'run_params'] +
'.dat')
107 params = {
'nevents': 1,
'run_params':
'1pt1',
'seed': 1,
'param_card':
'param_card.dat',
'apmass': 1,
'map': 1,
'mpid': 1,
'mrhod': 1}
108 mg.set_parameters(params)
110 mg_dir = os.getenv(
"HPSMC_DIR",
None) +
'/share/generators'
111 self.assertEqual(mg.madgraph_dir, mg_dir)
118 self.assertEqual(mg4.name,
'ap')
119 self.assertEqual(mg4.event_types, [
'unweighted',
'weighted'])
123 self.assertEqual(mg4.name,
'BH')
127 self.assertEqual(mg4.name,
'RAD')
131 self.assertEqual(mg4.name,
'TM')
135 self.assertEqual(mg4.name,
'trigg')
139 self.assertEqual(mg4.name,
'tritrig')
143 self.assertEqual(mg4.name,
'wab')
146 self.assertRaises(Exception,
lambda:
MG4(
'some_invalid_name'))
150 self.assertEqual(mg4.get_install_dir(), os.getenv(
"HPSMC_DIR",
None) +
'/share/generators/madgraph4/src')
157 self.assertEqual(mg5.name,
'tritrig')
158 self.assertEqual(mg5.event_types, [
'unweighted',
'weighted'])
162 self.assertEqual(mg5.name,
'BH')
166 self.assertEqual(mg5.name,
'RAD')
170 self.assertEqual(mg5.name,
'simp')
173 self.assertRaises(Exception,
lambda:
MG5(
'some_invalid_name'))
177 self.assertEqual(mg5.get_install_dir(), os.getenv(
"HPSMC_DIR",
None) +
'/share/generators/madgraph5/src')
180 if __name__ ==
'__main__':
Run the EGS5 event generator to produce a StdHep file.
Event generator base class.
Run the MadGraph 4 event generator.
Run the MadGraph 5 event generator.
Abstract class for MadGraph generators.
def test_required_params(self)
def test_set_parameters(self)
def test_init_kwrags(self)
def test_output_files(self)
def test_optional_params(self)
def test_required_params(self)
def test_init_exception(self)
def test_init_tritrig(self)
def test_get_install_dir(self)
def test_init_trigger(self)
def test_init_exception(self)
def test_get_install_dir(self)
def test_required_params(self)
def test_set_parameters(self)
def test_output_files(self)
def test_optional_params(self)