mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
feature: tau is now read from calib file. if not there, it is set to defalt in server value, but switched off. load trimbits will not touch rate correction
This commit is contained in:
@ -69,7 +69,7 @@ int energyConversion::writeCalibrationFile(string fname, double gain, double off
|
||||
};
|
||||
|
||||
|
||||
int energyConversion::readCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType){
|
||||
int energyConversion::readCalibrationFile(string fname, int *gain, int *offset, int64_t &tau, detectorType myDetectorType){
|
||||
|
||||
|
||||
|
||||
@ -87,6 +87,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset,
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
//get gain and offset
|
||||
for (ig=0; ig<4; ig++) {
|
||||
//while ( (getline(infile,str)) > -1) {
|
||||
getline(infile,str);
|
||||
@ -101,6 +102,16 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset,
|
||||
if (ig>=4)
|
||||
break;
|
||||
}
|
||||
//get tau
|
||||
if (myDetectorType == EIGER) {
|
||||
if(getline(infile,str)){
|
||||
istringstream ssstr(str);
|
||||
ssstr >> tau;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "tau:" << tau << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
infile.close();
|
||||
cout << "Calibration file loaded: " << fname << endl;
|
||||
} else {
|
||||
@ -124,7 +135,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset,
|
||||
|
||||
};
|
||||
|
||||
int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType){
|
||||
int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset, int64_t tau, detectorType myDetectorType){
|
||||
//std::cout<< "Function not yet implemented " << std::endl;
|
||||
ofstream outfile;
|
||||
switch (myDetectorType) {
|
||||
@ -136,6 +147,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset,
|
||||
if (outfile.is_open()) {
|
||||
for (int ig=0; ig<4; ig++)
|
||||
outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl;
|
||||
outfile << tau << std::endl;
|
||||
} else {
|
||||
std::cout<< "Could not open calibration file "<< fname << " for writing" << std::endl;
|
||||
#ifndef MYROOT
|
||||
|
@ -55,16 +55,19 @@ class energyConversion
|
||||
\param fname file to be read
|
||||
\param gain reference to the gain variable
|
||||
\offset reference to the offset variable
|
||||
\tau tau
|
||||
\tau tau
|
||||
*/
|
||||
static int readCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType);
|
||||
static int readCalibrationFile(string fname, int *gain, int *offset, int64_t &tau, detectorType myDetectorType);
|
||||
|
||||
/**
|
||||
writes a calibration file
|
||||
\param fname file to be written
|
||||
\param gain
|
||||
\param offset
|
||||
\param tau
|
||||
*/
|
||||
static int writeCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType);
|
||||
static int writeCalibrationFile(string fname, int *gain, int *offset, int64_t tau, detectorType myDetectorType);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user