Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
3 from AthenaCommon
import Logging
4 from .configurable
import Configurable
5 from ..utility
import check_svn_revision, FileParser
11 logger = Logging.logging.getLogger(
"PowhegControl")
15 """! Base class for PowhegBox processes.
17 All process types inherit from this class.
19 @author James Robinson <james.robinson@cern.ch>
20 @author Stefan Richter <stefan.richter@cern.ch>
25 Returns a list of strings to be treated as info messages in the log
26 They otherwise throw an error with HOPPET v. 1.2.0
29 return [
"-----------------------------------------------------------",
30 "Welcome to HOPPET v. 1.2.0",
31 "Higher Order Perturbative Parton Evolution Toolkit",
32 "Written by Gavin P. Salam (2001-2012)",
33 "with contributions from Juan Rojo",
34 "Frederic Dreyer and Alexander Karlberg",
35 "It is made available under the GNU public license,",
36 "with the additional request that if you use it or any",
37 "derivative of it in scientific work then you should cite:",
38 "G.P. Salam & J. Rojo, CPC 180(2009)120 (arXiv:0804.3755).",
39 "You are also encouraged to cite the original references,",
40 "for LO, NLO and NNLO splitting functions, the QCD",
41 "1, 2 and 3 loop beta functions and the coupling and",
42 "PDF and coupling mass threshold matching functions."]
46 Returns a list of strings to be treated as warning messages in the log
47 They otherwise throw an error
49 return [
"WARNING in InitMTMNNLO: using parametrisation (less accuracte) for A2PShg"]
53 Returns a list of strings to be treated as error messages in the log
54 They otherwise do not throw an error
56 return [
"[POWHEG-BOX+OpenLoops] Process not found!"]
58 def __init__(self, base_directory, version, executable_name, cores, powheg_executable="pwhg_main", is_reweightable=True, warning_output = [], info_output = [], error_output = [], **kwargs):
61 @param base_directory path to PowhegBox code.
62 @param version PowhegBox version.
63 @param executable_name folder containing appropriate PowhegBox executable.
64 @param powheg_executable name of the powheg executable.
65 @param warning_output list of patterns which if found in the output will be treated as warning in the log.
66 @param error_output list of patterns which if found in the output will be treated as error in the log.
67 @param info_output list of patterns which if found in the output will be treated as info in the log.
72 self.
executable = os.path.join(base_directory, version, executable_name, powheg_executable)
75 os.environ[
"PYTHONPATH"] = os.path.join(base_directory, version, executable_name,
"python") +
":" + os.environ.get(
"PYTHONPATH",
"")
78 os.environ[
"LD_LIBRARY_PATH"] = os.path.join(base_directory, version, executable_name,
"amplitudes",
"obj-gnu") +
":" + os.environ.get(
"LD_LIBRARY_PATH",
"")
79 os.environ[
"LD_LIBRARY_PATH"] = os.path.join(base_directory, version, executable_name,
"QCDLoop-1.95",
"ff",
"obj-gnu") +
":" + os.environ.get(
"LD_LIBRARY_PATH",
"")
80 os.environ[
"LD_LIBRARY_PATH"] = os.path.join(base_directory, version, executable_name,
"Virtuals",
"obj-gnu") +
":" + os.environ.get(
"LD_LIBRARY_PATH",
"")
81 os.environ[
"LD_LIBRARY_PATH"] = os.path.join(base_directory, version, executable_name,
"obj-gfortran") +
":" + os.environ.get(
"LD_LIBRARY_PATH",
"")
82 os.environ[
"LD_LIBRARY_PATH"] = os.path.join(base_directory, version, executable_name,
"obj-gfortran",
"proclib") +
":" + os.environ.get(
"LD_LIBRARY_PATH",
"")
83 os.environ[
"LD_LIBRARY_PATH"] = os.path.join(base_directory, version, executable_name,
"obj-gnu") +
":" + os.environ.get(
"LD_LIBRARY_PATH",
"")
84 os.environ[
"LD_LIBRARY_PATH"] = os.path.join(base_directory, version, executable_name,
"obj-gnu",
"proclib") +
":" + os.environ.get(
"LD_LIBRARY_PATH",
"")
88 directories = [
'obj-gfortran',
'OpenLoops2',
'obj-gnu']
89 logger.info(
"OpenLoopsPath (before) = {0}".
format(os.getenv(
'OpenLoopsPath')))
90 for directory
in directories:
91 if os.path.isdir(os.path.join(base_directory, version, executable_name, directory,
'proclib')):
92 OLPath = os.path.join(base_directory, version, executable_name, directory)
93 os.environ[
'OpenLoopsPath'] = OLPath
94 logger.info(
"OpenLoopsPath (after) = {0}".
format(os.getenv(
'OpenLoopsPath')))
104 logger.info(
'MetaData: POWHEGVER = {0}'.
format(POWHEGVER))
105 os.environ[
"POWHEGVER"] = POWHEGVER
123 self.
add_keyword(
"ebeam1", kwargs.get(
"beam_energy",
None))
124 self.
add_keyword(
"ebeam2", kwargs.get(
"beam_energy",
None))
126 self.
add_keyword(
"numevts", kwargs.get(
"nEvents",
None))
150 """! Add an algorithm or external process to the sequence.
152 @param process Algorithm or external process to add.
155 if isinstance(alg_or_process, str):
159 self.
externals[alg_or_process.name] = alg_or_process
163 """! Wildcarded list of files created by this process that can be deleted."""
164 raise AttributeError(
"Names of unneeded files are not known for this process!")
168 """! Wildcarded list of integration files that might be created by this process."""
169 raise AttributeError(
"Integration file names are not known for this process!")
173 """! Wildcarded list of integration files that are needed for this process."""
174 raise AttributeError(
"Integration file names are not known for this process!")
178 """! Version of PowhegBox process."""
179 raise AttributeError(
"Powheg version is not known!")
183 """! Default PDFs for this process."""
184 raise AttributeError(
"Default PDFs are not known for this process!")
188 """! Default scale variations for this process."""
189 raise AttributeError(
"Default scales are not known for this process!")
192 """! Scale calculation parameters by n_cores."""
194 for keyword
in [
"ncall1",
"ncall1rm",
"ncall2",
"ncall2rm",
"nubound",
"numevts"]:
196 if int(parameter.value) > 0:
197 parameter.value =
int(math.ceil(
float(parameter.value) / n_cores))
199 logger.info(
"Scaling number of events per job from {} down to {}".
format(__nEvents_unscaled, __nEvents_scaled))
204 """! Set whether the specified POWHEG-BOX generation stage is complete."""
209 """! Validate any parameters which need it before preparing runcard."""
211 getattr(self, function_name)()
214 """! Validate integration keywords by forcing to integer values."""
216 for name
in (
"foldcsi",
"foldphi",
"foldy",
"itmx1",
"itmx2",
"ncall1",
"ncall2",
"nEvents"):
219 parameter.value =
int(parameter.value)
221 logger.fatal(
"Failed to validate {} with value {}".
format(name, parameter.value))
225 """! Check whether a decay mode is allowed an raise an exception if it is not."""
226 if allowed_decay_modes
is None:
227 allowed_decay_modes = self.allowed_decay_modes
228 if decay_mode
not in allowed_decay_modes:
229 logger.warning(
"Decay mode {} not recognised!".
format(decay_mode))
230 logger.info(
"Allowed decay modes are:")
231 for allowed_decay_mode
in allowed_decay_modes:
232 logger.info(
"... {}".
format(allowed_decay_mode))
233 raise ValueError(
"Decay mode {} not recognised!".
format(decay_mode))
239 missing_patterns = []
242 except AttributeError:
243 logger.fatal(
"No integration grid file name patterns defined for this process.")
245 for s
in search_strings:
250 missing_patterns.append(s)
251 if missing_patterns == []:
252 logger.info(
"Integration grid files found locally. Event generation shall continue, skipping the integration step.")
253 logger.info(
"Integration grid files found locally: {}".
format(found_files))
255 logger.info(
"Integration grid files needed were not found locally. Event generation shall continue, starting by the integration step.")
256 logger.info(
"Missing integration grid files with these patterns: {}".
format(missing_patterns))
257 logger.info(
"Integration grid files found locally (if any): {}".
format(found_files))
271 if abs(settingsList[2] - stage) <=1e-09:
277 FileParser(
"powheg.input").text_replace(key+
".*", key+
" {}".
format(value))
std::string replace(std::string s, const std::string &s2, const std::string &s3)
def expose(self)
Add all names to the interface of this object.
def validate_parameters(self)
Validate any parameters which need it before preparing runcard.
def check_svn_revision(path)
warning_output
Special treatment for some log messages.
def add_algorithm(self, alg_or_process)
Add an algorithm or external process to the sequence.
Base class for PowhegBox processes.
def parameters_by_name(self, name)
Retrieve all parameters that use a given name.
def default_scales(self)
Default scale variations for this process.
def check_using_integration_files(self)
def add_keyword(self, keyword, value=None, name=None, frozen=None, hidden=None, description=None, **kwargs)
Register configurable parameter that is exposed to the user.
def integration_file_names(self)
Wildcarded list of integration files that might be created by this process.
parameterStageDict
Dictionary used to change parameters of the Powheg input.
use_XML_reweighting
Switch to determine whether XML reweighting should be used.
def prepare_to_parallelise(self, n_cores)
Scale calculation parameters by n_cores.
def openloops_error(self)
def set_parameter_in_config(self, key, value)
def parameters_by_keyword(self, keyword)
Retrieve all parameters that use a given keyword.
def powheg_version(self)
Version of PowhegBox process.
process_revision
Add to Python path "python" directory on POWHEG process directory.
def __init__(self, base_directory, version, executable_name, cores, powheg_executable="pwhg_main", is_reweightable=True, warning_output=[], info_output=[], error_output=[], **kwargs)
Constructor.
def mandatory_integration_file_names(self)
Wildcarded list of integration files that are needed for this process.
validation_functions
List of validation functions to run before preparing runcard.
def check_decay_mode(self, decay_mode, allowed_decay_modes=None)
Check whether a decay mode is allowed an raise an exception if it is not.
powhegbox_revision
Log the PowhegBox version and process-code revision for AMI etc.
def validate_integration_parameters(self)
Validate integration keywords by forcing to integer values.
remove_oldStyle_rwt_comments
Switch to determine if the #rwgt and #pdf comments should be kept in lhe files despite using xml rewe...
algorithms
List of additional algorithms to schedule.
is_reweightable
Switch to determine whether reweighting is allowed.
externals
List of external processes to schedule.
def default_PDFs(self)
Default PDFs for this process.
cores
Number of cores to use.
executable
Powheg executable that will be used.
def modify_parameter(self, stage=0)
def files_for_cleanup(self)
Wildcarded list of files created by this process that can be deleted.
setBGCode setTAP setLVL2ErrorBits bool
def stage_is_completed(self, stage)
Set whether the specified POWHEG-BOX generation stage is complete.
Class for any process which can be configured.