ATLAS Offline Software
merge_output.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaCommon import Logging
4 from ...decorators import timed
5 from ...utility import FileParser, LHE
6 import glob
7 import subprocess
8 
9 
10 logger = Logging.logging.getLogger("PowhegControl")
11 
12 
13 @timed("merge output")
14 def merge_output(cores, n_events_unscaled, powheg_LHE_output):
15  """! Merge output events if running in multicore mode.
16 
17  @param cores Number of cores in use.
18  @param n_events_unscaled Total number of events generated.
19  @param powheg_LHE_output Name of LHE file produced by PowhegBox.
20 
21  @author James Robinson <james.robinson@cern.ch>
22  """
23  logger.info("Concatenating output LHE files: expecting {}, found {}".format(cores, len(glob.glob("pwgevents*.lhe"))))
24  LHE.merge("pwgevents*.lhe", powheg_LHE_output)
25  subprocess.call("rm pwgevents-*.lhe 2> /dev/null", shell=True)
26  # Unscale nEvents in case this is needed later on
27  FileParser("powheg*.input").text_replace("numevts .*", "numevts {}".format(n_events_unscaled))
python.decorators.timed.timed
def timed(name)
Decorator to output function execution time.
Definition: timed.py:12
vtune_athena.format
format
Definition: vtune_athena.py:14
python.algorithms.generators.merge_output.merge_output
def merge_output(cores, n_events_unscaled, powheg_LHE_output)
Merge output events if running in multicore mode.
Definition: merge_output.py:14