ATLAS Offline Software
Loading...
Searching...
No Matches
preprocessors/directory_cleaner.py
Go to the documentation of this file.
1# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon import Logging
4from ...decorators import timed
5import glob
6import os
7
8
9logger = Logging.logging.getLogger("PowhegControl")
10
11
12@timed("directory cleaner")
13def directory_cleaner(*args):
14 """! Clean up the directory before running.
15
16 Remove any existing LHE files to avoid repeated events.
17
18 @author James Robinson <james.robinson@cern.ch>
19 """
20 for LHE_file in glob.glob("*.lhe") + glob.glob("*.ev*ts"):
21 logger.warning("Removing existing LHE file: {}".format(LHE_file))
22 os.remove(LHE_file)