ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.processes.configurable.Configurable Class Reference

Class for any process which can be configured. More...

Inheritance diagram for python.processes.configurable.Configurable:
Collaboration diagram for python.processes.configurable.Configurable:

Public Member Functions

def __init__ (self)
 Constructor. More...
 
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. More...
 
def expose (self)
 Add all names to the interface of this object. More...
 
def has_keyword (self, keyword)
 
def has_parameter (self, parameter)
 
def parameters_by_keyword (self, keyword)
 Retrieve all parameters that use a given keyword. More...
 
def parameters_by_name (self, name)
 Retrieve all parameters that use a given name. More...
 

Public Attributes

 parameters
 List of available parameters. More...
 

Detailed Description

Class for any process which can be configured.

Author
James Robinson james.nosp@m..rob.nosp@m.inson.nosp@m.@cer.nosp@m.n.ch

Definition at line 10 of file configurable.py.

Constructor & Destructor Documentation

◆ __init__()

def python.processes.configurable.Configurable.__init__ (   self)

Constructor.

Definition at line 16 of file configurable.py.

16  def __init__(self):
17  """! Constructor."""
18 
19  self.parameters = []
20 

Member Function Documentation

◆ add_keyword()

def python.processes.configurable.Configurable.add_keyword (   self,
  keyword,
  value = None,
  name = None,
  frozen = None,
  hidden = None,
  description = None,
**  kwargs 
)

Register configurable parameter that is exposed to the user.

Parameters
keywordPowheg keyword that gets written to the runcard.
valueValue of the parameter.
nameConfigurable parameter name exposed to the user.
hiddenTrue if this parameter should be hidden from the user.
frozenTrue if this parameter cannot be changed.
descriptionDescription for the run card.
parameterName used in the run card if different.

Definition at line 21 of file configurable.py.

21  def add_keyword(self, keyword, value=None, name=None, frozen=None, hidden=None, description=None, **kwargs):
22  """! Register configurable parameter that is exposed to the user.
23 
24  @param keyword Powheg keyword that gets written to the runcard.
25  @param value Value of the parameter.
26  @param name Configurable parameter name exposed to the user.
27  @param hidden True if this parameter should be hidden from the user.
28  @param frozen True if this parameter cannot be changed.
29  @param description Description for the run card.
30  @param parameter Name used in the run card if different.
31  """
32  # Retrieve default settings from registry overriding if requested
33  defaults = Registry().get_defaults(keyword)
34  if value == defaults["value"] and value is not None and (hidden is not True):
35  if keyword not in ["ebeam1", "ebeam2"]:
36  logger.debug("Unnecessarily setting parameter {} to {} which is its default value!".format(keyword, value))
37  value = [value, defaults["value"]][value is None]
38  name = [name, defaults["name"]][name is None]
39  description = [description, defaults["description"]][description is None]
40  hidden = [hidden, defaults["hidden"]][hidden is None]
41  frozen = [frozen, defaults["frozen"]][frozen is None]
42  if keyword in [p.keyword for p in self.parameters]:
43  raise AttributeError("Keyword '{}' has already been defined for this process".format(keyword))
44  self.parameters.append(Parameter(keyword, name=name, value=value, frozen=frozen, hidden=hidden, description=description, **kwargs))
45 

◆ expose()

def python.processes.configurable.Configurable.expose (   self)

Add all names to the interface of this object.

Definition at line 46 of file configurable.py.

46  def expose(self):
47  """! Add all names to the interface of this object."""
48  for parameter in self.parameters:
49  setattr(self, parameter.name, parameter.value)
50 

◆ has_keyword()

def python.processes.configurable.Configurable.has_keyword (   self,
  keyword 
)

Definition at line 51 of file configurable.py.

51  def has_keyword(self, keyword):
52  return (len(list(self.parameters_by_keyword(keyword))) > 0)
53 

◆ has_parameter()

def python.processes.configurable.Configurable.has_parameter (   self,
  parameter 
)

Definition at line 54 of file configurable.py.

54  def has_parameter(self, parameter):
55  return (len(list(self.parameters_by_name(parameter))) > 0)
56 

◆ parameters_by_keyword()

def python.processes.configurable.Configurable.parameters_by_keyword (   self,
  keyword 
)

Retrieve all parameters that use a given keyword.

Parameters
keywordPowheg keyword that gets written to the runcard.

Definition at line 57 of file configurable.py.

57  def parameters_by_keyword(self, keyword):
58  """! Retrieve all parameters that use a given keyword.
59 
60  @param keyword Powheg keyword that gets written to the runcard.
61  """
62  return [p for p in self.parameters if p.keyword == keyword]
63 

◆ parameters_by_name()

def python.processes.configurable.Configurable.parameters_by_name (   self,
  name 
)

Retrieve all parameters that use a given name.

Parameters
nameConfigurable parameter name exposed to the user.

Definition at line 64 of file configurable.py.

64  def parameters_by_name(self, name):
65  """! Retrieve all parameters that use a given name.
66 
67  @param name Configurable parameter name exposed to the user.
68  """
69  return [p for p in self.parameters if p.name == name]

Member Data Documentation

◆ parameters

python.processes.configurable.Configurable.parameters

List of available parameters.

Definition at line 19 of file configurable.py.


The documentation for this class was generated from the following file:
python.processes.configurable.Configurable.expose
def expose(self)
Add all names to the interface of this object.
Definition: configurable.py:46
vtune_athena.format
format
Definition: vtune_athena.py:14
python.processes.configurable.Configurable.parameters_by_name
def parameters_by_name(self, name)
Retrieve all parameters that use a given name.
Definition: configurable.py:64
python.processes.configurable.Configurable.add_keyword
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.
Definition: configurable.py:21
python.processes.configurable.Configurable.has_parameter
def has_parameter(self, parameter)
Definition: configurable.py:54
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
python.processes.configurable.Configurable.parameters_by_keyword
def parameters_by_keyword(self, keyword)
Retrieve all parameters that use a given keyword.
Definition: configurable.py:57
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.processes.configurable.Configurable.has_keyword
def has_keyword(self, keyword)
Definition: configurable.py:51