From ece0bc689e230a5288ec190affd4a3db5ef0690c Mon Sep 17 00:00:00 2001
From: Zach Marshall <ZLMarshall@lbl.gov>
Date: Tue, 27 Apr 2021 14:02:55 +0200
Subject: [PATCH] Making sure MGC cleans up copies of events

We were missing the removal of a temporary copy of the LHE file, which
can be quite large under certain circumstances.
---
 Generators/MadGraphControl/python/MadGraphUtils.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Generators/MadGraphControl/python/MadGraphUtils.py b/Generators/MadGraphControl/python/MadGraphUtils.py
index 8cf7938f5569..e0b10e3b3ba6 100755
--- a/Generators/MadGraphControl/python/MadGraphUtils.py
+++ b/Generators/MadGraphControl/python/MadGraphUtils.py
@@ -1500,6 +1500,8 @@ def arrange_output(process_dir=MADGRAPH_GRIDPACK_LOCATION,lhe_version=None,saveP
             shutil.copyfileobj(mod_output2, final_file)
             final_file.close()
             shutil.copy(os.getcwd()+'/events.lhe.copy',os.getcwd()+'/events.lhe')
+            # Clean up after ourselves
+            os.remove(os.getcwd()+'/events.lhe.copy')
         mod_output2.close()
 
     # Actually move over the dataset
-- 
GitLab