예제 #1
0
  /** determine the best matching target beam position vector (x, y) */
  public BeamPosition getMatchingTargetBeamPosition(
      final List<BpmAgent> xBpmAgents, final List<BpmAgent> yBpmAgents) throws Exception {
    // TODO: much has changed since the original code was written. X and Y should be abstracted to
    // avoid code duplication.
    final TransferMapProbe probe = getProbe(SEQUENCE);
    final Scenario scenario = getScenario(SEQUENCE, probe);
    scenario.resync();
    scenario.run();
    final Trajectory<TransferMapState> trajectory = scenario.getTrajectory();
    final AcceleratorNode targetNode = SEQUENCE.getNodesOfType("Tgt").get(0);

    //		@SuppressWarnings("unchecked")
    //        final double[] xTargetBeamPositionAndError =
    // X_BEAM_POSITION_MATCHER.getMatchingTargetBeamPositionAndError( targetNode, xBpmAgents,
    // (Trajectory<TransferMapState>)trajectory );
    final double[] xTargetBeamPositionAndError =
        X_BEAM_POSITION_MATCHER.getMatchingTargetBeamPositionAndError(
            targetNode, xBpmAgents, trajectory);
    final double xTargetPosition = xTargetBeamPositionAndError[0];
    final double xTargetPositionError = xTargetBeamPositionAndError[1];

    //		@SuppressWarnings("unchecked")
    //        final double[] yTargetBeamPositionAndError =
    // Y_BEAM_POSITION_MATCHER.getMatchingTargetBeamPositionAndError( targetNode, yBpmAgents,
    // (Trajectory<TransferMapState>)trajectory );
    final double[] yTargetBeamPositionAndError =
        Y_BEAM_POSITION_MATCHER.getMatchingTargetBeamPositionAndError(
            targetNode, yBpmAgents, trajectory);
    final double yTargetPosition = yTargetBeamPositionAndError[0];
    final double yTargetPositionError = yTargetBeamPositionAndError[1];

    return new BeamPosition(
        xTargetPosition, xTargetPositionError, yTargetPosition, yTargetPositionError);
  }
예제 #2
0
 /** Use setpoints for electromagnets. */
 public void useSetpoints(final AcceleratorSeq sequence) {
   if (sequence != null) {
     final List<AcceleratorNode> magnets = sequence.getNodesOfType(Electromagnet.s_strType, true);
     for (AcceleratorNode node : magnets) {
       ((Electromagnet) node).setUseFieldReadback(false);
     }
   }
 }
예제 #3
0
 /**
  * use the field setpoints for the online model analysis otherwise the model produces ridiculous
  * answers
  */
 protected void useFieldSetpoint() {
   final List<AcceleratorNode> magnets =
       RTBT_SEQUENCE.getNodesOfType(Electromagnet.s_strType, true);
   for (final AcceleratorNode magnet : magnets) {
     if (magnet instanceof Electromagnet) {
       ((Electromagnet) magnet).setUseFieldReadback(false);
     }
   }
 }
예제 #4
0
  /** Constructor */
  public TargetOrbitAnalysis(final PlaneAdaptor planeAdaptor, final AcceleratorSeq sequence) {
    PLANE_ADAPTOR = planeAdaptor;
    SEQUENCE = sequence;

    TARGET = sequence.getNodesOfType("Tgt").get(0);

    _scale = planeAdaptor.getDefaultScale();
    _offset = planeAdaptor.getDefaultOffset();
    _rmsError = Double.NaN;
  }
예제 #5
0
 /**
  * Sets the accelerator sequence
  *
  * @param accSeq The new accelSeq value
  */
 public void setAccelSeq(AcceleratorSeq accSeq) {
   java.util.List<AcceleratorNode> accNodes = accSeq.getNodesOfType(Electromagnet.s_strType);
   java.util.Iterator<AcceleratorNode> itr = accNodes.iterator();
   while (itr.hasNext()) {
     Electromagnet emg = (Electromagnet) itr.next();
     if (emg.getStatus()) {
       emg.setUseFieldReadback(false);
     }
   }
   ringFoilPosCorr.setAccelSeq(accSeq);
 }