sharedmem: updated slsdetector, changes left

This commit is contained in:
maliakal_d 2018-06-25 18:19:19 +02:00
parent 5e9871720b
commit 69c71e48f6
5 changed files with 8580 additions and 8750 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,3 @@
/*******************************************************************
Date: $Date$
Revision: $Rev$
Author: $Author$
URL: $URL$
ID: $Id$
********************************************************************/
#ifndef MULTI_SLS_DETECTOR_H #ifndef MULTI_SLS_DETECTOR_H
#define MULTI_SLS_DETECTOR_H #define MULTI_SLS_DETECTOR_H
@ -19,8 +7,8 @@ ID: $Id$
* @author Anna Bergamaschi * @author Anna Bergamaschi
*/ */
#include "slsDetectorUtils.h" #include "slsDetectorUtils.h"
class slsDetector; class slsDetector;
class SharedMemory; class SharedMemory;
class ThreadPool; class ThreadPool;
@ -31,7 +19,7 @@ class ZmqSocket;
#include <string> #include <string>
#define MULTI_SHMVERSION 0x180618 #define MULTI_SHMVERSION 0x180625
#define SHORT_STRING_LENGTH 50 #define SHORT_STRING_LENGTH 50
#define DATE_LENGTH 29 #define DATE_LENGTH 29
@ -524,6 +512,7 @@ public:
/** /**
* Sets the hostname of all sls detectors in shared memory * Sets the hostname of all sls detectors in shared memory
* Connects to them to set up online flag
* @param s concatenated hostname of all the sls detectors * @param s concatenated hostname of all the sls detectors
*/ */
void setHostname(std::string s); void setHostname(std::string s);
@ -554,10 +543,9 @@ public:
std::string sgetDetectorsType(int pos=-1); std::string sgetDetectorsType(int pos=-1);
/** /**
* Just to overload getDetectorType * Just to overload getDetectorType from users
* Concatenates string types of all sls detectors or * Concatenates string types of all sls detectors or
* returns the detector type of the first sls detector * returns the detector type of the first sls detector
* @param pos position of sls detector in array, if -1, returns first detector type
* @returns detector type of sls detector in position pos, if -1, concatenates * @returns detector type of sls detector in position pos, if -1, concatenates
*/ */
std::string getDetectorType(); std::string getDetectorType();
@ -594,14 +582,14 @@ public:
void getNumberOfDetectors(int& nx, int& ny); void getNumberOfDetectors(int& nx, int& ny);
/** /**
* Returns sum of all modules per sls detector (Mythen) * Returns sum of all modules per sls detector from shared memory (Mythen)
* Other detectors, it is 1 * Other detectors, it is 1
* @returns sum of all modules per sls detector * @returns sum of all modules per sls detector
*/ */
int getNMods(); int getNMods();
/** /**
* Returns sum of all modules per sls detector in dimension d (Mythen) * Returns sum of all modules per sls detector in dimension d from shared memory (Mythen)
* Other detectors, it is 1 * Other detectors, it is 1
* @param d dimension d * @param d dimension d
* @returns sum of all modules per sls detector in dimension d * @returns sum of all modules per sls detector in dimension d
@ -609,15 +597,14 @@ public:
int getNMod(dimension d); int getNMod(dimension d);
/** /**
* Returns sum of all maximum modules per sls detector (Mythen). * Returns sum of all maximum modules per sls detector from shared memory (Mythen)
* Other detectors, it is 1 * Other detectors, it is 1
* @returns sum of all maximum modules per sls detector * @returns sum of all maximum modules per sls detector
*/ */
int getMaxMods(); int getMaxMods();
/** /**
* Returns sum of all maximum modules per sls detector in dimension d (Mythen) * Returns sum of all maximum modules per sls detector in dimension d from shared memory (Mythen)
* Other detectors, it is 1 * Other detectors, it is 1
* @param d dimension d * @param d dimension d
* @returns sum of all maximum modules per sls detector in dimension d * @returns sum of all maximum modules per sls detector in dimension d
@ -625,7 +612,7 @@ public:
int getMaxMod(dimension d); int getMaxMod(dimension d);
/** /**
* Returns the sum of all maximum modules per sls detector in dimension d (Mythen). * Returns the sum of all maximum modules per sls detector in dimension d Mythen)
* from the detector directly. * from the detector directly.
* Other detectors, it is 1 * Other detectors, it is 1
* @param d dimension d * @param d dimension d
@ -634,7 +621,7 @@ public:
int getMaxNumberOfModules(dimension d=X); int getMaxNumberOfModules(dimension d=X);
/** /**
* Sets the sum of all modules per sls detector in dimension d (Mythen). * Sets/Gets the sum of all modules per sls detector in dimension d (Mythen)
* from the detector directly. * from the detector directly.
* Other detectors, it is 1 * Other detectors, it is 1
* @param i the number of modules to set to * @param i the number of modules to set to
@ -644,21 +631,22 @@ public:
int setNumberOfModules(int i=-1, dimension d=X); int setNumberOfModules(int i=-1, dimension d=X);
/** /**
* Calculates the position of detector based on module number of entire multi * Using module id, returns the number of channels per that module
* detector list and returns the number of channels per that module (Mythen) * from shared memory (Mythen)
* @param imod module number of entire multi detector list * @param imod module number of entire multi detector list
* @returns number of channels per module imod * @returns number of channels per module imod
*/ */
int getChansPerMod(int imod=0); int getChansPerMod(int imod=0);
/** /**
* Returns the total number of channels of all sls detectors * Returns the total number of channels of all sls detectors from shared memory
* @returns the total number of channels of all sls detectors * @returns the total number of channels of all sls detectors
*/ */
int getTotalNumberOfChannels(); int getTotalNumberOfChannels();
/** /**
* Returns the total number of channels of all sls detectors in dimension d * Returns the total number of channels of all sls detectors in dimension d
* from shared memory
* @param d dimension d * @param d dimension d
* @returns the total number of channels of all sls detectors in dimension d * @returns the total number of channels of all sls detectors in dimension d
*/ */
@ -666,7 +654,7 @@ public:
/** /**
* Returns the total number of channels of all sls detectors in dimension d * Returns the total number of channels of all sls detectors in dimension d
* including gap pixels * including gap pixels from shared memory
* @param d dimension d * @param d dimension d
* @returns the total number of channels of all sls detectors in dimension d * @returns the total number of channels of all sls detectors in dimension d
* including gap pixels * including gap pixels
@ -674,13 +662,15 @@ public:
int getTotalNumberOfChannelsInclGapPixels(dimension d); int getTotalNumberOfChannelsInclGapPixels(dimension d);
/** /**
* Returns the maximum number of channels of all sls detectors (Mythen) * Returns the maximum number of channels of all sls detectors
* from shared memory (Mythen)
* @returns the maximum number of channels of all sls detectors * @returns the maximum number of channels of all sls detectors
*/ */
int getMaxNumberOfChannels(); int getMaxNumberOfChannels();
/** /**
* Returns the maximum number of channels of all sls detectors in dimension d (Mythen) * Returns the maximum number of channels of all sls detectors in dimension d
* from shared memory (Mythen)
* @param d dimension d * @param d dimension d
* @returns the maximum number of channels of all sls detectors in dimension d * @returns the maximum number of channels of all sls detectors in dimension d
*/ */
@ -688,24 +678,26 @@ public:
/** /**
* Returns the total number of channels of all sls detectors in dimension d * Returns the total number of channels of all sls detectors in dimension d
* including gap pixels (Mythen) * including gap pixels from shared memory(Mythen)
* @param d dimension d * @param d dimension d
* @returns the total number of channels of all sls detectors in dimension d * @returns the maximum number of channels of all sls detectors in dimension d
* including gap pixels * including gap pixels
*/ */
int getMaxNumberOfChannelsInclGapPixels(dimension d); int getMaxNumberOfChannelsInclGapPixels(dimension d);
/** /**
* Returns the maximum number of channels of all sls detectors in each dimension d, * Returns the maximum number of channels of all sls detectors in each dimension d
* multi detector shared memory variable to calculate offsets for each sls detector * from shared memory. multi detector shared memory variable to calculate
* offsets for each sls detector
* @param d dimension d * @param d dimension d
* @returns the maximum number of channels of all sls detectors in dimension d * @returns the maximum number of channels of all sls detectors in dimension d
*/ */
int getMaxNumberOfChannelsPerDetector(dimension d); int getMaxNumberOfChannelsPerDetector(dimension d);
/** /**
* Sets the maximum number of channels of all sls detectors in each dimension d, * Sets the maximum number of channels of all sls detectors in each dimension d
* multi detector shared memory variable to calculate offsets for each sls detector * from shared memory, multi detector shared memory variable to calculate
* offsets for each sls detector
* @param d dimension d * @param d dimension d
* @param i maximum number of channels for multi structure in dimension d * @param i maximum number of channels for multi structure in dimension d
* @returns the maximum number of channels of all sls detectors in dimension d * @returns the maximum number of channels of all sls detectors in dimension d
@ -736,9 +728,9 @@ public:
std::string checkOnline(); std::string checkOnline();
/** /**
* Set TCP Port of detector or receiver * Set/Gets TCP Port of detector or receiver
* @param t port type * @param t port type
* @param p port number * @param p port number (-1 gets)
* @returns port number * @returns port number
*/ */
int setPort(portType t, int p); int setPort(portType t, int p);
@ -791,12 +783,31 @@ public:
/** /**
* Load detector settings from the settings file picked from the trimdir/settingsdir * Load detector settings from the settings file picked from the trimdir/settingsdir
* Eiger only stores in shared memory ( a get will overwrite this)
* For Eiger, one must use threshold
* @param isettings settings * @param isettings settings
* @param ipos position in multi list (-1 all) * @param ipos position in multi list (-1 all)
* @returns current settings * @returns current settings
*/ */
detectorSettings setSettings(detectorSettings isettings, int pos=-1); detectorSettings setSettings(detectorSettings isettings, int pos=-1);
/**
* Get threshold energy (Mythen and Eiger)
* @param imod module number (-1 all)
* @returns current threshold value for imod in ev (-1 failed)
*/
int getThresholdEnergy(int imod=-1);
/**
* Set threshold energy (Mythen and 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
* @returns current threshold value for imod in ev (-1 failed)
*/
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS,int tb=1);
/** /**
* Returns the detector trimbit/settings directory \sa sharedSlsDetector * Returns the detector trimbit/settings directory \sa sharedSlsDetector
* @returns the trimbit/settings directory * @returns the trimbit/settings directory
@ -827,8 +838,7 @@ public:
* Loads the modules settings/trimbits reading from a specific file * Loads the modules settings/trimbits reading from a specific file
* file name extension is automatically generated. * file name extension is automatically generated.
* @param fname specific settings/trimbits file * @param fname specific settings/trimbits file
* @param imod module index of the entire list, * @param imod module number (-1 for all)
* from which will be calculated the detector index and the module index (-1 for all)
* returns OK or FAIL * returns OK or FAIL
*/ */
int loadSettingsFile(std::string fname, int imod=-1); int loadSettingsFile(std::string fname, int imod=-1);
@ -837,8 +847,7 @@ public:
* Saves the modules settings/trimbits to a specific file * Saves the modules settings/trimbits to a specific file
* file name extension is automatically generated. * file name extension is automatically generated.
* @param fname specific settings/trimbits file * @param fname specific settings/trimbits file
* @param imod module index of the entire list, * @param imod module number (-1 for all)
* from which will be calculated the detector index and the module index (-1 for all)
* returns OK or FAIL * returns OK or FAIL
*/ */
int saveSettingsFile(std::string fname, int imod=-1); int saveSettingsFile(std::string fname, int imod=-1);
@ -847,8 +856,7 @@ public:
* Loads the modules calibration data reading from a specific file (Mythen) * Loads the modules calibration data reading from a specific file (Mythen)
* file name extension is automatically generated. * file name extension is automatically generated.
* @param fname specific calibration file * @param fname specific calibration file
* @param imod module index of the entire list, * @param imod module number (-1 for all)
* from which will be calculated the detector index and the module index (-1 for all)
* returns OK or FAIL * returns OK or FAIL
*/ */
int loadCalibrationFile(std::string fname, int imod=-1); int loadCalibrationFile(std::string fname, int imod=-1);
@ -857,15 +865,13 @@ public:
* Saves the modules calibration data to a specific file (Mythen) * Saves the modules calibration data to a specific file (Mythen)
* file name extension is automatically generated. * file name extension is automatically generated.
* @param fname specific calibration file * @param fname specific calibration file
* @param imod module index of the entire list, * @param imod module number (-1 for all)
* from which will be calculated the detector index and the module index (-1 for all)
* returns OK or FAIL * returns OK or FAIL
*/ */
int saveCalibrationFile(std::string fname, int imod=-1); int saveCalibrationFile(std::string fname, int imod=-1);
/** /**
* (Not implemented in any detector from the client) * Sets/gets the detector in position i as master of the structure (Mythen)
* Sets/gets the detector in position i as master of the structure
* (e.g. it gates the other detectors and therefore must be started as last. * (e.g. it gates the other detectors and therefore must be started as last.
* Assumes that signal 0 is gate in, signal 1 is trigger in, signal 2 is gate out * Assumes that signal 0 is gate in, signal 1 is trigger in, signal 2 is gate out
* @param i position of master (-1 gets, -2 unset) * @param i position of master (-1 gets, -2 unset)
@ -873,8 +879,8 @@ public:
*/ */
int setMaster(int i=-1); int setMaster(int i=-1);
/** (Not implemented in any detector from the client) /**
* Sets/gets the synchronization mode of the various detector * Sets/gets the synchronization mode of the various detector (Mythen)
* @param sync syncronization mode * @param sync syncronization mode
* @returns current syncronization mode * @returns current syncronization mode
*/ */
@ -996,23 +1002,6 @@ public:
*/ */
int configureMAC(); int configureMAC();
/**
* Get threshold energy (Mythen and Eiger)
* @param imod module number (-1 all)
* @returns current threshold value for imod in ev (-1 failed)
*/
int getThresholdEnergy(int imod=-1);
/**
* Set threshold energy (Mythen and 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
* @returns current threshold value for imod in ev (-1 failed)
*/
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS,int tb=1);
/** /**
* Set/get timer value (not all implemented for all detectors) * Set/get timer value (not all implemented for all detectors)
* @param index timer index * @param index timer index
@ -1195,6 +1184,7 @@ public:
/** /**
* Set ROI (Gotthard) * Set ROI (Gotthard)
* At the moment only one set allowed
* @param n number of rois * @param n number of rois
* @param roiLimits array of roi * @param roiLimits array of roi
* @returns OK or FAIL * @returns OK or FAIL
@ -1507,7 +1497,7 @@ public:
* Reads an angular conversion file (Mythen, Gotthard) * Reads an angular conversion file (Mythen, Gotthard)
* \sa angleConversionConstant mythenDetector::readAngularConversion * \sa angleConversionConstant mythenDetector::readAngularConversion
* @param fname file to be read * @param fname file to be read
* @rreturns 0 if angular conversion disabled, >0 otherwise * @returns 0 if angular conversion disabled, >0 otherwise
*/ */
int readAngularConversionFile(std::string fname); int readAngularConversionFile(std::string fname);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -216,13 +216,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
*/ */
virtual std::string sgetDetectorsType(int pos=-1)=0; virtual std::string sgetDetectorsType(int pos=-1)=0;
/** returns the detector type
\param pos position in the multi detector structure (is -1 returns type of detector with id -1)
\returns type
*/
virtual detectorType setDetectorsType(detectorType t=GET_DETECTOR_TYPE, int pos=-1)=0;
virtual std::string ssetDetectorsType(detectorType t=GET_DETECTOR_TYPE, int pos=-1)=0;
virtual std::string ssetDetectorsType(std::string s, int pos=-1)=0;