From 49d6c00affd2f52382852a431c73195a08ed8be4 Mon Sep 17 00:00:00 2001 From: Shishlo Date: Wed, 13 May 2026 16:30:35 -0400 Subject: [PATCH 1/2] There are two changes in the Linac nodes and lattice: 1. Each LinacAccNode will have the copy of its own Data Adapter. It will allow to keep additional information for the future parsing if the user will need it. It could be PV names. In the SNS case it is the BPM length and orientation that we need for Online Model. The user could completely ignore the presence of this data. 2. The each AccNode will know its parent sequence. Before, only the level 1 nodes has this reference. Now we set it up even for children for consistency. --- py/orbit/py_linac/linac_parsers/sns_linac_lattice_factory.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/py/orbit/py_linac/linac_parsers/sns_linac_lattice_factory.py b/py/orbit/py_linac/linac_parsers/sns_linac_lattice_factory.py index d311750c..8d5ff039 100644 --- a/py/orbit/py_linac/linac_parsers/sns_linac_lattice_factory.py +++ b/py/orbit/py_linac/linac_parsers/sns_linac_lattice_factory.py @@ -301,6 +301,9 @@ def positionComp(node_da): accNode = MarkerLinacNode(node_da.stringValue("name")) accNode.setParam("pos", node_pos) thinNodes.append(accNode) + #-------------------------------------- + #---- sets up copy of XML data adaptor of this node + accNode.setDataAdaptor(node_da.getDeepCopy()) # ----- assign the thin nodes that are inside the thick nodes unusedThinNodes = [] for thinNode in thinNodes: From 77a61702943181a166836fe8088c180e97c5bfb8 Mon Sep 17 00:00:00 2001 From: Shishlo Date: Wed, 13 May 2026 16:31:24 -0400 Subject: [PATCH 2/2] There are two changes in the Linac nodes and lattice: 1. Each LinacAccNode will have the copy of its own Data Adapter. It will allow to keep additional information for the future parsing if the user will need it. It could be PV names. In the SNS case it is the BPM length and orientation that we need for Online Model. The user could completely ignore the presence of this data. 2. The each AccNode will know its parent sequence. Before, only the level 1 nodes has this reference. Now we set it up even for children for consistency. --- py/orbit/py_linac/lattice/LinacAccNodes.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/py/orbit/py_linac/lattice/LinacAccNodes.py b/py/orbit/py_linac/lattice/LinacAccNodes.py index 7a0c193f..5bc5ec16 100755 --- a/py/orbit/py_linac/lattice/LinacAccNodes.py +++ b/py/orbit/py_linac/lattice/LinacAccNodes.py @@ -41,9 +41,25 @@ def __init__(self, name="none"): self.setType("baseLinacNode") self.setParam("pos", 0.0) self.__linacSeqence = None + #------------------------------------------------- + # XML data adaptor of this node. + #------------------------------------------------- + self.data_adaptor = None # by default we use the TEAPOT tracker module self.tracking_module = TPB - + + def setDataAdaptor(self,data_adaptor): + """ + Sets the XML data adaptor of this node. + """ + self.data_adaptor = data_adaptor + + def getDataAdaptor(self): + """ + Returns the XML data adaptor of this node. + """ + return self.data_adaptor + def setLinacTracker(self, switch=True): """ This method will switch tracker module to the linac specific traker by default @@ -64,6 +80,9 @@ def setSequence(self, seq): Sets the seqence. """ self.__linacSeqence = seq + #---- set up Sequence for all children + for child_node in self.getAllChildren(): + child_node.setSequence(seq) def setPosition(self, pos): """