mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
changes for setting threshold without trimbits for eiger
This commit is contained in:
parent
ca358e4d17
commit
c2980b3c44
@ -550,6 +550,16 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
||||
myMod->chipregs=chipptr;
|
||||
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;
|
||||
nchipdiff=nChips-nchipold;
|
||||
if (nchipold!=nChips) {
|
||||
|
@ -12,7 +12,7 @@ SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c
|
||||
OBJS = $(SRC_CLNT:.c=.o)
|
||||
|
||||
|
||||
all: clean $(PROGS) #hv9m_blackfin_server
|
||||
all: clean updateVersion $(PROGS) #hv9m_blackfin_server
|
||||
|
||||
|
||||
boot: $(OBJS)
|
||||
@ -32,3 +32,6 @@ hv9m_blackfin_server:9mhvserial_bf.c
|
||||
clean:
|
||||
rm -rf $(DESTDIR)/$(PROGS) *.o $(DESTDIR)/hv9m_blackfin_server
|
||||
|
||||
updateVersion:
|
||||
./updateGitVersion.sh
|
||||
|
||||
|
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: d0aea299e999e12df143e036c0cf9c644125d45d
|
||||
Revision: 289
|
||||
Repsitory UUID: 0cb2b925263b128c0e4e3d30e546f1bd564a5272
|
||||
Revision: 290
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1423
|
||||
Last Changed Date: 2017-06-27 10:22:55 +0200
|
||||
Last Changed Rev: 1424
|
||||
Last Changed Date: 2017-06-27 17:46:32 +0200
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "d0aea299e999e12df143e036c0cf9c644125d45d"
|
||||
//#define SVNREV 0x1423
|
||||
#define SVNREPUUID "0cb2b925263b128c0e4e3d30e546f1bd564a5272"
|
||||
//#define SVNREV 0x1424
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x1423
|
||||
#define SVNREV 0x1424
|
||||
#define SVNDATE 0x20170627
|
||||
//
|
||||
|
@ -542,25 +542,31 @@ int setModule(sls_detector_module myMod, int delay){
|
||||
for(i=0;i<myMod.ndac;i++)
|
||||
setDAC((enum DACINDEX)i,myMod.dacs[i],myMod.module,0,retval);
|
||||
|
||||
//includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy,ichip,ix,ip=0,ich=0;
|
||||
for(iy=0;iy<256;iy++) {
|
||||
for (ichip=0; ichip<4; ichip++) {
|
||||
for(ix=0;ix<256;ix++) {
|
||||
tt[ip++]=myMod.chanregs[ich++];
|
||||
}
|
||||
if (ichip<3) {
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=0;
|
||||
|
||||
if(myMod.nchan==0 && myMod.nchip == 0)
|
||||
cprintf(BLUE,"Setting module without trimbits\n");
|
||||
else{
|
||||
cprintf(GREEN,"Setting module with trimbits\n");
|
||||
//includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy,ichip,ix,ip=0,ich=0;
|
||||
for(iy=0;iy<256;iy++) {
|
||||
for (ichip=0; ichip<4; ichip++) {
|
||||
for(ix=0;ix<256;ix++) {
|
||||
tt[ip++]=myMod.chanregs[ich++];
|
||||
}
|
||||
if (ichip<3) {
|
||||
tt[ip++]=0;
|
||||
tt[ip++]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set trimbits
|
||||
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
|
||||
cprintf(BG_RED,"Could not set trimbits\n");
|
||||
return FAIL;
|
||||
//set trimbits
|
||||
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
|
||||
cprintf(BG_RED,"Could not set trimbits\n");
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return thisSettings;
|
||||
@ -1211,11 +1217,13 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
|
||||
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");
|
||||
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");
|
||||
return FAIL;
|
||||
}
|
||||
@ -1249,14 +1257,19 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
if (srcMod->offset>=0)
|
||||
destMod->offset=srcMod->offset;
|
||||
|
||||
for (ichip=0; ichip<(srcMod->nchip); ichip++) {
|
||||
if (*((srcMod->chipregs)+ichip)>=0)
|
||||
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
|
||||
}
|
||||
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
||||
if (*((srcMod->chanregs)+ichan)>=0)
|
||||
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
|
||||
if((destMod->nchip!=0) || (destMod->nchan!=0)) {
|
||||
for (ichip=0; ichip<(srcMod->nchip); ichip++) {
|
||||
if (*((srcMod->chipregs)+ichip)>=0)
|
||||
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
|
||||
}
|
||||
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
||||
if (*((srcMod->chanregs)+ichan)>=0)
|
||||
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
else printf("Not Copying trimbits\n");
|
||||
#endif
|
||||
for (idac=0; idac<(srcMod->ndac); idac++) {
|
||||
if (*((srcMod->dacs)+idac)>=0)
|
||||
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
|
||||
|
@ -1168,7 +1168,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 ret=-100;
|
||||
@ -1189,8 +1189,8 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
||||
for(int idet=posmin; idet<posmax; idet++){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func3_t<int,slsDetector,int,int,detectorSettings,int>(&slsDetector::setThresholdEnergy,
|
||||
detectors[idet],e_eV,-1,isettings,iret[idet]));
|
||||
Task* task = new Task(new func4_t<int,slsDetector,int,int,detectorSettings,int,int>(&slsDetector::setThresholdEnergy,
|
||||
detectors[idet],e_eV,-1,isettings,tb,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
|
@ -462,9 +462,10 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
\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 setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS,int tb=1);
|
||||
|
||||
/**
|
||||
get detector settings
|
||||
|
@ -2980,7 +2980,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 retval;
|
||||
@ -2997,6 +2997,11 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
//to exclude trimbits
|
||||
if(!tb) {
|
||||
module.nchan=0;
|
||||
module.nchip=0;
|
||||
}
|
||||
sendModule(&module);
|
||||
|
||||
//not included in module
|
||||
@ -3030,23 +3035,29 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
||||
if (ret!=FAIL) {
|
||||
if (detectorModules) {
|
||||
if (imod>=0 && imod<thisDetector->nMod[X]*thisDetector->nMod[Y]) {
|
||||
(detectorModules+imod)->nchan=module.nchan;
|
||||
(detectorModules+imod)->nchip=module.nchip;
|
||||
if(tb) {
|
||||
(detectorModules+imod)->nchan=module.nchan;
|
||||
(detectorModules+imod)->nchip=module.nchip;
|
||||
}
|
||||
(detectorModules+imod)->ndac=module.ndac;
|
||||
(detectorModules+imod)->nadc=module.nadc;
|
||||
thisDetector->nChips=module.nchip;
|
||||
thisDetector->nChans=module.nchan/module.nchip;
|
||||
if(tb) {
|
||||
thisDetector->nChips=module.nchip;
|
||||
thisDetector->nChans=module.nchan/module.nchip;
|
||||
}
|
||||
thisDetector->nDacs=module.ndac;
|
||||
thisDetector->nAdcs=module.nadc;
|
||||
|
||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
||||
if (chipregs)
|
||||
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
||||
if(tb) {
|
||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
||||
if (chipregs)
|
||||
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
||||
|
||||
if (chanregs) {
|
||||
for (int i=0; i<thisDetector->nChans; i++) {
|
||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
||||
if (chanregs) {
|
||||
for (int i=0; i<thisDetector->nChans; i++) {
|
||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3277,11 +3288,11 @@ int slsDetector::getThresholdEnergy(int imod){
|
||||
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
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
setThresholdEnergyAndSettings(e_eV,isettings);
|
||||
setThresholdEnergyAndSettings(e_eV,isettings,tb);
|
||||
return thisDetector->currentThresholdEV;
|
||||
}
|
||||
|
||||
@ -3322,7 +3333,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
|
||||
detectorSettings is = ((isettings != GET_SETTINGS) ? isettings: thisDetector->currentSettings);
|
||||
@ -3388,7 +3399,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
#endif
|
||||
//read the files
|
||||
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);
|
||||
return FAIL;
|
||||
}
|
||||
@ -3423,13 +3434,13 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
int tau1 = -1; //not included in the module
|
||||
int iodelay2 = -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));
|
||||
deleteModule(myMod1);
|
||||
deleteModule(myMod2);
|
||||
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));
|
||||
deleteModule(myMod1);
|
||||
deleteModule(myMod2);
|
||||
@ -3445,7 +3456,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
iodelay = iodelay1;
|
||||
|
||||
//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) {
|
||||
printf("Could not interpolate, different dac values in files\n");
|
||||
setErrorMask((getErrorMask())|(SETTINGS_NOT_SET));
|
||||
@ -3461,7 +3472,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
||||
|
||||
myMod->module=0;
|
||||
myMod->reg=thisDetector->currentSettings;
|
||||
setModule(*myMod, iodelay, tau, e_eV, 0, 0);
|
||||
setModule(*myMod, iodelay, tau, e_eV, 0, 0, tb);
|
||||
deleteModule(myMod);
|
||||
if (getSettings(-1) != is){
|
||||
std::cout << "Could not set settings in detector" << endl;
|
||||
|
@ -965,10 +965,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
\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 current register value
|
||||
\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);
|
||||
|
||||
/**
|
||||
@ -999,17 +1000,19 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
\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 setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS, int tb=1);
|
||||
|
||||
/**
|
||||
set threshold energy
|
||||
\param e_eV threshold in eV
|
||||
\param isettings ev. change settings
|
||||
\param tb 1 to include trimbits, 0 to exclude
|
||||
\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
|
||||
|
@ -207,7 +207,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
||||
/* *\/ */
|
||||
/* 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;
|
||||
|
||||
|
||||
|
@ -429,7 +429,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
virtual externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE)=0;
|
||||
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);};
|
||||
|
||||
|
||||
|
@ -564,6 +564,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="thresholdnotb"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="trimbits"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
@ -3390,10 +3394,10 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
||||
return myDet->getDetectorSettings(myDet->getSettings());
|
||||
} else if (cmd=="threshold") {
|
||||
if (action==PUT_ACTION) {
|
||||
detectorType type = myDet->getDetectorsType();
|
||||
if (!sscanf(args[1],"%d",&val)) {
|
||||
return string("invalid threshold value");
|
||||
}
|
||||
detectorType type = myDet->getDetectorsType();
|
||||
if (type != EIGER || (type == EIGER && narg<=2)) {
|
||||
myDet->setThresholdEnergy(val);
|
||||
} else {
|
||||
@ -3405,6 +3409,25 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
||||
}
|
||||
sprintf(ans,"%d",myDet->getThresholdEnergy());
|
||||
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") {
|
||||
if (narg>=2) {
|
||||
string sval=string(args[1]);
|
||||
@ -3487,7 +3510,8 @@ string slsDetectorCommand::helpSettings(int narg, char *args[], int 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"
|
||||
"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 << "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;
|
||||
@ -3497,6 +3521,7 @@ string slsDetectorCommand::helpSettings(int narg, char *args[], int action) {
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "settings \n gets the settings of the detector"<< std::endl;
|
||||
os << "threshold V\n gets the detector threshold"<< std::endl;
|
||||
os << "thresholdnotb V\n gets the detector threshold"<< std::endl;
|
||||
os << "trimbits [fname]\n returns the trimfile loaded on the detector. If fname is specified the trimbits are saved to file. If no extension is specified, the serial number of each module will be attached."<< std::endl;
|
||||
os << "trimval \n returns the value all trimbits are set to. If they are different, returns -1." << std::endl;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
// double* convertAngles(){return convertAngles(currentPosition);};
|
||||
// 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 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)
|
||||
if(myDetectorType != EIGER) {
|
||||
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
|
||||
for (int i = 0; i<myMod->nchan; i++)
|
||||
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]);
|
||||
if(tb) {
|
||||
for (int i = 0; i<myMod->nchan; i++)
|
||||
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]);
|
||||
}
|
||||
return myMod;
|
||||
}
|
||||
|
||||
@ -180,7 +182,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
|
||||
/* 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*)&iodelay,sizeof(iodelay));
|
||||
infile.read((char*)&tau,sizeof(tau));
|
||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||
#ifdef VERBOSE
|
||||
for(int i=0;i<myMod->ndac;i++)
|
||||
std::cout << "dac " << i << ":" << myMod->dacs[i] << std::endl;
|
||||
std::cout << "iodelay:" << iodelay << std::endl;
|
||||
std::cout << "tau:" << tau << std::endl;
|
||||
#endif
|
||||
if(infile.eof()){
|
||||
cout<<endl<<"Error, could not load trimbits end of file, "<<myfname<<", reached."<<endl<<endl;
|
||||
if (nflag)
|
||||
deleteModule(myMod);
|
||||
if(tb) {
|
||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||
if(infile.eof()){
|
||||
cout<<endl<<"Error, could not load trimbits end of file, "<<myfname<<", reached."<<endl<<endl;
|
||||
if (nflag)
|
||||
deleteModule(myMod);
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
infile.close();
|
||||
strcpy(settingsFile,fname.c_str());
|
||||
|
@ -88,9 +88,10 @@ class energyConversion
|
||||
\param energy energy to trim at
|
||||
\param e1 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
|
||||
*/
|
||||
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 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(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
|
||||
|
@ -129,8 +129,8 @@ public:
|
||||
Task(func2_t <string,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),m14(0),m15(0){};
|
||||
/* 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),m14(0),m15(0){};
|
||||
/* Return: int, Param: int,int,detectorSettings */
|
||||
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),m14(0),m15(0){};
|
||||
/* Return: int, Param: int,int,detectorSettings,int */
|
||||
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),m14(0),m15(0){};
|
||||
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
||||
Task(func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* 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(0),m14(t),m15(0){};
|
||||
/* Return: dacs_t, Param: dacIndex, int */
|
||||
@ -185,8 +185,8 @@ private:
|
||||
func2_t <string,slsDetector,networkParameter,string,string>* m11;
|
||||
/* Return: void, Param: none */
|
||||
func00_t <void,slsDetector>* m12;
|
||||
/* Return: int, Param: int,int,detectorSettings */
|
||||
func3_t <int,slsDetector,int,int,detectorSettings,int>* m13;
|
||||
/* Return: int, Param: int,int,detectorSettings,int */
|
||||
func4_t <int,slsDetector,int,int,detectorSettings,int,int>* m13;
|
||||
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
||||
func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* m14;
|
||||
/* Return: dacs_t, Param: dacIndex, int */
|
||||
|
Loading…
x
Reference in New Issue
Block a user