mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
new feature, set threshold without uploading trimbits
This commit is contained in:
parent
b1de501bef
commit
6a80bc5b54
@ -561,6 +561,15 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
|||||||
myMod->chipregs=chipptr;
|
myMod->chipregs=chipptr;
|
||||||
myMod->chanregs=chanptr;
|
myMod->chanregs=chanptr;
|
||||||
|
|
||||||
|
#ifdef EIGERD
|
||||||
|
//feature to exclude sending of trimbtis, nchips=0,nchans=0 in that case
|
||||||
|
if(myMod->nchip == 0 && myMod->nchan == 0) {
|
||||||
|
receiveAll=0;
|
||||||
|
nchipold=0;
|
||||||
|
nchanold=0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
nChips=myMod->nchip;
|
nChips=myMod->nchip;
|
||||||
nchipdiff=nChips-nchipold;
|
nchipdiff=nChips-nchipold;
|
||||||
if (nchipold!=nChips) {
|
if (nchipold!=nChips) {
|
||||||
@ -571,6 +580,7 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
|||||||
printf("received %d chips\n",nChips);
|
printf("received %d chips\n",nChips);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
nChans=myMod->nchan;
|
nChans=myMod->nchan;
|
||||||
nchandiff=nChans-nchanold;
|
nchandiff=nChans-nchanold;
|
||||||
if (nchanold!=nChans) {
|
if (nchanold!=nChans) {
|
||||||
|
Binary file not shown.
@ -627,25 +627,30 @@ int setModule(sls_detector_module myMod, int delay){
|
|||||||
for(i=0;i<myMod.ndac;i++)
|
for(i=0;i<myMod.ndac;i++)
|
||||||
setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval);
|
setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval);
|
||||||
|
|
||||||
//includ gap pixels
|
if(myMod.nchan==0 && myMod.nchip == 0)
|
||||||
unsigned int tt[263680];
|
cprintf(BLUE,"Setting module without trimbits\n");
|
||||||
int iy,ichip,ix,ip=0,ich=0;
|
else{
|
||||||
for(iy=0;iy<256;iy++) {
|
cprintf(GREEN,"Setting module with trimbits\n");
|
||||||
for (ichip=0; ichip<4; ichip++) {
|
//includ gap pixels
|
||||||
for(ix=0;ix<256;ix++) {
|
unsigned int tt[263680];
|
||||||
tt[ip++]=myMod.chanregs[ich++];
|
int iy,ichip,ix,ip=0,ich=0;
|
||||||
}
|
for(iy=0;iy<256;iy++) {
|
||||||
if (ichip<3) {
|
for (ichip=0; ichip<4; ichip++) {
|
||||||
tt[ip++]=0;
|
for(ix=0;ix<256;ix++) {
|
||||||
tt[ip++]=0;
|
tt[ip++]=myMod.chanregs[ich++];
|
||||||
|
}
|
||||||
|
if (ichip<3) {
|
||||||
|
tt[ip++]=0;
|
||||||
|
tt[ip++]=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//set trimbits
|
//set trimbits
|
||||||
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
|
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
|
||||||
cprintf(BG_RED,"Could not set trimbits\n");
|
cprintf(BG_RED,"Could not set trimbits\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
@ -1126,11 +1131,13 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
|||||||
|
|
||||||
destMod->serialnumber=srcMod->serialnumber;
|
destMod->serialnumber=srcMod->serialnumber;
|
||||||
}
|
}
|
||||||
if ((srcMod->nchip)>(destMod->nchip)) {
|
//no trimbit feature
|
||||||
|
if (destMod->nchip && ((srcMod->nchip)>(destMod->nchip))) {
|
||||||
printf("Number of chip of source is larger than number of chips of destination\n");
|
printf("Number of chip of source is larger than number of chips of destination\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if ((srcMod->nchan)>(destMod->nchan)) {
|
//no trimbit feature
|
||||||
|
if (destMod->nchan && ((srcMod->nchan)>(destMod->nchan))) {
|
||||||
printf("Number of channels of source is larger than number of channels of destination\n");
|
printf("Number of channels of source is larger than number of channels of destination\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -1164,14 +1171,21 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
|||||||
if (srcMod->offset>=0)
|
if (srcMod->offset>=0)
|
||||||
destMod->offset=srcMod->offset;
|
destMod->offset=srcMod->offset;
|
||||||
|
|
||||||
for (ichip=0; ichip<(srcMod->nchip); ichip++) {
|
if((destMod->nchip!=0) || (destMod->nchan!=0)) {
|
||||||
if (*((srcMod->chipregs)+ichip)>=0)
|
for (ichip=0; ichip<(srcMod->nchip); ichip++) {
|
||||||
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
|
if (*((srcMod->chipregs)+ichip)>=0)
|
||||||
}
|
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
|
||||||
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
}
|
||||||
if (*((srcMod->chanregs)+ichan)>=0)
|
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
||||||
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
|
if (*((srcMod->chanregs)+ichan)>=0)
|
||||||
|
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
printf("Not Copying trimbits\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
for (idac=0; idac<(srcMod->ndac); idac++) {
|
for (idac=0; idac<(srcMod->ndac); idac++) {
|
||||||
if (*((srcMod->dacs)+idac)>=0)
|
if (*((srcMod->dacs)+idac)>=0)
|
||||||
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
|
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
|
||||||
|
@ -1139,7 +1139,7 @@ int multiSlsDetector::getThresholdEnergy(int pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings isettings) {
|
int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings isettings, int tb) {
|
||||||
|
|
||||||
int posmin, posmax;
|
int posmin, posmax;
|
||||||
int ret=-100;
|
int ret=-100;
|
||||||
@ -1160,8 +1160,8 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
|||||||
for(int idet=posmin; idet<posmax; idet++){
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
if(detectors[idet]){
|
if(detectors[idet]){
|
||||||
iret[idet]= new int(-1);
|
iret[idet]= new int(-1);
|
||||||
Task* task = new Task(new func3_t<int,slsDetector,int,int,detectorSettings,int>(&slsDetector::setThresholdEnergy,
|
Task* task = new Task(new func4_t<int,slsDetector,int,int,detectorSettings,int,int>(&slsDetector::setThresholdEnergy,
|
||||||
detectors[idet],e_eV,-1,isettings,iret[idet]));
|
detectors[idet],e_eV,-1,isettings,tb, iret[idet]));
|
||||||
threadpool->add_task(task);
|
threadpool->add_task(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -453,9 +453,10 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
\param e_eV threshold in eV
|
\param e_eV threshold in eV
|
||||||
\param imod module number (-1 all)
|
\param imod module number (-1 all)
|
||||||
\param isettings ev. change settings
|
\param isettings ev. change settings
|
||||||
|
\param tb 1 to include trimbits, 0 to exclude
|
||||||
\returns current threshold value for imod in ev (-1 failed)
|
\returns current threshold value for imod in ev (-1 failed)
|
||||||
*/
|
*/
|
||||||
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS);
|
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS, int tb=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
get detector settings
|
get detector settings
|
||||||
|
@ -2886,7 +2886,7 @@ int slsDetector::setModule(int reg, int imod){
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval, int* offsetval){
|
int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval, int* offsetval, int tb){
|
||||||
|
|
||||||
int fnum=F_SET_MODULE;
|
int fnum=F_SET_MODULE;
|
||||||
int retval;
|
int retval;
|
||||||
@ -2903,6 +2903,11 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
|||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
//to exclude trimbits
|
||||||
|
if(!tb) {
|
||||||
|
module.nchan=0;
|
||||||
|
module.nchip=0;
|
||||||
|
}
|
||||||
sendModule(&module);
|
sendModule(&module);
|
||||||
|
|
||||||
//not included in module
|
//not included in module
|
||||||
@ -2936,23 +2941,29 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
|||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
if (detectorModules) {
|
if (detectorModules) {
|
||||||
if (imod>=0 && imod<thisDetector->nMod[X]*thisDetector->nMod[Y]) {
|
if (imod>=0 && imod<thisDetector->nMod[X]*thisDetector->nMod[Y]) {
|
||||||
(detectorModules+imod)->nchan=module.nchan;
|
if(tb) {
|
||||||
(detectorModules+imod)->nchip=module.nchip;
|
(detectorModules+imod)->nchan=module.nchan;
|
||||||
|
(detectorModules+imod)->nchip=module.nchip;
|
||||||
|
}
|
||||||
(detectorModules+imod)->ndac=module.ndac;
|
(detectorModules+imod)->ndac=module.ndac;
|
||||||
(detectorModules+imod)->nadc=module.nadc;
|
(detectorModules+imod)->nadc=module.nadc;
|
||||||
thisDetector->nChips=module.nchip;
|
if(tb) {
|
||||||
thisDetector->nChans=module.nchan/module.nchip;
|
thisDetector->nChips=module.nchip;
|
||||||
|
thisDetector->nChans=module.nchan/module.nchip;
|
||||||
|
}
|
||||||
thisDetector->nDacs=module.ndac;
|
thisDetector->nDacs=module.ndac;
|
||||||
thisDetector->nAdcs=module.nadc;
|
thisDetector->nAdcs=module.nadc;
|
||||||
|
|
||||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
if(tb) {
|
||||||
if (chipregs)
|
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
||||||
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
if (chipregs)
|
||||||
|
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
||||||
|
|
||||||
if (chanregs) {
|
if (chanregs) {
|
||||||
for (int i=0; i<thisDetector->nChans; i++) {
|
for (int i=0; i<thisDetector->nChans; i++) {
|
||||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3182,11 +3193,11 @@ int slsDetector::getThresholdEnergy(int imod){
|
|||||||
return thisDetector->currentThresholdEV;
|
return thisDetector->currentThresholdEV;
|
||||||
};
|
};
|
||||||
|
|
||||||
int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isettings){
|
int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isettings, int tb){
|
||||||
|
|
||||||
//currently only for eiger
|
//currently only for eiger
|
||||||
if (thisDetector->myDetectorType == EIGER) {
|
if (thisDetector->myDetectorType == EIGER) {
|
||||||
setThresholdEnergyAndSettings(e_eV,isettings);
|
setThresholdEnergyAndSettings(e_eV,isettings,tb);
|
||||||
return thisDetector->currentThresholdEV;
|
return thisDetector->currentThresholdEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3226,7 +3237,7 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings) {
|
int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings, int tb) {
|
||||||
|
|
||||||
//if settings provided, use that, else use the shared memory variable
|
//if settings provided, use that, else use the shared memory variable
|
||||||
detectorSettings is = ((isettings != GET_SETTINGS) ? isettings: thisDetector->currentSettings);
|
detectorSettings is = ((isettings != GET_SETTINGS) ? isettings: thisDetector->currentSettings);
|
||||||
@ -3292,7 +3303,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
|||||||
#endif
|
#endif
|
||||||
//read the files
|
//read the files
|
||||||
myMod=createModule();
|
myMod=createModule();
|
||||||
if (NULL == readSettingsFile(settingsfname,thisDetector->myDetectorType, iodelay, tau, myMod)) {
|
if (NULL == readSettingsFile(settingsfname,thisDetector->myDetectorType, iodelay, tau, myMod, tb)) {
|
||||||
if(myMod)deleteModule(myMod);
|
if(myMod)deleteModule(myMod);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -3327,13 +3338,13 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
|||||||
int tau1 = -1; //not included in the module
|
int tau1 = -1; //not included in the module
|
||||||
int iodelay2 = -1; //not included in the module
|
int iodelay2 = -1; //not included in the module
|
||||||
int tau2 = -1; //not included in the module
|
int tau2 = -1; //not included in the module
|
||||||
if (NULL == readSettingsFile(settingsfname1,thisDetector->myDetectorType, iodelay1, tau1, myMod1)) {
|
if (NULL == readSettingsFile(settingsfname1,thisDetector->myDetectorType, iodelay1, tau1, myMod1, tb)) {
|
||||||
setErrorMask((getErrorMask())|(SETTINGS_FILE_NOT_OPEN));
|
setErrorMask((getErrorMask())|(SETTINGS_FILE_NOT_OPEN));
|
||||||
deleteModule(myMod1);
|
deleteModule(myMod1);
|
||||||
deleteModule(myMod2);
|
deleteModule(myMod2);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (NULL == readSettingsFile(settingsfname2,thisDetector->myDetectorType, iodelay2, tau2, myMod2)) {
|
if (NULL == readSettingsFile(settingsfname2,thisDetector->myDetectorType, iodelay2, tau2, myMod2, tb)) {
|
||||||
setErrorMask((getErrorMask())|(SETTINGS_FILE_NOT_OPEN));
|
setErrorMask((getErrorMask())|(SETTINGS_FILE_NOT_OPEN));
|
||||||
deleteModule(myMod1);
|
deleteModule(myMod1);
|
||||||
deleteModule(myMod2);
|
deleteModule(myMod2);
|
||||||
@ -3349,7 +3360,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
|||||||
iodelay = iodelay1;
|
iodelay = iodelay1;
|
||||||
|
|
||||||
//interpolate module
|
//interpolate module
|
||||||
myMod = interpolateTrim(thisDetector->myDetectorType, myMod1, myMod2, e_eV, trim1, trim2);
|
myMod = interpolateTrim(thisDetector->myDetectorType, myMod1, myMod2, e_eV, trim1, trim2, tb);
|
||||||
if (myMod == NULL) {
|
if (myMod == NULL) {
|
||||||
printf("Could not interpolate, different dac values in files\n");
|
printf("Could not interpolate, different dac values in files\n");
|
||||||
setErrorMask((getErrorMask())|(SETTINGS_NOT_SET));
|
setErrorMask((getErrorMask())|(SETTINGS_NOT_SET));
|
||||||
@ -3365,7 +3376,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
|||||||
|
|
||||||
myMod->module=0;
|
myMod->module=0;
|
||||||
myMod->reg=thisDetector->currentSettings;
|
myMod->reg=thisDetector->currentSettings;
|
||||||
setModule(*myMod, iodelay, tau, e_eV, 0, 0);
|
setModule(*myMod, iodelay, tau, e_eV, 0, 0, tb);
|
||||||
deleteModule(myMod);
|
deleteModule(myMod);
|
||||||
if (getSettings(-1) != is){
|
if (getSettings(-1) != is){
|
||||||
printf( "Could not set settings in detector \n" );
|
printf( "Could not set settings in detector \n" );
|
||||||
|
@ -953,10 +953,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
\param e_eV threashold in eV (detector specific)
|
\param e_eV threashold in eV (detector specific)
|
||||||
\param gainval pointer to extra gain values
|
\param gainval pointer to extra gain values
|
||||||
\param offsetval pointer to extra offset values
|
\param offsetval pointer to extra offset values
|
||||||
|
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||||
\returns current register value
|
\returns current register value
|
||||||
\sa ::sls_detector_module
|
\sa ::sls_detector_module
|
||||||
*/
|
*/
|
||||||
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval=0, int* offsetval=0);
|
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval=0, int* offsetval=0, int tb=1);
|
||||||
//virtual int setModule(sls_detector_module module);
|
//virtual int setModule(sls_detector_module module);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -987,17 +988,19 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
\param e_eV threshold in eV
|
\param e_eV threshold in eV
|
||||||
\param imod module number (-1 all)
|
\param imod module number (-1 all)
|
||||||
\param isettings ev. change settings
|
\param isettings ev. change settings
|
||||||
|
\param tb 1 to include trimbits, 0 to exclude
|
||||||
\returns current threshold value for imod in ev (-1 failed)
|
\returns current threshold value for imod in ev (-1 failed)
|
||||||
*/
|
*/
|
||||||
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS);
|
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS, int tb=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
set threshold energy
|
set threshold energy
|
||||||
\param e_eV threshold in eV
|
\param e_eV threshold in eV
|
||||||
\param isettings ev. change settings
|
\param isettings ev. change settings
|
||||||
|
\param tb 1 to include trimbits, 0 to exclude
|
||||||
\returns OK if successful, else FAIL
|
\returns OK if successful, else FAIL
|
||||||
*/
|
*/
|
||||||
int setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings);
|
int setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings, int tb=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
get detector settings
|
get detector settings
|
||||||
|
@ -210,7 +210,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual detectorType getDetectorsType(int pos=-1)=0; */
|
/* virtual detectorType getDetectorsType(int pos=-1)=0; */
|
||||||
|
|
||||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
|
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
|
||||||
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
virtual externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE)=0;
|
virtual externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE)=0;
|
||||||
int setTimingMode(int i=-1){return slsDetectorUsers::getTimingMode( externalCommunicationType( setExternalCommunicationMode(externalCommunicationType( slsDetectorUsers::getTimingMode(i) ) ) ) );};
|
int setTimingMode(int i=-1){return slsDetectorUsers::getTimingMode( externalCommunicationType( setExternalCommunicationMode(externalCommunicationType( slsDetectorUsers::getTimingMode(i) ) ) ) );};
|
||||||
|
|
||||||
virtual int setThresholdEnergy(int e_eV, int imod, detectorSettings isettings=GET_SETTINGS)=0;
|
virtual int setThresholdEnergy(int e_eV, int imod, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
|
||||||
int setThresholdEnergy(int e_eV){return setThresholdEnergy(e_eV,-1);};
|
int setThresholdEnergy(int e_eV){return setThresholdEnergy(e_eV,-1);};
|
||||||
|
|
||||||
|
|
||||||
|
@ -552,6 +552,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="thresholdnotb"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||||
|
i++;
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="trimbits"; //
|
descrToFuncMap[i].m_pFuncName="trimbits"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||||
i++;
|
i++;
|
||||||
@ -3289,10 +3293,10 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
|||||||
return myDet->getDetectorSettings(myDet->getSettings());
|
return myDet->getDetectorSettings(myDet->getSettings());
|
||||||
} else if (cmd=="threshold") {
|
} else if (cmd=="threshold") {
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
detectorType type = myDet->getDetectorsType();
|
|
||||||
if (!sscanf(args[1],"%d",&val)) {
|
if (!sscanf(args[1],"%d",&val)) {
|
||||||
return string("invalid threshold value");
|
return string("invalid threshold value");
|
||||||
}
|
}
|
||||||
|
detectorType type = myDet->getDetectorsType();
|
||||||
if (type != EIGER || (type == EIGER && narg<=2)) {
|
if (type != EIGER || (type == EIGER && narg<=2)) {
|
||||||
myDet->setThresholdEnergy(val);
|
myDet->setThresholdEnergy(val);
|
||||||
} else {
|
} else {
|
||||||
@ -3304,6 +3308,25 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
|||||||
}
|
}
|
||||||
sprintf(ans,"%d",myDet->getThresholdEnergy());
|
sprintf(ans,"%d",myDet->getThresholdEnergy());
|
||||||
return string(ans);
|
return string(ans);
|
||||||
|
} else if (cmd=="thresholdnotb") {
|
||||||
|
if (action==PUT_ACTION) {
|
||||||
|
if (!sscanf(args[1],"%d",&val)) {
|
||||||
|
return string("invalid threshold value");
|
||||||
|
}
|
||||||
|
detectorType type = myDet->getDetectorsType();
|
||||||
|
if (type != EIGER)
|
||||||
|
return string("not implemented for this detector");
|
||||||
|
if (narg<=2) {
|
||||||
|
myDet->setThresholdEnergy(val, -1, GET_SETTINGS, 0);
|
||||||
|
} else {
|
||||||
|
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
|
||||||
|
if(sett == -1)
|
||||||
|
return string("invalid settings value");
|
||||||
|
myDet->setThresholdEnergy(val, -1, sett, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sprintf(ans,"%d",myDet->getThresholdEnergy());
|
||||||
|
return string(ans);
|
||||||
} else if (cmd=="trimbits") {
|
} else if (cmd=="trimbits") {
|
||||||
if (narg>=2) {
|
if (narg>=2) {
|
||||||
string sval=string(args[1]);
|
string sval=string(args[1]);
|
||||||
@ -3386,7 +3409,8 @@ string slsDetectorCommand::helpSettings(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||||
os << "settings s \n sets the settings of the detector - can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain"
|
os << "settings s \n sets the settings of the detector - can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain"
|
||||||
"lownoise, dynamichg0,fixgain1,fixgain2,forceswitchg1, forceswitchg2"<< std::endl;
|
"lownoise, dynamichg0,fixgain1,fixgain2,forceswitchg1, forceswitchg2"<< std::endl;
|
||||||
os << "threshold eV\n sets the detector threshold in eV"<< std::endl;
|
os << "threshold eV [sett]\n sets the detector threshold in eV. If sett is provided for eiger, uses settings sett"<< std::endl;
|
||||||
|
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 << "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 << "trim:mode fname\n trims the detector according to mode (can be noise, beam, improve, fix) and saves the resulting trimbits to file fname."<< std::endl;
|
os << "trim:mode fname\n trims the detector according to mode (can be noise, beam, improve, fix) and saves the resulting trimbits to file fname."<< std::endl;
|
||||||
os << "trimval i \n sets all the trimbits to i" << std::endl;
|
os << "trimval i \n sets all the trimbits to i" << std::endl;
|
||||||
|
@ -421,7 +421,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
// double* convertAngles(){return convertAngles(currentPosition);};
|
// double* convertAngles(){return convertAngles(currentPosition);};
|
||||||
// virtual double* convertAngles(double pos)=0;
|
// virtual double* convertAngles(double pos)=0;
|
||||||
|
|
||||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
|
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
|
||||||
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
||||||
|
|
||||||
virtual double getRateCorrectionTau()=0;
|
virtual double getRateCorrectionTau()=0;
|
||||||
|
@ -138,7 +138,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2){
|
slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2, int tb){
|
||||||
// only implemented for eiger currently (in terms of which dacs)
|
// only implemented for eiger currently (in terms of which dacs)
|
||||||
if(myDetectorType != EIGER) {
|
if(myDetectorType != EIGER) {
|
||||||
printf("Interpolation of Trim values not implemented for this detector!\n");
|
printf("Interpolation of Trim values not implemented for this detector!\n");
|
||||||
@ -168,8 +168,10 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Interpolate all trimbits
|
//Interpolate all trimbits
|
||||||
for (int i = 0; i<myMod->nchan; i++)
|
if(tb) {
|
||||||
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]);
|
for (int i = 0; i<myMod->nchan; i++)
|
||||||
|
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]);
|
||||||
|
}
|
||||||
return myMod;
|
return myMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +182,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
|
|||||||
/* I/O */
|
/* I/O */
|
||||||
|
|
||||||
|
|
||||||
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod){
|
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod, int tb){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -372,19 +374,21 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
infile.read((char*) myMod->dacs,sizeof(dacs_t)*(myMod->ndac));
|
infile.read((char*) myMod->dacs,sizeof(dacs_t)*(myMod->ndac));
|
||||||
infile.read((char*)&iodelay,sizeof(iodelay));
|
infile.read((char*)&iodelay,sizeof(iodelay));
|
||||||
infile.read((char*)&tau,sizeof(tau));
|
infile.read((char*)&tau,sizeof(tau));
|
||||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
for(int i=0;i<myMod->ndac;i++)
|
for(int i=0;i<myMod->ndac;i++)
|
||||||
printf( "dac %d:%d \n", i, myMod->dacs[i] );
|
printf( "dac %d:%d \n", i, myMod->dacs[i] );
|
||||||
printf( "iodelay:%d \n", iodelay );
|
printf( "iodelay:%d \n", iodelay );
|
||||||
printf( "tau:%d \n", tau );
|
printf( "tau:%d \n", tau );
|
||||||
#endif
|
#endif
|
||||||
if(infile.eof()){
|
if(tb) {
|
||||||
printf( "Error, could not load trimbits end of file reached: %s \n\n", myfname.c_str() );
|
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||||
if (nflag)
|
if(infile.eof()){
|
||||||
deleteModule(myMod);
|
printf( "Error, could not load trimbits end of file reached: %s \n\n", myfname.c_str() );
|
||||||
|
if (nflag)
|
||||||
|
deleteModule(myMod);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
infile.close();
|
infile.close();
|
||||||
strcpy(settingsFile,fname.c_str());
|
strcpy(settingsFile,fname.c_str());
|
||||||
|
@ -88,9 +88,10 @@ class energyConversion
|
|||||||
\param energy energy to trim at
|
\param energy energy to trim at
|
||||||
\param e1 reference trim value
|
\param e1 reference trim value
|
||||||
\param e2 reference trim value
|
\param e2 reference trim value
|
||||||
|
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||||
\returns the pointer to the module structure with interpolated values or NULL if error
|
\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);
|
sls_detector_module* interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2, int tb=1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -103,10 +104,11 @@ class energyConversion
|
|||||||
\param iodelay io delay (detector specific)
|
\param iodelay io delay (detector specific)
|
||||||
\param tau tau (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 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
|
\returns the pointer to myMod or NULL if reading the file failed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL);
|
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL, int tb=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
writes a trim/settings file
|
writes a trim/settings file
|
||||||
|
@ -129,8 +129,8 @@ public:
|
|||||||
Task(func2_t <char*,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0){};
|
Task(func2_t <char*,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0){};
|
||||||
/* Return: void, Param: none */
|
/* Return: void, Param: none */
|
||||||
Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0){};
|
Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0){};
|
||||||
/* Return: int, Param: int,int,detectorSettings */
|
/* Return: int, Param: int,int,detectorSettings,int */
|
||||||
Task(func3_t <int,slsDetector,int,int,detectorSettings,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t){};
|
Task(func4_t <int,slsDetector,int,int,detectorSettings,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t){};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ private:
|
|||||||
/* Return: void, Param: none */
|
/* Return: void, Param: none */
|
||||||
func00_t <void,slsDetector>* m12;
|
func00_t <void,slsDetector>* m12;
|
||||||
/* Return: int, Param: int,int,detectorSettings */
|
/* Return: int, Param: int,int,detectorSettings */
|
||||||
func3_t <int,slsDetector,int,int,detectorSettings,int>* m13;
|
func4_t <int,slsDetector,int,int,detectorSettings,int,int>* m13;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user