mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
resolved warnings, also from esrf: todo: include changes in zmq
This commit is contained in:
parent
e9f6dcf479
commit
445da80df8
@ -69,7 +69,7 @@ gotthardVirtualServer: $(SRC_MYTHEN_SVC)
|
|||||||
|
|
||||||
|
|
||||||
%.o : %.cpp %.h Makefile
|
%.o : %.cpp %.h Makefile
|
||||||
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -pthread -lrt $(LIBZMQ) #$(FLAGS)
|
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -pthread -lrt $(LIBZMQ) $(FLAGS)
|
||||||
|
|
||||||
|
|
||||||
package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||||
|
@ -1192,10 +1192,10 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200))
|
else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200))
|
||||||
ret=-1;
|
ret=-1;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=-1;
|
}else ret=-1;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1209,7 +1209,7 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
|||||||
|
|
||||||
slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
|
slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
|
||||||
|
|
||||||
int i, posmin, posmax;
|
int posmin, posmax;
|
||||||
int ret=-100;
|
int ret=-100;
|
||||||
|
|
||||||
if (pos<0) {
|
if (pos<0) {
|
||||||
@ -1243,10 +1243,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=GET_SETTINGS;
|
ret=GET_SETTINGS;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=GET_SETTINGS;
|
}else ret=GET_SETTINGS;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1291,10 +1291,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=GET_SETTINGS;
|
ret=GET_SETTINGS;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=GET_SETTINGS;
|
}else ret=GET_SETTINGS;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1454,7 +1454,7 @@ int* multiSlsDetector::getDataFromDetector() {
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
int* retval= NULL;
|
int* retval= NULL;
|
||||||
int *retdet, *p=retval;
|
int *retdet, *p=retval;
|
||||||
int nodata=1, nodatadet=-1;
|
int nodatadet=-1;
|
||||||
int nodatadetectortype = false;
|
int nodatadetectortype = false;
|
||||||
detectorType types = getDetectorsType();
|
detectorType types = getDetectorsType();
|
||||||
if(types == EIGER || types == JUNGFRAU){
|
if(types == EIGER || types == JUNGFRAU){
|
||||||
@ -1473,8 +1473,7 @@ int* multiSlsDetector::getDataFromDetector() {
|
|||||||
setErrorMask(getErrorMask()|(1<<id));
|
setErrorMask(getErrorMask()|(1<<id));
|
||||||
if(!nodatadetectortype){
|
if(!nodatadetectortype){
|
||||||
n=detectors[id]->getDataBytes();
|
n=detectors[id]->getDataBytes();
|
||||||
if (retdet) {
|
if (retdet) {;
|
||||||
nodata=0;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Detector " << id << " returned " << n << " bytes " << endl;
|
cout << "Detector " << id << " returned " << n << " bytes " << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -1681,10 +1680,10 @@ int multiSlsDetector::startAndReadAllNoWait(){
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
delete iret[idet];
|
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2126,7 +2125,6 @@ slsDetectorDefs::ROI* multiSlsDetector::getROI(int &n){
|
|||||||
n = 0;
|
n = 0;
|
||||||
int num = 0,i,j;
|
int num = 0,i,j;
|
||||||
int ndet = thisMultiDetector->numberOfDetectors;
|
int ndet = thisMultiDetector->numberOfDetectors;
|
||||||
int nroi[ndet];
|
|
||||||
int maxroi = ndet*MAX_ROIS;
|
int maxroi = ndet*MAX_ROIS;
|
||||||
ROI temproi;
|
ROI temproi;
|
||||||
ROI roiLimits[maxroi];
|
ROI roiLimits[maxroi];
|
||||||
@ -2141,7 +2139,6 @@ slsDetectorDefs::ROI* multiSlsDetector::getROI(int &n){
|
|||||||
if(detectors[i]->getErrorMask())
|
if(detectors[i]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<i));
|
setErrorMask(getErrorMask()|(1<<i));
|
||||||
|
|
||||||
nroi[i] = index;
|
|
||||||
if(temp){
|
if(temp){
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
if(index)
|
if(index)
|
||||||
@ -2364,7 +2361,7 @@ int multiSlsDetector::setFlatFieldCorrection(string fname){
|
|||||||
char ffffname[MAX_STR_LENGTH*2];
|
char ffffname[MAX_STR_LENGTH*2];
|
||||||
int nch;//nbad=0,
|
int nch;//nbad=0,
|
||||||
//int badlist[MAX_BADCHANS];
|
//int badlist[MAX_BADCHANS];
|
||||||
int im=0;
|
//int im=0;
|
||||||
|
|
||||||
if (fname=="default") {
|
if (fname=="default") {
|
||||||
fname=string(thisMultiDetector->flatFieldFile);
|
fname=string(thisMultiDetector->flatFieldFile);
|
||||||
@ -2636,7 +2633,7 @@ int multiSlsDetector::setRateCorrection(double t){
|
|||||||
ret=detectors[idet]->setRateCorrection(t);
|
ret=detectors[idet]->setRateCorrection(t);
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
if (ret1 != OK)
|
if (ret != OK)
|
||||||
ret1=FAIL;
|
ret1=FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3366,8 +3363,6 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
|||||||
|
|
||||||
if (s.find('+')==string::npos) {
|
if (s.find('+')==string::npos) {
|
||||||
|
|
||||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
|
||||||
|
|
||||||
if(!threadpool){
|
if(!threadpool){
|
||||||
cout << "Error in creating threadpool. Exiting" << endl;
|
cout << "Error in creating threadpool. Exiting" << endl;
|
||||||
return getNetworkParameter(p);
|
return getNetworkParameter(p);
|
||||||
@ -4033,10 +4028,10 @@ int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imo
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=-1;
|
}else ret=-1;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4131,10 +4126,10 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
delete iret[idet];
|
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4208,10 +4203,10 @@ int multiSlsDetector::setAllTrimbits(int val, int imod){
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=-1;
|
}else ret=-1;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4256,10 +4251,10 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
delete iret[idet];
|
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4544,9 +4539,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
|||||||
|
|
||||||
|
|
||||||
ofstream outfile;
|
ofstream outfile;
|
||||||
#ifdef VERBOSE
|
int iline = 0;
|
||||||
int ret;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
outfile.open(fname.c_str(),ios_base::out);
|
outfile.open(fname.c_str(),ios_base::out);
|
||||||
if (outfile.is_open()) {
|
if (outfile.is_open()) {
|
||||||
@ -4559,7 +4552,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
|||||||
cout << iv << " " << names[iv] << endl;
|
cout << iv << " " << names[iv] << endl;
|
||||||
strcpy(args[0],names[iv].c_str());
|
strcpy(args[0],names[iv].c_str());
|
||||||
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
||||||
|
iline++;
|
||||||
// single detector configuration
|
// single detector configuration
|
||||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
// sprintf(ext,".det%d",i);
|
// sprintf(ext,".det%d",i);
|
||||||
@ -4577,6 +4570,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
|||||||
cout << iv << " " << names[iv] << endl;
|
cout << iv << " " << names[iv] << endl;
|
||||||
strcpy(args[0],names[iv].c_str());
|
strcpy(args[0],names[iv].c_str());
|
||||||
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
||||||
|
iline++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4588,7 +4582,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "wrote " <<ret << " lines to configuration file " << std::endl;
|
std::cout<< "wrote " <<iline << " lines to configuration file " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@ -4934,10 +4928,10 @@ int multiSlsDetector::startReceiver(){
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
delete iret[idet];
|
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4996,10 +4990,10 @@ int multiSlsDetector::stopReceiver(){
|
|||||||
if(iret[idet] != NULL){
|
if(iret[idet] != NULL){
|
||||||
if(*iret[idet] != OK)
|
if(*iret[idet] != OK)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
delete iret[idet];
|
|
||||||
}else ret = FAIL;
|
}else ret = FAIL;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5199,7 +5193,7 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
|||||||
|
|
||||||
//jungfrau masking adcval
|
//jungfrau masking adcval
|
||||||
if(masking){
|
if(masking){
|
||||||
int snel = size/sizeof(int);
|
unsigned int snel = size/sizeof(int);
|
||||||
for(unsigned int i=0;i<snel;++i){
|
for(unsigned int i=0;i<snel;++i){
|
||||||
image[i] = (image[i] & 0x3FFF3FFF);
|
image[i] = (image[i] & 0x3FFF3FFF);
|
||||||
}
|
}
|
||||||
@ -5524,7 +5518,7 @@ string multiSlsDetector::getErrorMessage(int &critical){
|
|||||||
slsMask=detectors[idet]->getErrorMask();
|
slsMask=detectors[idet]->getErrorMask();
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
//append sls det error mask
|
//append sls det error mask
|
||||||
sprintf(sNumber,"0x%x",slsMask);
|
sprintf(sNumber,"0x%lx",slsMask);
|
||||||
retval.append("Error Mask " + string(sNumber)+string("\n"));
|
retval.append("Error Mask " + string(sNumber)+string("\n"));
|
||||||
#endif
|
#endif
|
||||||
//get the error critical level
|
//get the error critical level
|
||||||
@ -5757,10 +5751,10 @@ uint64_t multiSlsDetector::setCTBWord(int addr,uint64_t word) {
|
|||||||
ret1=detectors[idet]->setCTBWord(addr, word);
|
ret1=detectors[idet]->setCTBWord(addr, word);
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
if(ret==-100)
|
if(ret==(long long unsigned int)-100)
|
||||||
ret=ret1;
|
ret=ret1;
|
||||||
else if (ret!=ret1)
|
else if (ret!=ret1)
|
||||||
ret=-1;
|
ret=(long long unsigned int)-1;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -5871,10 +5865,10 @@ int multiSlsDetector::pulsePixel(int n,int x,int y) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=-1;
|
}else ret=-1;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5908,10 +5902,10 @@ int multiSlsDetector::pulsePixelNMove(int n,int x,int y) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=-1;
|
}else ret=-1;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5945,10 +5939,10 @@ int multiSlsDetector::pulseChip(int n) {
|
|||||||
ret=*iret[idet];
|
ret=*iret[idet];
|
||||||
else if (ret!=*iret[idet])
|
else if (ret!=*iret[idet])
|
||||||
ret=-1;
|
ret=-1;
|
||||||
delete iret[idet];
|
|
||||||
}else ret=-1;
|
}else ret=-1;
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete iret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -884,27 +884,29 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
framesPerFile=parentDet->framesPerFile;
|
framesPerFile=parentDet->framesPerFile;
|
||||||
fileFormatType=parentDet->fileFormatType;
|
fileFormatType=parentDet->fileFormatType;
|
||||||
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==PROPIX)){
|
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==PROPIX)){
|
||||||
setFramesPerFile(MAX_FRAMES_PER_FILE);
|
fileIO::setFramesPerFile(MAX_FRAMES_PER_FILE);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
setFileFormat(BINARY);
|
setFileFormat(BINARY);
|
||||||
}else if (thisDetector->myDetectorType==EIGER){
|
}else if (thisDetector->myDetectorType==EIGER){
|
||||||
setFramesPerFile(EIGER_MAX_FRAMES_PER_FILE);
|
fileIO:: setFramesPerFile(EIGER_MAX_FRAMES_PER_FILE);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
setFileFormat(BINARY);
|
setFileFormat(BINARY);
|
||||||
}else if (thisDetector->myDetectorType==MOENCH){
|
}else if (thisDetector->myDetectorType==MOENCH){
|
||||||
setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
|
fileIO:: setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
setFileFormat(BINARY);
|
setFileFormat(BINARY);
|
||||||
}else if (thisDetector->myDetectorType==JUNGFRAU){
|
}else if (thisDetector->myDetectorType==JUNGFRAU){
|
||||||
setFramesPerFile(JFRAU_MAX_FRAMES_PER_FILE);
|
fileIO:: setFramesPerFile(JFRAU_MAX_FRAMES_PER_FILE);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
setFileFormat(BINARY);
|
setFileFormat(BINARY);
|
||||||
}else if (thisDetector->myDetectorType==JUNGFRAUCTB){
|
}else if (thisDetector->myDetectorType==JUNGFRAUCTB){
|
||||||
setFramesPerFile(JFCTB_MAX_FRAMES_PER_FILE);
|
setFramesPerFile(JFCTB_MAX_FRAMES_PER_FILE);
|
||||||
pthread_mutex_unlock(&ms);
|
fileIO:: pthread_mutex_unlock(&ms);
|
||||||
setFileFormat(BINARY);
|
setFileFormat(BINARY);
|
||||||
}else
|
}else
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
|
if (thisReceiver != NULL)
|
||||||
|
delete thisReceiver;
|
||||||
thisReceiver = new receiverInterface(dataSocket);
|
thisReceiver = new receiverInterface(dataSocket);
|
||||||
|
|
||||||
// setAngularConversionPointer(thisDetector->angOff,&thisDetector->nMods, thisDetector->nChans*thisDetector->nChips);
|
// setAngularConversionPointer(thisDetector->angOff,&thisDetector->nMods, thisDetector->nChans*thisDetector->nChips);
|
||||||
@ -926,8 +928,8 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
|
|
||||||
int slsDetector::initializeDetectorStructure() {
|
int slsDetector::initializeDetectorStructure() {
|
||||||
sls_detector_module *thisMod;
|
sls_detector_module *thisMod;
|
||||||
char *p2;
|
//char *p2;
|
||||||
p2=(char*)thisDetector;
|
//p2=(char*)thisDetector;
|
||||||
|
|
||||||
/** for each of the detector modules up to the maximum number which can be installed initlialize the sls_detector_module structure \sa ::sls_detector_module*/
|
/** for each of the detector modules up to the maximum number which can be installed initlialize the sls_detector_module structure \sa ::sls_detector_module*/
|
||||||
for (int imod=0; imod<thisDetector->nModsMax; imod++) {
|
for (int imod=0; imod<thisDetector->nModsMax; imod++) {
|
||||||
@ -995,18 +997,19 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
|||||||
sls_detector_module *myMod=(sls_detector_module*)malloc(sizeof(sls_detector_module));
|
sls_detector_module *myMod=(sls_detector_module*)malloc(sizeof(sls_detector_module));
|
||||||
|
|
||||||
|
|
||||||
int nch, nm, nc, nd, na=0;
|
int nch, nc, nd, na=0;
|
||||||
|
// int nm = 0;
|
||||||
|
|
||||||
switch(t) {
|
switch(t) {
|
||||||
case MYTHEN:
|
case MYTHEN:
|
||||||
nch=128; // complete mythen system
|
nch=128; // complete mythen system
|
||||||
nm=24;
|
// nm=24;
|
||||||
nc=10;
|
nc=10;
|
||||||
nd=6; // dacs
|
nd=6; // dacs
|
||||||
break;
|
break;
|
||||||
case PICASSO:
|
case PICASSO:
|
||||||
nch=128; // complete mythen system
|
nch=128; // complete mythen system
|
||||||
nm=24;
|
// nm=24;
|
||||||
nc=12;
|
nc=12;
|
||||||
nd=6; // dacs+adcs
|
nd=6; // dacs+adcs
|
||||||
break;
|
break;
|
||||||
@ -1026,7 +1029,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
|||||||
break;
|
break;
|
||||||
case EIGER:
|
case EIGER:
|
||||||
nch=256*256; // one EIGER half module
|
nch=256*256; // one EIGER half module
|
||||||
nm=1; //modules/detector
|
// nm=1; //modules/detector
|
||||||
nc=4*1; //chips
|
nc=4*1; //chips
|
||||||
nd=16; //dacs
|
nd=16; //dacs
|
||||||
na=0;
|
na=0;
|
||||||
@ -1040,21 +1043,21 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
|||||||
break;
|
break;
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
nch=256*256;//32;
|
nch=256*256;//32;
|
||||||
nm=1;
|
// nm=1;
|
||||||
nc=4*2;
|
nc=4*2;
|
||||||
nd=16; // dacs+adcs
|
nd=16; // dacs+adcs
|
||||||
na=0;
|
na=0;
|
||||||
break;
|
break;
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
nch=36;
|
nch=36;
|
||||||
nm=1;
|
// nm=1;
|
||||||
nc=1;
|
nc=1;
|
||||||
nd=8; // dacs+adcs
|
nd=8; // dacs+adcs
|
||||||
na=1;
|
na=1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nch=0; // dum!
|
nch=0; // dum!
|
||||||
nm=0; //modules/detector
|
// nm=0; //modules/detector
|
||||||
nc=0; //chips
|
nc=0; //chips
|
||||||
nd=0; //dacs+adcs
|
nd=0; //dacs+adcs
|
||||||
na=0;
|
na=0;
|
||||||
@ -1753,7 +1756,6 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
char mess[MAX_STR_LENGTH]="dummy";
|
char mess[MAX_STR_LENGTH]="dummy";
|
||||||
int connect;
|
int connect;
|
||||||
int num;
|
|
||||||
|
|
||||||
arg[0]=d;
|
arg[0]=d;
|
||||||
arg[1]=n;
|
arg[1]=n;
|
||||||
@ -1774,11 +1776,11 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
if (connect == UNDEFINED)
|
if (connect == UNDEFINED)
|
||||||
cout << "no control socket?" << endl;
|
cout << "no control socket?" << endl;
|
||||||
else if (connect == OK){
|
else if (connect == OK){
|
||||||
num = controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
num = controlSocket->SendDataOnly(&arg,sizeof(arg));
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
num = controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
num = controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
} else {
|
} else {
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
@ -1912,7 +1914,6 @@ int slsDetector::setFlippedData(dimension d, int value){
|
|||||||
int retval=-1;
|
int retval=-1;
|
||||||
int fnum=F_SET_FLIPPED_DATA_RECEIVER;
|
int fnum=F_SET_FLIPPED_DATA_RECEIVER;
|
||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
char mess[MAX_STR_LENGTH]="";
|
|
||||||
int args[2]={X,-1};
|
int args[2]={X,-1};
|
||||||
|
|
||||||
|
|
||||||
@ -3365,7 +3366,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
|
|||||||
ostfn << thisDetector->settingsDir << ssettings << "/" << e_eV << "eV" << "/noise.sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
ostfn << thisDetector->settingsDir << ssettings << "/" << e_eV << "eV" << "/noise.sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
||||||
string settingsfname = ostfn.str();
|
string settingsfname = ostfn.str();
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Settings File is %s\n", settingsfname1.c_str());
|
printf("Settings File is %s\n", settingsfname.c_str());
|
||||||
#endif
|
#endif
|
||||||
//read the files
|
//read the files
|
||||||
myMod=createModule();
|
myMod=createModule();
|
||||||
@ -3806,18 +3807,18 @@ int slsDetector::updateDetectorNoWait() {
|
|||||||
enum readOutFlags ro;
|
enum readOutFlags ro;
|
||||||
// int ret=OK;
|
// int ret=OK;
|
||||||
enum detectorSettings t;
|
enum detectorSettings t;
|
||||||
int thr, n, nm;
|
int thr, n = 0, nm;
|
||||||
// int it;
|
// int it;
|
||||||
int64_t retval;// tns=-1;
|
int64_t retval;// tns=-1;
|
||||||
char lastClientIP[INET_ADDRSTRLEN];
|
char lastClientIP[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
n = controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
n += controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Updating detector last modified by " << lastClientIP << std::endl;
|
cout << "Updating detector last modified by " << lastClientIP << std::endl;
|
||||||
#endif
|
#endif
|
||||||
n = controlSocket->ReceiveDataOnly(&nm,sizeof(nm));
|
n += controlSocket->ReceiveDataOnly(&nm,sizeof(nm));
|
||||||
thisDetector->nMod[X]=nm;
|
thisDetector->nMod[X]=nm;
|
||||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||||
/// Should be overcome at a certain point!
|
/// Should be overcome at a certain point!
|
||||||
|
|
||||||
if (thisDetector->myDetectorType==MYTHEN) {
|
if (thisDetector->myDetectorType==MYTHEN) {
|
||||||
@ -3839,13 +3840,13 @@ int slsDetector::updateDetectorNoWait() {
|
|||||||
if (thisDetector->nModMax[Y]<thisDetector->nMod[Y])
|
if (thisDetector->nModMax[Y]<thisDetector->nMod[Y])
|
||||||
thisDetector->nModMax[Y]=thisDetector->nMod[Y];
|
thisDetector->nModMax[Y]=thisDetector->nMod[Y];
|
||||||
|
|
||||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||||
thisDetector->dynamicRange=nm;
|
thisDetector->dynamicRange=nm;
|
||||||
|
|
||||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||||
thisDetector->dataBytes=nm;
|
thisDetector->dataBytes=nm;
|
||||||
//t=setSettings(GET_SETTINGS);
|
//t=setSettings(GET_SETTINGS);
|
||||||
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
n += controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||||
thisDetector->currentSettings=t;
|
thisDetector->currentSettings=t;
|
||||||
|
|
||||||
if((thisDetector->myDetectorType!= GOTTHARD)&&
|
if((thisDetector->myDetectorType!= GOTTHARD)&&
|
||||||
@ -3853,49 +3854,49 @@ int slsDetector::updateDetectorNoWait() {
|
|||||||
(thisDetector->myDetectorType!= JUNGFRAU)&&
|
(thisDetector->myDetectorType!= JUNGFRAU)&&
|
||||||
(thisDetector->myDetectorType!= MOENCH) && (thisDetector->myDetectorType!= JUNGFRAUCTB)){
|
(thisDetector->myDetectorType!= MOENCH) && (thisDetector->myDetectorType!= JUNGFRAUCTB)){
|
||||||
//thr=getThresholdEnergy();
|
//thr=getThresholdEnergy();
|
||||||
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
n += controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||||
thisDetector->currentThresholdEV=thr;
|
thisDetector->currentThresholdEV=thr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//retval=setFrames(tns);
|
//retval=setFrames(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
||||||
// retval=setExposureTime(tns);
|
// retval=setExposureTime(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||||
|
|
||||||
if(thisDetector->myDetectorType == EIGER){
|
if(thisDetector->myDetectorType == EIGER){
|
||||||
//retval=setSubFrameExposureTime(tns);
|
//retval=setSubFrameExposureTime(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
||||||
}
|
}
|
||||||
//retval=setPeriod(tns);
|
//retval=setPeriod(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||||
//retval=setDelay(tns);
|
//retval=setDelay(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||||
// retval=setGates(tns);
|
// retval=setGates(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[GATES_NUMBER]=retval;
|
thisDetector->timerValue[GATES_NUMBER]=retval;
|
||||||
|
|
||||||
//retval=setProbes(tns);
|
//retval=setProbes(tns);
|
||||||
if (thisDetector->myDetectorType == MYTHEN){
|
if (thisDetector->myDetectorType == MYTHEN){
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//retval=setTrains(tns);
|
//retval=setTrains(tns);
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
||||||
|
|
||||||
//retval=setProbes(tns);
|
//retval=setProbes(tns);
|
||||||
if (thisDetector->myDetectorType == JUNGFRAUCTB){
|
if (thisDetector->myDetectorType == JUNGFRAUCTB){
|
||||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||||
if (retval>=0)
|
if (retval>=0)
|
||||||
thisDetector->timerValue[SAMPLES_JCTB]=retval;
|
thisDetector->timerValue[SAMPLES_JCTB]=retval;
|
||||||
n = controlSocket->ReceiveDataOnly( &ro,sizeof(ro));
|
n += controlSocket->ReceiveDataOnly( &ro,sizeof(ro));
|
||||||
|
|
||||||
thisDetector->roFlags=ro;
|
thisDetector->roFlags=ro;
|
||||||
|
|
||||||
@ -3905,6 +3906,11 @@ int slsDetector::updateDetectorNoWait() {
|
|||||||
// thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
// thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!n)
|
||||||
|
printf("n: %d\n", n);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4315,7 +4321,6 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
char mess[MAX_STR_LENGTH]="";
|
char mess[MAX_STR_LENGTH]="";
|
||||||
int ret=OK;
|
int ret=OK;
|
||||||
int n=0;
|
|
||||||
|
|
||||||
if (index!=MEASUREMENTS_NUMBER) {
|
if (index!=MEASUREMENTS_NUMBER) {
|
||||||
|
|
||||||
@ -4327,7 +4332,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&index,sizeof(index));
|
controlSocket->SendDataOnly(&index,sizeof(index));
|
||||||
n=controlSocket->SendDataOnly(&t,sizeof(t));
|
controlSocket->SendDataOnly(&t,sizeof(t));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
@ -4823,7 +4828,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) {
|
|||||||
int retval=-1;
|
int retval=-1;
|
||||||
char mess[MAX_STR_LENGTH]="";
|
char mess[MAX_STR_LENGTH]="";
|
||||||
int ret=OK;
|
int ret=OK;
|
||||||
int n=0;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Setting speed variable"<< sp << " to " << value << std::endl;
|
std::cout<< "Setting speed variable"<< sp << " to " << value << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -4831,7 +4836,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) {
|
|||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&sp,sizeof(sp));
|
controlSocket->SendDataOnly(&sp,sizeof(sp));
|
||||||
n=controlSocket->SendDataOnly(&value,sizeof(value));
|
controlSocket->SendDataOnly(&value,sizeof(value));
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Sent "<< n << " bytes " << std::endl;
|
std::cout<< "Sent "<< n << " bytes " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -5078,7 +5083,7 @@ int slsDetector::sendROI(int n,ROI roiLimits[]){
|
|||||||
if (ret!=FAIL){
|
if (ret!=FAIL){
|
||||||
controlSocket->ReceiveDataOnly(&retvalsize,sizeof(retvalsize));
|
controlSocket->ReceiveDataOnly(&retvalsize,sizeof(retvalsize));
|
||||||
nrec = controlSocket->ReceiveDataOnly(retval,retvalsize*sizeof(ROI));
|
nrec = controlSocket->ReceiveDataOnly(retval,retvalsize*sizeof(ROI));
|
||||||
if(nrec!=(retvalsize*sizeof(ROI))){
|
if(nrec!=(retvalsize*(int)sizeof(ROI))){
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
std::cout << " wrong size received: received " << nrec << "but expected " << retvalsize*sizeof(ROI) << endl;
|
std::cout << " wrong size received: received " << nrec << "but expected " << retvalsize*sizeof(ROI) << endl;
|
||||||
}
|
}
|
||||||
@ -5509,7 +5514,7 @@ int slsDetector::setRateCorrection(double t){
|
|||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
char mess[MAX_STR_LENGTH]="";
|
char mess[MAX_STR_LENGTH]="";
|
||||||
int64_t arg = t;
|
int64_t arg = t;
|
||||||
int64_t retval = -1;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Setting Rate Correction to " << arg << endl;
|
std::cout<< "Setting Rate Correction to " << arg << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -6617,13 +6622,17 @@ int slsDetector::readConfigurationFile(string const fname){
|
|||||||
//char *args[1000];
|
//char *args[1000];
|
||||||
|
|
||||||
string sargname, sargval;
|
string sargname, sargval;
|
||||||
int iline=0;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
int iline=0;
|
||||||
std::cout<< "config file name "<< fname << std::endl;
|
std::cout<< "config file name "<< fname << std::endl;
|
||||||
#endif
|
#endif
|
||||||
infile.open(fname.c_str(), ios_base::in);
|
infile.open(fname.c_str(), ios_base::in);
|
||||||
if (infile.is_open()) {
|
if (infile.is_open()) {
|
||||||
|
#ifdef VERBOSE
|
||||||
iline=readConfigurationFile(infile);
|
iline=readConfigurationFile(infile);
|
||||||
|
#else
|
||||||
|
readConfigurationFile(infile);
|
||||||
|
#endif
|
||||||
infile.close();
|
infile.close();
|
||||||
} else {
|
} else {
|
||||||
std::cout<< "Error opening configuration file " << fname << " for reading" << std::endl;
|
std::cout<< "Error opening configuration file " << fname << " for reading" << std::endl;
|
||||||
@ -6711,11 +6720,16 @@ int slsDetector::writeConfigurationFile(string const fname){
|
|||||||
|
|
||||||
|
|
||||||
ofstream outfile;
|
ofstream outfile;
|
||||||
|
#ifdef VERBOSE
|
||||||
int ret;
|
int ret;
|
||||||
|
#endif
|
||||||
outfile.open(fname.c_str(),ios_base::out);
|
outfile.open(fname.c_str(),ios_base::out);
|
||||||
if (outfile.is_open()) {
|
if (outfile.is_open()) {
|
||||||
|
#ifdef VERBOSE
|
||||||
ret=writeConfigurationFile(outfile);
|
ret=writeConfigurationFile(outfile);
|
||||||
|
#else
|
||||||
|
writeConfigurationFile(outfile);
|
||||||
|
#endif
|
||||||
outfile.close();
|
outfile.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -6831,7 +6845,7 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::writeSettingsFile(string fname, int imod, int& iodelay, int& tau){
|
int slsDetector::writeSettingsFile(string fname, int imod, int iodelay, int tau){
|
||||||
|
|
||||||
return writeSettingsFile(fname,thisDetector->myDetectorType, detectorModules[imod], iodelay, tau);
|
return writeSettingsFile(fname,thisDetector->myDetectorType, detectorModules[imod], iodelay, tau);
|
||||||
|
|
||||||
@ -6844,7 +6858,6 @@ int slsDetector::programFPGA(string fname){
|
|||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
int fnum=F_PROGRAM_FPGA;
|
int fnum=F_PROGRAM_FPGA;
|
||||||
char mess[MAX_STR_LENGTH]="";
|
char mess[MAX_STR_LENGTH]="";
|
||||||
int64_t retval = -1;
|
|
||||||
size_t filesize=0;
|
size_t filesize=0;
|
||||||
char* fpgasrc = NULL;
|
char* fpgasrc = NULL;
|
||||||
|
|
||||||
@ -7449,6 +7462,7 @@ string slsDetector::checkReceiverOnline() {
|
|||||||
return string("");
|
return string("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8026,30 +8040,32 @@ string slsDetector::getReceiverLastClientIP(){
|
|||||||
|
|
||||||
int slsDetector::updateReceiverNoWait() {
|
int slsDetector::updateReceiverNoWait() {
|
||||||
|
|
||||||
int n,ind;
|
int n = 0,ind;
|
||||||
char path[MAX_STR_LENGTH];
|
char path[MAX_STR_LENGTH];
|
||||||
char lastClientIP[INET_ADDRSTRLEN];
|
char lastClientIP[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
n += dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
fileIO::setFileIndex(ind);
|
fileIO::setFileIndex(ind);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
fileIO::setFilePath(path);
|
fileIO::setFilePath(path);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
fileIO::setFileName(path);
|
fileIO::setFileName(path);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
|
|
||||||
|
if (!n) printf("n: %d\n", n);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -8550,9 +8566,9 @@ int slsDetector::setReceiverFifoDepth(int i){
|
|||||||
int slsDetector::setCTBPattern(string fname) {
|
int slsDetector::setCTBPattern(string fname) {
|
||||||
|
|
||||||
|
|
||||||
int fnum=F_SET_CTB_PATTERN;
|
//int fnum=F_SET_CTB_PATTERN;
|
||||||
int ret = FAIL;
|
//int ret = FAIL;
|
||||||
char retval[MAX_STR_LENGTH]="";
|
//char retval[MAX_STR_LENGTH]="";
|
||||||
|
|
||||||
|
|
||||||
// if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
// if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||||
|
@ -512,7 +512,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
\sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
\sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||||
*/
|
*/
|
||||||
using energyConversion::writeSettingsFile;
|
using energyConversion::writeSettingsFile;
|
||||||
int writeSettingsFile(string fname, int imod, int& iodelay, int& tau);
|
int writeSettingsFile(string fname, int imod, int iodelay, int tau);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,10 +75,10 @@ int slsDetectorActions::setActionScript(int iaction, string fname) {
|
|||||||
|
|
||||||
|
|
||||||
int slsDetectorActions::setActionParameter(int iaction, string par) {
|
int slsDetectorActions::setActionParameter(int iaction, string par) {
|
||||||
int am;
|
//int am;
|
||||||
|
|
||||||
if (iaction>=0 && iaction<MAX_ACTIONS) {
|
if (iaction>=0 && iaction<MAX_ACTIONS) {
|
||||||
am= 1& ( (*actionMask) << iaction);
|
// am= 1& ( (*actionMask) << iaction);
|
||||||
|
|
||||||
if (par!="") {
|
if (par!="") {
|
||||||
strcpy(actionParameter[iaction],par.c_str());
|
strcpy(actionParameter[iaction],par.c_str());
|
||||||
|
@ -3472,7 +3472,11 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
|
|
||||||
if (cmd=="thisversion"){
|
if (cmd=="thisversion"){
|
||||||
sprintf(answer,"%llx",myDet->getId(THIS_SOFTWARE_VERSION));
|
int64_t retval = myDet->getId(THIS_SOFTWARE_VERSION);
|
||||||
|
if (retval < 0)
|
||||||
|
sprintf(answer, "%d", -1);
|
||||||
|
else
|
||||||
|
sprintf(answer,"%lx", (long long unsigned int)retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3482,37 +3486,61 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
|||||||
if (cmd=="moduleversion") {
|
if (cmd=="moduleversion") {
|
||||||
int ival=-1;
|
int ival=-1;
|
||||||
if (sscanf(args[0],"moduleversion:%d",&ival)) {
|
if (sscanf(args[0],"moduleversion:%d",&ival)) {
|
||||||
sprintf(answer,"%llx",myDet->getId(MODULE_FIRMWARE_VERSION,ival));
|
int64_t retval = myDet->getId(MODULE_FIRMWARE_VERSION, ival);
|
||||||
|
if (retval < 0)
|
||||||
|
sprintf(answer, "%d", -1);
|
||||||
|
else
|
||||||
|
sprintf(answer,"%lx", (long long unsigned int)retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else
|
} else
|
||||||
return string("undefined module number");
|
return string("undefined module number");
|
||||||
}
|
}
|
||||||
if (cmd=="detectornumber") {
|
if (cmd=="detectornumber") {
|
||||||
sprintf(answer,"%llx",myDet->getId(DETECTOR_SERIAL_NUMBER));
|
int64_t retval = myDet->getId(DETECTOR_SERIAL_NUMBER);
|
||||||
|
if (retval < 0)
|
||||||
|
sprintf(answer, "%d", -1);
|
||||||
|
else
|
||||||
|
sprintf(answer,"%lx", (long long unsigned int)retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
if (cmd.find("modulenumber")!=string::npos) {
|
if (cmd.find("modulenumber")!=string::npos) {
|
||||||
int ival=-1;
|
int ival=-1;
|
||||||
if (sscanf(args[0],"modulenumber:%d",&ival)) {
|
if (sscanf(args[0],"modulenumber:%d",&ival)) {
|
||||||
sprintf(answer,"%llx",myDet->getId(MODULE_SERIAL_NUMBER,ival));
|
int64_t retval = myDet->getId(MODULE_SERIAL_NUMBER, ival);
|
||||||
|
if (retval < 0)
|
||||||
|
sprintf(answer, "%d", -1);
|
||||||
|
else
|
||||||
|
sprintf(answer,"%lx", (long long unsigned int)retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
} else
|
} else
|
||||||
return string("undefined module number");
|
return string("undefined module number");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd=="detectorversion") {
|
if (cmd=="detectorversion") {
|
||||||
sprintf(answer,"%llx",myDet->getId(DETECTOR_FIRMWARE_VERSION));
|
int64_t retval = myDet->getId(DETECTOR_FIRMWARE_VERSION);
|
||||||
|
if (retval < 0)
|
||||||
|
sprintf(answer, "%d", -1);
|
||||||
|
else
|
||||||
|
sprintf(answer,"%lx", (long long unsigned int)retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd=="softwareversion") {
|
if (cmd=="softwareversion") {
|
||||||
sprintf(answer,"%llx",myDet->getId(DETECTOR_SOFTWARE_VERSION));
|
int64_t retval = myDet->getId(DETECTOR_SOFTWARE_VERSION);
|
||||||
|
if (retval < 0)
|
||||||
|
sprintf(answer, "%d", -1);
|
||||||
|
else
|
||||||
|
sprintf(answer,"%lx", (long long unsigned int)retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd=="receiverversion") {
|
if (cmd=="receiverversion") {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||||
sprintf(answer,"%llx",myDet->getId(RECEIVER_VERSION));
|
int64_t retval = myDet->getId(RECEIVER_VERSION);
|
||||||
|
if (retval < 0)
|
||||||
|
sprintf(answer, "%d", -1);
|
||||||
|
else
|
||||||
|
sprintf(answer,"%lx", (long long unsigned int)retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
return string("unknown id mode ")+cmd;
|
return string("unknown id mode ")+cmd;
|
||||||
@ -4558,7 +4586,7 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
|||||||
if (action==GET_ACTION)
|
if (action==GET_ACTION)
|
||||||
return string("cannot get");
|
return string("cannot get");
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< " resetting fpga " << sval << std::endl;
|
std::cout<< " resetting fpga " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
if(myDet->resetFPGA() == OK)
|
if(myDet->resetFPGA() == OK)
|
||||||
@ -4938,7 +4966,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
|||||||
else
|
else
|
||||||
return string("Could not scan address (hexadecimal fomat) ")+string(args[1]);
|
return string("Could not scan address (hexadecimal fomat) ")+string(args[1]);
|
||||||
|
|
||||||
if (sscanf(args[2],"%llx",&word))
|
if (sscanf(args[2],"%lx",&word))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
|
||||||
@ -4954,7 +4982,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
|
|
||||||
if (sscanf(args[1],"%llx",&word))
|
if (sscanf(args[1],"%lx",&word))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan value (hexadecimal fomat) ")+string(args[1]);
|
return string("Could not scan value (hexadecimal fomat) ")+string(args[1]);
|
||||||
@ -4971,7 +4999,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
|
|
||||||
if (sscanf(args[1],"%llx",&word))
|
if (sscanf(args[1],"%lx",&word))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan value (hexadecimal fomat) ")+string(args[1]);
|
return string("Could not scan value (hexadecimal fomat) ")+string(args[1]);
|
||||||
@ -5242,7 +5270,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
|
|
||||||
if (sscanf(args[1],"%lld",&t))
|
if (sscanf(args[1],"%ld",&t))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan wait time")+string(args[1]);
|
return string("Could not scan wait time")+string(args[1]);
|
||||||
@ -5265,7 +5293,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
|
|
||||||
if (sscanf(args[1],"%lld",&t))
|
if (sscanf(args[1],"%ld",&t))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan wait time ")+string(args[1]);
|
return string("Could not scan wait time ")+string(args[1]);
|
||||||
@ -5283,7 +5311,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
|||||||
} else if (cmd=="patwaittime2") {
|
} else if (cmd=="patwaittime2") {
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
|
|
||||||
if (sscanf(args[1],"%lld",&t))
|
if (sscanf(args[1],"%ld",&t))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("Could not scan wait time ")+string(args[1]);
|
return string("Could not scan wait time ")+string(args[1]);
|
||||||
@ -5471,13 +5499,12 @@ string slsDetectorCommand::cmdPulse(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return string("");
|
|
||||||
/*
|
|
||||||
if(retval == OK)
|
if(retval == OK)
|
||||||
return string(" successful");
|
return string(" successful");
|
||||||
else
|
else
|
||||||
return string(" failed");
|
return string(" failed");
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -806,7 +806,6 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
|||||||
slsDetectorCommand *cmd;
|
slsDetectorCommand *cmd;
|
||||||
string names[100];
|
string names[100];
|
||||||
int nvar=0;
|
int nvar=0;
|
||||||
int nvar1=0;
|
|
||||||
|
|
||||||
names[nvar++]="fname";
|
names[nvar++]="fname";
|
||||||
names[nvar++]="index";
|
names[nvar++]="index";
|
||||||
@ -886,6 +885,9 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
|||||||
names[nvar++]="patnloop2";
|
names[nvar++]="patnloop2";
|
||||||
names[nvar++]="patwait2";
|
names[nvar++]="patwait2";
|
||||||
names[nvar++]="patwaittime2";
|
names[nvar++]="patwaittime2";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -916,7 +918,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
|||||||
names[nvar++]="flatfield";
|
names[nvar++]="flatfield";
|
||||||
names[nvar++]="badchannels";
|
names[nvar++]="badchannels";
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (getDetectorsType()) {
|
switch (getDetectorsType()) {
|
||||||
@ -924,7 +927,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
|||||||
case MYTHEN:
|
case MYTHEN:
|
||||||
names[nvar++]="trimbits";
|
names[nvar++]="trimbits";
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// char ext[100];
|
// char ext[100];
|
||||||
|
@ -255,8 +255,8 @@ int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod,
|
|||||||
angOff[nm].etilt=epitch;
|
angOff[nm].etilt=epitch;
|
||||||
|
|
||||||
}
|
}
|
||||||
// cout << angOff[nm].center << " " << \
|
// cout << angOff[nm].center << " " <<
|
||||||
// angOff[nm].r_conversion << " " << \
|
// angOff[nm].r_conversion << " " <<
|
||||||
// angOff[nm].offset << endl;
|
// angOff[nm].offset << endl;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
@ -457,7 +457,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int energyConversion::writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int& iodelay, int& tau){
|
int energyConversion::writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int iodelay, int tau){
|
||||||
|
|
||||||
ofstream outfile;
|
ofstream outfile;
|
||||||
|
|
||||||
@ -537,8 +537,8 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
|||||||
std::cout << "tau: " << tau << std::endl;
|
std::cout << "tau: " << tau << std::endl;
|
||||||
#endif
|
#endif
|
||||||
outfile.write((char*)mod.dacs, sizeof(dacs_t)*(mod.ndac));
|
outfile.write((char*)mod.dacs, sizeof(dacs_t)*(mod.ndac));
|
||||||
outfile.write((char*)iodelay, sizeof(iodelay));
|
outfile.write(reinterpret_cast<char*>(&iodelay), sizeof(iodelay));
|
||||||
outfile.write((char*)tau, sizeof(tau));
|
outfile.write(reinterpret_cast<char*>(&tau), sizeof(tau));
|
||||||
outfile.write((char*)mod.chanregs, sizeof(int)*(mod.nchan));
|
outfile.write((char*)mod.chanregs, sizeof(int)*(mod.nchan));
|
||||||
|
|
||||||
outfile.close();
|
outfile.close();
|
||||||
|
@ -119,7 +119,7 @@ class energyConversion
|
|||||||
|
|
||||||
\sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module)
|
\sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module)
|
||||||
*/
|
*/
|
||||||
int writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int& iodelay, int& tau);
|
int writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int iodelay, int tau);
|
||||||
|
|
||||||
/** allocates the momery for a detector module structure
|
/** allocates the momery for a detector module structure
|
||||||
\param myDetectorType detector type (needed for number of channels, chips, dacs etc.)
|
\param myDetectorType detector type (needed for number of channels, chips, dacs etc.)
|
||||||
|
@ -534,9 +534,7 @@ class fileIOStatic {
|
|||||||
static int readDataFile(int nch, string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
|
static int readDataFile(int nch, string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
|
||||||
ifstream infile; \
|
ifstream infile; \
|
||||||
int iline=0; \
|
int iline=0; \
|
||||||
int maxchans; \
|
|
||||||
string str; \
|
string str; \
|
||||||
maxchans=nch; \
|
|
||||||
infile.open(fname.c_str(), ios_base::in); \
|
infile.open(fname.c_str(), ios_base::in); \
|
||||||
if (infile.is_open()) { \
|
if (infile.is_open()) { \
|
||||||
iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \
|
iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \
|
||||||
|
@ -38,7 +38,7 @@ int postProcessing::kbhit(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL), numberOfChannels(0), badChannelMask(NULL){
|
postProcessing::postProcessing(): expTime(NULL), badChannelMask(NULL), ang(NULL), val(NULL), err(NULL), numberOfChannels(0) {
|
||||||
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
||||||
mp=mp1;
|
mp=mp1;
|
||||||
pthread_mutex_init(&mp, NULL);
|
pthread_mutex_init(&mp, NULL);
|
||||||
@ -433,10 +433,9 @@ void* postProcessing::processData(int delflag) {
|
|||||||
|
|
||||||
|
|
||||||
int *myData;
|
int *myData;
|
||||||
char *p;
|
|
||||||
int dum=1;
|
int dum=1;
|
||||||
int nf=1, ii, nch;
|
// int nf=1, ii, nch;
|
||||||
int jctb=0;
|
// int jctb=0;
|
||||||
|
|
||||||
|
|
||||||
// if (getDetectorsType()==JUNGFRAUCTB) {
|
// if (getDetectorsType()==JUNGFRAUCTB) {
|
||||||
@ -467,7 +466,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
|
|
||||||
|
|
||||||
// if (jctb) {
|
// if (jctb) {
|
||||||
// p=(char*)myData;
|
// char* p=(char*)myData;
|
||||||
// for (ii=0; ii<nf; ii++) {
|
// for (ii=0; ii<nf; ii++) {
|
||||||
// processFrame((int*)p,delflag, 1);
|
// processFrame((int*)p,delflag, 1);
|
||||||
// p+=2*nch;
|
// p+=2*nch;
|
||||||
@ -891,6 +890,9 @@ void postProcessing::startThread(int delflag) {
|
|||||||
else
|
else
|
||||||
ret = pthread_create(&dataProcessingThread, &tattr,startProcessDataNoDelete, (void*)this);
|
ret = pthread_create(&dataProcessingThread, &tattr,startProcessDataNoDelete, (void*)this);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
printf("ret %d\n", ret);
|
||||||
|
|
||||||
pthread_attr_destroy(&tattr);
|
pthread_attr_destroy(&tattr);
|
||||||
|
|
||||||
// scheduling parameters of target thread
|
// scheduling parameters of target thread
|
||||||
|
@ -24,8 +24,8 @@ public:
|
|||||||
~func00_t() {}
|
~func00_t() {}
|
||||||
void operator()() const {((m_ptr->*m_fn)());}
|
void operator()() const {((m_ptr->*m_fn)());}
|
||||||
private:
|
private:
|
||||||
_Class* m_ptr;
|
|
||||||
_Ret (_Class::*m_fn)();
|
_Ret (_Class::*m_fn)();
|
||||||
|
_Class* m_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Ret, typename _Class, typename _Store>
|
template<typename _Ret, typename _Class, typename _Store>
|
||||||
@ -36,8 +36,8 @@ public:
|
|||||||
~func0_t() {}
|
~func0_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)());}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)());}
|
||||||
private:
|
private:
|
||||||
_Class* m_ptr;
|
|
||||||
_Ret (_Class::*m_fn)();
|
_Ret (_Class::*m_fn)();
|
||||||
|
_Class* m_ptr;
|
||||||
_Store* m_store;
|
_Store* m_store;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -49,8 +49,8 @@ public:
|
|||||||
~func1_t() {}
|
~func1_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1));}
|
||||||
private:
|
private:
|
||||||
_Class* m_ptr;
|
|
||||||
_Ret (_Class::*m_fn)(_Arg1);
|
_Ret (_Class::*m_fn)(_Arg1);
|
||||||
|
_Class* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Store* m_store;
|
_Store* m_store;
|
||||||
};
|
};
|
||||||
@ -63,8 +63,8 @@ public:
|
|||||||
~func2_t() {}
|
~func2_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2));}
|
||||||
private:
|
private:
|
||||||
_Class* m_ptr;
|
|
||||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2);
|
_Ret (_Class::*m_fn)(_Arg1,_Arg2);
|
||||||
|
_Class* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Arg2 m_arg2;
|
_Arg2 m_arg2;
|
||||||
_Store* m_store;
|
_Store* m_store;
|
||||||
@ -78,8 +78,8 @@ public:
|
|||||||
~func3_t() {}
|
~func3_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3));}
|
||||||
private:
|
private:
|
||||||
_Class* m_ptr;
|
|
||||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3);
|
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3);
|
||||||
|
_Class* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Arg2 m_arg2;
|
_Arg2 m_arg2;
|
||||||
_Arg3 m_arg3;
|
_Arg3 m_arg3;
|
||||||
@ -94,8 +94,8 @@ public:
|
|||||||
~func4_t() {}
|
~func4_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3,m_arg4));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3,m_arg4));}
|
||||||
private:
|
private:
|
||||||
_Class* m_ptr;
|
|
||||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3,_Arg4);
|
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3,_Arg4);
|
||||||
|
_Class* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Arg2 m_arg2;
|
_Arg2 m_arg2;
|
||||||
_Arg3 m_arg3;
|
_Arg3 m_arg3;
|
||||||
|
@ -67,12 +67,13 @@ int ThreadPool::destroy_threadpool(){
|
|||||||
/*cout << "Broadcasting STOP signal to all threads..." << endl;*/
|
/*cout << "Broadcasting STOP signal to all threads..." << endl;*/
|
||||||
m_task_cond_var.broadcast(); // notify all threads we are shttung down
|
m_task_cond_var.broadcast(); // notify all threads we are shttung down
|
||||||
|
|
||||||
int ret = -1;
|
// int ret = -1;
|
||||||
for (int i = 0; i < m_pool_size; i++) {
|
for (int i = 0; i < m_pool_size; i++) {
|
||||||
void* result;
|
void* result;
|
||||||
sem_post(&semStart);
|
sem_post(&semStart);
|
||||||
sem_post(&semDone);
|
sem_post(&semDone);
|
||||||
ret = pthread_join(m_threads[i], &result);
|
//ret =
|
||||||
|
pthread_join(m_threads[i], &result);
|
||||||
/*cout << "pthread_join() returned " << ret << ": " << strerror(errno) << endl;*/
|
/*cout << "pthread_join() returned " << ret << ": " << strerror(errno) << endl;*/
|
||||||
m_task_cond_var.broadcast(); // try waking up a bunch of threads that are still waiting
|
m_task_cond_var.broadcast(); // try waking up a bunch of threads that are still waiting
|
||||||
}
|
}
|
||||||
@ -85,7 +86,8 @@ int ThreadPool::destroy_threadpool(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* ThreadPool::execute_thread(){
|
void* ThreadPool::execute_thread(){
|
||||||
int ithread = current_thread_number;
|
//for debugging seting ithread value
|
||||||
|
// int ithread = current_thread_number;
|
||||||
thread_started = true;
|
thread_started = true;
|
||||||
Task* task = NULL;
|
Task* task = NULL;
|
||||||
m_tasks_loaded = false;
|
m_tasks_loaded = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user