Commit fb4ed1ca authored by Zach Marshall's avatar Zach Marshall
Browse files

MadGraphControl SUSY: Allowing multiple input LHE files

Some of the manipulations in the SUSY post-exec assume that we have a
tarball as input, which happens when a single input file is used. When
multiple input files come in, we have an LHE file as input, and in that
case we need to handle things a bit differently (mostly avoid all of the
tarball manipulations and instead treat the thing as a text file
directly).
parent e8c07022
......@@ -67,21 +67,30 @@ else:
modify_param_card(process_dir=process_dir,params={'MASS':masses,'DECAY':decays})
param_card_old = process_dir+'/Cards/param_card.dat'
ktdurham = -1
import tarfile
myTarball = tarfile.open(runArgs.inputGeneratorFile)
myEvents = None
for afile in myTarball.getnames():
if afile.endswith('.events'): myEvents = afile
if myEvents is None:
raise RuntimeError('No input events file found!')
if '.tar' in runArgs.inputGeneratorFile or '.tgz' in runArgs.inputGeneratorFile:
import tarfile
myTarball = tarfile.open(runArgs.inputGeneratorFile)
myEvents = None
for afile in myTarball.getnames():
if afile.endswith('.events'): myEvents = afile
if myEvents is None:
raise RuntimeError('No input events file found!')
else:
events_file = myTarball.extractfile( myEvents )
update_lhe_file(lhe_file_old=myEvents,param_card_old=param_card_old,masses=masses)
for aline in events_file:
if 'ktdurham' in aline and "=" in aline:
ktdurham = float(aline.split('=')[0].strip())
break
myTarball.close()
else:
events_file = myTarball.extractfile( myEvents )
update_lhe_file(lhe_file_old=myEvents,param_card_old=param_card_old,masses=masses)
for aline in events_file:
if 'ktdurham' in aline and "=" in aline:
ktdurham = float(aline.split('=')[0].strip())
break
myTarball.close()
# Assume this is already an unzipped file -- happens when we run on multiple LHEs
update_lhe_file(lhe_file_old=runArgs.inputGeneratorFile,param_card_old=param_card_old,masses=masses)
with open(runArgs.inputGeneratorFile,'r') as events_file:
for aline in events_file:
if 'ktdurham' in aline and "=" in aline:
ktdurham = float(aline.split('=')[0].strip())
break
if madspin_card is not None:
# Do a stupid addition of madspin - requires a dummy process
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment