Exemple #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);
  }
Exemple #2
0
 protected Trajectory<TransferMapState> calculateTrajectory(final AcceleratorSeq sequence)
     throws Exception {
   _sequence = sequence;
   final PVLoggerSnapshot snapshot = _snapshot;
   final Scenario scenario = getScenario(snapshot.getDataSource());
   scenario.run();
   final Trajectory<TransferMapState> trajectory = scenario.getTrajectory();
   _trajectory = trajectory;
   return trajectory;
 }