Package eu.ess.lt.parser
Class ComponentFactory
java.lang.Object
eu.ess.lt.parser.ComponentFactory
A factory that generates BLED entities. If the factory can connect to the
BLED database, it will first attempt to retrieve the entity instance from the
database. This will prevent problems when saving the changes, since there
will be no attempts to duplicate entities.
- Author:
- Jakob Battelino Prelog
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAperture(String name, double dx, double dy, BeamlineElement.ApertureType apertureType, Integer previousSubsystem) Returns an existingApertureidentified by its name, or creates a new one.getBeamline(String name, String description, Integer previousSubsystem) Returns an existing beam line identified by its name, or creates a new one.getBend(String name, String entranceEdgeName, String exitEdgeName, double bendAngle, double curvatureRadius, int gradientIndex, double aperture, Bend.Orientation orientation, double gap, double entranceAngle, double entranceCurvature, double exitAngle, double exitCurvature, Integer previousSubsystem) Returns an existingBendidentified by its name, or creates a new one.Returns an existingBPMidentified by its name, or creates a new one.getCorrector(String name, boolean insideNext, double fx, double fy, Double fmax, boolean electric, Double c1, Double c2, Double aperture, Integer previousSubsystem) Returns an existingCorrectoridentified by its name, or creates a new one.Returns an existingDriftidentified by its name, or creates a new one.getDTLCell(String name, double length, double quadLength1, double quadLength2, double cellCenter, double fieldGradient1, double fieldGradient2, double gapVoltage, double rfPhase, double aperture, boolean isPhaseAbsolute, double beta, double transitTimeFactor, double kT, double kkT, Integer previousSubsystem) Returns an existingDTLCellidentified by its name, or creates a new one.getElectrostaticAcceleration(String name, double length, double voltage, double defocal, double aperture, Integer previousSubsystem) Returns an existingElectrostaticAccelerationidentified by its name, or creates a new one.getElectrostaticBend(String name, double bendAngle, double curvatureRadius, ElectrostaticBend.BendType bendType, double aperture, boolean horizVert, Integer previousSubsystem) Returns an existingElectrostaticBendidentified by its name, or creates a new one.getElectrostaticQuadrupole(String name, double length, double voltage, double apertureRadius, double skewAngle, double sextupoleVoltage, double octupoleVoltage, double decapoleVoltage, double dodecapoleVoltage, Integer previousSubsystem) Returns an existingElectrostaticQuadropoleidentified by its name, or creates a new one.getFieldMap(String name, double length, int geom, double rfPhase, double aperture, double magneticIntensityFactor, double electricIntensityFactor, double spaceChargeCompensationFactor, int apertureFlag, String fileName, Integer previousSubsystem) Returns an existingFieldMapidentified by its name, or creates a new one.getLatticeCommand(String name, String value, Integer previousSubsystem) Returns an existingMarkeridentified by its name, or creates a new one.getMultipoleFieldMap(String name, double length, MultipoleMagnet.MagnetType magnetType, int numberOfSteps, double magneticField, double aperture, double solenoidLength, int solenoidStepNumber, Integer previousSubsystem) Returns an existingMultipoleMagnetidentified by its name, or creates a new one.getNCell(String name, double length, int mode, int numberOfCells, double geometricBeta, double gapVoltage, double rfPhase, double aperture, boolean isPhaseAbsolute, double inputFieldCorrection, double outputFieldCorrection, double gapDisplacement1, double gapDisplacement2, double beta, double ttfMiddleGaps, double kTMiddleGaps, double kktMiddleGaps, double ttfInputGaps, double kTInputGaps, double kkTInputGaps, double ttfOutputGaps, double kTOutputGaps, double kkTOutputGaps, Integer previousSubsystem) Returns an existingNCellidentified by its name, or creates a new one.getQuadrupole(String name, double length, double quadrupoleGradient, double aperture, double skewAngle, double sextupoleGradient, double octupoleGradient, double decapoleGradient, double dodecapoleGradient, Integer previousSubsystem) Returns an existingMultipoleMagnetof quadruple type identified by its name, or creates a new one.getRFCavity(String name, double gapVoltage, double rfPhase, double apertureRadius, boolean isPhaseAbsolute, double beta, double transitTimeFactor, double kT, double kkT, double kS, double kkS, RFCavity.CavityType cavityType, Integer previousSubsystem) Returns an existingRFCavityidentified by its name, or creates a new one.getRFCavity(String name, double length, int cellNumber, double averageAccField, double phaseAtEntrance, double aperture, boolean isPhaseAbsolute, RFCavity.CavityType cavityType, Integer previousSubsystem) Returns an existingRFCavityidentified by its name, or creates a new one.getRFQCell(String name, double length, double gapVoltage, double vaneRadius, double accParameter, double modulation, double rfPhase, String type, double curvature, double focusing, Integer previousSubsystem) Returns an existingRFQCellidentified by its name, or creates a new one.Returns an existing slot identified by its name, or creates a new one.getSolenoid(String name, double length, double magneticField, double aperture, Integer previousSubsystem) Returns an existingSolenoididentified by its name, or creates a new one.getSpaceChargeCompensation(String name, double factor, Integer previousSubsystem) Returns an existingSpaceChargeCompensationidentified by its name, or creates a new one.getThinLens(String name, double focalLengthX, double focalLengthY, double aperture, Integer previousSubsystem) Returns an existingThinLensidentified by its name, or creates a new one.voidsetBasePath(String basePath) voidsetFieldmapPath(String fieldmapPath) validateFields(Subsystem subsystem)
-
Constructor Details
-
ComponentFactory
public ComponentFactory()
-
-
Method Details
-
getAperture
public Aperture getAperture(String name, double dx, double dy, BeamlineElement.ApertureType apertureType, Integer previousSubsystem) Returns an existingApertureidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the aperture.dx-doubleaperture's X position.dy-doubleaperture's Y position.apertureType-BeamlineElement.ApertureTypetype of the aperture.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
Aperturewith the specified field values.
-
getBend
public Bend getBend(String name, String entranceEdgeName, String exitEdgeName, double bendAngle, double curvatureRadius, int gradientIndex, double aperture, Bend.Orientation orientation, double gap, double entranceAngle, double entranceCurvature, double exitAngle, double exitCurvature, Integer previousSubsystem) Returns an existingBendidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the bending magnet.entranceEdgeName-exitEdgeName-bendAngle-doubleangle of bending.curvatureRadius-doubleradius of the trajectory curve.gradientIndex-intgradient index.aperture-doubleaperture size.orientation-Bend.Orientationorientation of the bending magnet.gap-doubletotal gap of the magnet.entranceAngle-doubleangle of the incoming beam.entranceCurvature-doublecurvature of the incoming beam.exitAngle-doubleangle of the outgoing beam.exitCurvature-doublecurvature of the outgoing beam.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
Bendwith the specified field values.
-
getRFCavity
public RFCavity getRFCavity(String name, double gapVoltage, double rfPhase, double apertureRadius, boolean isPhaseAbsolute, double beta, double transitTimeFactor, double kT, double kkT, double kS, double kkS, RFCavity.CavityType cavityType, Integer previousSubsystem) Returns an existingRFCavityidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the RF cavity.gapVoltage-doubleeffective gap voltage.rfPhase-doubleRF phase.apertureRadius-doubleaperture size.isPhaseAbsolute-boolean1 if phase is absolute, 0 if it's relative.beta-doubletransitTimeFactor-doubletransit time factor.kT-doubletransit time factor coefficient.kkT-doubletransit time factor coefficient.kS-doubletransit time factor coefficient.kkS-doubletransit time factor coefficient.cavityType-RFCavity.CavityTypetype of the cavity.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
RFCavitywith the specified field values.
-
getDrift
public Drift getDrift(String name, double length, double aperture, double apertureY, Integer previousSubsystem) Returns an existingDriftidentified by its name, or creates a new one. The returned entity has its fields set to the specified values. -
getDTLCell
public DTLCell getDTLCell(String name, double length, double quadLength1, double quadLength2, double cellCenter, double fieldGradient1, double fieldGradient2, double gapVoltage, double rfPhase, double aperture, boolean isPhaseAbsolute, double beta, double transitTimeFactor, double kT, double kkT, Integer previousSubsystem) Returns an existingDTLCellidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the DTL cell.length-doublelength of the DTL cell.quadLength1-doublefirst 1/2 quadrupole length.quadLength2-doublesecond 1/2 quadrupole length.cellCenter-doublecell center.fieldGradient1-doublefirst magnetic field gradient.fieldGradient2-doublesecond magnetic field gradient.gapVoltage-doubleeffective gap voltage.rfPhase-doubleRF phase.aperture-doubleaperture size.isPhaseAbsolute-boolean1 if phase is absolute, 0 if it's relative.beta-doubleparticle reduced velocity.transitTimeFactor-doubletransit time factor.kT-doubletransit time factor coefficient.kkT-doubletransit time factor coefficient.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
DTLCellwith the specified field values.
-
getElectrostaticAcceleration
public ElectrostaticAcceleration getElectrostaticAcceleration(String name, double length, double voltage, double defocal, double aperture, Integer previousSubsystem) Returns an existingElectrostaticAccelerationidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the electrostatic acceleration element.length-doublelength of the electrostatic acceleration element.voltage-doublevoltage.defocal-doubletransverse defocal.aperture-doubleaperture size.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
ElectrostaticAccelerationwith the specified field values.
-
getElectrostaticQuadrupole
public ElectrostaticQuadropole getElectrostaticQuadrupole(String name, double length, double voltage, double apertureRadius, double skewAngle, double sextupoleVoltage, double octupoleVoltage, double decapoleVoltage, double dodecapoleVoltage, Integer previousSubsystem) Returns an existingElectrostaticQuadropoleidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the electrostatic quadrupole.length-doublelength of the electrostatic quadrupole.voltage-doublevoltage between electrodes.apertureRadius-doubleaperture size.skewAngle-doubleskew angle.sextupoleVoltage-doublesextupole voltage component.octupoleVoltage-doubleoctupole voltage component.decapoleVoltage-doubledecapole voltage component.dodecapoleVoltage-doubledodecapole voltage component.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
ElectrostaticQuadropolewith the specified field values.
-
getFieldMap
public FieldMap getFieldMap(String name, double length, int geom, double rfPhase, double aperture, double magneticIntensityFactor, double electricIntensityFactor, double spaceChargeCompensationFactor, int apertureFlag, String fileName, Integer previousSubsystem) Returns an existingFieldMapidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the field map.length-doublelength of the field map element.geom-intfield map type.rfPhase-doubleRF phase.aperture-doubleaperture size.magneticIntensityFactor-doublemagnetic field intensity factor.electricIntensityFactor-doubleelectric field intensity factor.spaceChargeCompensationFactor-doublespace charge compensation factor.apertureFlag-intaperture flag.fileName-Stringfile name without extension.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
FieldMapwith the specified field values.
-
getMultipoleFieldMap
public MultipoleMagnet getMultipoleFieldMap(String name, double length, MultipoleMagnet.MagnetType magnetType, int numberOfSteps, double magneticField, double aperture, double solenoidLength, int solenoidStepNumber, Integer previousSubsystem) Returns an existingMultipoleMagnetidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the multipole magnet.length-doublelength of the multipole magnet.magnetType-MultipoleMagnet.MagnetTypemagnet type.numberOfSteps-intnumber of steps along x and y directions.magneticField-doublemagnetic field on pole.aperture-doubleaperture size.solenoidLength-doublephysical length of solenoid.solenoidStepNumber-intstep number of solenoid case.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
MultipoleMagnetwith the specified field values.- See Also:
-
getQuadrupole
public Quadrupole getQuadrupole(String name, double length, double quadrupoleGradient, double aperture, double skewAngle, double sextupoleGradient, double octupoleGradient, double decapoleGradient, double dodecapoleGradient, Integer previousSubsystem) Returns an existingMultipoleMagnetof quadruple type identified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the quadrupole magnet.length-doublelength of the quadrupole magnet.quadrupoleGradient-doublemagnetic field gradient (T/m)aperture-doubleapertureskewAngle-doubleskew angle (degrees)sextupoleGradient-doublesextupole gradient (T/m2)octupoleGradient-doubleoctupole gradient (T/m3)decapoleGradient-doubledecapole gradient (T/m4)dodecapoleGradient-doubledodecapole gradient (T/m5)previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
MultipoleMagnetwith the specified field values.
-
getNCell
public NCell getNCell(String name, double length, int mode, int numberOfCells, double geometricBeta, double gapVoltage, double rfPhase, double aperture, boolean isPhaseAbsolute, double inputFieldCorrection, double outputFieldCorrection, double gapDisplacement1, double gapDisplacement2, double beta, double ttfMiddleGaps, double kTMiddleGaps, double kktMiddleGaps, double ttfInputGaps, double kTInputGaps, double kkTInputGaps, double ttfOutputGaps, double kTOutputGaps, double kkTOutputGaps, Integer previousSubsystem) Returns an existingNCellidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the NCell element.length-Stringlength of the NCell element.mode-intmode.numberOfCells-intnumber of cells.geometricBeta-doublegeometric beta.gapVoltage-doubleeffective gap voltage.rfPhase-doubleRF phase.aperture-doubleaperture size.isPhaseAbsolute-boolean1 if phase is absolute, 0 if it's relative.inputFieldCorrection-doubleinput field correction.outputFieldCorrection-doubleoutput field correction.gapDisplacement1-doublefirst gap displacement.gapDisplacement2-doublesecond gap displacement.beta-doubleparticle reduced velocity.ttfMiddleGaps-doubletransit time factor for the middle gaps.kTMiddleGaps-doubletransit time factor coefficient for the middle gaps.kktMiddleGaps-doubletransit time factor coefficient for the middle gaps.ttfInputGaps-doubletransit time factor for the input gaps.kTInputGaps-doubletransit time factor coefficient for the input gaps.kkTInputGaps-doubletransit time factor coefficient for the input gaps.ttfOutputGaps-doubletransit time factor for the output gaps.kTOutputGaps-doubletransit time factor coefficient for the output gaps.kkTOutputGaps-doubletransit time factor coefficient for the output gaps.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
NCellwith the specified field values.
-
getRFQCell
public RFQCell getRFQCell(String name, double length, double gapVoltage, double vaneRadius, double accParameter, double modulation, double rfPhase, String type, double curvature, double focusing, Integer previousSubsystem) Returns an existingRFQCellidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the RFQ cell.length-doublelength of the RFQ cell.gapVoltage-doubleeffective gap voltage.vaneRadius-doublevane radius.accParameter-doubleacceleration parameter.modulation-doublemodulation.rfPhase-doubleRF phase.type-Stringtype of RF cell.curvature-doubletransverse curvature.focusing-doubletransverse focusing.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
RFQCellwith the specified field values.
-
getRFCavity
public RFCavity getRFCavity(String name, double length, int cellNumber, double averageAccField, double phaseAtEntrance, double aperture, boolean isPhaseAbsolute, RFCavity.CavityType cavityType, Integer previousSubsystem) Returns an existingRFCavityidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the RF cavity.length-doublelength of the RF cavity.cellNumber-intcell number.averageAccField-doubleaverage accelerating field.phaseAtEntrance-doublephase of the synchronous particle at the entrance.aperture-doubleaperture size.isPhaseAbsolute-boolean1 if phase is absolute, 0 if it's relative.cavityType-RFCavity.CavityTypetype of the cavity.previousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
RFCavitywith the specified field values.
-
getSolenoid
public Solenoid getSolenoid(String name, double length, double magneticField, double aperture, Integer previousSubsystem) Returns an existingSolenoididentified by its name, or creates a new one. The returned entity has its fields set to the specified values. -
getThinLens
public ThinLens getThinLens(String name, double focalLengthX, double focalLengthY, double aperture, Integer previousSubsystem) Returns an existingThinLensidentified by its name, or creates a new one. The returned entity has its fields set to the specified values. -
getCorrector
public Corrector getCorrector(String name, boolean insideNext, double fx, double fy, Double fmax, boolean electric, Double c1, Double c2, Double aperture, Integer previousSubsystem) Returns an existingCorrectoridentified by its name, or creates a new one. The returned entity has its fields set to the specified values. -
getBPM
Returns an existingBPMidentified by its name, or creates a new one. The returned entity has its fields set to the specified values. -
getSlot
Returns an existing slot identified by its name, or creates a new one. The returned entity has its fields set to the specified values. Slots are not virtual subsystems. -
getBeamline
Returns an existing beam line identified by its name, or creates a new one. The returned entity has its fields set to the specified values. Beam lines are virtual subsystems. -
getMarker
Returns an existingMarkeridentified by its name, or creates a new one. The returned entity has its fields set to the specified values. -
getElectrostaticBend
public ElectrostaticBend getElectrostaticBend(String name, double bendAngle, double curvatureRadius, ElectrostaticBend.BendType bendType, double aperture, boolean horizVert, Integer previousSubsystem) Returns an existingElectrostaticBendidentified by its name, or creates a new one. The returned entity has its fields set to the specified values.- Parameters:
name-Stringname of the electrostatic bend.bendAngle-doublebend angle in the rotation plane (deg)curvatureRadius-doublecurvature radius of central trajectory (mm)bendType-ElectrostaticBend.BendTypeCYLINDRICAL, SPHERICAL or TOROIDALaperture-doubleaperture (mm)horizVert-falsehorizontal,trueverticalpreviousSubsystem-Subsystemsubsystem positioned previously in the lattice.- Returns:
-
getSpaceChargeCompensation
public SpaceChargeCompensation getSpaceChargeCompensation(String name, double factor, Integer previousSubsystem) Returns an existingSpaceChargeCompensationidentified by its name, or creates a new one. The returned entity has its fields set to the specified values. -
getLatticeCommand
-
validateFields
-
setFieldmapPath
-
setBasePath
-