moved tau to settings file, removed gain and offset, setting threshold loads settings file, setting threshold only sets client variable

This commit is contained in:
Dhanya Maliakal
2017-02-03 12:29:44 +01:00
parent 111856ed7b
commit 87ce1ed736
42 changed files with 583 additions and 6302 deletions

View File

@ -35,7 +35,9 @@ class energyConversion
reads a calibration file
\param fname file to be read
\param gain reference to the gain variable
\offset reference to the offset variable
\param offset reference to the offset variable
\returns OK if successful, else FAIL or -1
*/
static int readCalibrationFile(string fname, double &gain, double &offset);
@ -44,36 +46,51 @@ class energyConversion
\param fname file to be written
\param gain
\param offset
\returns OK if successful, else FAIL or -1
*/
static int writeCalibrationFile(string fname, double gain, double offset);
/**
reads a calibration file
\param fname file to be read
\param gain reference to the gain variable
\offset reference to the offset variable
\tau tau
\tau tau
\param offset reference to the offset variable
\returns OK if successful, else FAIL or -1
*/
static int readCalibrationFile(string fname, int *gain, int *offset, int64_t &tau, detectorType myDetectorType);
static int readCalibrationFile(string fname, int *gain, int *offset);
/**
writes a calibration file
\param fname file to be written
\param gain
\param offset
\param tau
\param gain reference to the gain variable
\param offset reference to the offset variable
\returns OK if successful, else FAIL or -1
*/
static int writeCalibrationFile(string fname, int *gain, int *offset, int64_t tau, detectorType myDetectorType);
static int writeCalibrationFile(string fname, int *gain, int *offset);
//Template function to do linear interpolation between two points
template <typename E, typename V>
V linearInterpolation(const E x, const E x1, const E x2, const V y1, const V y2){
double k = static_cast<double>(y2-y1)/(x2-x1);
double m = y1-k*x1;
int y = round( k*x+m );
return static_cast<V>(y);
}
/**
* interpolates dacs and trimbits between 2 trim files
\param myDetectorType detector type (needed for which dacs that neeeds to be interpolated & which kept same)
\param a first module structure
\param b second module structure
\param energy energy to trim at
\param e1 reference trim value
\param e2 reference trim value
\returns the pointer to the module structure with interpolated values or NULL if error
*/
sls_detector_module* interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2);
@ -83,12 +100,13 @@ class energyConversion
reads a trim/settings file
\param fname name of the file to be read
\param myDetectorType detector type (needed for number of channels, chips, dacs etc.)
\param myMod pointer to the module structure which has to be set. <BR> If it is NULL a new module structure will be created
\param iodelay io delay (detector specific)
\param tau tau (detector specific)
\param myMod pointer to the module structure which has to be set. <BR> If it is NULL a new module structure will be created
\returns the pointer to myMod or NULL if reading the file failed
*/
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, sls_detector_module* myMod=NULL, int* iodelay=0);
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL);
/**
writes a trim/settings file
@ -96,11 +114,12 @@ class energyConversion
\param myDetectorType detector type (needed for number of channels, chips, dacs etc.)
\param mod module structure which has to be written to file
\param iodelay io delay (detector specific)
\param tau tau (detector specific)
\returns OK or FAIL if the file could not be written
\sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module)
*/
int writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int* iodelay=0);
int writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int& iodelay, int& tau);
/** allocates the momery for a detector module structure
\param myDetectorType detector type (needed for number of channels, chips, dacs etc.)
@ -114,6 +133,7 @@ class energyConversion
*/
virtual void deleteModule(sls_detector_module *myMod)=0;
protected:
/** pointer to settings file name */
char *settingsFile;