Beispiel #1
0
random.seed(100)

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac_sts.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=", linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
    totalLength += seq.getLength()
    print "seq=", seq.getName(), " L=", seq.getLength(
    ), "  total length=", totalLength

lattFactory = LinacLatticeFactory(linacTree)
accLattice = lattFactory.getLinacAccLattice(["SCLMed", "SCLHigh"])

print "Acc Lattice is ready. "

#------- read the SCL cavities phases
fl_in = open("./data/scl_cavs_phases_sts.dat", "r")
lns = fl_in.readlines()
fl_in.close()
cav_phases_dict = {}
for ln in lns:
    res_arr = ln.split()
    if (len(res_arr) == 2):
        cav_phases_dict[res_arr[0]] = float(res_arr[1])

#------- read the SCL RF gaps E0TL parameters  (E0TL in MeV) we want GeV
Beispiel #2
0
from orbit.lattice import AccLattice, AccNode, AccActionsContainer

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=", linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
    totalLength += seq.getLength()
    print "seq=", seq.getName(), " L=", seq.getLength(
    ), "  total length=", totalLength

lattFactory = LinacLatticeFactory(linacTree)
accLattice = lattFactory.getLinacAccLattice([
    "MEBT", "DTL1", "DTL2", "DTL3", "DTL4", "DTL5", "DTL6", "CCL1", "CCL2",
    "CCL3", "CCL4", "SCLMed", "SCLHigh"
])

b = Bunch()
syncPart = b.getSyncParticle()
#set H- mass
b.mass(0.9382723 + 2 * 0.000511)
b.charge(-1.0)
syncPart.kinEnergy(0.0025)

#set up design
paramsDict = {"test_pos": 0., "count": 0}
actionContainer = AccActionsContainer("Test Design Bunch Tracking")
random.seed(100)

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac_sts.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=", linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
    totalLength += seq.getLength()
    print "seq=", seq.getName(), " L=", seq.getLength(
    ), "  total length=", totalLength

lattFactory = LinacLatticeFactory(linacTree)
lattFactory.setMaxDriftLength(0.01)
#accLattice = lattFactory.getLinacAccLattice(["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed","SCLHigh"])
#accLattice = lattFactory.getLinacAccLattice(["SCLMed","SCLHigh"])
accLattice = lattFactory.getLinacAccLattice([
    "MEBT", "DTL1", "DTL2", "DTL3", "DTL4", "DTL5", "DTL6", "CCL1", "CCL2",
    "CCL3", "CCL4", "SCLMed", "SCLHigh"
])

#-----------------------------------------------------
# Set up Space Charge Acc Nodes
#-----------------------------------------------------
from orbit.space_charge.sc3d import setSC3DAccNodes, setUniformEllipsesSCAccNodes
from spacecharge import SpaceChargeCalcUnifEllipse, SpaceChargeCalc3D
sc_path_length_min = 0.02
from sns_linac_bunch_generator import SNS_Linac_BunchGenerator

random.seed(100)

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac_sts.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=",linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
	totalLength +=  seq.getLength()	
	print "seq=",seq.getName()," L=",seq.getLength(),"  total length=",totalLength

lattFactory = 	LinacLatticeFactory(linacTree)
lattFactory.setMaxDriftLength(0.01)
#accLattice = lattFactory.getLinacAccLattice(["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed","SCLHigh"])
#accLattice = lattFactory.getLinacAccLattice(["SCLMed","SCLHigh"])
accLattice = lattFactory.getLinacAccLattice(["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4"])

#-----------------------------------------------------
# Set up Space Charge Acc Nodes
#-----------------------------------------------------
from orbit.space_charge.sc3d import setSC3DAccNodes, setUniformEllipsesSCAccNodes
from spacecharge import SpaceChargeCalcUnifEllipse, SpaceChargeCalc3D
sc_path_length_min = 0.02

print "Set up Space Charge nodes. "
"""
# set of uniformly charged ellipses Space Charge

random.seed(100)

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac_sts.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=",linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
	totalLength +=  seq.getLength()	
	print "seq=",seq.getName()," L=",seq.getLength(),"  total length=",totalLength

lattFactory = 	LinacLatticeFactory(linacTree)
accLattice = lattFactory.getLinacAccLattice(["SCLMed","SCLHigh"])

print "Acc Lattice is ready. "
		
#------- read the SCL cavities phases 
fl_in = open("./data/scl_cavs_phases_sts.dat","r")
lns = fl_in.readlines()
fl_in.close()
cav_phases_dict = {}
for ln in lns:
	res_arr = ln.split()
	if(len(res_arr) == 2):
		cav_phases_dict[res_arr[0]] = float(res_arr[1])	
		
#------- read the SCL RF gaps E0TL parameters  (E0TL in MeV) we want GeV 
from sns_linac_bunch_generator import SNS_Linac_BunchGenerator

random.seed(100)

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=",linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
	totalLength +=  seq.getLength()	
	print "seq=",seq.getName()," L=",seq.getLength(),"  total length=",totalLength

lattFactory = 	LinacLatticeFactory(linacTree)
lattFactory.setMaxDriftLength(0.01)
#accLattice = lattFactory.getLinacAccLattice(["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed","SCLHigh"])
accLattice = lattFactory.getLinacAccLattice(["SCLMed",])

#-----------------------------------------------------
# Set up Space Charge Acc Nodes
#-----------------------------------------------------
from orbit.space_charge.sc2p5d import setSC2p5DrbAccNodes
from orbit.space_charge.sc3d import setSC3DAccNodes, setUniformEllipsesSCAccNodes
from spacecharge import SpaceChargeCalc2p5Drb, SpaceChargeCalcUnifEllipse, SpaceChargeCalc3D
sc_path_length_min = 0.01

"""
#the 2p5rb Space Charge nodes
sizeX = 32
random.seed(100)

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=", linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
    totalLength += seq.getLength()
    print "seq=", seq.getName(), " L=", seq.getLength(
    ), "  total length=", totalLength

lattFactory = LinacLatticeFactory(linacTree)
lattFactory.setMaxDriftLength(0.01)
#accLattice = lattFactory.getLinacAccLattice(["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed","SCLHigh"])
accLattice = lattFactory.getLinacAccLattice([
    "SCLMed",
])

#-----------------------------------------------------
# Set up Space Charge Acc Nodes
#-----------------------------------------------------
from orbit.space_charge.sc2p5d import setSC2p5DrbAccNodes
from orbit.space_charge.sc3d import setSC3DAccNodes, setUniformEllipsesSCAccNodes
from spacecharge import SpaceChargeCalc2p5Drb, SpaceChargeCalcUnifEllipse, SpaceChargeCalc3D
sc_path_length_min = 0.01
"""
#the 2p5rb Space Charge nodes
random.seed(100)

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=", linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
    totalLength += seq.getLength()
    print "seq=", seq.getName(), " L=", seq.getLength(
    ), "  total length=", totalLength

lattFactory = LinacLatticeFactory(linacTree)
lattFactory.setMaxDriftLength(0.02)
#accLattice = lattFactory.getLinacAccLattice(["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed","SCLHigh"])
accLattice = lattFactory.getLinacAccLattice([
    "MEBT",
])

#-----------------------------------------------------
# Set up Space Charge Acc Nodes
#-----------------------------------------------------
from orbit.space_charge.sc2p5d import setSC2p5DrbAccNodes
from orbit.space_charge.sc3d import setSC3DAccNodes, setUniformEllipsesSCAccNodes
from spacecharge import SpaceChargeCalc2p5Drb, SpaceChargeCalcUnifEllipse, SpaceChargeCalc3D
sc_path_length_min = 0.015
"""
#the 2p5rb Space Charge nodes
from bunch import Bunch

from orbit.lattice import AccLattice, AccNode, AccActionsContainer

parser = SimplifiedLinacParser("../SNS_Linac_XML/sns_linac.xml")
linacTree = parser.getLinacStructureTree()
print "======================================="
print "Total length=",linacTree.getLength()
print "======================================="
sequences = linacTree.getSeqs()
totalLength = 0.
for seq in sequences:
	totalLength +=  seq.getLength()	
	print "seq=",seq.getName()," L=",seq.getLength(),"  total length=",totalLength

lattFactory = 	LinacLatticeFactory(linacTree)
accLattice = lattFactory.getLinacAccLattice(["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed","SCLHigh"])

b = Bunch()
syncPart = b.getSyncParticle()
#set H- mass
b.mass(0.9382723 + 2*0.000511)
b.charge(-1.0)
syncPart.kinEnergy(0.0025)

#set up design
paramsDict = {"test_pos":0.,"count":0}
actionContainer = AccActionsContainer("Test Design Bunch Tracking")

outF = open("sns_linac_energy.dat","w")