ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
python.parameters.parameter.Parameter Class Reference

Class to store information about a single Powheg parameter. More...

Inheritance diagram for python.parameters.parameter.Parameter:
Collaboration diagram for python.parameters.parameter.Parameter:

Public Member Functions

def __init__ (self, keyword=None, name=None, value=None, description=None, frozen=False, hidden=False, needs_processing=False)
 Initialise a parameter object. More...
 
def __str__ (self)
 String representation. More...
 
def ensure_default (self)
 Ensure that default value exists. More...
 
def freeze (self)
 Freeze this parameter so that it cannot be changed. More...
 
def keyword (self)
 Retrieve the Powheg keyword. More...
 
def name (self)
 Retrieve the user-visible name. More...
 
def needs_processing (self)
 Indicator that this parameter needs further processing. More...
 
def value (self)
 Retrieve the current value of this parameter. More...
 
def default_value (self)
 Retrieve the default value of this parameter (if it exists). More...
 
def description (self)
 Retrieve the human-readable description string. More...
 
def is_frozen (self)
 Boolean indicating whether this parameter can be changed. More...
 
def is_hidden (self)
 Boolean indicating whether this parameter is visible to the user. More...
 
def is_visible (self)
 Boolean indicating whether this parameter should be hidden from the user. More...
 
def value (self, value)
 Set the value of this parameter (if it is not frozen). More...
 

Private Member Functions

def __single_element (self, to_check)
 Return the first element if input is a list, or the input otherwise. More...
 

Private Attributes

 __keyword
 
 __name
 
 __description
 
 __value
 
 __default_value
 
 __frozen
 
 __hidden
 
 __needs_processing
 

Detailed Description

Class to store information about a single Powheg parameter.

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

Definition at line 6 of file parameter.py.

Constructor & Destructor Documentation

◆ __init__()

def python.parameters.parameter.Parameter.__init__ (   self,
  keyword = None,
  name = None,
  value = None,
  description = None,
  frozen = False,
  hidden = False,
  needs_processing = False 
)

Initialise a parameter object.

Parameters
keywordPowheg keyword.
nameUser-visible name.
valueCurrent value.
descriptionHuman-readable description string.
frozenTrue if this parameter cannot be changed.
hiddenTrue if this parameter should be hidden from the user.
needs_processingTrue if this parameter needs further processing.

Definition at line 12 of file parameter.py.

12  def __init__(self, keyword=None, name=None, value=None, description=None, frozen=False, hidden=False, needs_processing=False):
13  """! Initialise a parameter object.
14 
15  @param keyword Powheg keyword.
16  @param name User-visible name.
17  @param value Current value.
18  @param description Human-readable description string.
19  @param frozen True if this parameter cannot be changed.
20  @param hidden True if this parameter should be hidden from the user.
21  @param needs_processing True if this parameter needs further processing.
22  """
23  self.__keyword = keyword
24  self.__name = name
25  self.__description = description
26  self.__value = value
27  self.__default_value = None
28  self.__frozen = frozen
29  self.__hidden = hidden
30  self.__needs_processing = needs_processing
31 

Member Function Documentation

◆ __single_element()

def python.parameters.parameter.Parameter.__single_element (   self,
  to_check 
)
private

Return the first element if input is a list, or the input otherwise.

Parameters
to_checkAn iterable or non-iterable parameter

Definition at line 43 of file parameter.py.

43  def __single_element(self, to_check):
44  """! Return the first element if input is a list, or the input otherwise.
45 
46  @param to_check An iterable or non-iterable parameter
47  """
48  if isinstance(to_check, collections.abc.Iterable) and not isinstance(to_check, str) and len(to_check) > 0:
49  return to_check[0]
50  return to_check
51 

◆ __str__()

def python.parameters.parameter.Parameter.__str__ (   self)

String representation.

Definition at line 32 of file parameter.py.

32  def __str__(self):
33  """! String representation."""
34  current_value = [self.value, "'{}'".format(self.value)][any(x in self.name for x in ("lhrwgt", "rwl_file"))] # some parameters need to be in quotes
35  pwg_cmd = "{} {}".format(self.keyword, self.__single_element(current_value)) # construct command for PowhegBox
36  return "{:<40}! [ATLAS default: {}] {}".format(pwg_cmd, self.default_value, self.description)
37 

◆ default_value()

def python.parameters.parameter.Parameter.default_value (   self)

Retrieve the default value of this parameter (if it exists).

Definition at line 77 of file parameter.py.

77  def default_value(self):
78  """! Retrieve the default value of this parameter (if it exists)."""
79  if self.__default_value is None:
80  return self.value
81  return self.__default_value
82 

◆ description()

def python.parameters.parameter.Parameter.description (   self)

Retrieve the human-readable description string.

Definition at line 84 of file parameter.py.

84  def description(self):
85  """! Retrieve the human-readable description string."""
86  return self.__description
87 

◆ ensure_default()

def python.parameters.parameter.Parameter.ensure_default (   self)

Ensure that default value exists.

Definition at line 38 of file parameter.py.

38  def ensure_default(self):
39  """! Ensure that default value exists."""
40  if self.__default_value is None:
41  self.__default_value = self.value
42 

◆ freeze()

def python.parameters.parameter.Parameter.freeze (   self)

Freeze this parameter so that it cannot be changed.

Definition at line 52 of file parameter.py.

52  def freeze(self):
53  """! Freeze this parameter so that it cannot be changed."""
54  self.__frozen = True
55 

◆ is_frozen()

def python.parameters.parameter.Parameter.is_frozen (   self)

Boolean indicating whether this parameter can be changed.

Definition at line 89 of file parameter.py.

89  def is_frozen(self):
90  """! Boolean indicating whether this parameter can be changed."""
91  return self.__frozen
92 

◆ is_hidden()

def python.parameters.parameter.Parameter.is_hidden (   self)

Boolean indicating whether this parameter is visible to the user.

Definition at line 94 of file parameter.py.

94  def is_hidden(self):
95  """! Boolean indicating whether this parameter is visible to the user."""
96  return self.__hidden
97 

◆ is_visible()

def python.parameters.parameter.Parameter.is_visible (   self)

Boolean indicating whether this parameter should be hidden from the user.

Definition at line 99 of file parameter.py.

99  def is_visible(self):
100  """! Boolean indicating whether this parameter should be hidden from the user."""
101  return not (self.__frozen or self.__hidden)
102 

◆ keyword()

def python.parameters.parameter.Parameter.keyword (   self)

Retrieve the Powheg keyword.

Definition at line 57 of file parameter.py.

57  def keyword(self):
58  """! Retrieve the Powheg keyword."""
59  return self.__keyword
60 

◆ name()

def python.parameters.parameter.Parameter.name (   self)

Retrieve the user-visible name.

Definition at line 62 of file parameter.py.

62  def name(self):
63  """! Retrieve the user-visible name."""
64  return self.__name
65 

◆ needs_processing()

def python.parameters.parameter.Parameter.needs_processing (   self)

Indicator that this parameter needs further processing.

Definition at line 67 of file parameter.py.

67  def needs_processing(self):
68  """! Indicator that this parameter needs further processing."""
69  return self.__needs_processing
70 

◆ value() [1/2]

def python.parameters.parameter.Parameter.value (   self)

Retrieve the current value of this parameter.

Definition at line 72 of file parameter.py.

72  def value(self):
73  """! Retrieve the current value of this parameter."""
74  return self.__value
75 

◆ value() [2/2]

def python.parameters.parameter.Parameter.value (   self,
  value 
)

Set the value of this parameter (if it is not frozen).

Definition at line 104 of file parameter.py.

104  def value(self, value):
105  """! Set the value of this parameter (if it is not frozen)."""
106  if self.__frozen:
107  raise AttributeError("Parameter {} cannot be changed in jobOptions.".format(self.name))
108  else:
109  self.__value = value

Member Data Documentation

◆ __default_value

python.parameters.parameter.Parameter.__default_value
private

Definition at line 27 of file parameter.py.

◆ __description

python.parameters.parameter.Parameter.__description
private

Definition at line 25 of file parameter.py.

◆ __frozen

python.parameters.parameter.Parameter.__frozen
private

Definition at line 28 of file parameter.py.

◆ __hidden

python.parameters.parameter.Parameter.__hidden
private

Definition at line 29 of file parameter.py.

◆ __keyword

python.parameters.parameter.Parameter.__keyword
private

Definition at line 23 of file parameter.py.

◆ __name

python.parameters.parameter.Parameter.__name
private

Definition at line 24 of file parameter.py.

◆ __needs_processing

python.parameters.parameter.Parameter.__needs_processing
private

Definition at line 30 of file parameter.py.

◆ __value

python.parameters.parameter.Parameter.__value
private

Definition at line 26 of file parameter.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
athena.value
value
Definition: athena.py:124
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
LArParamsProperties::keyword
std::string keyword(const std::string &classname)
Definition: LArParamsProperties.cxx:160
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88