mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
still updating slsdetector.cpp
This commit is contained in:
@ -2196,14 +2196,7 @@ int multiSlsDetector::writeAdcRegister(int addr, int val, int detPos) {
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::writeAdcRegister, addr, val);
|
||||
if (sls::allEqual(r))
|
||||
return r.front();
|
||||
|
||||
// can't have different values
|
||||
FILE_LOG(logERROR) << "Error: Different Values for function writeAdcRegister "
|
||||
"(write 0x" << std::hex << val << " to addr 0x" << std::hex << addr << std::dec << ")";
|
||||
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
||||
return -1;
|
||||
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
||||
}
|
||||
|
||||
|
||||
@ -2458,33 +2451,22 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::getChanRegs(double* retval, bool fromDetector, int detPos) {
|
||||
int multiSlsDetector::getChanRegs(double* retval, int detPos) {
|
||||
|
||||
int offset = 0;
|
||||
std::vector<int> r;
|
||||
for (auto& d : detectors) {
|
||||
int nch = d->getTotalNumberOfChannels();
|
||||
double result[nch];
|
||||
r.push_back(d->getChanRegs(result, fromDetector));
|
||||
r.push_back(d->getChanRegs(result));
|
||||
memcpy(retval + offset, result, nch * sizeof(double));
|
||||
}
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::calibratePedestal(int frames, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->calibratePedestal(frames);
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::calibratePedestal, frames);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::setRateCorrection(int t, int detPos) {
|
||||
int multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setRateCorrection(t);
|
||||
@ -2496,7 +2478,7 @@ int multiSlsDetector::setRateCorrection(int t, int detPos) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::getRateCorrection(int detPos) {
|
||||
int64_t multiSlsDetector::getRateCorrection(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getRateCorrection();
|
||||
@ -2508,15 +2490,14 @@ int multiSlsDetector::getRateCorrection(int detPos) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::printReceiverConfiguration(int detPos) {
|
||||
void multiSlsDetector::printReceiverConfiguration(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->printReceiverConfiguration();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::printReceiverConfiguration);
|
||||
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
||||
parallelCall(&slsDetector::printReceiverConfiguration);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1153,21 +1153,10 @@ public:
|
||||
/**
|
||||
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
int getChanRegs(double* retval, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Set Rate correction ( Eiger)
|
||||
@ -1177,21 +1166,20 @@ public:
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns 0 if rate correction disabled, >0 otherwise
|
||||
*/
|
||||
int setRateCorrection(int t=0, int detPos = -1);
|
||||
int setRateCorrection(int64_t t = 0, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Get rate correction ( Eiger)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns 0 if rate correction disabled, > 0 otherwise (ns)
|
||||
*/
|
||||
int getRateCorrection(int detPos = -1);
|
||||
int64_t 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);
|
||||
void printReceiverConfiguration(int detPos = -1);
|
||||
|
||||
/**
|
||||
* Sets up receiver socket if online and sets the flag
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,8 +32,6 @@ typedef struct detParameterList {
|
||||
int nChipY;
|
||||
int nDacs;
|
||||
int nAdcs;
|
||||
int nGain;
|
||||
int nOffset;
|
||||
int dynamicRange;
|
||||
int nGappixelsX;
|
||||
int nGappixelsY;
|
||||
@ -112,12 +110,6 @@ private:
|
||||
/** number of adcs per module */
|
||||
int nAdcs;
|
||||
|
||||
/** number of extra gain values*/
|
||||
int nGain;
|
||||
|
||||
/** number of extra offset values */
|
||||
int nOffset;
|
||||
|
||||
/** dynamic range of the detector data */
|
||||
int dynamicRange;
|
||||
|
||||
@ -158,18 +150,9 @@ private:
|
||||
/** memory offsets for the adc arrays */
|
||||
int adcoff;
|
||||
|
||||
/** memory offsets for the chip register arrays */
|
||||
int chipoff;
|
||||
|
||||
/** memory offsets for the channel register arrays -trimbits*/
|
||||
int chanoff;
|
||||
|
||||
/** memory offsets for the gain register arrays */
|
||||
int gainoff;
|
||||
|
||||
/** memory offsets for the offset register arrays -trimbits*/
|
||||
int offsetoff;
|
||||
|
||||
/** ip address/hostname of the receiver for client control via TCP */
|
||||
char receiver_hostname[MAX_STR_LENGTH];
|
||||
|
||||
@ -622,12 +605,10 @@ public:
|
||||
* Writes a trim/settings file for module number
|
||||
* the values will be read from the current detector structure
|
||||
* @param fname name of the file to be written
|
||||
* @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 sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||
*/
|
||||
int writeSettingsFile(std::string fname, int iodelay, int tau);
|
||||
int writeSettingsFile(std::string fname);
|
||||
|
||||
/**
|
||||
* Get detector settings
|
||||
@ -1073,11 +1054,11 @@ public:
|
||||
|
||||
/**
|
||||
* Gets counter memory block in detector (Gotthard)
|
||||
* @param arg counter memory block from detector
|
||||
* @param image counter memory block from detector
|
||||
* @param startACQ 1 to start acquisition afterwards, else 0
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int getCounterBlock(short int arg[],int startACQ=0);
|
||||
int getCounterBlock(short int image[],int startACQ=0);
|
||||
|
||||
/**
|
||||
* Resets counter in detector
|
||||
@ -1276,10 +1257,8 @@ public:
|
||||
|
||||
|
||||
/**
|
||||
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
|
||||
* Returns the trimbits from the detector's shared memmory (Eiger)
|
||||
* @param retval is the array with the trimbits
|
||||
* @param fromDetector is true if the trimbits shared memory have to be
|
||||
* uploaded from detector
|
||||
* @returns total number of channels for the detector
|
||||
*/
|
||||
int getChanRegs(double* retval,bool fromDetector);
|
||||
@ -1289,17 +1268,11 @@ public:
|
||||
* Called for loading trimbits and settings settings to the detector
|
||||
* @param module module to be set - must contain correct module number and
|
||||
* also channel and chip registers
|
||||
* @param iodelay iodelay (detector specific)
|
||||
* @param tau tau (detector specific)
|
||||
* @param e_eV threashold in eV (detector specific)
|
||||
* @param gainval pointer to extra gain values
|
||||
* @param offsetval pointer to extra offset values
|
||||
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
* @returns ok or fail
|
||||
* \sa ::sls_detector_module
|
||||
*/
|
||||
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV,
|
||||
int* gainval=0, int* offsetval=0, int tb=1);
|
||||
int setModule(sls_detector_module module, int tb = 1);
|
||||
|
||||
|
||||
/**
|
||||
@ -1308,14 +1281,6 @@ public:
|
||||
*/
|
||||
sls_detector_module *getModule();
|
||||
|
||||
/**
|
||||
* Calibrate Pedestal (ChipTestBoard)
|
||||
* Starts acquisition, calibrates pedestal and writes to fpga
|
||||
* @param frames number of frames
|
||||
* @returns number of frames
|
||||
*/
|
||||
int calibratePedestal(int frames = 0);
|
||||
|
||||
/**
|
||||
* Set Rate correction (Mythen, Eiger)
|
||||
* @param t dead time in ns - if 0 disable correction,
|
||||
@ -1323,19 +1288,19 @@ public:
|
||||
* for current settings
|
||||
* @returns 0 if rate correction disabled, >0 otherwise
|
||||
*/
|
||||
int setRateCorrection(int t=0);
|
||||
int setRateCorrection(int64_t t = 0);
|
||||
|
||||
/**
|
||||
* Get rate correction Eiger)
|
||||
* @returns 0 if rate correction disabled, > 0 otherwise
|
||||
*/
|
||||
int getRateCorrection();
|
||||
int64_t getRateCorrection();
|
||||
|
||||
/**
|
||||
* Prints receiver configuration
|
||||
* @returns OK or FAIL
|
||||
* #param level print level
|
||||
*/
|
||||
int printReceiverConfiguration();
|
||||
void printReceiverConfiguration(int level = logINFO);
|
||||
|
||||
/**
|
||||
* Checks if receiver is online and set flag
|
||||
@ -1824,28 +1789,21 @@ private:
|
||||
/**
|
||||
* reads a trim/settings file
|
||||
* @param fname name of the file to be read
|
||||
* @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
|
||||
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
* @returns the pointer to myMod or NULL if reading the file failed
|
||||
*/
|
||||
|
||||
sls_detector_module* readSettingsFile(std::string fname,
|
||||
int& iodelay, int& tau,
|
||||
sls_detector_module* myMod=NULL, int tb=1);
|
||||
sls_detector_module* readSettingsFile(std::string fname, sls_detector_module* myMod=NULL, int tb=1);
|
||||
|
||||
/**
|
||||
* writes a trim/settings file
|
||||
* @param fname name of the file to be written
|
||||
* @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
|
||||
*/
|
||||
int writeSettingsFile(std::string fname,
|
||||
sls_detector_module mod, int iodelay, int tau);
|
||||
int writeSettingsFile(std::string fname, sls_detector_module mod);
|
||||
|
||||
|
||||
/** slsDetector Id or position in the detectors list */
|
||||
@ -1884,17 +1842,8 @@ private:
|
||||
/** pointer to adc valuse in shared memory */
|
||||
int *adcs;
|
||||
|
||||
/** pointer to chip registers in shared memory */
|
||||
int *chipregs;
|
||||
|
||||
/** pointer to channal registers in shared memory */
|
||||
int *chanregs;
|
||||
|
||||
/** pointer to gain values in shared memory */
|
||||
int *gain;
|
||||
|
||||
/** pointer to offset values in shared memory */
|
||||
int *offset;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -924,14 +924,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
++i;
|
||||
|
||||
/*! \page settings
|
||||
- <b>pedestal [i]</b> starts acquisition for i frames, calculates pedestal and writes back to fpga. Used in GOTTHARD only. Only put! \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="pedestal"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
++i;
|
||||
|
||||
|
||||
|
||||
/* pots */
|
||||
/*! \page settings
|
||||
@ -2725,16 +2717,16 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action, int d
|
||||
if (action==HELP_ACTION) {
|
||||
return helpRateCorr(action);
|
||||
}
|
||||
int fval;
|
||||
int64_t ival;
|
||||
char answer[1000];
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
sscanf(args[1],"%d",&fval);
|
||||
myDet->setRateCorrection(fval, detPos);
|
||||
sscanf(args[1],"%lld",&ival);
|
||||
myDet->setRateCorrection(ival, detPos);
|
||||
}
|
||||
sprintf(answer,"%d",myDet->getRateCorrection(detPos));
|
||||
sprintf(answer,"%lld",myDet->getRateCorrection(detPos));
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -3549,15 +3541,6 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action, int d
|
||||
}
|
||||
sprintf(ans,"%d",myDet->setAllTrimbits(-1, detPos));
|
||||
return ans;
|
||||
} else if (cmd=="pedestal") {
|
||||
if (action==GET_ACTION)
|
||||
return string("cannot get");
|
||||
if (sscanf(args[1],"%d",&val)){
|
||||
sprintf(ans,"%d",myDet->calibratePedestal(val, detPos));
|
||||
return string(ans);
|
||||
}else
|
||||
return string("cannot parse frame number")+cmd;
|
||||
|
||||
}
|
||||
return string("unknown settings command ")+cmd;
|
||||
|
||||
@ -3574,8 +3557,6 @@ string slsDetectorCommand::helpSettings(int action) {
|
||||
os << "thresholdnotb eV [sett]\n sets the detector threshold in eV without loading trimbits. If sett is provided for eiger, uses settings sett"<< std::endl;
|
||||
os << "trimbits fname\n loads the trimfile fname to the detector. If no extension is specified, the serial number of each module will be attached."<< std::endl;
|
||||
os << "trimval i \n sets all the trimbits to i" << std::endl;
|
||||
os << "pedestal i \n starts acquisition for i frames, calculates pedestal and writes back to fpga."<< std::endl;
|
||||
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "settings \n gets the settings of the detector"<< std::endl;
|
||||
|
Reference in New Issue
Block a user