def initialize(self):
		"""
		Method. Initializes the matrix lattice, child node structures, and calculates
		the one turn matrix.
		"""
		AccLattice.initialize(self)
		self.makeOneTurnMatrix()
Beispiel #2
0
    def initialize(self):
        """
		Method. Initializes the matrix lattice, child node structures, and calculates
		the one turn matrix.
		"""
        AccLattice.initialize(self)
        self.makeOneTurnMatrix()
Beispiel #3
0
 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()
Beispiel #4
0
	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()
Beispiel #5
0
    def reverseOrder(self):
        """
		This method is used for a lattice reversal and a bunch backtracking.
		This method will reverse the order of the children nodes. It will 
		apply the reverse recursively to the all children nodes.
		"""
        AccLattice.reverseOrder(self)
        self.getSequences().reverse()
        seqs = self.getSequences()
        for seq in seqs:
            seq.reverseOrder()
        #---- reverse order of RF gaps in the RF Cavities and change the first RF gap assignment
        for rf_cavity in self.getRF_Cavities():
            rf_cavity.reverseOrder()
        #---- now initialization of the lattice
        self.initialize()
        #------ the positions of the nodes inside sequences will be defined by their positions
        #------ inside their order in the AccLattice. It is necessary for the reverse order
        #------ operation.
        node_pos_dict = self.getNodePositionsDict()
        for seq in seqs:
            pos_seq_start = seq.getPosition()
            nodes = seq.getNodes()
            for node in nodes:
                (pos_start, pos_stop) = node_pos_dict[node]
                node.setPosition((pos_start + pos_stop) / 2.0 - pos_seq_start)
            nodes = sorted(nodes, key=lambda x: x.getPosition(), reverse=False)
            seq.setNodes(nodes)
        """
Beispiel #6
0
    def __init__(self, name=None):
        AccLattice.__init__(self, name)
        self.oneTurnMatrix = Matrix(7, 7)
        self.oneTurnMatrix.unit()

        self.Matrix = Matrix(7, 7)
        self.Matrix.unit()
Beispiel #7
0
    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)
Beispiel #8
0
	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)
Beispiel #9
0
    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)
b = Bunch()
b.addParticle(1.0e-3,0.0,0.0,0.0,0.0,0.0)
b.addParticle(0.0,1.0e-3,0.0,0.0,0.0,0.0)
b.addParticle(0.0,0.0,1.0e-3,0.0,0.0,0.0)
b.addParticle(0.0,0.0,0.0,1.0e-3,0.0,0.0)
b.addParticle(0.0,0.0,0.0,0.0,1.0,0.0)
b.addParticle(0.0,0.0,0.0,0.0,0.0,1.0e-3)
b.compress()

syncPart = b.getSyncParticle()
energy = 1.0                          #energy in GeV
#p = syncPart.energyToMomentum(energy)
#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()
Beispiel #11
0
 def __init__(self, name=None):
     AccLattice.__init__(self, name)
     self.__rfCavities = []
     self.__sequences = []
Beispiel #12
0
import sys
import math
import posix

from orbit.lattice import AccLattice, AccNode, AccActionsContainer

lattice = AccLattice("test_lattice")

elem1 = AccNode("el-1")
elem2 = AccNode("el-2")
elem3 = AccNode("el-3")

elem1.setLength(1.1)
elem2.setLength(2.1)
elem3.setLength(3.1)

lattice.addNode(elem1)
lattice.addNode(elem2)
lattice.addNode(elem3)

elem1_1 = AccNode("el-1-1")
elem1_1.setnParts(2)
elem1_1_1 = AccNode("el-1-1-1")
elem1_1_2 = AccNode("el-1-1-2")
elem1_1_3 = AccNode("el-1-1-3")
elem1_1_4 = AccNode("el-1-1-4")

elem1.addChildNode(elem1_1,AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_1,AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_2,AccNode.BODY,0)
elem1_1.addChildNode(elem1_1_3,AccNode.BODY,1)
import sys
import math
import posix

from orbit.lattice import AccLattice, AccNode, AccActionsContainer

lattice = AccLattice("test_lattice")

elem1 = AccNode("el-1")
elem2 = AccNode("el-2")
elem3 = AccNode("el-3")

elem1.setLength(1.1)
elem2.setLength(2.1)
elem3.setLength(3.1)

lattice.addNode(elem1)
lattice.addNode(elem2)
lattice.addNode(elem3)

elem1_1 = AccNode("el-1-1")
elem1_1.setnParts(2)
elem1_1_1 = AccNode("el-1-1-1")
elem1_1_2 = AccNode("el-1-1-2")
elem1_1_3 = AccNode("el-1-1-3")
elem1_1_4 = AccNode("el-1-1-4")

elem1.addChildNode(elem1_1, AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_1, AccNode.ENTRANCE)
elem1_1.addChildNode(elem1_1_2, AccNode.BODY, 0)
elem1_1.addChildNode(elem1_1_3, AccNode.BODY, 1)
Beispiel #14
0
b.addParticle(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 0.3, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 0.6, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 0.9, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 1.2, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 1.5, 0.0)
b.addParticle(0.0, 0.0, 0.0, 0.0, 1.8, 0.0)
b.compress()

syncPart = b.getSyncParticle()
energy = 1.0  #energy in GeV
#p = syncPart.energyToMomentum(energy)
#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()
	def __init__(self, name = None):
		AccLattice.__init__(self,name)
		self.oneTurmMatrix = Matrix(7,7)
		self.oneTurmMatrix.unit()	
	def __init__(self, name = None):
		AccLattice.__init__(self,name)
		self.__rfCavities = []
		self.__sequences = []
Beispiel #17
0
 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)
Beispiel #18
0
	def __init__(self, name = "no name"):
		AccLattice.__init__(self,name)
		self.useCharge = 1
Beispiel #19
0
	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)
Beispiel #20
0
 def __init__(self, name="no name"):
     AccLattice.__init__(self, name)
     self.useCharge = 1
Beispiel #21
0
b = Bunch()
b.addParticle(1.0e-3,0.0,0.0,0.0,0.0,0.0)
b.addParticle(0.0,1.0e-3,0.0,0.0,0.0,0.0)
b.addParticle(0.0,0.0,1.0e-3,0.0,0.0,0.0)
b.addParticle(0.0,0.0,0.0,1.0e-3,0.0,0.0)
b.addParticle(0.0,0.0,0.0,0.0,1.0,0.0)
b.addParticle(0.0,0.0,0.0,0.0,0.0,1.0e-3)
b.compress()

syncPart = b.getSyncParticle()
energy = 1.0                          #energy in GeV
#p = syncPart.energyToMomentum(energy)
#syncPart.pz(p)
syncPart.kinEnergy(energy)

lattice = AccLattice("test_lattice")

elem1 = teapot.DriftTEAPOT("drift1")
elem2 = teapot.QuadTEAPOT("quad1")
elem3 = teapot.QuadTEAPOT("quad2")
elem4 = teapot.BendTEAPOT("bend1")
elem5 = teapot.BendTEAPOT("bend2")
elem6 = teapot.MultipoleTEAPOT("sextupole")

lattice.addNode(elem1)
lattice.addNode(elem2)
lattice.addNode(elem3)
lattice.addNode(elem4)
lattice.addNode(elem5)
lattice.addNode(elem6)
	def initialize(self):
		"""
		Method. Initializes the linac lattice, child node structures, and calculates 
		the one turn matrix.
		"""
		AccLattice.initialize(self)	
Beispiel #23
0
    def initialize(self):
        """
		Method. Initializes the linac lattice, child node structures, and calculates 
		the one turn matrix.
		"""
        AccLattice.initialize(self)