|
def | __init__ (self, name="AlgSequence") |
|
def | name (self) |
|
def | insert (self, index, algOrSeq) |
|
def | addSelfToJob (self, job) |
|
def | __getitem__ (self, index) |
|
def | __getattr__ (self, name) |
|
def | __delattr__ (self, name) |
|
def | __iter__ (self) |
|
def | __iadd__ (self, algOrSeq, index=None) |
|
def | __eq__ (self, other) |
|
def | __ne__ (self, other) |
|
def | __str__ (self) |
|
def | __len__ (self) |
|
Standalone algorithm sequence
This is a light-weight emulation of Athena's AthSequencer class,
implementing a simple algorithm sequence for EventLoop jobs.
Definition at line 19 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
◆ __init__()
def python.AlgSequence.AlgSequence.__init__ |
( |
|
self, |
|
|
|
name = "AlgSequence" |
|
) |
| |
Algorithm sequence constructor
Keyword arguments:
name -- The name of the algorithm sequence (for debugging)
Definition at line 26 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
26 def __init__( self, name = "AlgSequence" ):
27 """Algorithm sequence constructor
30 name -- The name of the algorithm sequence (for debugging)
35 self._algsAndSequences = []
◆ __delattr__()
def python.AlgSequence.AlgSequence.__delattr__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
Remove one algorithm/sequence from this sequence, by name
This is to allow removing algorithms (or even sequences) from this
sequence in case that would be needed.
Keyword arguments:
name -- The name of the algorithm/sequence to delete from the
sequence
Definition at line 107 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
107 def __delattr__( self, name ):
108 """Remove one algorithm/sequence from this sequence, by name
110 This is to allow removing algorithms (or even sequences) from this
111 sequence in case that would be needed.
114 name -- The name of the algorithm/sequence to delete from the
119 for algOrSeq
in self._algsAndSequences:
120 if algOrSeq.name() == name:
122 self._algsAndSequences.
remove( algOrSeq )
128 raise AttributeError(
'Algorithm/sequence with name "%s" was not ' \
◆ __eq__()
def python.AlgSequence.AlgSequence.__eq__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Check for equality with another object
The implementation of this is very simple. We only check that
the name of the sequences would match.
Keyword arguments:
other -- The object to compare this one against
Definition at line 177 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
177 def __eq__( self, other ):
178 """Check for equality with another object
180 The implementation of this is very simple. We only check that
181 the name of the sequences would match.
184 other -- The object to compare this one against
188 if not isinstance( other, AlgSequence ):
193 return ( self.name() == other.name() )
◆ __getattr__()
def python.AlgSequence.AlgSequence.__getattr__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
Access one algorithm/sequence in this sequence, by name
This is to allow modifying the properties of algorithms in a
sequence that was set up centrally.
Keyword arguments:
name -- The name of the algorithm/sequence to look up in the
sequence
Definition at line 86 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
86 def __getattr__( self, name ):
87 """Access one algorithm/sequence in this sequence, by name
89 This is to allow modifying the properties of algorithms in a
90 sequence that was set up centrally.
93 name -- The name of the algorithm/sequence to look up in the
98 for algOrSeq
in self._algsAndSequences:
99 if algOrSeq.name() == name:
104 raise AttributeError(
'Algorithm/sequence with name "%s" was not ' \
◆ __getitem__()
def python.AlgSequence.AlgSequence.__getitem__ |
( |
|
self, |
|
|
|
index |
|
) |
| |
Return one algorithm/sequence from the sequence by index
This is to allow getting the n'th element of an algorithm sequence
(which itself may either be an algorithm or a sequence),
including the n'th element from the back of it if needed.
Keyword arguments:
index -- The index of the algorithm/sequence to get from the
sequence
Definition at line 72 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
73 """Return one algorithm/sequence from the sequence by index
75 This is to allow getting the n'th element of an algorithm sequence
76 (which itself may either be an algorithm or a sequence),
77 including the n'th element from the back of it if needed.
80 index -- The index of the algorithm/sequence to get from the
84 return self._algsAndSequences[ index ]
◆ __iadd__()
def python.AlgSequence.AlgSequence.__iadd__ |
( |
|
self, |
|
|
|
algOrSeq, |
|
|
|
index = None |
|
) |
| |
Add one algorithm/sequence to the sequence
This function is used to add one algorithm (or algorithm sequence)
to the sequence object, using the '+=' operator.
Keyword arguments:
algOrSeq -- The algorithm/sequence to add to the sequence
Definition at line 142 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
142 def __iadd__( self, algOrSeq, index = None ):
143 """Add one algorithm/sequence to the sequence
145 This function is used to add one algorithm (or algorithm sequence)
146 to the sequence object, using the '+=' operator.
149 algOrSeq -- The algorithm/sequence to add to the sequence
153 if not isinstance( algOrSeq, AnaAlgorithmConfig )
and \
154 not isinstance( algOrSeq, PythonConfig )
and \
155 not isinstance( algOrSeq, AlgSequence ):
156 raise TypeError(
'The received object is not of type ' \
157 'AnaAlgorithmConfig or PythonConfig or AlgSequence' )
163 raise RuntimeError(
'Algorithm/sequence %s is already in ' \
164 'this sequence' % algOrSeq.name() )
169 self._algsAndSequences.
append( algOrSeq )
171 self._algsAndSequences.insert( index, algOrSeq )
◆ __iter__()
def python.AlgSequence.AlgSequence.__iter__ |
( |
|
self | ) |
|
Create an iterator over all the algorithms of this sequence
This is to allow for a Python-like iteration over all algorithms
that are part of the sequence. This includes iterating over the
algorithms that may be in sub-sequences of this sequence.
Definition at line 131 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
132 """Create an iterator over all the algorithms of this sequence
134 This is to allow for a Python-like iteration over all algorithms
135 that are part of the sequence. This includes iterating over the
136 algorithms that may be in sub-sequences of this sequence.
140 return AlgSequenceIterator( self._algsAndSequences )
◆ __len__()
def python.AlgSequence.AlgSequence.__len__ |
( |
|
self | ) |
|
Return the size/length of the algorithm sequence
Just returning the number of algorithms and sequences that are in
this sequence. So this is not a recursive count.
Definition at line 223 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
224 """Return the size/length of the algorithm sequence
226 Just returning the number of algorithms and sequences that are in
227 this sequence. So this is not a recursive count.
230 return len( self._algsAndSequences )
◆ __ne__()
def python.AlgSequence.AlgSequence.__ne__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Check for an inequality with another object
This is just defined to make the '!=' operator of Python behave
consistently with the '==' operator for such objects.
Keyword arguments:
other -- The object to compare this one against
Definition at line 195 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
195 def __ne__( self, other ):
196 """Check for an inequality with another object
198 This is just defined to make the '!=' operator of Python behave
199 consistently with the '==' operator for such objects.
202 other -- The object to compare this one against
204 return not self.__eq__( other )
◆ __str__()
def python.AlgSequence.AlgSequence.__str__ |
( |
|
self | ) |
|
Print the algorithm sequence in a user-friendly way
This function takes care of printing the full configuration of every
algorithm in the sequence.
Definition at line 206 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
207 """Print the algorithm sequence in a user-friendly way
209 This function takes care of printing the full configuration of every
210 algorithm in the sequence.
213 result = AnaAlgorithmConfig._printHeader(
'AlgSequence/%s' %
216 for algOrSeq
in self._algsAndSequences:
217 result +=
'| %s\n' %
indentBy(
str( algOrSeq ),
'| ' )
219 result += AnaAlgorithmConfig._printFooter(
'AlgSequence/%s' %
◆ addSelfToJob()
def python.AlgSequence.AlgSequence.addSelfToJob |
( |
|
self, |
|
|
|
job |
|
) |
| |
add a copy of this config to the EventLoop job object
Keyword arguments:
job -- The job object to add ourself to
Definition at line 61 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
61 def addSelfToJob( self, job ):
62 """add a copy of this config to the EventLoop job object
65 job -- The job object to add ourself to
68 alg.addSelfToJob (job)
◆ insert()
def python.AlgSequence.AlgSequence.insert |
( |
|
self, |
|
|
|
index, |
|
|
|
algOrSeq |
|
) |
| |
Insert one algorithm/sequence into this sequence
This allows us to extend existing sequences with a greater
flexibility.
Keyword arguments:
index -- The index to insert the algorithm/sequence under
algOrSeq -- The object to insert
Definition at line 48 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
48 def insert( self, index, algOrSeq ):
49 """Insert one algorithm/sequence into this sequence
51 This allows us to extend existing sequences with a greater
55 index -- The index to insert the algorithm/sequence under
56 algOrSeq -- The object to insert
59 return self.__iadd__( algOrSeq, index = index )
◆ name()
def python.AlgSequence.AlgSequence.name |
( |
|
self | ) |
|
Return the name of this sequence
Mainly for debugging purposes, and for when we are embedding
one sequence into another one.
Definition at line 39 of file PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py.
40 """Return the name of this sequence
42 Mainly for debugging purposes, and for when we are embedding
43 one sequence into another one.
◆ _algsAndSequences
python.AlgSequence.AlgSequence._algsAndSequences |
|
private |
◆ _name
python.AlgSequence.AlgSequence._name |
|
private |
The documentation for this class was generated from the following file: