ATLAS Offline Software
Functions | Variables
python.algorithms.postprocessors.quark_colour_fixer Namespace Reference

Functions

def quark_colour_fixer (process, powheg_LHE_output)
 Post-process existing events to ensure that all quarks are coloured. More...
 

Variables

 logger = Logging.logging.getLogger("PowhegControl")
 Get handle to Athena logging. More...
 

Function Documentation

◆ quark_colour_fixer()

def python.algorithms.postprocessors.quark_colour_fixer.quark_colour_fixer (   process,
  powheg_LHE_output 
)

Post-process existing events to ensure that all quarks are coloured.

Parameters
processPowhegBox process.
powheg_LHE_outputName of LHE file produced by PowhegBox.
Author
James Robinson james.nosp@m..rob.nosp@m.inson.nosp@m.@cer.nosp@m.n.ch

Definition at line 13 of file quark_colour_fixer.py.

13 def quark_colour_fixer(process, powheg_LHE_output):
14  """! Post-process existing events to ensure that all quarks are coloured.
15 
16  @param process PowhegBox process.
17  @param powheg_LHE_output Name of LHE file produced by PowhegBox.
18 
19  @author James Robinson <james.robinson@cern.ch>
20  """
21  # Check whether vdecaymode is one of the hadronic modes
22  if all(p.value in [0, 10] for p in process.parameters_by_keyword("vdecaymode")):
23  logger.info("Checking for presence of colourless quarks!")
24 
25  # Get opening and closing strings
26  preamble = LHE.preamble(powheg_LHE_output)
27  postamble = LHE.postamble(powheg_LHE_output)
28 
29  # Check events for colourless final-state quarks and colour them
30  n_events = 0
31  logger.info("Checking events for colourless final-state quarks")
32  powheg_LHE_recoloured = "{}.recoloured".format(powheg_LHE_output)
33  with open(powheg_LHE_recoloured, "w") as f_output:
34  f_output.write("{}\n".format(preamble))
35  for input_event in LHE.event_iterator(powheg_LHE_output):
36  is_event_changed, output_event = LHE.ensure_coloured_quarks(input_event)
37  f_output.write(output_event)
38  n_events += [0, 1][is_event_changed]
39  f_output.write(postamble)
40  logger.info("Re-coloured final-state quarks in {} events!".format(n_events))
41 
42  # Make a backup of the original events
43  shutil.move(powheg_LHE_output, "{}.quark_colour_fixer_backup".format(powheg_LHE_output))
44  shutil.move(powheg_LHE_recoloured, powheg_LHE_output)

Variable Documentation

◆ logger

python.algorithms.postprocessors.quark_colour_fixer.logger = Logging.logging.getLogger("PowhegControl")

Get handle to Athena logging.

Definition at line 9 of file quark_colour_fixer.py.

vtune_athena.format
format
Definition: vtune_athena.py:14
python.algorithms.postprocessors.quark_colour_fixer.quark_colour_fixer
def quark_colour_fixer(process, powheg_LHE_output)
Post-process existing events to ensure that all quarks are coloured.
Definition: quark_colour_fixer.py:13
Trk::open
@ open
Definition: BinningType.h:40
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:64