just skeleton of gappixels

This commit is contained in:
Dhanya Maliakal 2017-09-27 17:08:00 +02:00
parent 986826cbe9
commit 352ade6457
6 changed files with 95 additions and 6 deletions

View File

@ -4239,6 +4239,28 @@ int multiSlsDetector::setFlippedData(dimension d, int value){
return ret;
}
int multiSlsDetector::enableGapPixels(int val) {
if(getDetectorsType() != EIGER){
std::cout << "Not implemented for this detector" << std::endl;
return -1;
}
int ret=-100,ret1;
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet)
if (detectors[idet]){
ret1=detectors[idet]->enableGapPixels(val);
if(ret==-100)
ret=ret1;
else if (ret!=ret1)
ret=-1;
}
/** do something */
return ret;
}

View File

@ -253,6 +253,11 @@ class multiSlsDetector : public slsDetectorUtils {
/** destructor */
virtual ~multiSlsDetector();
/**
* returns true. Used when reference is slsDetectorUtils and to determine if command can be implemented as slsDetector/multiSlsDetector object/
*/
bool isMultiSlsDetectorClass(){return 1;};
/**
* Creates all the threads in the threadpool
\returns OK or FAIL
@ -1028,6 +1033,13 @@ class multiSlsDetector : public slsDetectorUtils {
*/
int setFlippedData(dimension d=X, int value=-1);
/**
* Enable gap pixels, only for Eiger
* @param val 1 sets, 0 unsets, -1 gets
* @return gap pixel enable
*/
int enableGapPixels(int val=-1);
int getMaxNumberOfModules(dimension d=X);
int setDynamicRange(int i=-1);

View File

@ -710,7 +710,6 @@ int slsDetector::initializeDetectorSize(detectorType type) {
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*thisDetector->dynamicRange/8;
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
cout << "here1" << endl;
getTotalNumberOfChannels();
// thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
}
@ -1981,6 +1980,16 @@ int slsDetector::setFlippedData(dimension d, int value){
int slsDetector::enableGapPixels(int val) {
if(thisDetector->myDetectorType!= EIGER)
return -1;
return 0;
}
/*
This function is used to set the polarity and meaning of the digital I/O signals (signal index)

View File

@ -322,6 +322,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
/** destructor */
virtual ~slsDetector();
/**
* returns true. Used when reference is slsDetectorUtils and to determine if command can be implemented as slsDetector/multiSlsDetector object/
*/
bool isMultiSlsDetectorClass(){return 0;};
int setOnline(int const online=GET_ONLINE_FLAG);
string checkOnline();
@ -755,6 +760,13 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
*/
int setFlippedData(dimension d=X, int value=-1);
/**
* Enable gap pixels, only for Eiger
* @param val 1 sets, 0 unsets, -1 gets
* @return gap pixel enable
*/
int enableGapPixels(int val=-1);
/*
returns the instrinsic size of the detector (maxmodx, maxmody, nchans, nchips, ndacs

View File

@ -406,6 +406,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
++i;
/*! \page config
- <b>gappixels [i]</b> enables/disables gap pixels in system (detector & receiver). 1 sets, 0 unsets. Used in EIGER only and only in multi detector level command. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="gappixels"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
++i;
/* flags */
/*! \page config
@ -4320,6 +4328,14 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setFlippedData(Y,val);
}
if(cmd=="gappixels"){
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
return string ("cannot scan gappixels mode: must be 0 or 1");
myDet->setReceiverOnline(ONLINE_FLAG);
if (myDet->isMultiSlsDetectorClass()) // only in multi detector level to update offsets etc.
myDet->enableGapPixels(val);
}
}
if (cmd=="nmod" || cmd=="roimask") {
@ -4337,17 +4353,22 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
}
else if(cmd=="flippeddatax"){
myDet->setReceiverOnline(ONLINE_FLAG);
sprintf(ans,"%d",myDet->getFlippedData(X));
return string(ans);
ret = myDet->getFlippedData(X);
}
else if(cmd=="flippeddatay"){
return string("Not required for this detector\n");
myDet->setReceiverOnline(ONLINE_FLAG);
sprintf(ans,"%d",myDet->getFlippedData(Y));
return string(ans);
ret = myDet->getFlippedData(Y);
}
else if(cmd=="gappixels"){
myDet->setReceiverOnline(ONLINE_FLAG);
if (!myDet->isMultiSlsDetectorClass()) // only in multi detector level to update offsets etc.
return string("Cannot execute this command from slsDetector level. Please use multiSlsDetector level.\n");
ret = myDet->enableGapPixels();
}
else
return string("unknown detector size ")+cmd;
return string("unknown command ")+cmd;
if (cmd=="roimask")
sprintf(ans,"0x%x",ret);
@ -4369,6 +4390,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
os << "flippeddatax x \n sets if the data should be flipped on the x axis"<< std::endl;
os << "flippeddatay y \n sets if the data should be flipped on the y axis"<< std::endl;
os << "gappixels i \n enables/disables gap pixels in system (detector & receiver). 1 sets, 0 unsets. Used in EIGER only and multidetector level." << std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION) {
os << "nmod \n gets the number of modules of the detector"<< std::endl;
@ -4378,6 +4400,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
os << "flippeddatax\n gets if the data will be flipped on the x axis"<< std::endl;
os << "flippeddatay\n gets if the data will be flipped on the y axis"<< std::endl;
os << "gappixels\n gets if gap pixels is enabled in system. Used in EIGER only and multidetector level." << std::endl;
}
return os.str();

View File

@ -62,6 +62,10 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
virtual ~slsDetectorUtils(){};
/**
* Used when reference is slsDetectorUtils and to determine if command can be implemented as slsDetector/multiSlsDetector object/
*/
virtual bool isMultiSlsDetectorClass()=0;
virtual int getNumberOfDetectors(){return 1; };
@ -77,6 +81,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
*/
virtual int setFlippedData(dimension d=X, int value=-1)=0;
/**
* Enable gap pixels, only for Eiger
* @param val 1 sets, 0 unsets, -1 gets
* @return gap pixel enable
*/
virtual int enableGapPixels(int val=-1) = 0;
//int setPositions(int nPos, double *pos){return angularConversion::setPositions(nPos, pos);};
// int getPositions(double *pos=NULL){return angularConversion::getPositions(pos);};