void REIXSMoveToSampleTransferPositionAction::startImplementation()
{
	REIXSSampleChamber* sampleControls = REIXSBeamline::bl()->sampleChamber();

	// check that all the sample manipulator controls are connected
	if(!sampleControls->isConnected()) {
		AMErrorMon::alert(this, -4, "Could not move to the sample position because not all the sample manipulator controls are connected. Please report this problem to the beamline staff.");
		notifyFailed();
		return;
	}

	const AMControlInfoList& positions = qobject_cast<REIXSMoveToSampleTransferPositionActionInfo*>(info())->positions();
	const AMControlInfo& xTarget = positions.controlNamed("sampleX");
	const AMControlInfo& yTarget = positions.controlNamed("sampleY");
	const AMControlInfo& zTarget = positions.controlNamed("sampleZ");
	const AMControlInfo& thetaTarget = positions.controlNamed("sampleTheta");


	// build up the list actions: First the y move, then the x move, then the z move, then theta
	addSubAction(new AMInternalControlMoveAction(sampleControls->x(), xTarget.value()));
	addSubAction(new AMInternalControlMoveAction(sampleControls->y(), yTarget.value()));
	addSubAction(new AMInternalControlMoveAction(sampleControls->z(), zTarget.value()));
	addSubAction(new AMInternalControlMoveAction(sampleControls->r(), thetaTarget.value()));


}
Ejemplo n.º 2
0
  void incDecAction<T>::initialize(QIcon UpIcon,
                                   QIcon DownIcon,
                                   QString UpText,
                                   QString DownText,
                                   int (T::*getFunction)()const,
                                   void (T::*setFunction)(const int&))
  {
    // TODO remove old actions
    d->clear();
    d->plusAction = new QAction(UpIcon, UpText, this) ;
    d->minusAction = new QAction(DownIcon, DownText, this) ;
    addSubAction(d->plusAction);
    addSubAction(d->minusAction);

    d->setFunction = setFunction ;
    d->getFunction = getFunction ;
  }
CLSSIS3820ScalerDarkCurrentMeasurementAction::CLSSIS3820ScalerDarkCurrentMeasurementAction(CLSSIS3820ScalerDarkCurrentMeasurementActionInfo *info, QObject *parent) :
    AMListAction3(info, AMListAction3::Sequential, parent)
{
	CLSSIS3820Scaler *scaler = CLSBeamline::clsBeamline()->scaler();
	double secondsDwell = scalerDarkCurrentMeasurementActionInfo()->dwellTime();

	connect( this, SIGNAL(failed()), this, SLOT(onActionFailed()) );

	if (scaler && scaler->isConnected() && secondsDwell > 0) {

		// pre-measurement settings.
		double oldDwell = scaler->dwellTime();

		// first turn off beam.
//		addSubAction(AMBeamline::bl()->createTurnOffBeamActions());

		// set the scaler's dwell time to new time.
		addSubAction(scaler->createDwellTimeAction3(secondsDwell));

		// initiate a scaler measurement and wait until it is complete.
		addSubAction(scaler->createStartAction3(true));
		addSubAction(scaler->createWaitForDwellFinishedAction(secondsDwell + 5.0));

		// notify attached and able scaler channel detectors that the latest measurement was a dark current measurement.
		AMListAction3 *notifyChannelDetectors = new AMListAction3(new AMListActionInfo3("Set last measurement as dark current measurement", "Set last measurement as dark current measurement"));

		for (int i = 0; i < scaler->channels().count(); i++) {
			CLSSIS3820ScalerChannel *channel = scaler->channelAt(i);

			if (channel && channel->isEnabled() && channel->detector() && channel->detector()->canDoDarkCurrentCorrection()) {
				notifyChannelDetectors->addSubAction(channel->detector()->createSetLastMeasurementAsDarkCurrentAction());
			}
		}

		addSubAction(notifyChannelDetectors);

		// reset settings to pre-measurement conditions.
		addSubAction(scaler->createDwellTimeAction3(oldDwell));

	} else {
		AMErrorMon::alert(this, CLSSIS3820SCALERDARKCURRENTMEASUREMENTACTION_SCALER_NOT_VALID, "Failed to complete dark current measurement--scaler not valid.");
		setFailed();
	}

}