mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
some jctb changes
This commit is contained in:
parent
bd3466b04f
commit
de0f35afb3
@ -99,6 +99,7 @@ int udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
||||
u_int32_t clkDivider[2]={32,16};
|
||||
int32_t clkPhase[2]={0,0};
|
||||
|
||||
u_int32_t adcDisableMask=0;
|
||||
|
||||
int ififostart, ififostop, ififostep, ififo;
|
||||
|
||||
@ -1137,10 +1138,31 @@ u_int32_t testRAM(void) {
|
||||
}
|
||||
|
||||
int getNModBoard() {
|
||||
return nModX;
|
||||
return 32;//nModX;
|
||||
}
|
||||
|
||||
int setNMod(int n) {
|
||||
|
||||
/* printf("Writin ADC disable register %08x\n",n); */
|
||||
/* bus_w(ADC_LATCH_DISABLE_REG,n); */
|
||||
return getNMod();
|
||||
}
|
||||
|
||||
int getNMod() {
|
||||
/* u_int32_t reg; */
|
||||
/* int i; */
|
||||
/* reg=bus_r(ADC_LATCH_DISABLE_REG); */
|
||||
|
||||
/* printf("Read ADC disable register %08x\n",reg); */
|
||||
/* nModX=32; */
|
||||
/* for (i=0; i<32; i++) { */
|
||||
/* if (reg & (1<<i)) { */
|
||||
/* nModX--; */
|
||||
/* printf("ADC %d is disabled\n",i); */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
|
||||
return nModX;
|
||||
}
|
||||
|
||||
@ -1314,6 +1336,65 @@ int64_t getFramesFromStart(){
|
||||
}
|
||||
|
||||
|
||||
ROI *setROI(int nroi,ROI* arg,int *retvalsize, int *ret) {
|
||||
ROI retval[MAX_ROIS];
|
||||
int i, ich;
|
||||
|
||||
adcDisableMask=0xfffffffff;
|
||||
|
||||
printf("Setting ROI\n");
|
||||
if (nroi>=0) {
|
||||
if (nroi==0) {
|
||||
adcDisableMask=0;
|
||||
} else {
|
||||
for (i=0; i<nroi; i++) {
|
||||
printf("iroi: %d - %d %d %d %d\n",i, arg[i].xmin, arg[i].xmax, arg[i].ymin, arg[i].ymax);
|
||||
for (ich=arg[i].xmin; ich<=arg[i].xmax; ich++) {
|
||||
if (ich>=0 && ich<NCHAN)
|
||||
adcDisableMask&=~(1<<ich);
|
||||
else
|
||||
break;
|
||||
printf("%d write adc disable mask %08x\n",ich , adcDisableMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("write adc disable mask %08x\n",adcDisableMask);
|
||||
bus_w(ADC_LATCH_DISABLE_REG,adcDisableMask);
|
||||
}
|
||||
*ret=OK;
|
||||
|
||||
adcDisableMask=bus_r(ADC_LATCH_DISABLE_REG);
|
||||
|
||||
printf("read adc disable mask %08x\n",adcDisableMask);
|
||||
*retvalsize=0;
|
||||
retval[0].xmin=0;
|
||||
retval[0].xmax=0;
|
||||
for (ich=0 ; ich<NCHAN ; ich++) {
|
||||
if ((~adcDisableMask)&(1<<ich)) {
|
||||
if (ich==0) {
|
||||
*retvalsize+=1;
|
||||
if (*retvalsize>MAX_ROIS) {
|
||||
*retvalsize-=1;
|
||||
break;
|
||||
}
|
||||
retval[*retvalsize-1].xmin=ich;
|
||||
retval[*retvalsize-1].xmax=ich;
|
||||
} else {
|
||||
if ((adcDisableMask)&(1<<(ich-1))) {
|
||||
*retvalsize+=1;
|
||||
if (*retvalsize>MAX_ROIS) {
|
||||
*retvalsize-=1;
|
||||
break;
|
||||
}
|
||||
retval[*retvalsize-1].xmin=ich;
|
||||
}
|
||||
retval[*retvalsize-1].xmax=ich;
|
||||
}
|
||||
}
|
||||
}
|
||||
getDynamicRange();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
int loadImage(int index, short int ImageVals[]){
|
||||
@ -1878,7 +1959,7 @@ u_int32_t runState(void) {
|
||||
// State Machine
|
||||
|
||||
int startStateMachine(){
|
||||
int i;
|
||||
//int i;
|
||||
//#ifdef VERBOSE
|
||||
printf("*******Starting State Machine*******\n");
|
||||
//#endif
|
||||
@ -1896,23 +1977,24 @@ int i;
|
||||
#endif
|
||||
|
||||
|
||||
for(i=0;i<100;i++){
|
||||
// for(i=0;i<100;i++){
|
||||
//start state machine
|
||||
bus_w16(CONTROL_REG, FIFO_RESET_BIT);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
|
||||
usleep(20);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
//verify
|
||||
if(bus_r(STATUS_REG) & RUN_BUSY_BIT)
|
||||
break;
|
||||
else {
|
||||
printf("status: %08x\n",bus_r(STATUS_REG));
|
||||
usleep(5000);
|
||||
}
|
||||
}
|
||||
/* if(bus_r(STATUS_REG) & RUN_BUSY_BIT) */
|
||||
/* break; */
|
||||
/* else { */
|
||||
/* printf("status: %08x\n",bus_r(STATUS_REG)); */
|
||||
/* usleep(5000); */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
if(i!=0)
|
||||
printf("tried to start state machine %d times\n",i);
|
||||
/* if(i!=0) */
|
||||
/* printf("tried to start state machine %d times\n",i); */
|
||||
|
||||
if(i==100){
|
||||
printf("\n***********COULD NOT START STATE MACHINE***************\n");
|
||||
@ -1935,15 +2017,16 @@ int stopStateMachine(){
|
||||
write_stop_sm(1);
|
||||
write_status_sm("Stopped");
|
||||
#endif
|
||||
for(i=0;i<100;i++){
|
||||
// for(i=0;i<100;i++){
|
||||
//stop state machine
|
||||
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
||||
usleep(100);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
usleep(5000);
|
||||
//verify
|
||||
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT))
|
||||
break;
|
||||
}
|
||||
/* usleep(5000); */
|
||||
/* //verify */
|
||||
/* if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT)) */
|
||||
/* break; */
|
||||
/* } */
|
||||
if(i!=0)
|
||||
printf("tried to stop state machine %d times\n",i);
|
||||
if(i==100){
|
||||
@ -1974,6 +2057,7 @@ int startReadOut(){
|
||||
printf("State machine status is %08x\n",bus_r(STATUS_REG));
|
||||
#endif
|
||||
bus_w16(CONTROL_REG, START_ACQ_BIT |START_READOUT_BIT); // start readout
|
||||
usleep(100);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
return OK;
|
||||
}
|
||||
@ -2019,6 +2103,7 @@ u_int16_t* fifo_read_event(int ns)
|
||||
int i=0;//, j=0;
|
||||
/* volatile u_int16_t volatile *dum; */
|
||||
volatile u_int16_t a;
|
||||
volatile u_int32_t val;
|
||||
// volatile u_int32_t volatile *dum;
|
||||
// volatile u_int32_t a;
|
||||
|
||||
@ -2060,9 +2145,22 @@ u_int16_t* fifo_read_event(int ns)
|
||||
/* #else */
|
||||
|
||||
bus_w16(DUMMY_REG,1<<8); // read strobe to all fifos
|
||||
// bus_w16(DUMMY_REG,0);
|
||||
// for (i=0; i<32; i++) {
|
||||
bus_w16(DUMMY_REG,0); //
|
||||
bus_w16(DUMMY_REG,0);
|
||||
// i=0;//
|
||||
/* for (i=0; i<32; i++) { */
|
||||
|
||||
/* /\* while (((adcDisableMask&(3<<((i)*2)))>>((i)*2))==3) { *\/ */
|
||||
/* /\* i++; *\/ */
|
||||
/* /\* if (i>15) *\/ */
|
||||
/* /\* break; *\/ */
|
||||
/* /\* } *\/ */
|
||||
/* /\* if (i<16) { *\/ */
|
||||
/* bus_w16(DUMMY_REG,i); */
|
||||
/* } */
|
||||
/* val=*values; */
|
||||
|
||||
|
||||
// bus_w16(DUMMY_REG,0); //
|
||||
for (i=0; i<16; i++) {
|
||||
|
||||
|
||||
@ -2074,26 +2172,33 @@ u_int16_t* fifo_read_event(int ns)
|
||||
//dum=(((u_int32_t*)(now_ptr))+i);
|
||||
|
||||
// a=*values;//bus_r(FIFO_DATA_REG);
|
||||
// if ((adcDisableMask&(3<<(i*2)))==0) {
|
||||
*((u_int32_t*)now_ptr)=*values;//bus_r(FIFO_DATA_REG);
|
||||
|
||||
|
||||
if (i!=0 || ns!=0) {
|
||||
a=0;
|
||||
while (*((u_int32_t*)now_ptr)==*((u_int32_t*)(now_ptr)-1) && a++<10) {
|
||||
|
||||
// printf("******************** %d: fifo %d: new %08x old %08x\n ",ns, i, *((u_int32_t*)now_ptr),*((u_int32_t*)(now_ptr)-1));
|
||||
*((u_int32_t*)now_ptr)=*values;
|
||||
// printf("%d-",i);
|
||||
|
||||
}
|
||||
}
|
||||
now_ptr+=4;
|
||||
// }
|
||||
/* while (((adcDisableMask&(3<<((i+1)*2)))>>((i+1)*2))==3) { */
|
||||
/* i++; */
|
||||
/* } */
|
||||
|
||||
*((u_int32_t*)now_ptr)=*values;//bus_r(FIFO_DATA_REG);
|
||||
|
||||
|
||||
if (i!=0 || ns!=0) {
|
||||
a=0;
|
||||
while (*((u_int32_t*)now_ptr)==*((u_int32_t*)(now_ptr)-1) && a++<10) {
|
||||
|
||||
// printf("******************** %d: fifo %d: new %08x old %08x\n ",ns, i, *((u_int32_t*)now_ptr),*((u_int32_t*)(now_ptr)-1));
|
||||
*((u_int32_t*)now_ptr)=*values;
|
||||
// printf("%d-",i);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
now_ptr+=4;
|
||||
bus_w16(DUMMY_REG,i+1);
|
||||
// if (((adcDisableMask&(3<<((i+1)*2)))>>((i+1)*2))!=3) {
|
||||
|
||||
bus_w16(DUMMY_REG,i+1);
|
||||
// }
|
||||
// *(((u_int16_t*)(now_ptr))+i)=bus_r16(FIFO_DATA_REG);
|
||||
}
|
||||
bus_w16(DUMMY_REG,0); //
|
||||
// bus_w16(DUMMY_REG,0); //
|
||||
/* #ifdef TIMEDBG */
|
||||
|
||||
/* gettimeofday(&tss,NULL); */
|
||||
@ -2229,8 +2334,8 @@ int setDynamicRange(int dr) {
|
||||
dynamicRange=16;
|
||||
nSamples=dr/16;
|
||||
bus_w(NSAMPLES_REG,nSamples);
|
||||
dataBytes=NMAXMOD*NCHIP*NCHAN*2;
|
||||
}
|
||||
}
|
||||
getDynamicRange();
|
||||
allocateRAM();
|
||||
printf("Setting dataBytes to %d: dr %d; samples %d\n",dataBytes, dynamicRange, nSamples);
|
||||
return getDynamicRange();
|
||||
@ -2244,6 +2349,8 @@ int setDynamicRange(int dr) {
|
||||
int getDynamicRange() {
|
||||
// dynamicRange=16;
|
||||
nSamples=bus_r(NSAMPLES_REG);
|
||||
getChannels();
|
||||
dataBytes=nModX*NCHIP*getChannels()*2;
|
||||
return dynamicRange*bus_r(NSAMPLES_REG);//nSamples;
|
||||
|
||||
}
|
||||
@ -2290,12 +2397,21 @@ int setStoreInRAM(int b) {
|
||||
return allocateRAM();
|
||||
}
|
||||
|
||||
int getChannels() {
|
||||
int nch=32;
|
||||
int i;
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
if (adcDisableMask & (1<<i)) nch--;
|
||||
}
|
||||
return nch;
|
||||
}
|
||||
|
||||
int allocateRAM() {
|
||||
size_t size;
|
||||
|
||||
getDynamicRange();
|
||||
size=dataBytes*nSamples;
|
||||
|
||||
//adcDisableMask
|
||||
size=dataBytes*nSamples;
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("\nnmodx=%d nmody=%d dynamicRange=%d dataBytes=%d nFrames=%d nTrains=%d, size=%d\n",nModX,nModY,dynamicRange,dataBytes,nf,nt,(int)size );
|
||||
|
@ -169,6 +169,9 @@ uint64_t setPatternWaitTime(int level, uint64_t t);
|
||||
void initDac(int dacnum);
|
||||
int setDac(int dacnum,int dacvalue);
|
||||
|
||||
ROI *setROI(int nroi,ROI* arg,int *retvalsize, int *ret);
|
||||
int getChannels();
|
||||
|
||||
/*
|
||||
|
||||
u_int32_t setNBits(u_int32_t);
|
||||
|
@ -2581,68 +2581,68 @@ int calibration_chip(int num, int *v, int *dacs) {
|
||||
|
||||
|
||||
|
||||
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
||||
/* ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){ */
|
||||
|
||||
int i,adc;
|
||||
ROI temp;
|
||||
/* int i,adc; */
|
||||
/* ROI temp; */
|
||||
|
||||
if(n>=0){
|
||||
/* if(n>=0){ */
|
||||
|
||||
//clear rois
|
||||
for(i=0;i<MAX_ROIS;i++)
|
||||
rois[i]=temp;
|
||||
/* //clear rois */
|
||||
/* for(i=0;i<MAX_ROIS;i++) */
|
||||
/* rois[i]=temp; */
|
||||
|
||||
/*ideal way to set roi
|
||||
for(i=0;i<n;i++)
|
||||
rois[i]=arg[i];
|
||||
nROI = n;
|
||||
*/
|
||||
/* /\*ideal way to set roi */
|
||||
/* for(i=0;i<n;i++) */
|
||||
/* rois[i]=arg[i]; */
|
||||
/* nROI = n; */
|
||||
/* *\/ */
|
||||
|
||||
if(n==0)
|
||||
adc=-1;
|
||||
else{
|
||||
//if its for 1 adc or general
|
||||
if ((arg[0].xmin==0) && (arg[0].xmax==GOTTHARDNCHIP*GOTTHARDNCHAN))
|
||||
adc=-1;
|
||||
else{
|
||||
//adc = mid value/numchans also for only 1 roi
|
||||
adc = ((((arg[0].xmax)+(arg[0].xmin))/2)/(GOTTHARDNCHAN*NCHIPS_PER_ADC));
|
||||
if((adc>=0) && (adc<=4));
|
||||
else {
|
||||
printf("warning:adc value greater than 5. deleting roi\n");
|
||||
adc=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if(n==0) */
|
||||
/* adc=-1; */
|
||||
/* else{ */
|
||||
/* //if its for 1 adc or general */
|
||||
/* if ((arg[0].xmin==0) && (arg[0].xmax==GOTTHARDNCHIP*GOTTHARDNCHAN)) */
|
||||
/* adc=-1; */
|
||||
/* else{ */
|
||||
/* //adc = mid value/numchans also for only 1 roi */
|
||||
/* adc = ((((arg[0].xmax)+(arg[0].xmin))/2)/(GOTTHARDNCHAN*NCHIPS_PER_ADC)); */
|
||||
/* if((adc>=0) && (adc<=4)); */
|
||||
/* else { */
|
||||
/* printf("warning:adc value greater than 5. deleting roi\n"); */
|
||||
/* adc=-1; */
|
||||
/* } */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
|
||||
//set rois for just 1 adc - take only 1st roi
|
||||
if(adc!=-1){
|
||||
rois[0].xmin=adc*(GOTTHARDNCHAN*NCHIPS_PER_ADC);
|
||||
rois[0].xmax=(adc+1)*(GOTTHARDNCHAN*NCHIPS_PER_ADC)-1;
|
||||
rois[0].ymin=-1;
|
||||
rois[0].ymax=-1;
|
||||
nROI = 1;
|
||||
}else
|
||||
nROI = 0;
|
||||
/* //set rois for just 1 adc - take only 1st roi */
|
||||
/* if(adc!=-1){ */
|
||||
/* rois[0].xmin=adc*(GOTTHARDNCHAN*NCHIPS_PER_ADC); */
|
||||
/* rois[0].xmax=(adc+1)*(GOTTHARDNCHAN*NCHIPS_PER_ADC)-1; */
|
||||
/* rois[0].ymin=-1; */
|
||||
/* rois[0].ymax=-1; */
|
||||
/* nROI = 1; */
|
||||
/* }else */
|
||||
/* nROI = 0; */
|
||||
|
||||
if((arg[0].xmin!=rois[0].xmin)||(arg[0].xmax!=rois[0].xmax)||(arg[0].ymin!=rois[0].ymin)||(arg[0].ymax!=rois[0].ymax))
|
||||
*ret=FAIL;
|
||||
if(n!=nROI)
|
||||
*ret=FAIL;
|
||||
/* if((arg[0].xmin!=rois[0].xmin)||(arg[0].xmax!=rois[0].xmax)||(arg[0].ymin!=rois[0].ymin)||(arg[0].ymax!=rois[0].ymax)) */
|
||||
/* *ret=FAIL; */
|
||||
/* if(n!=nROI) */
|
||||
/* *ret=FAIL; */
|
||||
|
||||
//set adc of interest
|
||||
setADC(adc);
|
||||
}
|
||||
/* //set adc of interest */
|
||||
/* setADC(adc); */
|
||||
/* } */
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("Rois:\n");
|
||||
for( i=0;i<nROI;i++)
|
||||
printf("%d\t%d\t%d\t%d\n",rois[i].xmin,rois[i].xmax,rois[i].ymin,rois[i].ymax);
|
||||
//#endif
|
||||
*retvalsize = nROI;
|
||||
return rois;
|
||||
}
|
||||
/* //#ifdef VERBOSE */
|
||||
/* printf("Rois:\n"); */
|
||||
/* for( i=0;i<nROI;i++) */
|
||||
/* printf("%d\t%d\t%d\t%d\n",rois[i].xmin,rois[i].xmax,rois[i].ymin,rois[i].ymax); */
|
||||
/* //#endif */
|
||||
/* *retvalsize = nROI; */
|
||||
/* return rois; */
|
||||
/* } */
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -167,7 +167,7 @@ int calibration_chip(int num, int *values, int *dacs);
|
||||
|
||||
|
||||
|
||||
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
//ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -59,6 +59,7 @@ int adcvpp=0x4;
|
||||
int init_detector(int b, int checkType) {
|
||||
|
||||
int i;
|
||||
int retvalsize,ret;
|
||||
if (mapCSP0()==FAIL) { printf("Could not map memory\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -157,6 +158,7 @@ int init_detector(int b, int checkType) {
|
||||
strcpy(thisClientIP,"none1");
|
||||
lockStatus=0;
|
||||
// getDynamicRange();
|
||||
setROI(-1,NULL,&retvalsize,&ret);
|
||||
allocateRAM();
|
||||
return OK;
|
||||
}
|
||||
@ -2286,38 +2288,43 @@ int set_roi(int file_des) {
|
||||
int retvalsize=0;
|
||||
ROI arg[MAX_ROIS];
|
||||
ROI* retval=0;
|
||||
|
||||
int iroi;
|
||||
strcpy(mess,"Could not set/get roi\n");
|
||||
|
||||
|
||||
// u_int32_t disable_reg=0;
|
||||
|
||||
|
||||
n = receiveDataOnly(file_des,&nroi,sizeof(nroi));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
if(nroi!=-1){
|
||||
if(nroi>=0){
|
||||
n = receiveDataOnly(file_des,arg,nroi*sizeof(ROI));
|
||||
if (n != (nroi*sizeof(ROI))) {
|
||||
sprintf(mess,"Received wrong number of bytes for ROI\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
//#ifdef VERBOSE
|
||||
/*
|
||||
|
||||
printf("Setting ROI to:");
|
||||
for( i=0;i<nroi;i++)
|
||||
printf("%d\t%d\t%d\t%d\n",arg[i].xmin,arg[i].xmax,arg[i].ymin,arg[i].ymax);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//
|
||||
printf("Error: Function 41 or Setting ROI is not yet implemented in Moench!\n");
|
||||
//#endif
|
||||
}
|
||||
/* execute action if the arguments correctly arrived*/
|
||||
|
||||
|
||||
ret = FAIL;
|
||||
/* NOT IMPLEMENTED
|
||||
#ifdef MCB_FUNCS
|
||||
|
||||
|
||||
|
||||
if (lockStatus==1 && differentClients==1){//necessary???
|
||||
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
||||
ret=FAIL;
|
||||
@ -2331,8 +2338,7 @@ int set_roi(int file_des) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
if(ret==OK && differentClients){
|
||||
printf("Force update\n");
|
||||
ret=FORCE_UPDATE;
|
||||
|
@ -896,8 +896,8 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
||||
na=1;
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
nch=32;
|
||||
nm=1;
|
||||
nch=1//32;
|
||||
nm=32;
|
||||
nc=1;
|
||||
nd=8; // dacs+adcs
|
||||
na=1;
|
||||
@ -1560,7 +1560,6 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetector::getMaxNumberOfModules(dimension d){
|
||||
|
||||
int retval;
|
||||
|
@ -684,6 +684,9 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int setNumberOfModules(int n=GET_FLAG, dimension d=X); // if n=GET_FLAG returns the number of installed modules
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
returns the instrinsic size of the detector (maxmodx, maxmody, nchans, nchips, ndacs
|
||||
enum numberOf {
|
||||
|
@ -402,6 +402,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="roimask"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
|
||||
/* flags */
|
||||
|
||||
@ -2904,13 +2908,17 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION) {
|
||||
if (cmd=="maxmod")
|
||||
return string("cannot put!");
|
||||
else if (cmd=="roimask"){
|
||||
if (!sscanf(args[1],"%d",&val))
|
||||
return string("could not scan ")+string(args[0])+string(" ")+string(args[1]);
|
||||
}
|
||||
else if (!sscanf(args[1],"%d",&val))
|
||||
return string("could not scan ")+string(args[0])+string(" ")+string(args[1]);
|
||||
return string("could not scan ")+string(args[0])+string(" ")+string(args[1]);
|
||||
|
||||
if (cmd=="roi"){
|
||||
//debug number of arguments
|
||||
if ((val<0) || (narg!=((val*4)+2)) )
|
||||
return helpDetectorSize(narg,args,action);
|
||||
//debug number of arguments
|
||||
if ((val<0) || (narg!=((val*4)+2)) )
|
||||
return helpDetectorSize(narg,args,action);
|
||||
ROI allroi[val];
|
||||
pos=2;
|
||||
for(i=0;i<val;i++){
|
||||
@ -2929,9 +2937,10 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if ((narg > 2) && (sscanf(args[2],"%d",&val)) && (val>0))
|
||||
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cmd=="nmod") {
|
||||
if (cmd=="nmod" || cmd=="roimask") {
|
||||
ret=myDet->setNumberOfModules(val);
|
||||
} else if (cmd=="maxmod") {
|
||||
ret=myDet->getMaxNumberOfModules();
|
||||
@ -2949,8 +2958,11 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
else
|
||||
return string("unknown detector size ")+cmd;
|
||||
|
||||
|
||||
sprintf(ans,"%d",ret);
|
||||
if (cmd=="roimask")
|
||||
sprintf(ans,"%x",ret);
|
||||
else
|
||||
sprintf(ans,"%d",ret);
|
||||
|
||||
return string(ans);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user