ATLAS Offline Software
photos.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2 
3 import os
4 import shutil
5 from AthenaCommon import Logging
6 from ...decorators import timed
7 from ...utility import ProcessManager, SingleProcessThread
8 
9 
10 logger = Logging.logging.getLogger("PowhegControl")
11 
12 
13 @timed("PHOTOS post-processing")
14 def PHOTOS(process, powheg_LHE_output):
15  """! Run PHOTOS over pre-generated Powheg events.
16 
17  @param process External PHOTOS process.
18 
19  @author James Robinson <james.robinson@cern.ch>
20  """
21  logger.info("Running PHOTOS afterburner")
22  if not os.path.isfile(process.executable):
23  raise OSError("PHOTOS executable {} not found!".format(process.executable))
24  processes = [SingleProcessThread(process.executable)]
25  manager = ProcessManager(processes)
26  while manager.monitor():
27  pass
28 
29  # Get file names
30  input_LHE_events = powheg_LHE_output
31  photos_output = "pwgevents_photos.lhe"
32 
33  # Rename output file
34  if os.path.isfile(input_LHE_events):
35  shutil.move(input_LHE_events, "{}.undecayed_ready_for_photos".format(input_LHE_events))
36  shutil.move(photos_output, input_LHE_events)
37  logger.info("Moved {} to {}".format(photos_output, input_LHE_events))
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.postprocessors.photos.PHOTOS
def PHOTOS(process, powheg_LHE_output)
Run PHOTOS over pre-generated Powheg events.
Definition: photos.py:14