3 from AthenaCommon
import Logging
4 from functools
import partial
5 from .
import generators
6 from .
import postprocessors
7 from .
import preprocessors
11 logger = Logging.logging.getLogger(
"PowhegControl")
15 """! Schedule algorithms in appropriate order.
17 @author James Robinson <james.robinson@cern.ch>
21 powheg_LHE_output =
"pwgevents.lhe"
24 ordered_preprocessors = [
"directory cleaner",
"reweighter"]
27 ordered_event_generators = [
"singlecore",
"multicore",
"merge output",
"output validation"]
30 ordered_postprocessors = [
33 "reweighter",
"NNLO reweighter",
34 "LHE ubexcess_correct weight updater",
35 "LHE file nominal weight updater",
42 "integration grid tester",
43 "cross section calculator",
45 "output file renamer",
46 "output tarball preparer",
47 "integration gridpack creator",
52 preprocessor_fn_dict = {
53 "directory cleaner": preprocessors.directory_cleaner,
54 "reweighter": preprocessors.reweighter
59 "merge output": partial(generators.merge_output, powheg_LHE_output=powheg_LHE_output),
60 "multicore": generators.multicore,
61 "output validator": partial(generators.output_validator, powheg_LHE_output=powheg_LHE_output),
62 "singlecore": generators.singlecore
66 postprocessor_fn_dict = {
67 "cross section calculator": partial(postprocessors.cross_section_calculator, powheg_LHE_output=powheg_LHE_output),
68 "directory cleaner": postprocessors.directory_cleaner,
69 "integration gridpack creator": postprocessors.integration_gridpack_creator,
70 "integration grid tester": postprocessors.integration_grid_tester,
71 "MadSpin": partial(postprocessors.MadSpin, powheg_LHE_output=powheg_LHE_output),
72 "NNLO reweighter": partial(postprocessors.NNLO_reweighter, powheg_LHE_output=powheg_LHE_output),
73 "output file renamer": partial(postprocessors.output_file_renamer, powheg_LHE_output=powheg_LHE_output),
74 "output tarball preparer": postprocessors.output_tarball_preparer,
75 "PHOTOS": partial(postprocessors.PHOTOS, powheg_LHE_output=powheg_LHE_output),
76 "reweighter": partial(postprocessors.reweighter, powheg_LHE_output=powheg_LHE_output),
77 "quark colour fixer": partial(postprocessors.quark_colour_fixer, powheg_LHE_output=powheg_LHE_output),
78 "mu2tau": partial(postprocessors.mu2tau, powheg_LHE_output=powheg_LHE_output),
79 "mu2e": partial(postprocessors.mu2e, powheg_LHE_output=powheg_LHE_output),
80 "e2tau": partial(postprocessors.e2tau, powheg_LHE_output=powheg_LHE_output),
81 "e2mu": partial(postprocessors.e2mu, powheg_LHE_output=powheg_LHE_output),
82 "gg4l_emu2all": partial(postprocessors.gg4l_emu2all, powheg_LHE_output=powheg_LHE_output),
83 "LHE file cleaner": partial(postprocessors.lhe_cleaner, powheg_LHE_output=powheg_LHE_output),
84 "LHE file nominal weight updater": partial(postprocessors.lhe_nominal_weight_updater, powheg_LHE_output=powheg_LHE_output),
85 "LHE ubexcess_correct weight updater": partial(postprocessors.lhe_ubexcess_correct_reweighter, powheg_LHE_output=powheg_LHE_output),
91 self.
sequence = {
"preprocessors": {},
"generators": {},
"postprocessors": {}}
94 self.
add(
"output validator")
95 self.
add(
"integration grid tester")
96 self.
add(
"LHE file cleaner")
98 def add(self, name, *args):
99 """! Add a component to the sequence.
101 @param name name of component to add.
102 @param args arguments to pass to this component when it runs.
106 self.
sequence[
"preprocessors"][name] = args
110 self.
sequence[
"generators"][name] = args
114 self.
sequence[
"postprocessors"][name] = args
117 """! Print the sequence to the logger."""
118 logger.info(
"Scheduling the following PowhegControl sequence:")
119 logger.info(
"|---+ Preprocessing:")
121 logger.info(
" |--- {}".
format(name))
122 logger.info(
"|---+ Event generation:")
124 logger.info(
" |--- {}".
format(name))
125 logger.info(
"|---+ Postprocessing:")
127 logger.info(
" |--- {}".
format(name))
130 """! Run all preprocessors in order."""
135 """! Run all event generators in order."""
140 """! Run all postprocessors in order."""