def __init__(self, name = "baserfgap"): """ Constructor for the simplest RF gap. E0L and E0TL parameters are in GeV. Phases are in radians. """ AbstractRF_Gap.__init__(self,name) self.addParam("E0TL",0.) self.addParam("mode",0.) self.addParam("gap_phase",0.) self.addParam("rfCavity", None) #----- TTF model params ------ self.addParam("E0L",0.) self.polyT = Polynomial(0) self.polyT.coefficient(0,1.0) self.polyS = Polynomial(0) self.polyS.coefficient(0,0.0) self.polyTp = Polynomial(0) self.polyTp.coefficient(0,0.0) self.polySp = Polynomial(0) self.polySp.coefficient(0,0.0) self.addParam("beta_min",0.) self.addParam("beta_max",1.) #----------------------------- self.addParam("rfCavity",None) self.addParam("EzFile","no_file") self.setType("baserfgap") self.__isFirstGap = False #---- by default we use the TTF model #---- which is a Transit-Time-Factor model from Parmila #self.cppGapModel = MatrixRfGap() #self.cppGapModel = BaseRfGap() self.cppGapModel = RfGapTTF()
def __init__(self, baserf_gap): """ Constructor for the axis field RF gap. E0L parameter is in GeV. Phases are in radians. """ AbstractRF_Gap.__init__(self,baserf_gap.getName()) self.setAsFirstRFGap(baserf_gap.isFirstRFGap()) self.baserf_gap = baserf_gap self.setType("axis_field_rfgap") self.addParam("E0TL",self.baserf_gap.getParam("E0TL")) self.addParam("mode",self.baserf_gap.getParam("mode")) self.addParam("gap_phase",self.baserf_gap.getParam("gap_phase")) self.addParam("rfCavity",self.baserf_gap.getParam("rfCavity")) self.addParam("E0L",self.baserf_gap.getParam("E0L")) self.addParam("EzFile",self.baserf_gap.getParam("EzFile")) self.setPosition(self.baserf_gap.getPosition()) #---- aperture parameters if(baserf_gap.hasParam("aperture") and baserf_gap.hasParam("aprt_type")): self.addParam("aperture",baserf_gap.getParam("aperture")) self.addParam("aprt_type",baserf_gap.getParam("aprt_type")) #---- axis field related parameters self.axis_field_func = None self.z_step = 0.01 self.z_min = 0. self.z_max = 0. self.z_tolerance = 0.000001 # in meters self.phase_tolerance = 0.001 # in degrees #---- gap_phase_vs_z_arr keeps [pos,phase] pairs after the tracking self.gap_phase_vs_z_arr = [] #---- The position of the particle during the run. #---- It is used for the path length accounting. self.part_pos = 0. #---- The RF gap model - three points model self.cppGapModel = RfGapThreePointTTF()
def __init__(self, name = "baserfgap"): """ Constructor for the simplest RF gap. E0L and E0TL parameters are in GeV. Phases are in radians. """ AbstractRF_Gap.__init__(self,name) self.addParam("E0TL",0.) self.addParam("mode",0.) self.addParam("gap_phase",0.) self.addParam("rfCavity", None) #----- TTF model params ------ self.addParam("E0L",0.) self.polyT = Polynomial(0) self.polyT.coefficient(0,1.0) self.polyS = Polynomial(0) self.polyS.coefficient(0,0.0) self.polyTp = Polynomial(0) self.polyTp.coefficient(0,0.0) self.polySp = Polynomial(0) self.polySp.coefficient(0,0.0) self.addParam("beta_min",0.) self.addParam("beta_max",1.) #----------------------------- self.addParam("rfCavity",None) self.addParam("EzFile","no_file") self.setType("baserfgap") self.__isFirstGap = False self.cppGapModel = MatrixRfGap() self.cppGapModel = BaseRfGap() self.cppGapModel = RfGapTTF()
def setLinacTracker(self, switch = True): """ This method will switch RF gap model to slower one where transformations coefficients are calculated for each particle in the bunch. """ AbstractRF_Gap.setLinacTracker(self,switch) if(switch): self.cppGapModel = RfGapThreePointTTF_slow() else: self.cppGapModel = RfGapThreePointTTF()
def setLinacTracker(self, switch = True): """ This method will switch RF gap model to slower one where transformations coefficients are calculated for each particle in the bunch. """ AbstractRF_Gap.setLinacTracker(self,switch) if(switch): if(isinstance(self.cppGapModel,BaseRfGap) or isinstance(self.cppGapModel,BaseRfGap_slow)): self.cppGapModel = BaseRfGap_slow() if(isinstance(self.cppGapModel,RfGapTTF) or isinstance(self.cppGapModel,RfGapTTF_slow)): self.cppGapModel = RfGapTTF_slow() else: if(isinstance(self.cppGapModel,BaseRfGap) or isinstance(self.cppGapModel,BaseRfGap_slow)): self.cppGapModel = BaseRfGap() if(isinstance(self.cppGapModel,RfGapTTF) or isinstance(self.cppGapModel,RfGapTTF_slow)): self.cppGapModel = RfGapTTF()
def __init__(self, axis_field_rf_gap): """ Constructor for the axis field RF gap. The axis_field_rf_gap is the instance of the AbstractRF_Gap class. E0L parameter is in GeV. Phases are in radians. """ AbstractRF_Gap.__init__(self, axis_field_rf_gap.getName()) self.setType("GAP&Q") self.axis_field_rf_gap = axis_field_rf_gap self.addParam("E0TL", self.axis_field_rf_gap.getParam("E0TL")) self.addParam("mode", self.axis_field_rf_gap.getParam("mode")) self.addParam("gap_phase", self.axis_field_rf_gap.getParam("gap_phase")) self.addParam("rfCavity", self.axis_field_rf_gap.getParam("rfCavity")) self.addParam("E0L", self.axis_field_rf_gap.getParam("E0L")) self.addParam("EzFile", self.axis_field_rf_gap.getParam("EzFile")) self.setPosition(self.axis_field_rf_gap.getPosition()) #---- aperture parameters if (axis_field_rf_gap.hasParam("aperture") and axis_field_rf_gap.hasParam("aprt_type")): self.addParam("aperture", axis_field_rf_gap.getParam("aperture")) self.addParam("aprt_type", axis_field_rf_gap.getParam("aprt_type")) #---- axis field related parameters self.z_step = 0.01 self.z_min = 0. self.z_max = 0. #---- gap_phase_vs_z_arr keeps [pos,phase] pairs after the tracking self.gap_phase_vs_z_arr = [] #---- The position of the particle during the run. #---- It is used for the path length accounting. self.part_pos = 0. #---- The RF gap model - three points model self.cppGapModel = RfGapThreePointTTF() #---- If we going to use the longitudinal magnetic field component of quad self.useLongField = False #---- quadrupole field sources #----quads_fields_arr is an array of [quad, fieldFunc, z_center_of_field] self.quads_fields_arr = [] #---- If it is true then the this tracking will be in the reversed lattice self.reversed_lattice = False