areaDetector  3-14
EPICS areaDetector framework
andorCCD.h
Go to the documentation of this file.
1 
13 #ifndef ANDORCCD_H
14 #define ANDORCCD_H
15 
16 #include <libxml/parser.h>
17 #include <CCDMultiTrack.h>
18 
19 #include "ADDriver.h"
20 #include "SPEHeader.h"
21 
22 #define MAX_ENUM_STRING_SIZE 26
23 #define MAX_ADC_SPEEDS 16
24 #define MAX_PREAMP_GAINS 16
25 #define MAX_VS_PERIODS 16
26 
27 #define AndorCoolerParamString "ANDOR_COOLER"
28 #define AndorTempStatusMessageString "ANDOR_TEMP_STAT"
29 #define AndorMessageString "ANDOR_MESSAGE"
30 #define AndorShutterModeString "ANDOR_SHUTTER_MODE"
31 #define AndorShutterExTTLString "ANDOR_SHUTTER_EXTTL"
32 #define AndorPalFileNameString "ANDOR_PAL_FILE_PATH"
33 #define AndorAccumulatePeriodString "ANDOR_ACCUMULATE_PERIOD"
34 #define AndorPreAmpGainString "ANDOR_PREAMP_GAIN"
35 #define AndorEmGainString "ANDOR_EM_GAIN"
36 #define AndorEmGainModeString "ANDOR_EM_GAIN_MODE"
37 #define AndorEmGainAdvancedString "ANDOR_EM_GAIN_ADVANCED"
38 #define AndorAdcSpeedString "ANDOR_ADC_SPEED"
39 #define AndorBaselineClampString "ANDOR_BASELINE_CLAMP"
40 #define AndorReadOutModeString "ANDOR_READOUT_MODE"
41 #define AndorFrameTransferModeString "ANDOR_FT_MODE"
42 #define AndorVerticalShiftPeriodString "ANDOR_VS_PERIOD"
43 #define AndorVerticalShiftAmplitudeString "ANDOR_VS_AMPLITUDE"
44 
49 typedef struct {
50  int ADCIndex;
51  int AmpIndex;
53  float HSSpeed;
54  int BitDepth;
55  char *EnumString;
56  int EnumValue;
58 
63 typedef struct {
64  float Gain;
65  char *EnumString;
66  int EnumValue;
68 
69 /*
70  * Structure defining a Vertical Shift Period for the ADAndor driver.
71  */
72 typedef struct {
73  float Period;
74  int Index;
75  char *EnumString;
76  int EnumValue;
78 
83 class AndorCCD : public ADDriver {
84  public:
85  AndorCCD(const char *portName, const char *installPath, int cameraSerial, int shamrockID,
86  int maxBuffers, size_t maxMemory, int priority, int stackSize);
87  virtual ~AndorCCD();
88 
89  /* These are the methods that we override from ADDriver */
90  virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
91  virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
92  virtual asynStatus writeInt32Array(asynUser *pasynUser, epicsInt32 *value, size_t nElements);
93  virtual void report(FILE *fp, int details);
94  virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[],
95  size_t nElements, size_t *nIn);
96 
97  // Should be private, but are called from C so must be public
98  void statusTask(void);
99  void dataTask(void);
100 
101  protected:
103 #define FIRST_ANDOR_PARAM AndorCoolerParam
120 #define LAST_ANDOR_PARAM AndorVerticalShiftAmplitude
121 
122  private:
123 
124  unsigned int checkStatus(unsigned int returnStatus);
125  asynStatus setupAcquisition();
126  asynStatus setupShutter(int command);
127  void saveDataFrame(int frameNumber);
128  void setupADCSpeeds();
129  void setupTrackDefn(int minX, int sizeX, int binX);
130  void setupPreAmpGains();
131  void setupVerticalShiftPeriods();
132  unsigned int SaveAsSPE(char *fullFileName);
136  static const epicsInt32 AImageFastKinetics;
137 
141  static const epicsUInt32 AASingle;
142  static const epicsUInt32 AAAccumulate;
143  static const epicsUInt32 AAKinetics;
144  static const epicsUInt32 AAFastKinetics;
145  static const epicsUInt32 AARunTillAbort;
146  static const epicsUInt32 AATimeDelayedInt;
147 
151  static const epicsUInt32 ATInternal;
152  static const epicsUInt32 ATExternal;
153  static const epicsUInt32 ATExternalStart;
154  static const epicsUInt32 ATExternalExposure;
155  static const epicsUInt32 ATExternalFVB;
156  static const epicsUInt32 ATSoftware;
157 
161  static const epicsUInt32 ASIdle;
162  static const epicsUInt32 ASTempCycle;
163  static const epicsUInt32 ASAcquiring;
164  static const epicsUInt32 ASAccumTimeNotMet;
165  static const epicsUInt32 ASKineticTimeNotMet;
166  static const epicsUInt32 ASErrorAck;
167  static const epicsUInt32 ASAcqBuffer;
168  static const epicsUInt32 ASSpoolError;
169 
173  static const epicsInt32 ARFullVerticalBinning;
174  static const epicsInt32 ARMultiTrack;
175  static const epicsInt32 ARRandomTrack;
176  static const epicsInt32 ARSingleTrack;
177  static const epicsInt32 ARImage;
178 
182  static const epicsInt32 AShutterFullyAuto;
183  static const epicsInt32 AShutterAlwaysOpen;
184  static const epicsInt32 AShutterAlwaysClosed;
185  static const epicsInt32 AShutterOpenFVP;
186  static const epicsInt32 AShutterOpenAny;
187 
191  static const epicsInt32 AFFTIFF;
192  static const epicsInt32 AFFBMP;
193  static const epicsInt32 AFFSIF;
194  static const epicsInt32 AFFEDF;
195  static const epicsInt32 AFFRAW;
196  static const epicsInt32 AFFFITS;
197  static const epicsInt32 AFFSPE;
198 
199  epicsEventId statusEvent;
200  epicsEventId dataEvent;
201  double mPollingPeriod;
202  double mFastPollingPeriod;
203  unsigned int mAcquiringData;
204  char *mInstallPath;
205  bool mExiting;
206  int mExited;
207 
211  int mNumAmps;
212  int mNumADCs;
213  int mNumADCSpeeds;
214  AndorADCSpeed_t mADCSpeeds[MAX_ADC_SPEEDS];
215  int mTotalPreAmpGains;
216  int mNumPreAmpGains;
217  AndorPreAmpGain_t mPreAmpGains[MAX_PREAMP_GAINS];
218 
219  // Vertical Shift Period parameters
220  int mTotalVSPeriods;
221  int mNumVSPeriods;
222  int mVSIndex;
223  float mVSPeriod;
224  AndorVSPeriod_t mVSPeriods[MAX_VS_PERIODS];
225 
226  //Shutter control parameters
227  float mAcquireTime;
228  float mAcquirePeriod;
229  float mAccumulatePeriod;
230  int mMinShutterOpenTime;
231  int mMinShutterCloseTime;
232 
233  // Shamrock spectrometer ID
234  int mShamrockId;
235 
236  // AndorCapabilities structure
237  AndorCapabilities mCapabilities;
238 
239  CCDMultiTrack mMultiTrack;
240 
241  // EM Gain parameters
242  int mEmGainRangeLow;
243  int mEmGainRangeHigh;
244 
245  // SPE file header
246  tagCSMAHEAD *mSPEHeader;
247  xmlDocPtr mSPEDoc;
248 
249  // Camera init status
250  bool mInitOK;
251 };
252 
253 #endif //ANDORCCD_H
#define MAX_PREAMP_GAINS
Definition: andorCCD.h:24
#define MAX_ADC_SPEEDS
Definition: andorCCD.h:23
#define MAX_VS_PERIODS
Definition: andorCCD.h:25
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:132
Driver for Andor CCD cameras using version 2 of their SDK; inherits from ADDriver class in ADCore.
Definition: andorCCD.h:83
virtual ~AndorCCD()
Destructor.
Definition: andorCCD.cpp:374
virtual asynStatus writeInt32Array(asynUser *pasynUser, epicsInt32 *value, size_t nElements)
Definition: andorCCD.cpp:930
int AndorShutterExTTL
Definition: andorCCD.h:107
int AndorVerticalShiftAmplitude
Definition: andorCCD.h:119
int AndorFrameTransferMode
Definition: andorCCD.h:117
int AndorEmGainAdvanced
Definition: andorCCD.h:113
int AndorAccumulatePeriod
Definition: andorCCD.h:109
int AndorEmGainMode
Definition: andorCCD.h:112
int AndorMessage
Definition: andorCCD.h:105
int AndorPreAmpGain
Definition: andorCCD.h:110
int AndorEmGain
Definition: andorCCD.h:111
void dataTask(void)
Do data readout from the detector.
Definition: andorCCD.cpp:1522
int AndorAdcSpeed
Definition: andorCCD.h:114
virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn)
Definition: andorCCD.cpp:456
int AndorReadOutMode
Definition: andorCCD.h:116
int AndorCoolerParam
Definition: andorCCD.h:102
int AndorVerticalShiftPeriod
Definition: andorCCD.h:118
int AndorBaselineClamp
Definition: andorCCD.h:115
virtual void report(FILE *fp, int details)
Report status of the driver.
Definition: andorCCD.cpp:551
void statusTask(void)
Update status of detector.
Definition: andorCCD.cpp:1112
int AndorPalFileName
Definition: andorCCD.h:108
AndorCCD(const char *portName, const char *installPath, int cameraSerial, int shamrockID, int maxBuffers, size_t maxMemory, int priority, int stackSize)
Constructor for Andor driver; most parameters are simply passed to ADDriver::ADDriver.
Definition: andorCCD.cpp:115
int AndorShutterMode
Definition: andorCCD.h:106
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
Called when asyn clients call pasynFloat64->write().
Definition: andorCCD.cpp:802
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Called when asyn clients call pasynInt32->write().
Definition: andorCCD.cpp:647
int AndorTempStatusMessage
Definition: andorCCD.h:104
Area Detector class enabling multi-ROI driver for the Andor CCD.
Definition: CCDMultiTrack.h:19
list value
Definition: makeDbAndEdl.py:234
Structure defining an ADC speed for the ADAndor driver.
Definition: andorCCD.h:49
int BitDepth
Definition: andorCCD.h:54
float HSSpeed
Definition: andorCCD.h:53
char * EnumString
Definition: andorCCD.h:55
int HSSpeedIndex
Definition: andorCCD.h:52
int EnumValue
Definition: andorCCD.h:56
int ADCIndex
Definition: andorCCD.h:50
int AmpIndex
Definition: andorCCD.h:51
Structure defining a pre-amp gain for the ADAndor driver.
Definition: andorCCD.h:63
char * EnumString
Definition: andorCCD.h:65
int EnumValue
Definition: andorCCD.h:66
float Gain
Definition: andorCCD.h:64
Definition: andorCCD.h:72
int Index
Definition: andorCCD.h:74
float Period
Definition: andorCCD.h:73
char * EnumString
Definition: andorCCD.h:75
int EnumValue
Definition: andorCCD.h:76
Definition: SPEHeader.h:101