Closed ZLLentz closed 6 years ago
I like the idea of sources
. The end result of having a QComboBox with Periscope
/ Mono
underneath the regular XCS button seems very intuitive.
I'm not sure we need to create a full Node
structure. In retrospect, this would have been the cleaner implementation, but it might be overkill to add it just for this. Can we just have a dictionary that keeps the beamlines that need sources
and implement it that way?
This will be entirely solved by #47
After talking to Teddy about this, I went through the code and thought about this issue a lot more... I think it deserves a write-up. Apologies in advance for the wall of text:
The addition of the periscope line causes us issues compared to the others because the path is no longer a nice tree structure, it becomes a more general directed graph. This is a quick brain dump about this problem and potential solutions.
Issues:
BeamPath
objects must end if they don’t have a branching device.These two issues combined mean that we must split the XCS lines into a ‘Periscope’ line that ends before the LODCM and an ‘XCS’ line that goes all the way through, including the inside of the LODCM (e.g. make it look like a tree). This is ok for skywalker but not for a more general use case in XCS, and we may have this problem again with some of the proposed FEE branching schemes in lcls2.
So we must do the following:
beamlines
dict
inLightController
to allow two paths to exist with the same destination, without compromising usability.BeamPath
s to continue at the start of otherBeamPath
s without a physical branching device.BeamPath
s to continue in the middle of otherBeamPath
s (Not required, just makes definitions cleaner. May be useful in lcls2)Implementation idea:
BeamPath
objects at the end of__init__
, but would direct the way these paths are built:ContinueNode
: place at the end of aBeamPath
that should continue onto the beginning of anotherBeamPath
. This would simply implement the branches property and specify a list of one element: the destination line.JoinNode
: place at the beginning of aBeamPath
that should accept inputs from multipleBeamPath
s. This should implement a new property,sources
, that is adict
mapping of sourceBeamPath
name to a suffix for the combined line.So, with current hardware, we’d have an XCS_Periscope
BeamPath
and an XCS_MONOBeamPath
that each end in aContinueNode
, wherenode.branches == [‘XCS’]
. The XCS line would begin with aJoinNode
right before LODCM Cr2, wherenode.sources == dict(XCS_Periscope=’P’, XCS_MONO=’M’)
. TheLightController
sees the branch to XCS on each line, so it callsxcspath.join
. It then checks for theJoinNode
and renames theBeamPath
accordingly, stashing it into thebeamlines
dict
. Eventually it reaches the XCS line itself, sees theJoinNode
, deletes XCS from beamlines (it's already been duplicated/split if it has aJoinNode
), and goes through the branches block for the newBeamPath
s, XCSP and XCSM, instead (in case there was another branch point). At the end, allContinueNode
andJoinNode
objects are stripped out, and we're left with two validBeamPath
s to the XCS interaction point, XCSP and XCSM. (Example names of course)Let me know what you think, we need to properly handle these double paths at some point. I think the concept of node objects will be useful for things like continuing the HXD line into CXI as well.