Пример #1
0
class TeapotFoilNode(DriftTEAPOT):
	""" 
	The foil node class for TEAPOT lattice
	"""
	def __init__(self, xmin, xmax, ymin, ymax, thick, name = "foil no name"):
		"""
		Constructor. Creates the Foil TEAPOT element.
		"""
		DriftTEAPOT.__init__(self,name)
		self.foil = Foil(xmin, xmax, ymin, ymax, thick)
		self.setType("foil teapot")
		self.setLength(0.0)
		# The user choice of scattering routine. Defualt (0) is full scatter
		self.scatterChoice = 0

	def track(self, paramsDict):
		"""
		The foil-teapot class implementation of the AccNodeBunchTracker class track(probe) method.
		"""
		length = self.getLength(self.getActivePartIndex())
		bunch = paramsDict["bunch"]
		lostbunch = paramsDict["lostbunch"]
		if(self.scatterChoice == 0):
			self.foil.traverseFoilFullScatter(bunch, lostbunch)
		else:
			self.foil.traverseFoilSimpleScatter(bunch)
	
	
	def setScatterChoice(self, choice):
		self.scatterChoice = choice
Пример #2
0
class TeapotFoilNode(DriftTEAPOT):
    """ 
	The foil node class for TEAPOT lattice
	"""
    def __init__(self, xmin, xmax, ymin, ymax, thick, name="foil no name"):
        """
		Constructor. Creates the Foil TEAPOT element.
		"""
        DriftTEAPOT.__init__(self, name)
        self.foil = Foil(xmin, xmax, ymin, ymax, thick)
        self.setType("foil teapot")
        self.setLength(0.0)
        # The user choice of scattering routine. Defualt (0) is full scatter
        self.scatterChoice = 0

    def track(self, paramsDict):
        """
		The foil-teapot class implementation of the AccNodeBunchTracker class track(probe) method.
		"""
        length = self.getLength(self.getActivePartIndex())
        bunch = paramsDict["bunch"]
        lostbunch = paramsDict["lostbunch"]
        if (self.scatterChoice == 0):
            self.foil.traverseFoilFullScatter(bunch, lostbunch)
        else:
            self.foil.traverseFoilSimpleScatter(bunch)

    def setScatterChoice(self, choice):
        self.scatterChoice = choice
Пример #3
0
thick = 400

foil = Foil(xmin, xmax, ymin, ymax, thick)

#------------------------------
#Main Bunch init
#------------------------------
b = Bunch()
print "Read Bunch."
runName = "Benchmark_Collimator"

b.mass(0.93827231)
b.macroSize(1.0e+1)
energy = 1.0 #Gev
b.readBunch("parts.dat")
b.getSyncParticle().kinEnergy(energy)

#=====track bunch through Foil============

lostbunch = Bunch()
lostbunch.addPartAttr("LostParticleAttributes") 

foil.traverseFoilFullScatter(b, lostbunch)
b.dumpBunch("scatteredbunch.dat")
lostbunch.dumpBunch("lostbunch.dat")

print "Stop."