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

Functions

def cross_section_calculator (powheg_LHE_output)
 Calculate the cross-section (mean event weight) of pre-generated Powheg events. More...
 

Variables

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

Function Documentation

◆ cross_section_calculator()

def python.algorithms.postprocessors.cross_section_calculator.cross_section_calculator (   powheg_LHE_output)

Calculate the cross-section (mean event weight) of pre-generated Powheg events.

Parameters
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 12 of file cross_section_calculator.py.

12 def cross_section_calculator(powheg_LHE_output):
13  """! Calculate the cross-section (mean event weight) of pre-generated Powheg events.
14 
15  @param powheg_LHE_output Name of LHE file produced by PowhegBox.
16 
17  @author James Robinson <james.robinson@cern.ch>
18  """
19  logger.info("Born-level suppression is enabled so the cross-section MUST be recalculated!")
20  # LHEUtils returns a generator, since the input file may be large
21  sum_of_weights, n_events = 0., 0
22  for event_weight in LHE.event_weight_iterator(powheg_LHE_output):
23  sum_of_weights += event_weight
24  n_events += 1
25  # import numpy as np
26  # import itertools as it
27  # sum_of_weights, n_events = reduce(np.add, it.izip(LHEUtils.event_weight_iterator(LHE_file_name), it.repeat(1)))
28 
29  # Print statistics to logger
30  logger.info("... sum of event weights is: {}".format(sum_of_weights))
31  logger.info("... number of events generated: {}".format(int(n_events)))
32  logger.info("... mean event weight: {}".format((sum_of_weights / n_events if n_events != 0 else 0)))
33  logger.info("MetaData: cross-section (nb) = {:.3E}".format((sum_of_weights / (1000 * n_events) if n_events != 0 else 0)))

Variable Documentation

◆ logger

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

Get handle to Athena logging.

Definition at line 8 of file cross_section_calculator.py.

vtune_athena.format
format
Definition: vtune_athena.py:14
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.algorithms.postprocessors.cross_section_calculator.cross_section_calculator
def cross_section_calculator(powheg_LHE_output)
Calculate the cross-section (mean event weight) of pre-generated Powheg events.
Definition: cross_section_calculator.py:12