Package gda.device.monitor
Class EpicsBeamMonitor
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.scannable.ScannableBase
gda.device.monitor.MonitorBase
gda.device.monitor.EpicsBeamMonitor
- All Implemented Interfaces:
Device,Monitor,Scannable,Configurable,Findable,gda.observable.IObservable,gov.aps.jca.event.MonitorListener,EventListener
A class to monitor the beam using an EPICS-based Detector, such as a multi-channel EpicsScaler
EpicsScaler, or an ETLDetecor
ETLDetector. This class monitors the specified detector count value and
checks whether the data count rate has fallen below a specified threshold. If so the scan is paused and a new thread
is spawned to monitor the detector until the data is above the threshold value for a given number of consecutive
reads before the scan is resumed.-
Field Summary
Fields inherited from class gda.device.scannable.ScannableBase
__doc__, DEFAULT_INPUT_NAME, DEFAULT_OUTPUT_FORMAT, extraNames, inputNames, level, outputFormatFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLE -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor for Castor configuration.EpicsBeamMonitor(String detectorName, int channel, double threshold, int waitTime, int consecutiveCountsAboveThreshold, double countTime) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.intintdoubleintreturns the number of elements in this monitor.Returns the current position of the Scannable.doublegetUnit()gets the physical unit of the monitor.intbooleanchecks beam monitor flagvoidmonitorChanged(gov.aps.jca.event.MonitorEvent arg0) voidoff()switch off beam monitoringvoidon()switch on beam monitoringvoidsetChannel(int channel) voidsetConsecutiveCountsAboveThreshold(int consecutiveCountsAboveThreshold) voidsetCountTime(double countTime) voidsetDetectorName(String detectorName) voidsetMonitorOn(boolean monitorOn) set beam monitor flagvoidsetThreshold(double threshold) voidsetWaitTime(int waitTime) Returns a string representation of the Scannable and its current position/value/statusMethods inherited from class gda.device.monitor.MonitorBase
asynchronousMoveTo, isBusyMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanEnd, atScanLineEnd, atScanLineStart, atScanStart, checkPositionValid, externalToInternal, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, internalToExternal, isAt, moveTo, rawAsynchronousMoveTo, rawGetPosition, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, stop, throwExceptionIfInvalidTarget, toString, validateScannable, valueUnavailableString, waitWhileBusy, waitWhileBusyMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, getAttribute, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gda.factory.Configurable
isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObserversMethods inherited from interface gda.device.Scannable
atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanEnd, atScanLineEnd, atScanLineStart, atScanStart, checkPositionValid, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, moveTo, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, stop, waitWhileBusy
-
Constructor Details
-
EpicsBeamMonitor
public EpicsBeamMonitor()Empty constructor for Castor configuration. -
EpicsBeamMonitor
public EpicsBeamMonitor(String detectorName, int channel, double threshold, int waitTime, int consecutiveCountsAboveThreshold, double countTime) Constructor- Parameters:
detectorName- the name of the detector instance.channel- the detector channel to use for beam monitoring.threshold- the threshold when the scan is paused/resumed.waitTime- the time (in secs) between successive monitors whilst the scan is paused.consecutiveCountsAboveThreshold- the number of successful readings above the threshold.countTime- the counting time.
-
-
Method Details
-
configure
Description copied from class:ConfigurableBaseDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
getThreshold
public double getThreshold()- Returns:
- Returns the threshold.
-
setThreshold
public void setThreshold(double threshold) - Parameters:
threshold- The threshold to set.
-
getWaitTime
public int getWaitTime()- Returns:
- Returns the waitTime.
-
setWaitTime
public void setWaitTime(int waitTime) - Parameters:
waitTime- The waitTime to set.
-
getConsecutiveCountsAboveThreshold
public int getConsecutiveCountsAboveThreshold()- Returns:
- Returns the consecutiveCountsAboveThreshold.
-
setConsecutiveCountsAboveThreshold
public void setConsecutiveCountsAboveThreshold(int consecutiveCountsAboveThreshold) - Parameters:
consecutiveCountsAboveThreshold- The consecutiveCountsAboveThreshold to set.
-
getCountTime
public double getCountTime()- Returns:
- Returns the countTime.
-
setCountTime
public void setCountTime(double countTime) - Parameters:
countTime- The countTime to set.
-
getDetectorName
- Returns:
- Returns the detectorName.
-
setDetectorName
- Parameters:
detectorName- The detectorName to set.
-
getChannel
public int getChannel()- Returns:
- Returns the channel.
-
setChannel
public void setChannel(int channel) - Parameters:
channel- The channel to set.
-
getPosition
Description copied from class:ScannableBaseReturns the current position of the Scannable. Called by ConcurentScan at the end of the point. Reads an internal (hardware) position from rawGetPosition, converts this to an external (user) position and returns it.- Specified by:
getPositionin interfaceScannable- Overrides:
getPositionin classScannableBase- Returns:
- Current position with an element for each input and extra field. null if their are no fields.
- Throws:
DeviceException
-
getElementCount
Description copied from interface:Monitorreturns the number of elements in this monitor.- Specified by:
getElementCountin interfaceMonitor- Overrides:
getElementCountin classMonitorBase- Returns:
- int the element count
- Throws:
DeviceException
-
getUnit
Description copied from interface:Monitorgets the physical unit of the monitor.- Specified by:
getUnitin interfaceMonitor- Overrides:
getUnitin classMonitorBase- Returns:
- String the physical unit
- Throws:
DeviceException
-
monitorChanged
public void monitorChanged(gov.aps.jca.event.MonitorEvent arg0) - Specified by:
monitorChangedin interfacegov.aps.jca.event.MonitorListener
-
isMonitorOn
public boolean isMonitorOn()checks beam monitor flag- Returns:
- boolean
-
setMonitorOn
public void setMonitorOn(boolean monitorOn) set beam monitor flag- Parameters:
monitorOn-
-
on
public void on()switch on beam monitoring -
off
public void off()switch off beam monitoring -
toFormattedString
Description copied from interface:ScannableReturns a string representation of the Scannable and its current position/value/statusTypically should return:
name : position
or for detectors, name : status
If the position/status cannot be determined, the function should return
Scannable.VALUE_UNAVAILABLEin its place.- Specified by:
toFormattedStringin interfaceScannable- Overrides:
toFormattedStringin classScannableBase- Returns:
- string as defined above
-