コード例 #1
0
 /**
  * Scale the field by beta-gamma to preserve the magnet's influence on the beam.
  *
  * @param kineticEnergy
  * @param designKineticEnergy
  * @param restEnergy
  */
 public void preserveDesignInfluence(
     final double kineticEnergy, final double designKineticEnergy, final double restEnergy) {
   final double energy = kineticEnergy + restEnergy;
   final double designEnergy = designKineticEnergy + restEnergy;
   final double betaGamma = Math.sqrt(Math.pow(energy / restEnergy, 2) - 1.0);
   final double designBetaGamma = Math.sqrt(Math.pow(designEnergy / restEnergy, 2) - 1.0);
   final LiveParameter fieldParameter = getLiveParameter(FIELD_INDEX);
   final double designField = fieldParameter.getDesignValue();
   fieldParameter.setCustomValue(designField * betaGamma / designBetaGamma);
 }
コード例 #2
0
 /**
  * Export optics changes using the exporter.
  *
  * @param exporter the optics exporter to use for exporting this node's optics changes
  */
 public void exportOpticsChanges(final OpticsExporter exporter) {
   final LiveParameter parameter = getLiveParameter(FIELD_INDEX);
   if (parameter.getDesignValue() != parameter.getInitialValue()) {
     final DataAdaptor adaptor =
         exporter.getChildAdaptor(getNode().getParent(), getNode().dataLabel());
     adaptor.setValue("id", getNode().getId());
     final DataAdaptor attributesAdaptor = adaptor.createChild("attributes");
     final DataAdaptor magnetAdaptor = attributesAdaptor.createChild("magnet");
     magnetAdaptor.setValue("dfltMagFld", parameter.getInitialValue());
   }
 }