def initialize(self): """ Method. Initializes the matrix lattice, child node structures, and calculates the one turn matrix. """ AccLattice.initialize(self) self.makeOneTurnMatrix()
def initialize(self): AccLattice.initialize(self) #set up ring length for RF nodes ringRF_Node = RingRFTEAPOT() for node in self.getNodes(): if(node.getType() == ringRF_Node.getType()): node.getParamsDict()["ring_length"] = self.getLength()
def initialize(self): AccLattice.initialize(self) #set up ring length for RF nodes ringRF_Node = RingRFTEAPOT() for node in self.getNodes(): if (node.getType() == ringRF_Node.getType()): node.getParamsDict()["ring_length"] = self.getLength()
def initialize(self): """ Method. Initializes the matrix lattice, child node structures, and calculates the one turn matrix. """ AccLattice.initialize(self) self.makeOneTurnMatrix()
def initialize(self): """ Method. Initializes the linac lattice, child node structures, and calculates the one turn matrix. """ AccLattice.initialize(self) #-----add Sequences that are referenced from the AccNodes self.__sequences = [] for node in self.getNodes(): seq = node.getSequence() if (not seq in self.__sequences): self.__sequences.append(seq) #------define sequences' position and length (position of the beginning of the sequence) seqs = self.getSequences() for seq in seqs: nodes = seq.getNodes() if (len(nodes) == 0): continue node_start = seq.getNodes()[0] node_last = seq.getNodes()[len(nodes) - 1] (pos_start, pos_tmp) = self.getNodePositionsDict()[node_start] (pos_tmp, pos_stop) = self.getNodePositionsDict()[node_last] seq.setPosition(pos_start) seq.setLength(pos_stop - pos_start) #---- define position parameter for nodes - position are realtive to start of the sequence for node in nodes: (pos_node_start, pos_node_end) = self.getNodePositionsDict()[node] node.setParam("pos", (pos_node_start + pos_node_end) / 2.0 - pos_start) #------add RF cavities that are in referenced from the AccNodes (RF gaps) self.__rfCavities = [] for node in self.getNodes(): if (isinstance(node, AbstractRF_Gap)): rf_cavity = node.getRF_Cavity() if (rf_cavity == None): msg = "LinacAccLattice.initialize() - Problem with RF gap!" msg = msg + os.linesep msg = msg + "RF gap=" + node.getName( ) + " does not have the parent RF cavity!" msg = msg + os.linesep msg = msg + "Stop." msg = msg + os.linesep orbitFinalize(msg) if (not rf_cavity in self.__rfCavities): self.__rfCavities.append(rf_cavity)
def initialize(self): AccLattice.initialize(self) #set up ring length for RF nodes ringRF_Node = RingRFTEAPOT() bunchwrap_Node = BunchWrapTEAPOT() for node in self.getNodes(): if (node.getType() == ringRF_Node.getType()): node.getParamsDict()["ring_length"] = self.getLength() paramsDict = {} actions = AccActionsContainer() def accSetWrapLengthAction(paramsDict): """ Nonbound function. Sets lattice length for wrapper nodes """ node = paramsDict["node"] bunchwrap_node = BunchWrapTEAPOT() if (node.getType() == bunchwrap_Node.getType()): node.getParamsDict()["ring_length"] = self.getLength() actions.addAction(accSetWrapLengthAction, AccNode.EXIT) self.trackActions(actions, paramsDict) actions.removeAction(accSetWrapLengthAction, AccNode.EXIT)
def initialize(self): AccLattice.initialize(self) #set up ring length for RF nodes ringRF_Node = RingRFTEAPOT() bunchwrap_Node = BunchWrapTEAPOT() for node in self.getNodes(): if(node.getType() == ringRF_Node.getType()): node.getParamsDict()["ring_length"] = self.getLength() paramsDict = {} actions = AccActionsContainer() def accSetWrapLengthAction(paramsDict): """ Nonbound function. Sets lattice length for wrapper nodes """ node = paramsDict["node"] bunchwrap_node = BunchWrapTEAPOT() if(node.getType() == bunchwrap_Node.getType()): node.getParamsDict()["ring_length"] = self.getLength() actions.addAction(accSetWrapLengthAction, AccNode.EXIT) self.trackActions(actions, paramsDict) actions.removeAction(accSetWrapLengthAction, AccNode.EXIT)
def initialize(self): """ Method. Initializes the linac lattice, child node structures, and calculates the one turn matrix. """ AccLattice.initialize(self)
#syncPart.pz(p) syncPart.kinEnergy(energy) lattice = AccLattice("test_lattice") elem0 = teapot.DriftTEAPOT("drift0") lattice.addNode(elem0) #----------------------------- # Set TEAPOT nodes parameters #----------------------------- elem0.setLength(4.0) lattice.initialize() #/////////////////////////////////////////////////////////// ZtoPhi = 2.0 * math.pi / lattice.getLength() dESync = 0.0 RFHNum = 1.0 RFVoltage = 0.1 RFPhase = 0.0 length = 0.0 name = "harmonic_rfnode" rf_node = RFNode.Harmonic_RFNode(ZtoPhi, dESync, RFHNum, RFVoltage, RFPhase, length, name) position = 1.0 RFLatticeModifications.addRFNode(lattice, position, rf_node) print "Lattice length = ", lattice.getLength() print "ZtoPhi = ", ZtoPhi
nLevel[0]), "EXIT level=", nLevel[0], " node=", node.getName() nLevel[0] -= 1 def funcTrack(paramsDict): node = paramsDict["node"] if (paramsDict.has_key("print") and paramsDict["print"] == True): print Blanks(nLevel[0]), "BODY TRACK through node =", node.getName( ), " level=", nLevel[0] acts.addAction(funcEntrance, AccActionsContainer.ENTRANCE) acts.addAction(funcTrack, AccActionsContainer.BODY) acts.addAction(funcExit, AccActionsContainer.EXIT) lattice.initialize() print "Total length=", lattice.getLength() nodes = lattice.getNodes() for node in nodes: print "node=", node.getName( ), " s start,stop = %4.3f %4.3f " % lattice.getNodePositionsDict()[node] d = {"print": True} lattice.trackActions(acts, d) print "Total number of nodes=", nElems[0] #========Speed test========================== count = 1
def addChildren(self): AccLattice.initialize(self) for node in self.getNodes(): bunchwrapper = BunchWrapTEAPOT("Bunch Wrap") bunchwrapper.getParamsDict()["ring_length"] = self.getLength() node.addChildNode(bunchwrapper, AccNode.BODY)
def addChildren(self): AccLattice.initialize(self) for node in self.getNodes(): bunchwrapper = BunchWrapTEAPOT("Bunch Wrap") bunchwrapper.getParamsDict()["ring_length"] = self.getLength() node.addChildNode(bunchwrapper, AccNode.BODY)
def initialize(self): """ Method. Initializes the linac lattice, child node structures, and calculates the one turn matrix. """ AccLattice.initialize(self)