], #cwd=pjoin(self.path), stdout=stdout, stderr=stdout) self.check_parton_output(cross=4.541638, error=0.035) self.check_parton_output('run_02', cross=4.41887317, error=0.035) self.check_pythia_output() self.assertEqual(cwd, os.getcwd()) # # Additional test: Check that the banner of the run_02 include correctly # the ptheavy 50 information banner = banner_mod.Banner( pjoin(self.run_dir, 'Events', 'run_01', 'run_01_fermi_banner.txt')) run_card = banner.charge_card('run_card') self.assertEqual(run_card['ptheavy'], 0) banner = banner_mod.Banner( pjoin(self.run_dir, 'Events', 'run_02', 'run_02_fermi_banner.txt')) run_card = banner.charge_card('run_card') self.assertEqual(run_card['ptheavy'], 50) events = lhe_parser.EventFile( pjoin(self.run_dir, 'Events', 'run_02', 'unweighted_events.lhe.gz')) banner = banner_mod.Banner(events.banner) run_card = banner.charge_card('run_card') self.assertEqual(run_card['ptheavy'], 50) for event in events: event.check()
def test_generation_from_file_1(self): """ """ cwd = os.getcwd() try: shutil.rmtree('/tmp/MGPROCESS/') except Exception as error: pass import subprocess if logging.getLogger('madgraph').level <= 20: stdout = None stderr = None else: devnull = open(os.devnull, 'w') stdout = devnull stderr = devnull if not os.path.exists(pjoin(MG5DIR, 'pythia-pgs')): p = subprocess.Popen([pjoin(MG5DIR, 'bin', 'mg5')], stdin=subprocess.PIPE, stdout=stdout, stderr=stderr) out = p.communicate('install pythia-pgs'.encode()) misc.compile(cwd=pjoin(MG5DIR, 'pythia-pgs')) if logging.getLogger('madgraph').level > 20: stdout = devnull else: stdout = None fsock = open(pjoin(self.path, 'test_mssm_generation'), 'w') fsock.write( open(pjoin(_file_path, 'input_files', 'test_mssm_generation')).read() % { 'dir_name': self.run_dir, 'mg5_path': pjoin(_file_path, os.path.pardir) }) fsock.close() subprocess.call( [ pjoin(_file_path, os.path.pardir, 'bin', 'mg5'), pjoin(self.path, 'test_mssm_generation') ], #cwd=pjoin(self.path), stdout=stdout, stderr=stdout) self.check_parton_output(cross=4.541638, error=0.035) self.check_parton_output('run_02', cross=4.41887317, error=0.035) self.check_pythia_output() self.assertEqual(cwd, os.getcwd()) # # Additional test: Check that the banner of the run_02 include correctly # the ptheavy 50 information banner = banner_mod.Banner( pjoin(self.run_dir, 'Events', 'run_01', 'run_01_fermi_banner.txt')) run_card = banner.charge_card('run_card') self.assertEqual(run_card['ptheavy'], 0) banner = banner_mod.Banner( pjoin(self.run_dir, 'Events', 'run_02', 'run_02_fermi_banner.txt')) run_card = banner.charge_card('run_card') self.assertEqual(run_card['ptheavy'], 50) events = lhe_parser.EventFile( pjoin(self.run_dir, 'Events', 'run_02', 'unweighted_events.lhe.gz')) banner = banner_mod.Banner(events.banner) run_card = banner.charge_card('run_card') self.assertEqual(run_card['ptheavy'], 50) for event in events: event.check()