Option to not run Pythia
I added an Option to not run pythia, if the pythia8card is not specified. That's intended for the parton-level only mode.
@@ -138,21 +138,13 @@ def run_mg_pythia(mg_directory,
initial_command=None,
log_file=None):
- # Copy cards
- if run_card_file is not None:
- shutil.copyfile(run_card_file, mg_process_directory + '/Cards/run_card.dat')
- if param_card_file is not None:
- shutil.copyfile(param_card_file, mg_process_directory + '/Cards/param_card.dat')
- if reweight_card_file is not None:
- shutil.copyfile(reweight_card_file, mg_process_directory + '/Cards/reweight_card.dat')
- if pythia8_card_file is not None:
- shutil.copyfile(pythia8_card_file, mg_process_directory + '/Cards/pythia8_card.dat')
-
# Remove unneeded cards
if os.path.isfile(mg_process_directory + '/Cards/delphes_card.dat'):
os.remove(mg_process_directory + '/Cards/delphes_card.dat')
if os.path.isfile(mg_process_directory + '/Cards/pythia_card.dat'):
os.remove(mg_process_directory + '/Cards/pythia_card.dat')
+ if os.path.isfile(mg_process_directory + '/Cards/pythia_card.dat'):
+ os.remove(mg_process_directory + '/Cards/pythia8_card.dat')
if os.path.isfile(mg_process_directory + '/Cards/madanalysis5_hadron_card.dat'):
os.remove(mg_process_directory + '/Cards/madanalysis5_hadron_card.dat')
if os.path.isfile(mg_process_directory + '/Cards/madanalysis5_parton_card.dat'):
@@ -177,9 +169,20 @@ def run_mg_pythia(mg_directory,
os.mkdir(mg_process_directory + '/HTML')
os.mkdir(mg_process_directory + '/Events')
+ # Copy cards
+ if run_card_file is not None:
+ shutil.copyfile(run_card_file, mg_process_directory + '/Cards/run_card.dat')
+ if param_card_file is not None:
+ shutil.copyfile(param_card_file, mg_process_directory + '/Cards/param_card.dat')
+ if reweight_card_file is not None:
+ shutil.copyfile(reweight_card_file, mg_process_directory + '/Cards/reweight_card.dat')
+ if pythia8_card_file is not None:
+ shutil.copyfile(pythia8_card_file, mg_process_directory + '/Cards/pythia8_card.dat')
+
# MG commands
temp_proc_card_file = temp_directory + '/run.mg5'
+ if pythia8_card_file != None:
mg_commands = '''
launch {}
shower=Pythia8
@@ -189,6 +192,16 @@ def run_mg_pythia(mg_directory,
reweight=ON
done
'''.format(mg_process_directory)
+ else:
+ mg_commands = '''
+ launch {}
+ shower=OFF
+ detector=OFF
+ analysis=OFF
+ madspin=OFF
+ reweight=ON
+ done
+ '''.format(mg_process_directory)
with open(temp_proc_card_file, 'w') as file:
file.write(mg_commands)
