Пример #1
0
#----------------------------------------------
# Initialize a Teapot-Style PTC lattice
#----------------------------------------------
PTC_File = "SIS_18_BENCHMARK.flt"
Lattice = PTC_Lattice("MACHINE")
Lattice.readPTC(PTC_File)
readScriptPTC('Input/time.ptc')

paramsDict = {}
paramsDict["length"]=Lattice.getLength()/Lattice.nHarm

#----------------------------------------------
# Add apertures
#----------------------------------------------
position = 0
for node in Lattice.getNodes():
	myaperturenode = TeapotApertureNode(1, 10, 10, position)
	node.addChildNode(myaperturenode, node.ENTRANCE)
	node.addChildNode(myaperturenode, node.BODY)
	node.addChildNode(myaperturenode, node.EXIT)
	position += node.getLength()

#----------------------------------------------
# Add the main bunch and lost particles bunch
#----------------------------------------------
bunch = Bunch()
setBunchParamsPTC(bunch)

from simulation_parameters import parameters as p
p['harmonic_number'] = Lattice.nHarm 
p['phi_s']           = 0
print '  betax0: \t\t', Lattice.betax0, 'm'
print '  alphay0: \t\t', Lattice.alphay0
print '  betay0: \t\t', Lattice.betay0, 'm'
print '  Dx0: \t\t\t', Lattice.etax0, 'm'
print '  Dpx0: \t\t', Lattice.etapx0, 'm'
print '  harm. number: \t', Lattice.nHarm
print '  nodes: \t\t', Lattice.nNodes

#----------------------------------------------
# Add apertures
#----------------------------------------------
position = 0
pos_start = 0
pos_stop = Lattice.getLength()
n = 0
for node in Lattice.getNodes():
    (node_pos_start, node_pos_stop) = Lattice.getNodePositionsDict()[node]
    print "node number=", n, "node=", node.getName(), " type=", node.getType(
    ), "  pos=", node_pos_start, " L=", node.getLength(
    ), " end=", node_pos_start + node.getLength()
    myaperturenode = TeapotApertureNode(1, 10, 18, position)
    node.addChildNode(myaperturenode, node.EXIT)
    position += node.getLength()
    n += 1

#----------------------------------------------
# Add the main bunch and lost particles bunch
#----------------------------------------------
print '\nAdding main bunch ...'
Intensity = 170e+10
m0 = mass_proton  # protons ...