SGMXASScanConfiguration::SGMXASScanConfiguration(QObject *parent) : AMXASScanConfiguration(parent) , SGMScanConfiguration() { xasRegions()->setEnergyControl(SGMBeamline::sgm()->energy()); //regions_->setDefaultTimeControl(SGMBeamline::sgm()->scalerIntegrationTime()); //regions_->setDefaultTimeControl(SGMBeamline::sgm()->picoammeterDwellTime()); regions_->setDefaultTimeControl(SGMBeamline::sgm()->masterDwell()); regions_->setSensibleRange(200, 2000); regions_->setDefaultUnits(" eV"); regions_->setDefaultTimeUnits(" s"); fluxResolutionSet_ = SGMBeamline::sgm()->fluxResolutionSet(); trackingSet_ = SGMBeamline::sgm()->trackingSet(); xasDetectors_ = SGMBeamline::sgm()->XASDetectors(); connect(SGMBeamline::sgm(), SIGNAL(detectorAvailabilityChanged(AMOldDetector*,bool)), this, SLOT(detectorAvailabilityChanged(AMOldDetector*,bool))); allDetectors_ = new AMOldDetectorSet(this); for(int x = 0; x < SGMBeamline::sgm()->feedbackDetectors()->count(); x++) allDetectors_->addDetector(SGMBeamline::sgm()->feedbackDetectors()->detectorAt(x), true); for(int x = 0; x < xasDetectors_->count(); x++) allDetectors_->addDetector(xasDetectors_->detectorAt(x), xasDetectors_->isDefaultAt(x)); xasDetectorsCfg_ = xasDetectors_->toInfoSet(); // default channels removed. Need to come up with new replacement system to create default analysis blocks instead. emit exitSlitGapChanged(exitSlitGap_); emit gratingChanged(grating_); emit trackingGroupChanged(trackingGroup_); }
bool SGMXASScanConfiguration::setGrating(SGMBeamlineInfo::sgmGrating grating) { SGMBeamlineInfo::sgmGrating oldGrating = grating_; bool rVal = SGMScanConfiguration::setGrating(grating); if(rVal && oldGrating != grating_){ emit gratingChanged(grating); emit fluxResolutionGroupChanged(fluxResolutionGroup_); setModified(true); emit configurationChanged(); } return rVal; }
SGMXASScanConfiguration2013::SGMXASScanConfiguration2013(const SGMXASScanConfiguration2013 &original) : AMStepScanConfiguration(original), SGMScanConfiguration2013(original) { detectorConfigurations_ = original.detectorConfigurations(); setTrackingGroup(original.trackingGroup()); setFluxResolutionGroup(original.fluxResolutionGroup()); connect(SGMBeamline::sgm()->exitSlitGap(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->grating(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->harmonic(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->undulatorTracking(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->monoTracking(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->exitSlitTracking(), SIGNAL(valueChanged(double)), this,SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(exitSlitGapChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(gratingChanged(SGMBeamlineInfo::sgmGrating)), this, SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(harmonicChanged(SGMBeamlineInfo::sgmHarmonic)), this, SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(trackingGroupChanged()), this, SLOT(checkIfMatchesBeamline())); }
SGMXASScanConfiguration2013::SGMXASScanConfiguration2013(QObject *parent) : AMStepScanConfiguration(parent), SGMScanConfiguration2013() { AMScanAxisRegion *region = new AMScanAxisRegion; AMScanAxis *axis = new AMScanAxis(AMScanAxis::StepAxis, region); appendScanAxis(axis); connect(SGMBeamline::sgm()->exitSlitGap(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->grating(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->harmonic(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->undulatorTracking(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->monoTracking(), SIGNAL(valueChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(SGMBeamline::sgm()->exitSlitTracking(), SIGNAL(valueChanged(double)), this,SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(exitSlitGapChanged(double)), this, SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(gratingChanged(SGMBeamlineInfo::sgmGrating)), this, SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(harmonicChanged(SGMBeamlineInfo::sgmHarmonic)), this, SLOT(checkIfMatchesBeamline())); connect(this->dbObject(), SIGNAL(trackingGroupChanged()), this, SLOT(checkIfMatchesBeamline())); }
bool SGMXASScanConfiguration::setFluxResolutionGroup(AMControlInfoList fluxResolutionList){ double oldExitSlit = exitSlitGap_; SGMBeamlineInfo::sgmGrating oldGrating = grating_; SGMBeamlineInfo::sgmHarmonic oldHarmonic = harmonic_; bool rVal = SGMScanConfiguration::setFluxResolutionGroup(fluxResolutionList); if(rVal){ emit fluxResolutionGroupChanged(fluxResolutionList); if(oldExitSlit != exitSlitGap_) emit exitSlitGapChanged(exitSlitGap_); if(oldGrating != grating_) emit gratingChanged(grating_); if(oldHarmonic != harmonic_) emit harmonicChanged(harmonic_); setModified(true); emit configurationChanged(); } return rVal; }
AMControl::FailureExplanation REIXSSpectrometer::move(double setpoint) { if(!isConnected()) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, 2, "Can't move the spectrometer: some motor controls are not connected. Check that the IOCs are running and the network connections are good.")); return NotConnectedFailure; } // can't start a move while moving if(moveInProgress() || isMoving()) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, 2, "Can't move the spectrometer, because it's already moving. Stop the spectrometer first before attempting another move.")); return AlreadyMovingFailure; } specifiedEV_ = setpoint; currentFocusOffset_ = specifiedFocusOffset_; currentDetectorTiltOffset_ = specifiedDetectorTiltOffset_; if(currentGrating_ != specifiedGrating_) { emit gratingChanged(currentGrating_ = specifiedGrating_); } /// \todo limits? out of range? moveSetpoint_ = calibration_.computeSpectrometerPosition(specifiedGrating_, specifiedEV_, currentFocusOffset_, currentDetectorTiltOffset_); // build the move action (With sub-actions to run in parallel) moveAction_ = new AMListAction3(new AMListActionInfo3("spectrometer eV move", "spectrometer eV move"), AMListAction3::Parallel, this); // if we need to move the grating into position, add actions for that: if(!gratingInPosition()) { // make a sequential action for the grating moves AMListAction3* gratingAction = new AMListAction3(new AMListActionInfo3("grating move", "grating move")); // sequential by default. // first, move Z to 0 gratingAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->z(), 0)); // then move U,V,W to 0 AMListAction3* uvw0Action = new AMListAction3(new AMListActionInfo3("grating UVW move to 0"), AMListAction3::Parallel); uvw0Action->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->u(), 0)); uvw0Action->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->v(), 0)); uvw0Action->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->w(), 0)); gratingAction->addSubAction(uvw0Action); // then move R,S,T into position (Can do simultaneously with parallel action) AMListAction3* rstAction = new AMListAction3(new AMListActionInfo3("grating RST move"), AMListAction3::Parallel); rstAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->r(), moveSetpoint_.controlNamed("hexapodR").value())); rstAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->s(), moveSetpoint_.controlNamed("hexapodS").value())); rstAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->t(), moveSetpoint_.controlNamed("hexapodT").value())); gratingAction->addSubAction(rstAction); // move U,V,W to actual position AMListAction3* uvwAction = new AMListAction3(new AMListActionInfo3("grating UVW move"), AMListAction3::Parallel); uvwAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->u(), moveSetpoint_.controlNamed("hexapodU").value())); uvwAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->v(), moveSetpoint_.controlNamed("hexapodV").value())); uvwAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->w(), moveSetpoint_.controlNamed("hexapodW").value())); gratingAction->addSubAction(uvwAction); // then move X,Y,Z into position (can do simultaneously with parallel action) AMListAction3* xyzAction = new AMListAction3(new AMListActionInfo3("grating XYZ move"), AMListAction3::Parallel); xyzAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->x(), moveSetpoint_.controlNamed("hexapodX").value())); xyzAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->y(), moveSetpoint_.controlNamed("hexapodY").value())); xyzAction->addSubAction(AMActionSupport::buildControlMoveAction(hexapod_->z(), moveSetpoint_.controlNamed("hexapodZ").value())); gratingAction->addSubAction(xyzAction); moveAction_->addSubAction(gratingAction); } // add Lift, Tilt, and Translation moveAction_->addSubAction(AMActionSupport::buildControlMoveAction(spectrometerRotationDrive_, moveSetpoint_.controlNamed("spectrometerRotationDrive").value())); moveAction_->addSubAction(AMActionSupport::buildControlMoveAction(detectorTiltDrive_, moveSetpoint_.controlNamed("detectorTiltDrive").value())); moveAction_->addSubAction(AMActionSupport::buildControlMoveAction(detectorTranslation_, moveSetpoint_.controlNamed("detectorTranslation").value())); // Disabled for now: moveAction_->addSubAction(new AMInternalControlMoveAction(endstationTranslation_, moveSetpoint_.controlNamed("endstationTranslation").value())) // Watch the move action: succeeded or failed (or cancelled) connect(moveAction_, SIGNAL(stateChanged(int,int)), this, SLOT(onMoveActionStateChanged(int,int))); emit moveStarted(); moveAction_->start(); return NoFailure; }