mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
bottom is defined as flippeddatax in config file, not anymore as argument for receiver
This commit is contained in:
@ -1826,6 +1826,57 @@ int slsDetector::getMaxNumberOfModules(dimension d){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetector::setFlippedData(dimension d, int value){
|
||||
int retval=-1;
|
||||
int fnum=F_SET_FLIPPED_DATA_RECEIVER;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int args[2]={X,-1};
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType!= EIGER){
|
||||
std::cout << "Flipped Data is not implemented in this detector" << std::endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_FLIPPED_DATA_NOT_SET));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl;
|
||||
std::cout << "Setting/Getting flipped data across axis " << d <<" with value " << value << std::endl;
|
||||
#endif
|
||||
if(value > -1){
|
||||
thisDetector->flippedData[d] = value;
|
||||
args[1] = value;
|
||||
}else
|
||||
args[1] = thisDetector->flippedData[d];
|
||||
|
||||
args[0] = d;
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendIntArray(fnum,retval,args);
|
||||
|
||||
disconnectData();
|
||||
}
|
||||
|
||||
if((args[1] != retval && args[1]>=0) || (ret==FAIL)){
|
||||
ret = FAIL;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_FLIPPED_DATA_NOT_SET));
|
||||
}
|
||||
|
||||
if(ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
}
|
||||
|
||||
|
||||
return thisDetector->flippedData[d];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
This function is used to set the polarity and meaning of the digital I/O signals (signal index)
|
||||
|
||||
@ -5601,8 +5652,10 @@ char* slsDetector::setReceiver(string receiverIP){
|
||||
setTimer(FRAME_NUMBER,thisDetector->timerValue[FRAME_NUMBER]);
|
||||
setTimer(ACQUISITION_TIME,thisDetector->timerValue[ACQUISITION_TIME]);
|
||||
setDynamicRange(thisDetector->dynamicRange);
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
setFlippedData(X,-1);
|
||||
activate(-1);
|
||||
}
|
||||
//std::cout << "***********************************dataStreaming:" << parentDet->enableDataStreamingFromReceiver(-1) << endl << endl;
|
||||
//parentDet->enableDataStreamingFromReceiver(parentDet->enableDataStreamingFromReceiver(-1));
|
||||
//set scan tag
|
||||
|
@ -267,6 +267,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
|
||||
/** flag for acquiring */
|
||||
bool acquiringFlag;
|
||||
/** flipped data across x or y axis */
|
||||
bool flippedData[2];
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
@ -657,6 +659,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
|
||||
int getMaxNumberOfChannels(dimension d){return thisDetector->nChan[d]*thisDetector->nChip[d]*thisDetector->nModMax[d];};
|
||||
|
||||
/** returns the enable if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* returns 1 or 0
|
||||
*/
|
||||
int getFlippedData(dimension d=X){return thisDetector->flippedData[d];};
|
||||
|
||||
/** Returns number of rois */
|
||||
int getNRoi(){return thisDetector->nROI;};
|
||||
|
||||
@ -722,6 +730,12 @@ 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
|
||||
|
||||
|
||||
/** sets the enable which determines if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* \param value 0 or 1 to reset/set or -1 to get value
|
||||
* \return enable flipped data across x or y axis
|
||||
*/
|
||||
int setFlippedData(dimension d=X, int value=-1);
|
||||
|
||||
|
||||
/*
|
||||
@ -1585,18 +1599,6 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int resetFramesCaught();
|
||||
|
||||
/**
|
||||
* Create Receiving Data Sockets
|
||||
* @param destroy is true to destroy all the sockets
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int createReceivingDataSockets(const bool destroy = false){return 0;};
|
||||
|
||||
|
||||
/** Reads frames from receiver through a constant socket
|
||||
*/
|
||||
void readFrameFromReceiver(){};
|
||||
|
||||
/** Locks/Unlocks the connection to the receiver
|
||||
/param lock sets (1), usets (0), gets (-1) the lock
|
||||
/returns lock status of the receiver
|
||||
|
@ -432,7 +432,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="flippeddatax"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="flippeddatay"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
/* flags */
|
||||
|
||||
@ -3136,7 +3142,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if (action==HELP_ACTION)
|
||||
return helpDetectorSize(narg,args,action);
|
||||
int ret, val=-1, pos=-1,i;
|
||||
char ans[1000], temp[100];
|
||||
char ans[1000];
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
@ -3173,6 +3179,21 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
|
||||
}
|
||||
|
||||
if(cmd=="flippeddatax"){
|
||||
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
|
||||
return string ("cannot scan flippeddata x mode: must be 0 or 1");
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->setFlippedData(X,val);
|
||||
}
|
||||
|
||||
if(cmd=="flippeddatay"){
|
||||
return string("Not required for this detector\n");
|
||||
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
|
||||
return string ("cannot scan flippeddata y mode: must be 0 or 1");
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->setFlippedData(Y,val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cmd=="nmod" || cmd=="roimask") {
|
||||
@ -3185,10 +3206,18 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
} else if (cmd=="roi") {
|
||||
myDet->getROI(ret);
|
||||
} else if (cmd=="detsizechan") {
|
||||
sprintf(ans,"%d",myDet->getMaxNumberOfChannelsPerDetector(X));
|
||||
sprintf(temp,"%d",myDet->getMaxNumberOfChannelsPerDetector(Y));
|
||||
strcat(ans," ");
|
||||
strcat(ans,temp);
|
||||
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
|
||||
return string(ans);
|
||||
}
|
||||
else if(cmd=="flippeddatax"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
sprintf(ans,"%d",myDet->getFlippedData(X));
|
||||
return string(ans);
|
||||
}
|
||||
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);
|
||||
}
|
||||
else
|
||||
@ -3212,6 +3241,8 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
|
||||
os << "dr i \n sets the dynamic range of the detector"<< std::endl;
|
||||
os << "roi i xmin xmax ymin ymax \n sets region of interest where i is number of rois;i=0 to clear rois"<< std::endl;
|
||||
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;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "nmod \n gets the number of modules of the detector"<< std::endl;
|
||||
@ -3219,7 +3250,8 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
|
||||
os << "dr \n gets the dynamic range of the detector"<< std::endl;
|
||||
os << "roi \n gets region of interest"<< std::endl;
|
||||
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 respectively"<< std::endl;
|
||||
os << "flippeddatay\n gets if the data will be flipped on the y axis respectively"<< std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
|
@ -70,6 +70,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
virtual int setMaxNumberOfChannelsPerDetector(dimension d,int i){return -1;};
|
||||
|
||||
/** sets the enable which determines if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* \param value 0 or 1 to reset/set or -1 to get value
|
||||
* \return enable flipped data across x or y axis
|
||||
*/
|
||||
virtual int setFlippedData(dimension d=X, int value=-1)=0;
|
||||
|
||||
//int setPositions(int nPos, double *pos){return angularConversion::setPositions(nPos, pos);};
|
||||
|
||||
// int getPositions(double *pos=NULL){return angularConversion::getPositions(pos);};
|
||||
@ -425,6 +432,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
virtual int getMaxNumberOfChannels()=0;
|
||||
virtual int getMaxNumberOfChannels(dimension d)=0;
|
||||
|
||||
/** returns the enable if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* returns 1 or 0
|
||||
*/
|
||||
virtual int getFlippedData(dimension d=X)=0;
|
||||
|
||||
// virtual int getParameters();
|
||||
|
||||
|
||||
@ -660,12 +673,12 @@ virtual int resetFramesCaught()=0;
|
||||
* @param destroy is true to destroy all the sockets
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int createReceivingDataSockets(const bool destroy = false)=0;
|
||||
virtual int createReceivingDataSockets(const bool destroy = false){return -1;};
|
||||
|
||||
|
||||
/** Reads frames from receiver through a constant socket
|
||||
*/
|
||||
virtual void readFrameFromReceiver()=0;
|
||||
virtual void readFrameFromReceiver(){};
|
||||
|
||||
/**
|
||||
Turns off the receiver server!
|
||||
|
Reference in New Issue
Block a user