Class XmapDetectorFromEpicsMca

All Implemented Interfaces:
Detector, NexusDetector, Device, Scannable, XmapDetector, Configurable, Findable, gda.observable.IObservable, Serializable

public class XmapDetectorFromEpicsMca extends DetectorBase implements XmapDetector, NexusDetector
An XmapDetector made from a number of Mca's (technically Analysers).
See Also:
  • Constructor Details

    • XmapDetectorFromEpicsMca

      public XmapDetectorFromEpicsMca()
  • Method Details

    • isUseConfigFileAtConfigure

      public boolean isUseConfigFileAtConfigure()
    • setUseConfigFileAtConfigure

      public void setUseConfigFileAtConfigure(boolean useConfigFileAtConfigure)
    • isPrefixExtraNameWithDetElement

      public boolean isPrefixExtraNameWithDetElement()
    • setPrefixExtraNameWithDetElement

      public void setPrefixExtraNameWithDetElement(boolean prefixExtraNameWithDetElement)
      Parameters:
      prefixExtraNameWithDetElement - If true the extraName for each roi is set to detector name + "_" + roiName. If false the extraName is simply the name of the roi. Default is true if true
    • isReadConfigFromDeviceAtScanStart

      public boolean isReadConfigFromDeviceAtScanStart()
    • setReadConfigFromDeviceAtScanStart

      public void setReadConfigFromDeviceAtScanStart(boolean readConfigFromDeviceAtScanStart)
      Readout requires vortexParameters to be defined. If readConfigFromDeviceAtScanStart is true then this parameter is set aat atScanStart by reading from the device. This allows roi's to be defined ont he device itself rather than having to edit the configFile. Default value is false;
      Parameters:
      readConfigFromDeviceAtScanStart -
    • isReportInvalidROI

      protected boolean isReportInvalidROI()
    • setReportInvalidROI

      protected void setReportInvalidROI(boolean reportInvalidROI)
    • isReturnFullSpectrum

      protected boolean isReturnFullSpectrum()
    • setReturnFullSpectrum

      protected void setReturnFullSpectrum(boolean returnFullSpectrum)
    • toJavaNativeDoubleArray

      public static double[][] toJavaNativeDoubleArray(List<List<Double>> ll)
      To aid debugging with mocks from java
    • setAnalysers

      public void setAnalysers(List<Analyser> analysers)
    • getAnalysers

      public List<Analyser> getAnalysers()
    • getConfigFileName

      public String getConfigFileName()
    • setConfigFileName

      public void setConfigFileName(String configFileName)
    • setSumAllElementData

      public void setSumAllElementData(boolean sumAllElementData)
    • isSumAllElementData

      public boolean isSumAllElementData()
    • setReadNetCounts

      public void setReadNetCounts(boolean readNetCounts)
    • isReadNetCounts

      public boolean isReadNetCounts()
    • setUseLiveTime

      public void setUseLiveTime(boolean useLiveTime)
    • isUseLiveTime

      public boolean isUseLiveTime()
    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default 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:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • getNumberOfMca

      public int getNumberOfMca() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the number of MCAs currently connected to the XMap detector
      Specified by:
      getNumberOfMca in interface XmapDetector
      Returns:
      number of MCA
      Throws:
      DeviceException
    • loadConfigurationFromFile

      public void loadConfigurationFromFile() throws Exception
      Throws:
      Exception
    • configureHardware

      public void configureHardware(VortexParameters vortexParameters) throws Exception
      Throws:
      Exception
    • readConfigFile

      public VortexParameters readConfigFile(String fileName) throws Exception
      Throws:
      Exception
    • getChannelLabels

      public List<String> getChannelLabels()
      Description copied from interface: XmapDetector
      Lightly to be only implemented on the server.
      Specified by:
      getChannelLabels in interface XmapDetector
      Returns:
      the labels for the channels defined by the user.
    • clear

      public void clear() throws DeviceException
      Description copied from interface: XmapDetector
      Clear all MCA's
      Specified by:
      clear in interface XmapDetector
      Throws:
      DeviceException
    • start

      public void start() throws DeviceException
      Description copied from interface: XmapDetector
      Start data acquisition in all MCA's
      Specified by:
      start in interface XmapDetector
      Throws:
      DeviceException
    • clearAndStart

      public void clearAndStart() throws DeviceException
      Description copied from interface: XmapDetector
      Clears all MCAs and starts data collection
      Specified by:
      clearAndStart in interface XmapDetector
      Throws:
      DeviceException
    • setCollectionTime

      public void setCollectionTime(double collectionTime) throws DeviceException
      Description copied from interface: Detector
      Sets the collection time, in seconds, to be used during the next call of collectData.
      Specified by:
      setCollectionTime in interface Detector
      Overrides:
      setCollectionTime in class DetectorBase
      Parameters:
      collectionTime - the collection time in seconds
      Throws:
      DeviceException
    • getCollectionTime

      public double getCollectionTime()
      Description copied from interface: Detector
      Returns the time, in seconds, the detector collects for during the next call to collectData()
      Specified by:
      getCollectionTime in interface Detector
      Overrides:
      getCollectionTime in class DetectorBase
      Returns:
      double
    • collectData

      public void collectData() throws DeviceException
      Description copied from interface: Detector
      Tells the detector to begin to collect a set of data, then returns immediately. Should cause the hardware to start collecting immediately: if there is any delay then detectors used in the same scan would collect over different times when beam conditions may differ.
      Specified by:
      collectData in interface Detector
      Throws:
      DeviceException
    • stop

      public void stop() throws DeviceException
      Description copied from class: ScannableBase
      Stop the current move/operation. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
      Specified by:
      stop in interface Scannable
      Specified by:
      stop in interface XmapDetector
      Overrides:
      stop in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • setNumberOfBins

      public void setNumberOfBins(int numberOfBins) throws DeviceException
      Description copied from interface: XmapDetector
      Sets maximum numbers of bins/channels to use for spectrum acquisition in each MCA
      Specified by:
      setNumberOfBins in interface XmapDetector
      Parameters:
      numberOfBins -
      Throws:
      DeviceException
    • getNumberOfBins

      public int getNumberOfBins() throws DeviceException
      Description copied from interface: XmapDetector
      Returns current number of Bins/channels for spectrum acquisition in each MCA
      Specified by:
      getNumberOfBins in interface XmapDetector
      Returns:
      numberOfBins
      Throws:
      DeviceException
    • setAcquisitionTime

      public void setAcquisitionTime(double time) throws DeviceException
      Description copied from interface: XmapDetector
      Tells the detector for how many seconds to acquire data
      Specified by:
      setAcquisitionTime in interface XmapDetector
      Parameters:
      time -
      Throws:
      DeviceException
    • getAcquisitionTime

      public double getAcquisitionTime() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the time for which the detector is set to acquire data
      Specified by:
      getAcquisitionTime in interface XmapDetector
      Returns:
      time
      Throws:
      DeviceException
    • getRealTime

      public double getRealTime() throws DeviceException
      This implementation simply returns the acquisition time. The analyser will determine which to use when its setCollectionTime method is called.
      Specified by:
      getRealTime in interface XmapDetector
      Returns:
      real time
      Throws:
      DeviceException
    • createsOwnFiles

      public boolean createsOwnFiles() throws DeviceException
      Description copied from interface: Detector
      Returns a value which indicates whether the detector creates its own files. If it does (return true) the readout() method returns the name of the latest file created as a string. If it does not (return false) the readout() method will return the data directly.
      Specified by:
      createsOwnFiles in interface Detector
      Returns:
      true if readout() returns filenames
      Throws:
      DeviceException
    • getStatus

      public int getStatus() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the status of the detector
      Specified by:
      getStatus in interface Detector
      Specified by:
      getStatus in interface XmapDetector
      Returns:
      Detector.IDLE/BUSY
      Throws:
      DeviceException
    • getData

      public int[][] getData() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the data array of all the MCAs
      Specified by:
      getData in interface XmapDetector
      Returns:
      array of data arrays
      Throws:
      DeviceException
    • getData

      public int[] getData(int mcaNumber) throws DeviceException
      Description copied from interface: XmapDetector
      Returns the data array of the specified MCA
      Specified by:
      getData in interface XmapDetector
      Parameters:
      mcaNumber -
      Returns:
      data array
      Throws:
      DeviceException
    • getDataDimensions

      public int[] getDataDimensions() throws DeviceException
      Description copied from class: DetectorBase
      Default which should be overridden by subclasses.
      Specified by:
      getDataDimensions in interface Detector
      Overrides:
      getDataDimensions in class DetectorBase
      Returns:
      the dimensions of the data object returned by the Detector.readout() method
      Throws:
      DeviceException
      See Also:
    • atScanStart

      public void atScanStart() throws DeviceException
      Description copied from class: ScannableBase
      Called for every Scannable at the start of a group of nested scans (or a single scan if that is the case) Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
      Specified by:
      atScanStart in interface Scannable
      Overrides:
      atScanStart in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • readout

      public NexusTreeProvider readout() throws DeviceException
      Description copied from interface: Detector
      Returns the latest data collected. The size of the Object returned must be consistent with the values returned by getDataDimensions and getExtraNames.

      If LocalProperties.GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY is true then motors may be moved while the detector readouts. The value returned must not be effected by any concurrent motor or shutter movements. See Detector.waitWhileBusy() and ConcurrentScan. Readout must block until the detector is ready to respond quickly to Detector.collectData() again.

      Specified by:
      readout in interface Detector
      Specified by:
      readout in interface NexusDetector
      Returns:
      the data collected
      Throws:
      DeviceException
    • readoutScalerData

      public double readoutScalerData() throws DeviceException
      Description copied from interface: XmapDetector
      Reads out the scaler data of the roi counts, corrects for deadtime and returns the sum.
      Specified by:
      readoutScalerData in interface XmapDetector
      Returns:
      The FF data
      Throws:
      DeviceException
    • getROIsSum

      public double[] getROIsSum() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the sum of the corresponding ROIs of all the MCA. For e.g if the MCAs have three ROIs each say R0, R1 and R2. This method sums up the R0 of all the MCA R1 of all the MCAs and so on
      Specified by:
      getROIsSum in interface XmapDetector
      Returns:
      ROI sum array
      Throws:
      DeviceException
    • setNthROI

      public void setNthROI(double[][] rois, int roiIndex) throws DeviceException
      Description copied from interface: XmapDetector
      Sets a ROI for all of the MCAs
      Specified by:
      setNthROI in interface XmapDetector
      Parameters:
      rois - This array length should be same as the number of MCAs
      roiIndex -
      Throws:
      DeviceException
    • setROIs

      public void setROIs(double[][] rois) throws DeviceException
      Description copied from interface: XmapDetector
      Sets the ROIs of all the MCA. Use this method only if you want to set all the MCA with the same ROIs.To set different ROI for each of the MCA use setNthROI method.
      Specified by:
      setROIs in interface XmapDetector
      Parameters:
      rois - array. Each roi should have a low and high value.
      Throws:
      DeviceException
    • getNumberOfROIs

      public int getNumberOfROIs() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the total number of ROIs currently set
      Specified by:
      getNumberOfROIs in interface XmapDetector
      Returns:
      number of ROIs
      Throws:
      DeviceException
    • getROICounts

      public double[] getROICounts(int iRoi) throws DeviceException
      Description copied from interface: XmapDetector
      Gets the count for each mca for a given ROI.
      Specified by:
      getROICounts in interface XmapDetector
      Parameters:
      iRoi -
      Returns:
      double[] of counts per mca for this roi
      Throws:
      DeviceException
    • getExtraNames

      public String[] getExtraNames()
      Description copied from interface: Scannable
      Additional names for extra values that returned by getPosition().
      Specified by:
      getExtraNames in interface Scannable
      Overrides:
      getExtraNames in class ScannableBase
      Returns:
      array of names of the extra elements if the array returned by getPosition is larger than the array required by moveTo
    • getOutputFormat

      public String[] getOutputFormat()
      Description copied from interface: Scannable
      Returns an array of strings which are the format strings to use when pretty printing parts of the output
      Specified by:
      getOutputFormat in interface Scannable
      Overrides:
      getOutputFormat in class ScannableBase
      Returns:
      string array
    • getDescription

      public String getDescription() throws DeviceException
      Specified by:
      getDescription in interface Detector
      Overrides:
      getDescription in class DetectorBase
      Returns:
      A description of the detector.
      Throws:
      DeviceException
    • getDetectorID

      public String getDetectorID() throws DeviceException
      Specified by:
      getDetectorID in interface Detector
      Overrides:
      getDetectorID in class DetectorBase
      Returns:
      A identifier for this detector.
      Throws:
      DeviceException
    • getDetectorType

      public String getDetectorType() throws DeviceException
      Specified by:
      getDetectorType in interface Detector
      Overrides:
      getDetectorType in class DetectorBase
      Returns:
      The type of detector.
      Throws:
      DeviceException
    • setStatusRate

      public void setStatusRate(double statusRate) throws DeviceException
      Description copied from interface: XmapDetector
      Sets the rate at which status is read in the Epics interface
      Specified by:
      setStatusRate in interface XmapDetector
      Parameters:
      statusRate -
      Throws:
      DeviceException
    • getStatusRate

      public double getStatusRate() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the current set rate at which status is read in the Epics interface
      Specified by:
      getStatusRate in interface XmapDetector
      Returns:
      status rate
      Throws:
      DeviceException
    • setReadRate

      public void setReadRate(double readRate) throws DeviceException
      Description copied from interface: XmapDetector
      Sets the rate at which data is read in the Epics interface
      Specified by:
      setReadRate in interface XmapDetector
      Parameters:
      readRate -
      Throws:
      DeviceException
    • getReadRate

      public double getReadRate() throws DeviceException
      Description copied from interface: XmapDetector
      Returns the current rate at which data is read in the Epics interface
      Specified by:
      getReadRate in interface XmapDetector
      Returns:
      readRate
      Throws:
      DeviceException
    • createVortexParameters

      public VortexParameters createVortexParameters() throws Exception
      Throws:
      Exception
    • waitWhileBusy

      public void waitWhileBusy() throws DeviceException, InterruptedException
      Description copied from class: ScannableBase
      Returns when operation carried out by moveTo has completed If this is to be overriden, isBusy must also be valid. Although the pos and scan command currently use this method to determine if the Scannable is busy, this must not be relied upon.
      Specified by:
      waitWhileBusy in interface Detector
      Specified by:
      waitWhileBusy in interface Scannable
      Overrides:
      waitWhileBusy in class ScannableBase
      Throws:
      DeviceException
      InterruptedException