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 file nominal weight updater",
40 "integration grid tester",
41 "cross section calculator",
43 "output file renamer",
44 "output tarball preparer",
45 "integration gridpack creator",
50 preprocessor_fn_dict = {
51 "directory cleaner": preprocessors.directory_cleaner,
52 "reweighter": preprocessors.reweighter
57 "merge output": partial(generators.merge_output, powheg_LHE_output=powheg_LHE_output),
58 "multicore": generators.multicore,
59 "output validator": partial(generators.output_validator, powheg_LHE_output=powheg_LHE_output),
60 "singlecore": generators.singlecore
64 postprocessor_fn_dict = {
65 "cross section calculator": partial(postprocessors.cross_section_calculator, powheg_LHE_output=powheg_LHE_output),
66 "directory cleaner": postprocessors.directory_cleaner,
67 "integration gridpack creator": postprocessors.integration_gridpack_creator,
68 "integration grid tester": postprocessors.integration_grid_tester,
69 "MadSpin": partial(postprocessors.MadSpin, powheg_LHE_output=powheg_LHE_output),
70 "NNLO reweighter": partial(postprocessors.NNLO_reweighter, powheg_LHE_output=powheg_LHE_output),
71 "output file renamer": partial(postprocessors.output_file_renamer, powheg_LHE_output=powheg_LHE_output),
72 "output tarball preparer": postprocessors.output_tarball_preparer,
73 "PHOTOS": partial(postprocessors.PHOTOS, powheg_LHE_output=powheg_LHE_output),
74 "reweighter": partial(postprocessors.reweighter, powheg_LHE_output=powheg_LHE_output),
75 "quark colour fixer": partial(postprocessors.quark_colour_fixer, powheg_LHE_output=powheg_LHE_output),
76 "mu2tau": partial(postprocessors.mu2tau, powheg_LHE_output=powheg_LHE_output),
77 "mu2e": partial(postprocessors.mu2e, powheg_LHE_output=powheg_LHE_output),
78 "e2tau": partial(postprocessors.e2tau, powheg_LHE_output=powheg_LHE_output),
79 "e2mu": partial(postprocessors.e2mu, powheg_LHE_output=powheg_LHE_output),
80 "LHE file cleaner": partial(postprocessors.lhe_cleaner, powheg_LHE_output=powheg_LHE_output),
81 "LHE file nominal weight updater": partial(postprocessors.lhe_nominal_weight_updater, powheg_LHE_output=powheg_LHE_output),
87 self.
sequence = {
"preprocessors": {},
"generators": {},
"postprocessors": {}}
90 self.
add(
"output validator")
91 self.
add(
"integration grid tester")
92 self.
add(
"LHE file cleaner")
94 def add(self, name, *args):
95 """! Add a component to the sequence.
97 @param name name of component to add.
98 @param args arguments to pass to this component when it runs.
102 self.
sequence[
"preprocessors"][name] = args
106 self.
sequence[
"generators"][name] = args
110 self.
sequence[
"postprocessors"][name] = args
113 """! Print the sequence to the logger."""
114 logger.info(
"Scheduling the following PowhegControl sequence:")
115 logger.info(
"|---+ Preprocessing:")
117 logger.info(
" |--- {}".
format(name))
118 logger.info(
"|---+ Event generation:")
120 logger.info(
" |--- {}".
format(name))
121 logger.info(
"|---+ Postprocessing:")
123 logger.info(
" |--- {}".
format(name))
126 """! Run all preprocessors in order."""
131 """! Run all event generators in order."""
136 """! Run all postprocessors in order."""