areaDetector  3-12-1
EPICS areaDetector framework
Public Member Functions | List of all members
ADnEDTransform Class Reference

Library of functions to use for transforming the time of flight value into another parameter (for example dspace). More...

#include <ADnEDTransform.h>

Inheritance diagram for ADnEDTransform:

Public Member Functions

 ADnEDTransform ()
 Constructor. More...
virtual ~ADnEDTransform ()
 Destructor. More...
epicsFloat64 calculate (epicsUInt32 type, epicsUInt32 pixelID, epicsUInt32 tof) const
 Transform the time of flight value into a another parameter. More...
- Public Member Functions inherited from ADnEDTransformBase
 ADnEDTransformBase ()
 ADnEDTransform base class. More...
virtual ~ADnEDTransformBase ()
 Destructor. More...
int setIntParam (epicsUInt32 paramIndex, epicsUInt32 paramVal)
 Set integer param. More...
int setDoubleParam (epicsUInt32 paramIndex, epicsFloat64 paramVal)
 Set double param. More...
int setDoubleArray (epicsUInt32 paramIndex, const epicsFloat64 *pSource, epicsUInt32 size)
 Set array of doubles. More...
void printParams (void) const
 For debug, print all to stdout. More...
void setDebug (bool debug)

Additional Inherited Members

- Protected Attributes inherited from ADnEDTransformBase
epicsFloat64 m_doubleParam [ADNED_MAX_TRANSFORM_PARAMS]
epicsFloat64 * p_Array [ADNED_MAX_TRANSFORM_PARAMS]
bool m_debug

Detailed Description

Library of functions to use for transforming the time of flight value into another parameter (for example dspace).

The code is compiled into a seperate library and linked in with the ADnED IOC application. This makes it easy to modify or swap out with a different library. The library must be thread safe, and only one instance should be created per detector instance. It does depend on the ADnEDGlobals.h file.

Objects of this class have a range of parameters and arrays for use in the calculations. They are set by ADnED. Array storage is managed internally. The size of the arrays must be equal to the pixel ID range size for a particular detector.

The internal parameters that can be set, which are used in the calculations are: N * epicsUInt32 parameters N * epicsFloat64 parameters N * arrays of type epicsFloat64

The documentation for each calculation type will specify which parameter is used.

Matt Pearson
April 2015

Constructor & Destructor Documentation

◆ ADnEDTransform()

ADnEDTransform::ADnEDTransform ( void  )


◆ ~ADnEDTransform()

ADnEDTransform::~ADnEDTransform ( void  )


Member Function Documentation

◆ calculate()

epicsFloat64 ADnEDTransform::calculate ( epicsUInt32  type,
epicsUInt32  pixelID,
epicsUInt32  tof 
) const

Transform the time of flight value into a another parameter.

The calculation used is specified by the type input param. The associated pixel ID is required for any calculation involving a pixelID based lookup in an array.

Note: this could be a static factory method, returning ADnEDTransformBase objects

Transform types are:

ADNED_TRANSFORM_TYPE1 - multiply the TOF by a pixel ID lookup in doubleArray[0]. Can be used for fixed geometry instruments to calculate dspace. Can be used on Vulcan for example.

ADNED_TRANSFORM_TYPE2 - calculate dspace where the theta angle changes. Used for direct geometry instruments like Hyspec. NOTE: not sure how this works yet.

ADNED_TRANSFORM_TYPE3 - calculate deltaE for indirect geometry instruments for their inelastic detectors. This uses an equation which depends on the mass of the neutron, L1, an array of L2 and an array of Ef. The final energy per-pixelID, Ef, is known because of the use of mirrors to select energy. We can calculate incident energy using the known final energy and the TOF. So we are calculating energy transfer for each event.

deltaE = (1/2)Mn * (L1 / (TOF - (L2*sqrt(Mn/(2*Ef))) ) )**2 - Ef where: Mn = mass of neutron in 1.674954 × 10-27 L1 = constant (in meters) Ef and L2 are double arrays based on pixelID. The Ef input array must be in units of MeV. The L2 array is in meters. TOF = time of flight (in seconds)

Energy must be in Joules (1 eV = 1.602176565(35) × 10−19 J)

Once the deltaE has been obtained in Joules, it is converted back to MeV.

Implements ADnEDTransformBase.

The documentation for this class was generated from the following files: