mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
sending position id and num detectors in x and y dir
This commit is contained in:
@ -41,6 +41,9 @@ using namespace std;
|
|||||||
#define COULD_NOT_CONFIGURE_MAC 0x0002000000000000ULL
|
#define COULD_NOT_CONFIGURE_MAC 0x0002000000000000ULL
|
||||||
#define COULDNOT_START_RECEIVER 0x0001000000000000ULL // default error like starting threads
|
#define COULDNOT_START_RECEIVER 0x0001000000000000ULL // default error like starting threads
|
||||||
#define COULDNOT_STOP_RECEIVER 0x0000800000000000ULL
|
#define COULDNOT_STOP_RECEIVER 0x0000800000000000ULL
|
||||||
|
#define RECEIVER_DET_POSID_NOT_SET 0x0000400000000000ULL
|
||||||
|
#define RECEIVER_MULTI_DET_SIZE_NOT_SET 0x0000200000000000ULL
|
||||||
|
|
||||||
// 0xFFFFFFF000000000ULL
|
// 0xFFFFFFF000000000ULL
|
||||||
|
|
||||||
// 0x0000000FFFFFFFFFULL
|
// 0x0000000FFFFFFFFFULL
|
||||||
@ -136,6 +139,12 @@ public:
|
|||||||
if(slsErrorMask&DETECTOR_ACTIVATE)
|
if(slsErrorMask&DETECTOR_ACTIVATE)
|
||||||
retval.append("Could not activate/deactivate detector\n");
|
retval.append("Could not activate/deactivate detector\n");
|
||||||
|
|
||||||
|
if(slsErrorMask&RECEIVER_DET_POSID_NOT_SET)
|
||||||
|
retval.append("Could not set detector position id\n");
|
||||||
|
|
||||||
|
if(slsErrorMask&RECEIVER_MULTI_DET_SIZE_NOT_SET)
|
||||||
|
retval.append("Could not set multi detector size\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -776,7 +776,21 @@ int multiSlsDetector::addSlsDetector(detectorType t, int pos) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void multiSlsDetector::getNumberOfDetectors(int& nx, int& ny) {
|
||||||
|
nx = 0; ny = 0;
|
||||||
|
|
||||||
|
int offsetx = -1, offsety = -1;
|
||||||
|
for (int i = 0; i < thisMultiDetector->numberOfDetectors; ++i) {
|
||||||
|
if (thisMultiDetector->offsetX[i] > offsetx) {
|
||||||
|
nx++;
|
||||||
|
offsetx = thisMultiDetector->offsetX[i];
|
||||||
|
}
|
||||||
|
if (thisMultiDetector->offsetY[i] > offsety) {
|
||||||
|
ny++;
|
||||||
|
offsety = thisMultiDetector->offsetY[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,6 +322,12 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
\returns number of detectors */
|
\returns number of detectors */
|
||||||
int getNumberOfDetectors() {return thisMultiDetector->numberOfDetectors;};
|
int getNumberOfDetectors() {return thisMultiDetector->numberOfDetectors;};
|
||||||
|
|
||||||
|
/** returns the number of detectors in each direction
|
||||||
|
\param nx number of detectors in x direction
|
||||||
|
\param ny number of detectors in y direction
|
||||||
|
*/
|
||||||
|
void getNumberOfDetectors(int& nx, int& ny);
|
||||||
|
|
||||||
int getMaxMods();
|
int getMaxMods();
|
||||||
int getNMods();
|
int getNMods();
|
||||||
int getMaxMod(dimension d);
|
int getMaxMod(dimension d);
|
||||||
|
@ -5813,6 +5813,7 @@ char* slsDetector::setReceiver(string receiverIP){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Setting up receiver with" << endl;
|
std::cout << "Setting up receiver with" << endl;
|
||||||
std::cout << "detector type:" << slsDetectorBase::getDetectorType(thisDetector->myDetectorType) << endl;
|
std::cout << "detector type:" << slsDetectorBase::getDetectorType(thisDetector->myDetectorType) << endl;
|
||||||
|
std::cout << "detector id:" << posId << endl;
|
||||||
std::cout << "detector hostname:" << thisDetector->hostname << endl;
|
std::cout << "detector hostname:" << thisDetector->hostname << endl;
|
||||||
std::cout << "file path:" << fileIO::getFilePath() << endl;
|
std::cout << "file path:" << fileIO::getFilePath() << endl;
|
||||||
std::cout << "file name:" << fileIO::getFileName() << endl;
|
std::cout << "file name:" << fileIO::getFileName() << endl;
|
||||||
@ -5830,6 +5831,9 @@ char* slsDetector::setReceiver(string receiverIP){
|
|||||||
/** enable compresison, */
|
/** enable compresison, */
|
||||||
#endif
|
#endif
|
||||||
if(setDetectorType()!= GENERIC){
|
if(setDetectorType()!= GENERIC){
|
||||||
|
if(!posId)
|
||||||
|
sendMultiDetectorSize();
|
||||||
|
setDetectorId();
|
||||||
setDetectorHostname();
|
setDetectorHostname();
|
||||||
setFilePath(fileIO::getFilePath());
|
setFilePath(fileIO::getFilePath());
|
||||||
setFileName(fileIO::getFileName());
|
setFileName(fileIO::getFileName());
|
||||||
@ -7437,10 +7441,10 @@ string slsDetector::setFileName(string s) {
|
|||||||
if(!s.empty()){
|
if(!s.empty()){
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
fileIO::setFileName(s);
|
fileIO::setFileName(s);
|
||||||
if(thisDetector->myDetectorType == EIGER)
|
/*if(thisDetector->myDetectorType == EIGER)
|
||||||
parentDet->setDetectorIndex(posId);
|
parentDet->setDetectorIndex(posId);
|
||||||
else if(parentDet->getNumberOfDetectors()>1)
|
else if(parentDet->getNumberOfDetectors()>1)
|
||||||
parentDet->setDetectorIndex(posId);
|
parentDet->setDetectorIndex(-1);*/
|
||||||
s=parentDet->createReceiverFilePrefix();
|
s=parentDet->createReceiverFilePrefix();
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
}
|
}
|
||||||
@ -8190,6 +8194,54 @@ int slsDetector::enableReceiverCompression(int i){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetector::sendMultiDetectorSize(){
|
||||||
|
int fnum=F_SEND_RECEIVER_MULTIDETSIZE;
|
||||||
|
int ret = FAIL;
|
||||||
|
int retval = -1;
|
||||||
|
int arg[2];
|
||||||
|
|
||||||
|
pthread_mutex_lock(&ms);
|
||||||
|
parentDet->getNumberOfDetectors(arg[0],arg[1]);
|
||||||
|
pthread_mutex_unlock(&ms);
|
||||||
|
|
||||||
|
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Sending multi detector size to Receiver (" << arg[0] << "," << arg[1] << ")" << std::endl;
|
||||||
|
#endif
|
||||||
|
if (connectData() == OK){
|
||||||
|
ret=thisReceiver->sendIntArray(fnum,retval,arg);
|
||||||
|
disconnectData();
|
||||||
|
}
|
||||||
|
if((ret==FAIL)){
|
||||||
|
std::cout << "Could not set position Id" << std::endl;
|
||||||
|
setErrorMask((getErrorMask())|(RECEIVER_MULTI_DET_SIZE_NOT_SET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetector::setDetectorId(){
|
||||||
|
int fnum=F_SEND_RECEIVER_DETPOSID;
|
||||||
|
int ret = FAIL;
|
||||||
|
int retval = -1;
|
||||||
|
int arg = posId;
|
||||||
|
|
||||||
|
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Sending detector pos id to Receiver " << posId << std::endl;
|
||||||
|
#endif
|
||||||
|
if (connectData() == OK){
|
||||||
|
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||||
|
disconnectData();
|
||||||
|
}
|
||||||
|
if((ret==FAIL) || (retval != arg)){
|
||||||
|
std::cout << "Could not set position Id" << std::endl;
|
||||||
|
setErrorMask((getErrorMask())|(RECEIVER_DET_POSID_NOT_SET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void slsDetector::setDetectorHostname(){
|
void slsDetector::setDetectorHostname(){
|
||||||
int fnum=F_SEND_RECEIVER_DETHOSTNAME;
|
int fnum=F_SEND_RECEIVER_DETHOSTNAME;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
|
@ -1753,7 +1753,17 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
int enableReceiverCompression(int i = -1);
|
int enableReceiverCompression(int i = -1);
|
||||||
|
|
||||||
/** send the detector host name to the eiger receiver
|
/**
|
||||||
|
* Send the multi detector size to the detector
|
||||||
|
*/
|
||||||
|
void sendMultiDetectorSize();
|
||||||
|
|
||||||
|
/** send the detector pos id to the receiver
|
||||||
|
* for various file naming conventions for multi detectors in receiver
|
||||||
|
*/
|
||||||
|
void setDetectorId();
|
||||||
|
|
||||||
|
/** send the detector host name to the receiver
|
||||||
* for various handshaking required with the detector
|
* for various handshaking required with the detector
|
||||||
*/
|
*/
|
||||||
void setDetectorHostname();
|
void setDetectorHostname();
|
||||||
|
Reference in New Issue
Block a user