removed the allocating of memory for eiger and jungfrau to receive data via tcp from detector as this will not happen

This commit is contained in:
Dhanya Maliakal 2016-12-02 12:47:01 +01:00
parent dd9387ef29
commit a67f9d50de
2 changed files with 38 additions and 30 deletions

View File

@ -1420,40 +1420,45 @@ int multiSlsDetector::startReadOut(){
int* multiSlsDetector::getDataFromDetector() {
int nel=thisMultiDetector->dataBytes/sizeof(int);
int n;
int* retval=new int[nel];
int n = 0;
int* retval= NULL;
int *retdet, *p=retval;
int nodata=1, nodatadet=-1;;
int nodata=1, nodatadet=-1;
int nodatadetectortype = false;
detectorType types = getDetectorsType();
if(types == EIGER || types == JUNGFRAU){
nodatadetectortype = true;
}
if(!nodatadetectortype)
retval=new int[nel];
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
if (detectors[id]) {
retdet=detectors[id]->getDataFromDetector(p);
n=detectors[id]->getDataBytes();
if(detectors[id]->getErrorMask())
setErrorMask(getErrorMask()|(1<<id));
if (retdet) {
nodata=0;
if(!nodatadetectortype){
n=detectors[id]->getDataBytes();
if (retdet) {
nodata=0;
#ifdef VERBOSE
cout << "Detector " << id << " returned " << n << " bytes " << endl;
cout << "Detector " << id << " returned " << n << " bytes " << endl;
#endif
} else {
nodatadet=id;
} else {
nodatadet=id;
#ifdef VERBOSE
cout << "Detector " << id << " does not have data left " << endl;
cout << "Detector " << id << " does not have data left " << endl;
#endif
/*if((detectors[id]->getDetectorsType() != EIGER)||(detectors[id]->getDetectorsType() != JUNGFRAU))
break;*/
}
p+=n/sizeof(int);
}
p+=n/sizeof(int);
}
}
//eiger returns only null
detectorType types = getDetectorsType();
if(types == EIGER || types == JUNGFRAU){
delete [] retval;
if(nodatadetectortype){
return NULL;
}

View File

@ -3807,19 +3807,21 @@ int* slsDetector::readFrame(){
int* slsDetector::getDataFromDetector(int *retval){
int nel=thisDetector->dataBytes/sizeof(int);
int n;
int *r=retval;
// int* retval=new int[nel];
if (retval==NULL)
retval=new int[nel];
int ret=FAIL;
char mess[MAX_STR_LENGTH]="Nothing";
int nel=thisDetector->dataBytes/sizeof(int);
int n;
int *r=retval;
int nodatadetectortype = false;
detectorType types = getDetectorsType();
if(types == EIGER || types == JUNGFRAU){
nodatadetectortype = true;
}
if (!nodatadetectortype && retval==NULL)
retval=new int[nel];
#ifdef VERBOSE
std::cout<< "getting data "<< thisDetector->dataBytes << " " << nel<< std::endl;
@ -3841,11 +3843,12 @@ int* slsDetector::getDataFromDetector(int *retval){
std::cout<< "Detector successfully returned: " << mess << " " << n << std::endl;
#endif
}
if (r==NULL) {
if ((!nodatadetectortype) && (r==NULL)){
delete [] retval;
}
return NULL;
} else {
} else if (!nodatadetectortype){
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
#ifdef VERBOSE