areaDetector  3-5-0
EPICS areaDetector framework
andorCCD.h
Go to the documentation of this file.
1 
12 #ifndef ANDORCCD_H
13 #define ANDORCCD_H
14 
15 #include <libxml/parser.h>
16 
17 #include "ADDriver.h"
18 #include "SPEHeader.h"
19 
20 #define MAX_ENUM_STRING_SIZE 26
21 #define MAX_ADC_SPEEDS 16
22 #define MAX_PREAMP_GAINS 16
23 #define MAX_VS_PERIODS 16
24 
25 #define AndorCoolerParamString "ANDOR_COOLER"
26 #define AndorTempStatusMessageString "ANDOR_TEMP_STAT"
27 #define AndorMessageString "ANDOR_MESSAGE"
28 #define AndorShutterModeString "ANDOR_SHUTTER_MODE"
29 #define AndorShutterExTTLString "ANDOR_SHUTTER_EXTTL"
30 #define AndorPalFileNameString "ANDOR_PAL_FILE_PATH"
31 #define AndorAccumulatePeriodString "ANDOR_ACCUMULATE_PERIOD"
32 #define AndorPreAmpGainString "ANDOR_PREAMP_GAIN"
33 #define AndorEmGainString "ANDOR_EM_GAIN"
34 #define AndorEmGainModeString "ANDOR_EM_GAIN_MODE"
35 #define AndorEmGainAdvancedString "ANDOR_EM_GAIN_ADVANCED"
36 #define AndorAdcSpeedString "ANDOR_ADC_SPEED"
37 #define AndorBaselineClampString "ANDOR_BASELINE_CLAMP"
38 #define AndorReadOutModeString "ANDOR_READOUT_MODE"
39 #define AndorFrameTransferModeString "ANDOR_FT_MODE"
40 #define AndorVerticalShiftPeriodString "ANDOR_VS_PERIOD"
41 
46 typedef struct {
47  int ADCIndex;
48  int AmpIndex;
50  float HSSpeed;
51  int BitDepth;
52  char *EnumString;
53  int EnumValue;
55 
60 typedef struct {
61  float Gain;
62  char *EnumString;
63  int EnumValue;
65 
66 /*
67  * Structure defining a Vertical Shift Period for the ADAndor driver.
68  */
69 typedef struct {
70  float Period;
71  int Index;
72  char *EnumString;
73  int EnumValue;
75 
80 class AndorCCD : public ADDriver {
81  public:
82  AndorCCD(const char *portName, const char *installPath, int cameraSerial, int shamrockID,
83  int maxBuffers, size_t maxMemory, int priority, int stackSize);
84  virtual ~AndorCCD();
85 
86  /* These are the methods that we override from ADDriver */
87  virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
88  virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
89  virtual void report(FILE *fp, int details);
90  virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[],
91  size_t nElements, size_t *nIn);
92 
93  // Should be private, but are called from C so must be public
94  void statusTask(void);
95  void dataTask(void);
96 
97  protected:
99  #define FIRST_ANDOR_PARAM AndorCoolerParam
115  #define LAST_ANDOR_PARAM AndorVerticalShiftPeriod
116 
117  private:
118 
119  unsigned int checkStatus(unsigned int returnStatus);
120  asynStatus setupAcquisition();
121  asynStatus setupShutter(int command);
122  void saveDataFrame(int frameNumber);
123  void setupADCSpeeds();
124  void setupPreAmpGains();
125  void setupVerticalShiftPeriods();
126  unsigned int SaveAsSPE(char *fullFileName);
130  static const epicsInt32 AImageFastKinetics;
131 
135  static const epicsUInt32 AASingle;
136  static const epicsUInt32 AAAccumulate;
137  static const epicsUInt32 AAKinetics;
138  static const epicsUInt32 AAFastKinetics;
139  static const epicsUInt32 AARunTillAbort;
140  static const epicsUInt32 AATimeDelayedInt;
141 
145  static const epicsUInt32 ATInternal;
146  static const epicsUInt32 ATExternal;
147  static const epicsUInt32 ATExternalStart;
148  static const epicsUInt32 ATExternalExposure;
149  static const epicsUInt32 ATExternalFVB;
150  static const epicsUInt32 ATSoftware;
151 
155  static const epicsUInt32 ASIdle;
156  static const epicsUInt32 ASTempCycle;
157  static const epicsUInt32 ASAcquiring;
158  static const epicsUInt32 ASAccumTimeNotMet;
159  static const epicsUInt32 ASKineticTimeNotMet;
160  static const epicsUInt32 ASErrorAck;
161  static const epicsUInt32 ASAcqBuffer;
162  static const epicsUInt32 ASSpoolError;
163 
167  static const epicsInt32 ARFullVerticalBinning;
168  static const epicsInt32 ARMultiTrack;
169  static const epicsInt32 ARRandomTrack;
170  static const epicsInt32 ARSingleTrack;
171  static const epicsInt32 ARImage;
172 
176  static const epicsInt32 AShutterFullyAuto;
177  static const epicsInt32 AShutterAlwaysOpen;
178  static const epicsInt32 AShutterAlwaysClosed;
179  static const epicsInt32 AShutterOpenFVP;
180  static const epicsInt32 AShutterOpenAny;
181 
185  static const epicsInt32 AFFTIFF;
186  static const epicsInt32 AFFBMP;
187  static const epicsInt32 AFFSIF;
188  static const epicsInt32 AFFEDF;
189  static const epicsInt32 AFFRAW;
190  static const epicsInt32 AFFFITS;
191  static const epicsInt32 AFFSPE;
192 
193  epicsEventId statusEvent;
194  epicsEventId dataEvent;
195  double mPollingPeriod;
196  double mFastPollingPeriod;
197  unsigned int mAcquiringData;
198  char *mInstallPath;
199  bool mExiting;
200 
204  int mNumAmps;
205  int mNumADCs;
206  int mNumADCSpeeds;
207  AndorADCSpeed_t mADCSpeeds[MAX_ADC_SPEEDS];
208  int mTotalPreAmpGains;
209  int mNumPreAmpGains;
210  AndorPreAmpGain_t mPreAmpGains[MAX_PREAMP_GAINS];
211 
212  // Vertical Shift Period parameters
213  int mTotalVSPeriods;
214  int mNumVSPeriods;
215  int mVSIndex;
216  float mVSPeriod;
217  AndorVSPeriod_t mVSPeriods[MAX_VS_PERIODS];
218 
219  //Shutter control parameters
220  float mAcquireTime;
221  float mAcquirePeriod;
222  float mAccumulatePeriod;
223  int mMinShutterOpenTime;
224  int mMinShutterCloseTime;
225 
226  // Shamrock spectrometer ID
227  int mShamrockId;
228 
229  // AndorCapabilities structure
230  AndorCapabilities mCapabilities;
231 
232  // EM Gain parameters
233  int mEmGainRangeLow;
234  int mEmGainRangeHigh;
235 
236  // SPE file header
237  tagCSMAHEAD *mSPEHeader;
238  xmlDocPtr mSPEDoc;
239 
240  // Camera init status
241  bool mInitOK;
242 };
243 
244 #define NUM_ANDOR_DET_PARAMS ((int)(&LAST_ANDOR_PARAM - &FIRST_ANDOR_PARAM + 1))
245 
246 #endif //ANDORCCD_H
247 
int BitDepth
Definition: andorCCD.h:51
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:141
float Period
Definition: andorCCD.h:70
Definition: SPEHeader.h:101
void dataTask(void)
Do data readout from the detector.
Definition: andorCCD.cpp:1376
int AndorVerticalShiftPeriod
Definition: andorCCD.h:114
int AndorTempStatusMessage
Definition: andorCCD.h:100
int AndorPreAmpGain
Definition: andorCCD.h:106
int Index
Definition: andorCCD.h:71
int AndorShutterMode
Definition: andorCCD.h:102
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:114
Structure defining a pre-amp gain for the ADAndor driver.
Definition: andorCCD.h:60
int AndorFrameTransferMode
Definition: andorCCD.h:113
#define MAX_VS_PERIODS
Definition: andorCCD.h:23
virtual ~AndorCCD()
Destructor.
Definition: andorCCD.cpp:351
char * EnumString
Definition: andorCCD.h:72
list value
Definition: makeDbAndEdl.py:234
int HSSpeedIndex
Definition: andorCCD.h:49
int EnumValue
Definition: andorCCD.h:73
int AmpIndex
Definition: andorCCD.h:48
int ADCIndex
Definition: andorCCD.h:47
int AndorShutterExTTL
Definition: andorCCD.h:103
int AndorPalFileName
Definition: andorCCD.h:104
float HSSpeed
Definition: andorCCD.h:50
char * portName
The name of this asyn port.
Definition: asynPortDriver.h:179
char * EnumString
Definition: andorCCD.h:62
int AndorReadOutMode
Definition: andorCCD.h:112
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
Called when asyn clients call pasynFloat64->write().
Definition: andorCCD.cpp:748
int AndorMessage
Definition: andorCCD.h:101
#define MAX_PREAMP_GAINS
Definition: andorCCD.h:22
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Called when asyn clients call pasynInt32->write().
Definition: andorCCD.cpp:610
int EnumValue
Definition: andorCCD.h:53
Driver for Andor CCD cameras using version 2 of their SDK; inherits from ADDriver class in ADCore.
Definition: andorCCD.h:80
float Gain
Definition: andorCCD.h:61
int AndorCoolerParam
Definition: andorCCD.h:98
void statusTask(void)
Update status of detector.
Definition: andorCCD.cpp:984
int AndorBaselineClamp
Definition: andorCCD.h:111
int AndorEmGainMode
Definition: andorCCD.h:108
#define MAX_ADC_SPEEDS
Definition: andorCCD.h:21
virtual void report(FILE *fp, int details)
Report status of the driver.
Definition: andorCCD.cpp:514
Structure defining an ADC speed for the ADAndor driver.
Definition: andorCCD.h:46
int AndorAdcSpeed
Definition: andorCCD.h:110
int AndorAccumulatePeriod
Definition: andorCCD.h:105
int AndorEmGainAdvanced
Definition: andorCCD.h:109
virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn)
Called when asyn clients call pasynEnum->read().
Definition: andorCCD.cpp:419
int AndorEmGain
Definition: andorCCD.h:107
int EnumValue
Definition: andorCCD.h:63
char * EnumString
Definition: andorCCD.h:52
Definition: andorCCD.h:69