diff --git a/py/orbit/lattice/AccNode.py b/py/orbit/lattice/AccNode.py index 1a29276f..fdc145dc 100644 --- a/py/orbit/lattice/AccNode.py +++ b/py/orbit/lattice/AccNode.py @@ -168,7 +168,7 @@ def getNumberOfBodyChildren(self): nChildren = nChildren + len(arr[0]) + len(arr[1]) return nChildren - def addChildNode(self, node, place, part_index=0, place_in_part=AccActionsContainer.BEFORE): + def addChildNode(self, node, place, part_index=0, place_in_part=AccActionsContainer.AFTER): """ Method. Adds a child node to the list defined by place and (maybe) part index and place in the part (before or after). @@ -192,7 +192,10 @@ def addChildNode(self, node, place, part_index=0, place_in_part=AccActionsContai msg = msg + os.linesep orbitFinalize(msg) nodes = self.__childNodesArr[place][part_index][place_in_part] - nodes.append(node) + if(place_in_part == AccActionsContainer.AFTER): + nodes.append(node) + else: + nodes.insert(0, node) def getChildNodes(self, place, part_index=0, place_in_part=AccActionsContainer.BEFORE): """ diff --git a/py/orbit/py_linac/lattice/LinacTransportMatrixGenNodes.py b/py/orbit/py_linac/lattice/LinacTransportMatrixGenNodes.py index e66468fe..531a4355 100755 --- a/py/orbit/py_linac/lattice/LinacTransportMatrixGenNodes.py +++ b/py/orbit/py_linac/lattice/LinacTransportMatrixGenNodes.py @@ -228,7 +228,10 @@ def addTrMatrixGenNodes(self, accLattice, node_or_nodes, place=MarkerLinacNode.E # ----------------------------- for node in nodes: trMatrxGenNode = LinacTrMatrixGenNode(self, node.getName() + ":trMatrx") - node.addChildNode(trMatrxGenNode, place) + if(place == MarkerLinacNode.ENTRANCE): + node.addChildNode(trMatrxGenNode, place, place_in_part = AccActionsContainer.BEFORE) + else: + node.addChildNode(trMatrxGenNode, place, place_in_part = AccActionsContainer.AFTER) # ----- set up the position of the TrMatrix nodes actions = AccActionsContainer()