From 586c664a4370e737bfe2157e66ccfa78ede6ff83 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 3 Oct 2018 11:57:18 +0200 Subject: [PATCH] client multi.h comments and some signature updated --- .../multiSlsDetector/multiSlsDetector.h | 196 ++++++++++++++---- 1 file changed, 156 insertions(+), 40 deletions(-) diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index 3bf3d5bff..2f4d454a4 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -288,12 +288,14 @@ public: /** * Checks error mask and returns error message and its severity if it exists * @param critical is 1 if any of the messages is critical + * @param detPos -1 for all detectors in list or specific detector position * @returns error message else an empty std::string */ std::string getErrorMessage(int &critical, int detPos = -1); /** * Clears error mask of both multi and sls + * @param detPos -1 for all detectors in list or specific detector position * @returns error mask */ int64_t clearAllErrorMask(int detPos = -1); @@ -326,6 +328,7 @@ public: * Check version compatibility with detector/receiver software * (if hostname/rx_hostname has been set/ sockets created) * @param p port type control port or receiver port + * @param detPos -1 for all detectors in list or specific detector position * @returns FAIL for incompatibility, OK for compatibility */ int checkVersionCompatibility(portType t, int detPos = -1); @@ -333,21 +336,21 @@ public: /** * Get ID or version numbers * @param mode version type - * @param imod module number in entire module list (gets decoded) (-1 for all) + * @param detPos -1 for all detectors in list or specific detector position * @returns Id or version number of that type */ int64_t getId(idMode mode, int detPos = -1); /** * Get sls detector object from position in detectors array - * @param pos position in detectors array + * @param detPos -1 for all detectors in list or specific detector position * @returns pointer to sls detector object */ slsDetector* getSlsDetector(int detPos = -1); /** * Accessing the sls detector from the multi list using position - * @param pos position in the multi list + * @param detPos -1 for all detectors in list or specific detector position * @returns slsDetector object */ slsDetector *operator()(int detPos = -1) const; @@ -356,6 +359,7 @@ public: * Free shared memory from the command line * avoiding creating the constructor classes and mapping * @param multiId multi detector Id + * @param detPos -1 for all detectors in list or specific detector position */ static void freeSharedMemory(int multiId, int detPos = -1); @@ -364,6 +368,7 @@ public: * occupied by the sharedMultiSlsDetector structure * Clears all the vectors and destroys threadpool to bring * object back to state before object creation amap + * @param detPos -1 for all detectors in list or specific detector position */ void freeSharedMemory(int detPos = -1); @@ -377,13 +382,14 @@ public: * Sets the hostname of all sls detectors in shared memory * Connects to them to set up online flag * @param name concatenated hostname of all the sls detectors + * @param detPos -1 for all detectors in list or specific detector position */ void setHostname(const char* name, int detPos = -1); /** * Gets the hostname of detector at particular position * or concatenated hostnames of all the sls detectors - * @param pos position of detector in array, -1 for all detectors + * @param detPos -1 for all detectors in list or specific detector position * @returns concatenated hostnames of all detectors or hostname of specific one */ std::string getHostname(int detPos = -1); @@ -399,7 +405,7 @@ public: using slsDetectorBase::getDetectorType; /** * Get Detector type for a particular sls detector or get the first one - * @param pos position of sls detector in array, if -1, returns first detector type + * @param detPos -1 for all detectors in list or specific detector position * @returns detector type of sls detector in position pos, if -1, returns the first det type */ detectorType getDetectorsType(int detPos = -1); @@ -407,7 +413,7 @@ public: /** * Concatenates string types of all sls detectors or * returns the detector type of the first sls detector - * @param pos position of sls detector in array, if -1, returns first detector type + * @param detPos -1 for all detectors in list or specific detector position * @returns detector type of sls detector in position pos, if -1, concatenates */ std::string sgetDetectorsType(int detPos = -1); @@ -416,6 +422,7 @@ public: * Just to overload getDetectorType from users * Concatenates string types of all sls detectors or * returns the detector type of the first sls detector + * @param detPos -1 for all detectors in list or specific detector position * @returns detector type of sls detector in position pos, if -1, concatenates */ std::string getDetectorType(int detPos = -1); @@ -443,6 +450,7 @@ public: /** * Returns the total number of channels of all sls detectors from shared memory + * @param detPos -1 for all detectors in list or specific detector position * @returns the total number of channels of all sls detectors */ int getTotalNumberOfChannels(int detPos = -1); @@ -451,6 +459,7 @@ public: * Returns the total number of channels of all sls detectors in dimension d * from shared memory * @param d dimension d + * @param detPos -1 for all detectors in list or specific detector position * @returns the total number of channels of all sls detectors in dimension d */ int getTotalNumberOfChannels(dimension d, int detPos = -1); @@ -459,6 +468,7 @@ public: * Returns the total number of channels of all sls detectors in dimension d * including gap pixels from shared memory * @param d dimension d + * @param detPos -1 for all detectors in list or specific detector position * @returns the total number of channels of all sls detectors in dimension d * including gap pixels */ @@ -486,7 +496,7 @@ public: /** * Get Detector offset from shared memory in dimension d * @param d dimension d - * @param pos detector position in multi detector list + * @param detPos -1 for all detectors in list or specific detector position * @returns offset in dimension d, -1 if pos is not an actual position in list */ int getDetectorOffset(dimension d, int detPos = -1); @@ -495,7 +505,7 @@ public: * Set Detector offset in shared memory in dimension d * @param d dimension d * @param off offset for detector - * @param pos detector position in multi detector list + * @param detPos -1 for all detectors in list or specific detector position */ void setDetectorOffset(dimension d, int off, int detPos = -1); @@ -511,12 +521,14 @@ public: * else sets the detector in online/offline state * if OFFLINE_FLAG, (i.e. no communication to the detector - using only local structure - no data acquisition possible!); * if ONLINE_FLAG, detector in online state (i.e. communication to the detector updating the local structure) + * @param detPos -1 for all detectors in list or specific detector position * @returns online/offline status */ int setOnline(int const online=GET_ONLINE_FLAG, int detPos = -1); /** * Checks if each of the detectors are online/offline + * @param detPos -1 for all detectors in list or specific detector position * @returns empty string if they are all online, * else returns concatenation of strings of all detectors that are offline */ @@ -526,6 +538,7 @@ public: * Set/Gets TCP Port of detector or receiver * @param t port type * @param num port number (-1 gets) + * @param detPos -1 for all detectors in list or specific detector position * @returns port number */ int setPort(portType t, int num=-1, int detPos = -1); @@ -533,18 +546,21 @@ public: /** * Lock server for this client IP * @param p 0 to unlock, 1 to lock + * @param detPos -1 for all detectors in list or specific detector position * @returns 1 for locked or 0 for unlocked */ int lockServer(int p, int detPos = -1); /** * Get last client IP saved on detector server + * @param detPos -1 for all detectors in list or specific detector position * @returns last client IP saved on detector server */ std::string getLastClientIP(int detPos = -1); /** * Exit detector server + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int exitServer(int detPos = -1); @@ -565,13 +581,14 @@ public: /** * Returns the trimfile or settings file name (Useless??) + * @param detPos -1 for all detectors in list or specific detector position * @returns the trimfile or settings file name */ std::string getSettingsFile(int detPos = -1); /** * Get detector settings - * @param ipos position in multi list (-1 all) + * @param detPos -1 for all detectors in list or specific detector position * @returns current settings */ detectorSettings getSettings(int detPos = -1); @@ -581,30 +598,31 @@ public: * Eiger only stores in shared memory ( a get will overwrite this) * For Eiger, one must use threshold * @param isettings settings - * @param ipos position in multi list (-1 all) + * @param detPos -1 for all detectors in list or specific detector position * @returns current settings */ detectorSettings setSettings(detectorSettings isettings, int detPos = -1); /** * Get threshold energy (Eiger) - * @param imod module number (-1 all) + * @param detPos -1 for all detectors in list or specific detector position * @returns current threshold value for imod in ev (-1 failed) */ - int getThresholdEnergy(, int detPos = -1); + int getThresholdEnergy(int detPos = -1); /** * Set threshold energy (Eiger) * @param e_eV threshold in eV - * @param imod module number (-1 all) * @param isettings ev. change settings * @param tb 1 to include trimbits, 0 to exclude + * @param detPos -1 for all detectors in list or specific detector position * @returns current threshold value for imod in ev (-1 failed) */ int setThresholdEnergy(int e_eV, detectorSettings isettings=GET_SETTINGS,int tb=1, int detPos = -1); /** * Returns the detector trimbit/settings directory \sa sharedSlsDetector + * @param detPos -1 for all detectors in list or specific detector position * @returns the trimbit/settings directory */ std::string getSettingsDir(int detPos = -1); @@ -612,19 +630,22 @@ public: /** * Sets the detector trimbit/settings directory \sa sharedSlsDetector * @param s trimbits/settings directory + * @param detPos -1 for all detectors in list or specific detector position * @returns the trimbit/settings directory */ std::string setSettingsDir(std::string s, int detPos = -1); /** - * Returns the calibration files directory \sa sharedSlsDetector (Mythen) + * Returns the calibration files directory \sa sharedSlsDetector + * @param detPos -1 for all detectors in list or specific detector position * @returns the calibration files directory */ std::string getCalDir(int detPos = -1); /** - * Sets the calibration files directory \sa sharedSlsDetector (Mythen) + * Sets the calibration files directory \sa sharedSlsDetector ( * @param s the calibration files directory + * @param detPos -1 for all detectors in list or specific detector position * @returns the calibration files directory */ std::string setCalDir(std::string s, int detPos = -1); @@ -633,7 +654,7 @@ public: * Loads the modules settings/trimbits reading from a specific file * file name extension is automatically generated. * @param fname specific settings/trimbits file - * @param imod module number (-1 for all) + * @param detPos -1 for all detectors in list or specific detector position * returns OK or FAIL */ int loadSettingsFile(std::string fname, int detPos = -1); @@ -642,7 +663,7 @@ public: * Saves the modules settings/trimbits to a specific file * file name extension is automatically generated. * @param fname specific settings/trimbits file - * @param imod module number (-1 for all) + * @param detPos -1 for all detectors in list or specific detector position * returns OK or FAIL */ int saveSettingsFile(std::string fname, int detPos = -1); @@ -651,7 +672,7 @@ public: * Loads the modules calibration data reading from a specific file (Mythen) * file name extension is automatically generated. * @param fname specific calibration file - * @param imod module number (-1 for all) + * @param detPos -1 for all detectors in list or specific detector position * returns OK or FAIL */ int loadCalibrationFile(std::string fname, int detPos = -1); @@ -660,61 +681,70 @@ public: * Saves the modules calibration data to a specific file (Mythen) * file name extension is automatically generated. * @param fname specific calibration file - * @param imod module number (-1 for all) + * @param detPos -1 for all detectors in list or specific detector position * returns OK or FAIL */ int saveCalibrationFile(std::string fname, int detPos = -1); /** * Get Detector run status + * @param detPos -1 for all detectors in list or specific detector position * @returns status */ runStatus getRunStatus(int detPos = -1); /** * Prepares detector for acquisition (Eiger) + * @param detPos -1 for all detectors in list or specific detector position * @returns OK if all detectors are ready for acquisition, FAIL otherwise */ int prepareAcquisition(int detPos = -1); /** * Start detector acquisition (Non blocking) + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL if even one does not start properly */ int startAcquisition(int detPos = -1); /** * Stop detector acquisition + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int stopAcquisition(int detPos = -1); /** * Give an internal software trigger to the detector (Eiger only) + * @param detPos -1 for all detectors in list or specific detector position * @return OK or FAIL */ int sendSoftwareTrigger(int detPos = -1); /** * Start detector acquisition and read all data (Blocking until end of acquisition) + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int startAndReadAll(int detPos = -1); /** * Start readout (without exposure or interrupting exposure) (Eiger store in ram) + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int startReadOut(int detPos = -1); /** * Requests and receives all data from the detector (Eiger store in ram) + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int readAll(int detPos = -1); /** - * Configures in detector the destination for UDP packets (Not Mythen) + * Configures in detector the destination for UDP packets + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int configureMAC(int detPos = -1); @@ -723,7 +753,7 @@ public: * Set/get timer value (not all implemented for all detectors) * @param index timer index * @param t time in ns or number of...(e.g. frames, gates, probes) - * @param imod module number (gotthard delay can have different values) + * @param detPos -1 for all detectors in list or specific detector position * @returns timer set value in ns or number of...(e.g. frames, gates, probes) */ int64_t setTimer(timerIndex index, int64_t t=-1, int detPos = -1); @@ -732,7 +762,7 @@ public: * Set/get timer value left in acquisition (not all implemented for all detectors) * @param index timer index * @param t time in ns or number of...(e.g. frames, gates, probes) - * @param imod module number + * @param detPos -1 for all detectors in list or specific detector position * @returns timer set value in ns or number of...(e.g. frames, gates, probes) */ int64_t getTimeLeft(timerIndex index, int detPos = -1); @@ -741,6 +771,7 @@ public: * Set speed * @param sp speed type (clkdivider option for Jungfrau and Eiger, others for Mythen/Gotthard) * @param value (clkdivider 0,1,2 for full, half and quarter speed). Other values check manual + * @param detPos -1 for all detectors in list or specific detector position * @returns value of speed set */ int setSpeed(speedVariable sp, int value=-1, int detPos = -1); @@ -749,6 +780,7 @@ public: * Set/get dynamic range and updates the number of dataBytes * (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to 1) * @param i dynamic range (-1 get) + * @param detPos -1 for all detectors in list or specific detector position * @returns current dynamic range * \sa sharedSlsDetector */ @@ -756,6 +788,7 @@ public: /** * Recalculated number of data bytes for multi detector + * @param detPos -1 for all detectors in list or specific detector position * @returns tota number of data bytes for multi detector */ int getDataBytes(int detPos = -1); @@ -765,7 +798,7 @@ public: * @param val value (in V) * @param index DAC index * @param mV 0 in dac units or 1 in mV - * @param imod module number (if -1 all modules) + * @param detPos -1 for all detectors in list or specific detector position * @returns current DAC value */ dacs_t setDAC(dacs_t val, dacIndex index , int mV, int detPos = -1); @@ -773,7 +806,7 @@ public: /** * Get adc value * @param index adc(DAC) index - * @param imod module number (if -1 all modules) + * @param detPos -1 for all detectors in list or specific detector position * @returns current adc value (temperature for eiger and jungfrau in millidegrees) */ dacs_t getADC(dacIndex index, int detPos = -1); @@ -781,6 +814,7 @@ public: /** * Set/get timing mode * @param pol timing mode (-1 gets) + * @param detPos -1 for all detectors in list or specific detector position * @returns current timing mode */ externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE, int detPos = -1); @@ -789,6 +823,7 @@ public: * Set/get external signal flags (to specify triggerinrising edge etc) (Gotthard, Mythen) * @param pol external signal flag (-1 gets) * @param signalindex singal index (0 - 3) + * @param detPos -1 for all detectors in list or specific detector position * @returns current timing mode */ externalSignalFlag setExternalSignalFlags(externalSignalFlag pol=GET_EXTERNAL_SIGNAL_FLAG , int signalindex=0, int detPos = -1); @@ -796,6 +831,7 @@ public: /** * Set/get readout flags (Eiger, Mythen) * @param flag readout flag (Eiger options: parallel, nonparallel, safe etc.) (-1 gets) + * @param detPos -1 for all detectors in list or specific detector position * @returns readout flag */ int setReadOutFlags(readOutFlags flag=GET_READOUT_FLAGS, int detPos = -1); @@ -804,6 +840,7 @@ public: * Write in a register. For Advanced users * @param addr address of register * @param val value to write into register + * @param detPos -1 for all detectors in list or specific detector position * @returns value read after writing */ uint32_t writeRegister(uint32_t addr, uint32_t val, int detPos = -1); @@ -811,6 +848,7 @@ public: /** * Read from a register. For Advanced users * @param addr address of register + * @param detPos -1 for all detectors in list or specific detector position * @returns value read from register */ uint32_t readRegister(uint32_t addr, int detPos = -1); @@ -819,6 +857,7 @@ public: * Set bit in a register. For Advanced users * @param addr address of register * @param n nth bit + * @param detPos -1 for all detectors in list or specific detector position * @returns value read from register */ uint32_t setBit(uint32_t addr, int n, int detPos = -1); @@ -827,6 +866,7 @@ public: * Clear bit in a register. For Advanced users * @param addr address of register * @param n nth bit + * @param detPos -1 for all detectors in list or specific detector position * @returns value read from register */ uint32_t clearBit(uint32_t addr, int n, int detPos = -1); @@ -835,6 +875,7 @@ public: * Set network parameter * @param p network parameter type * @param s network parameter value + * @param detPos -1 for all detectors in list or specific detector position * @returns network parameter value set (from getNetworkParameter) */ std::string setNetworkParameter(networkParameter p, std::string s, int detPos = -1); @@ -842,14 +883,15 @@ public: /** * Get network parameter * @param p network parameter type + * @param detPos -1 for all detectors in list or specific detector position * @returns network parameter value set (from getNetworkParameter) */ - std::string getNetworkParameter(networkParameter, int detPos = -1); + std::string getNetworkParameter(networkParameter p, int detPos = -1); /** * Execute a digital test (Gotthard, Mythen) * @param mode testmode type - * @param imod module index (-1 for all) + * @param detPos -1 for all detectors in list or specific detector position * @returns result of test */ int digitalTest(digitalTestMode mode, int detPos = -1); @@ -858,6 +900,7 @@ public: * Load dark or gain image to detector (Gotthard) * @param index image type * @param fname file name from which to load image + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int loadImageToDetector(imageType index,std::string const fname, int detPos = -1); @@ -866,6 +909,7 @@ public: * Writes the counter memory block from the detector (Gotthard) * @param fname file name to load data from * @param startACQ is 1 to start acquisition after reading counter + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int writeCounterBlockFile(std::string const fname,int startACQ=0, int detPos = -1); @@ -873,6 +917,7 @@ public: /** * Resets counter in detector (Gotthard) * @param startACQ is 1 to start acquisition after resetting counter + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int resetCounterBlock(int startACQ=0, int detPos = -1); @@ -880,6 +925,7 @@ public: /** * Set/get counter bit in detector (Gotthard) * @param i is -1 to get, 0 to reset and any other value to set the counter bit + * @param detPos -1 for all detectors in list or specific detector position * @returns the counter bit in detector */ int setCounterBit(int i = -1, int detPos = -1); @@ -888,6 +934,7 @@ public: * Ensures that min is less than max in both dimensions (Gotthard) * @param n number of rois * @param r array of rois + * @param detPos -1 for all detectors in list or specific detector position */ void verifyMinMaxROI(int n, ROI r[], int detPos = -1); @@ -896,6 +943,7 @@ public: * At the moment only one set allowed * @param n number of rois * @param roiLimits array of roi + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int setROI(int n=-1,ROI roiLimits[]=NULL, int detPos = -1); @@ -903,6 +951,7 @@ public: /** * Get ROI from each detector and convert it to the multi detector scale (Gotthard) * @param n number of rois + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ ROI* getROI(int &n, int detPos = -1); @@ -911,6 +960,7 @@ public: * Write to ADC register (Gotthard, Jungfrau, ChipTestBoard). For expert users * @param addr address of adc register * @param val value + * @param detPos -1 for all detectors in list or specific detector position * @returns return value (mostly -1 as it can't read adc register) */ int writeAdcRegister(int addr, int val, int detPos = -1); @@ -918,6 +968,7 @@ public: /** * Activates/Deactivates the detector (Eiger only) * @param enable active (1) or inactive (0), -1 gets + * @param detPos -1 for all detectors in list or specific detector position * @returns 0 (inactive) or 1 (active)for activate mode */ int activate(int const enable=-1, int detPos = -1); @@ -925,6 +976,7 @@ public: /** * Set deactivated Receiver padding mode (Eiger only) * @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets) + * @param detPos -1 for all detectors in list or specific detector position * @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option */ int setDeactivatedRxrPaddingMode(int padding=-1, int detPos = -1); @@ -932,6 +984,7 @@ public: /** * Returns the enable if data will be flipped across x or y axis (Eiger) * @param d axis across which data is flipped + * @param detPos -1 for all detectors in list or specific detector position * @returns 1 for flipped, else 0 */ int getFlippedData(dimension d=X, int detPos = -1); @@ -941,6 +994,7 @@ public: * data will be flipped across x or y axis (Eiger) * @param d axis across which data is flipped * @param value 0 or 1 to reset/set or -1 to get value + * @param detPos -1 for all detectors in list or specific detector position * @returns enable flipped data across x or y axis */ int setFlippedData(dimension d=X, int value=-1, int detPos = -1); @@ -948,7 +1002,7 @@ public: /** * Sets all the trimbits to a particular value (Eiger) * @param val trimbit value - * @param imod module number, -1 means all modules + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int setAllTrimbits(int val, int detPos = -1); @@ -966,6 +1020,7 @@ public: * \sa sharedSlsDetector * @param nen number of energies * @param en array of energies + * @param detPos -1 for all detectors in list or specific detector position * @returns number of trim energies */ int setTrimEn(int nen, int *en=NULL, int detPos = -1); @@ -974,6 +1029,7 @@ public: * Returns the number of trim energies and their value (Eiger) * \sa sharedSlsDetector * @param en array of energies + * @param detPos -1 for all detectors in list or specific detector position * @returns number of trim energies */ int getTrimEn(int *en=NULL, int detPos = -1); @@ -983,6 +1039,7 @@ public: * @param n is number of times to pulse * @param x is x coordinate * @param y is y coordinate + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int pulsePixel(int n=0,int x=0,int y=0, int detPos = -1); @@ -992,6 +1049,7 @@ public: * @param n is number of times to pulse * @param x is relative x value * @param y is relative y value + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int pulsePixelNMove(int n=0,int x=0,int y=0, int detPos = -1); @@ -999,6 +1057,7 @@ public: /** * Pulse Chip (Eiger) * @param n is number of times to pulse + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int pulseChip(int n=0, int detPos = -1); @@ -1006,7 +1065,7 @@ public: /** * Set/gets threshold temperature (Jungfrau) * @param val value in millidegrees, -1 gets - * @param imod module number, -1 is all + * @param detPos -1 for all detectors in list or specific detector position * @returns threshold temperature in millidegrees */ int setThresholdTemperature(int val=-1, int detPos = -1); @@ -1014,7 +1073,7 @@ public: /** * Enables/disables temperature control (Jungfrau) * @param val value, -1 gets - * @param imod module number, -1 is all + * @param detPos -1 for all detectors in list or specific detector position * @returns temperature control enable */ int setTemperatureControl(int val=-1, int detPos = -1); @@ -1022,7 +1081,7 @@ public: /** * Resets/ gets over-temperature event (Jungfrau) * @param val value, -1 gets - * @param imod module number, -1 is all + * @param detPos -1 for all detectors in list or specific detector position * @returns over-temperature event */ int setTemperatureEvent(int val=-1, int detPos = -1); @@ -1030,6 +1089,7 @@ public: /** * Set storage cell that stores first acquisition of the series (Jungfrau) * @param value storage cell index. Value can be 0 to 15. (-1 gets) + * @param detPos -1 for all detectors in list or specific detector position * @returns the storage cell that stores the first acquisition of the series */ int setStoragecellStart(int pos=-1, int detPos = -1); @@ -1037,12 +1097,14 @@ public: /** * Programs FPGA with pof file (Jungfrau) * @param fname file name + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int programFPGA(std::string fname, int detPos = -1); /** * Resets FPGA (Jungfrau) + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int resetFPGA(int detPos = -1); @@ -1050,6 +1112,7 @@ public: /** * Power on/off Chip (Jungfrau) * @param ival on is 1, off is 0, -1 to get + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int powerChip(int ival= -1, int detPos = -1); @@ -1057,6 +1120,7 @@ public: /** * Automatic comparator disable (Jungfrau) * @param ival on is 1, off is 0, -1 to get + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int setAutoComparatorDisableMode(int ival= -1, int detPos = -1); @@ -1066,6 +1130,7 @@ public: * @param retval is the array with the trimbits * @param fromDetector is true if the trimbits shared memory have to be * uploaded from detector + * @param detPos -1 for all detectors in list or specific detector position * @returns total number of channels for the detector */ int getChanRegs(double* retval,bool fromDetector, int detPos = -1); @@ -1074,40 +1139,46 @@ public: * Calibrate Pedestal (ChipTestBoard) * Starts acquisition, calibrates pedestal and writes to fpga * @param frames number of frames + * @param detPos -1 for all detectors in list or specific detector position * @returns number of frames */ int calibratePedestal(int frames = 0, int detPos = -1); /** - * Set Rate correction (Mythen, Eiger) + * Set Rate correction ( Eiger) * @param t dead time in ns - if 0 disable correction, * if >0 set dead time to t, if < 0 set deadtime to default dead time * for current settings + * @param detPos -1 for all detectors in list or specific detector position * @returns 0 if rate correction disabled, >0 otherwise */ int setRateCorrection(double t=0, int detPos = -1); /** - * Get rate correction (Mythen, Eiger) + * Get rate correction ( Eiger) * @param t reference for dead time + * @param detPos -1 for all detectors in list or specific detector position * @returns 0 if rate correction disabled, > 0 otherwise */ int getRateCorrection(double &t, int detPos = -1); /** - * Get rate correction tau (Mythen, Eiger) + * Get rate correction tau ( Eiger) + * @param detPos -1 for all detectors in list or specific detector position * @returns 0 if rate correction disabled, otherwise the tau used for the correction */ double getRateCorrectionTau(int detPos = -1); /** - * Get rate correction (Mythen, Eiger) + * Get rate correction ( Eiger) + * @param detPos -1 for all detectors in list or specific detector position * @returns 0 if rate correction disabled, > 0 otherwise */ int getRateCorrection(int detPos = -1); /** * Prints receiver configuration + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int printReceiverConfiguration(int detPos = -1); @@ -1115,12 +1186,14 @@ public: /** * Sets up receiver socket if online and sets the flag * @param online online/offline flag (-1 gets) + * @param detPos -1 for all detectors in list or specific detector position * @returns online/offline flag */ int setReceiverOnline(int const online=GET_ONLINE_FLAG, int detPos = -1); /** * Checks if the receiver is really online + * @param detPos -1 for all detectors in list or specific detector position * @returns empty string if all online, else concatenates hostnames of all * detectors that are offline */ @@ -1129,30 +1202,35 @@ public: /** * Locks/Unlocks the connection to the receiver * @param lock sets (1), usets (0), gets (-1) the lock + * @param detPos -1 for all detectors in list or specific detector position * @returns lock status of the receiver */ int lockReceiver(int lock=-1, int detPos = -1); /** * Returns the IP of the last client connecting to the receiver + * @param detPos -1 for all detectors in list or specific detector position * @returns IP of last client connecting to receiver */ std::string getReceiverLastClientIP(int detPos = -1); /** * Turns off the receiver server! + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int exitReceiver(int detPos = -1); /** * Returns output file directory + * @param detPos -1 for all detectors in list or specific detector position * @returns output file directory */ std::string getFilePath(int detPos = -1); /** * Sets up the file directory + * @param detPos -1 for all detectors in list or specific detector position * @param s file directory * @returns file dir */ @@ -1160,12 +1238,14 @@ public: /** * Returns file name prefix + * @param detPos -1 for all detectors in list or specific detector position * @returns file name prefix */ std::string getFileName(int detPos = -1); /** * Sets up the file name prefix + * @param detPos -1 for all detectors in list or specific detector position * @param s file name prefix * @returns file name prefix */ @@ -1174,6 +1254,7 @@ public: /** * Sets the max frames per file in receiver * @param f max frames per file + * @param detPos -1 for all detectors in list or specific detector position * @returns max frames per file in receiver */ int setReceiverFramesPerFile(int f = -1, int detPos = -1); @@ -1181,6 +1262,7 @@ public: /** * Sets the frames discard policy in receiver * @param f frames discard policy + * @param detPos -1 for all detectors in list or specific detector position * @returns frames discard policy set in receiver */ frameDiscardPolicy setReceiverFramesDiscardPolicy(frameDiscardPolicy f = GET_FRAME_DISCARD_POLICY, int detPos = -1); @@ -1188,12 +1270,14 @@ public: /** * Sets the partial frames padding enable in receiver * @param f partial frames padding enable + * @param detPos -1 for all detectors in list or specific detector position * @returns partial frames padding enable in receiver */ int setReceiverPartialFramesPadding(int f = -1, int detPos = -1); /** * Returns file format + * @param detPos -1 for all detectors in list or specific detector position * @returns file name */ fileFormat getFileFormat(int detPos = -1); @@ -1201,12 +1285,14 @@ public: /** * Sets up the file format * @param f file format + * @param detPos -1 for all detectors in list or specific detector position * @returns file format */ fileFormat setFileFormat(fileFormat f, int detPos = -1); /** * Returns file index + * @param detPos -1 for all detectors in list or specific detector position * @returns file index */ int getFileIndex(int detPos = -1); @@ -1214,48 +1300,56 @@ public: /** * Sets up the file index * @param i file index + * @param detPos -1 for all detectors in list or specific detector position * @returns file index */ int setFileIndex(int i, int detPos = -1); /** * increments file index + * @param detPos -1 for all detectors in list or specific detector position * @returns the file index */ int incrementFileIndex(int detPos = -1); /** * Receiver starts listening to packets + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int startReceiver(int detPos = -1); /** * Stops the listening mode of receiver + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int stopReceiver(int detPos = -1); /** * Gets the status of the listening mode of receiver + * @param detPos -1 for all detectors in list or specific detector position * @returns status */ - runStatus getReceiverStatus(); + runStatus getReceiverStatus(int detPos = -1); /** * Gets the number of frames caught by receiver + * @param detPos -1 for all detectors in list or specific detector position * @returns number of frames caught by receiver */ int getFramesCaughtByReceiver(int detPos = -1); /** * Gets the number of frames caught by any one receiver (to avoid using threadpool) + * @param detPos -1 for all detectors in list or specific detector position * @returns number of frames caught by any one receiver (master receiver if exists) */ int getFramesCaughtByAnyReceiver(int detPos = -1); /** * Gets the current frame index of receiver + * @param detPos -1 for all detectors in list or specific detector position * @returns current frame index of receiver */ int getReceiverCurrentFrameIndex(int detPos = -1); @@ -1263,6 +1357,7 @@ public: /** * Resets framescaught in receiver * Use this when using startAcquisition instead of acquire + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int resetFramesCaught(int detPos = -1); @@ -1272,17 +1367,18 @@ public: * @param destroy is true to destroy all the sockets * @returns OK or FAIL */ - int createReceivingDataSockets(const bool destroy = false), int detPos = -1; + int createReceivingDataSockets(const bool destroy = false); /** * Reads frames from receiver through a constant socket * Called during acquire() when call back registered or when using gui */ - void readFrameFromReceiver(int detPos = -1); + void readFrameFromReceiver(); /** * Sets/Gets receiver file write enable * @param enable 1 or 0 to set/reset file write enable + * @param detPos -1 for all detectors in list or specific detector position * @returns file write enable */ int enableWriteToFile(int enable=-1, int detPos = -1); @@ -1290,6 +1386,7 @@ public: /** * Sets/Gets file overwrite enable * @param enable 1 or 0 to set/reset file overwrite enable + * @param detPos -1 for all detectors in list or specific detector position * @returns file overwrite enable */ int overwriteFile(int enable=-1, int detPos = -1); @@ -1300,6 +1397,7 @@ public: * else every nth frame to be sent to gui/callback * @param freq is the receiver read frequency. Value 0 is 200 ms timer (other * frames not sent), 1 is every frame, 2 is every second frame etc. + * @param detPos -1 for all detectors in list or specific detector position * @returns read receiver frequency */ int setReadReceiverFrequency(int freq=-1, int detPos = -1); @@ -1309,6 +1407,7 @@ public: * if data required from receiver randomly readRxrFrequency=0, * then the timer between each data stream is set with time_in_ms * @param time_in_ms timer between frames + * @param detPos -1 for all detectors in list or specific detector position * @returns read receiver timer */ int setReceiverReadTimer(int time_in_ms=500, int detPos = -1); @@ -1316,6 +1415,7 @@ public: /** * Enable data streaming to client * @param enable 0 to disable, 1 to enable, -1 to get the value + * @param detPos -1 for all detectors in list or specific detector position * @returns data streaming to client enable */ int enableDataStreamingToClient(int enable=-1, int detPos = -1); @@ -1323,6 +1423,7 @@ public: /** * Enable or disable streaming data from receiver to client * @param enable 0 to disable 1 to enable -1 to only get the value + * @param detPos -1 for all detectors in list or specific detector position * @returns data streaming from receiver enable */ int enableDataStreamingFromReceiver(int enable=-1, int detPos = -1); @@ -1330,6 +1431,7 @@ public: /** * Enable/disable or 10Gbe * @param i is -1 to get, 0 to disable and 1 to enable + * @param detPos -1 for all detectors in list or specific detector position * @returns if 10Gbe is enabled */ int enableTenGigabitEthernet(int i = -1, int detPos = -1); @@ -1337,6 +1439,7 @@ public: /** * Set/get receiver fifo depth * @param i is -1 to get, any other value to set the fifo deph + * @param detPos -1 for all detectors in list or specific detector position * @returns the receiver fifo depth */ int setReceiverFifoDepth(int i = -1, int detPos = -1); @@ -1344,6 +1447,7 @@ public: /** * Set/get receiver silent mode * @param i is -1 to get, 0 unsets silent mode, 1 sets silent mode + * @param detPos -1 for all detectors in list or specific detector position * @returns the receiver silent mode enable */ int setReceiverSilentMode(int i = -1, int detPos = -1); @@ -1351,6 +1455,7 @@ public: /** * Opens pattern file and sends pattern to CTB * @param fname pattern file to open + * @param detPos -1 for all detectors in list or specific detector position * @returns OK/FAIL */ int setCTBPattern(std::string fname, int detPos = -1); @@ -1360,6 +1465,7 @@ public: * @param addr address of the word, -1 is I/O control register, * -2 is clk control register * @param word 64bit word to be written, -1 gets + * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ uint64_t setCTBWord(int addr,uint64_t word=-1, int detPos = -1); @@ -1370,6 +1476,7 @@ public: * @param start start address if >=0 * @param stop stop address if >=0 * @param n number of loops (if level >=0) + * @param detPos -1 for all detectors in list or specific detector position * @returns OK/FAIL */ int setCTBPatLoops(int level,int &start, int &stop, int &n, int detPos = -1); @@ -1378,6 +1485,7 @@ public: * Sets the wait address in the CTB * @param level 0,1,2, wait level * @param addr wait address, -1 gets + * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ int setCTBPatWaitAddr(int level, int addr=-1, int detPos = -1); @@ -1386,6 +1494,7 @@ public: * Sets the wait time in the CTB * @param level 0,1,2, wait level * @param t wait time, -1 gets + * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ int setCTBPatWaitTime(int level, uint64_t t=-1, int detPos = -1); @@ -1395,6 +1504,7 @@ public: * @param fname file to read from * @param level if 2 reads also reads trimbits, angular conversion coefficients etc. * from files with default extensions as generated by dumpDetectorSetup + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int retrieveDetectorSetup(std::string const fname, int level=0, int detPos = -1); @@ -1404,6 +1514,7 @@ public: * @param fname file to write to * @param level if 2 reads also trimbits, flat field, angular correction etc. * and writes them to files with automatically added extension + * @param detPos -1 for all detectors in list or specific detector position * @returns OK or FAIL */ int dumpDetectorSetup(std::string const fname, int level=0, int detPos = -1); @@ -1580,9 +1691,6 @@ private: /** ZMQ Socket - Receiver to Client */ std::vector zmqSocket; - /** Threadpool */ - ThreadPool* threadpool; - /** semaphore to let postprocessing thread continue for next scan/measurement */ sem_t sem_newRTAcquisition; @@ -1590,8 +1698,12 @@ private: /** semaphore to let main thread know it got all the dummy packets (also from ext. process) */ sem_t sem_endRTAcquisition; + /** Total number of frames/images for next acquisition */ int totalProgress; + + /** Current progress or frames/images processed in current acquisition */ int progressIndex; + /** mutex to synchronize main and data processing threads */ pthread_mutex_t mp; @@ -1601,6 +1713,7 @@ private: /** mutex to synchronize slsdetector threads */ pthread_mutex_t ms; + /** true if post processing thread is enabled */ int threadedProcessing; /** sets when the acquisition is finished */ @@ -1612,7 +1725,10 @@ private: /** the data processing thread */ pthread_t dataProcessingThread; + /** gui data */ double *fdata; + + /** detector data packed for the gui */ detectorData *thisData; int (*acquisition_finished)(double,int,void*);