class BaseMATRIX(AccNodeBunchTracker): """ The base abstract class of the BaseMATRIX accelerator lattice elements hierarchy. """ def __init__(self, name = "no name"): """ Constructor. Creates the base MATRIX element. """ AccNodeBunchTracker.__init__(self,name) self.setType("base matrix") self.matrix = Matrix(7,7) def getMatrix(self): """ Returns the (7,7) Matrix for this transport AccNode. """ return self.matrix def track(self, paramsDict): """ It is tracking the parameter dictionary (with bunch as a "bunch") through the BaseMATRIX element. """ bunch = paramsDict["bunch"] self.matrix.track(bunch)
b = Bunch() b.addParticle(1., 2., 3., 4., 5., 6.) b.dumpBunch() m = Matrix(6, 6) m.unit() m.set(0, 0, math.cos(k)) m.set(0, 1, math.sin(k)) m.set(1, 0, -math.sin(k)) m.set(1, 1, math.cos(k)) m.set(2, 2, math.cos(k)) m.set(2, 3, math.sin(k)) m.set(3, 2, -math.sin(k)) m.set(3, 3, math.cos(k)) printM(m) for i in range(20000): m.track(b) n.TRACK_EXT(b) plotx.append([b.x(0), b.y(0)]) #ploty.append([b.y(0), b.yp(0)]); ploty.append([b.x(0), b.y(0)]) gp.plot(plotx) #gp.plot(ploty) #gp.plot(plotxy) print "Stop."