mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 08:17:13 +02:00
resolved warnings, also from esrf: todo: include changes in zmq
This commit is contained in:
@ -884,27 +884,29 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
framesPerFile=parentDet->framesPerFile;
|
||||
fileFormatType=parentDet->fileFormatType;
|
||||
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==PROPIX)){
|
||||
setFramesPerFile(MAX_FRAMES_PER_FILE);
|
||||
fileIO::setFramesPerFile(MAX_FRAMES_PER_FILE);
|
||||
pthread_mutex_unlock(&ms);
|
||||
setFileFormat(BINARY);
|
||||
}else if (thisDetector->myDetectorType==EIGER){
|
||||
setFramesPerFile(EIGER_MAX_FRAMES_PER_FILE);
|
||||
fileIO:: setFramesPerFile(EIGER_MAX_FRAMES_PER_FILE);
|
||||
pthread_mutex_unlock(&ms);
|
||||
setFileFormat(BINARY);
|
||||
}else if (thisDetector->myDetectorType==MOENCH){
|
||||
setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
|
||||
fileIO:: setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
|
||||
pthread_mutex_unlock(&ms);
|
||||
setFileFormat(BINARY);
|
||||
}else if (thisDetector->myDetectorType==JUNGFRAU){
|
||||
setFramesPerFile(JFRAU_MAX_FRAMES_PER_FILE);
|
||||
fileIO:: setFramesPerFile(JFRAU_MAX_FRAMES_PER_FILE);
|
||||
pthread_mutex_unlock(&ms);
|
||||
setFileFormat(BINARY);
|
||||
}else if (thisDetector->myDetectorType==JUNGFRAUCTB){
|
||||
setFramesPerFile(JFCTB_MAX_FRAMES_PER_FILE);
|
||||
pthread_mutex_unlock(&ms);
|
||||
fileIO:: pthread_mutex_unlock(&ms);
|
||||
setFileFormat(BINARY);
|
||||
}else
|
||||
pthread_mutex_unlock(&ms);
|
||||
if (thisReceiver != NULL)
|
||||
delete thisReceiver;
|
||||
thisReceiver = new receiverInterface(dataSocket);
|
||||
|
||||
// setAngularConversionPointer(thisDetector->angOff,&thisDetector->nMods, thisDetector->nChans*thisDetector->nChips);
|
||||
@ -926,8 +928,8 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
|
||||
int slsDetector::initializeDetectorStructure() {
|
||||
sls_detector_module *thisMod;
|
||||
char *p2;
|
||||
p2=(char*)thisDetector;
|
||||
//char *p2;
|
||||
//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 (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));
|
||||
|
||||
|
||||
int nch, nm, nc, nd, na=0;
|
||||
int nch, nc, nd, na=0;
|
||||
// int nm = 0;
|
||||
|
||||
switch(t) {
|
||||
case MYTHEN:
|
||||
nch=128; // complete mythen system
|
||||
nm=24;
|
||||
// nm=24;
|
||||
nc=10;
|
||||
nd=6; // dacs
|
||||
break;
|
||||
case PICASSO:
|
||||
nch=128; // complete mythen system
|
||||
nm=24;
|
||||
// nm=24;
|
||||
nc=12;
|
||||
nd=6; // dacs+adcs
|
||||
break;
|
||||
@ -1026,7 +1029,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
||||
break;
|
||||
case EIGER:
|
||||
nch=256*256; // one EIGER half module
|
||||
nm=1; //modules/detector
|
||||
// nm=1; //modules/detector
|
||||
nc=4*1; //chips
|
||||
nd=16; //dacs
|
||||
na=0;
|
||||
@ -1040,21 +1043,21 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
nch=256*256;//32;
|
||||
nm=1;
|
||||
// nm=1;
|
||||
nc=4*2;
|
||||
nd=16; // dacs+adcs
|
||||
na=0;
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
nch=36;
|
||||
nm=1;
|
||||
// nm=1;
|
||||
nc=1;
|
||||
nd=8; // dacs+adcs
|
||||
na=1;
|
||||
break;
|
||||
default:
|
||||
nch=0; // dum!
|
||||
nm=0; //modules/detector
|
||||
// nm=0; //modules/detector
|
||||
nc=0; //chips
|
||||
nd=0; //dacs+adcs
|
||||
na=0;
|
||||
@ -1753,7 +1756,6 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="dummy";
|
||||
int connect;
|
||||
int num;
|
||||
|
||||
arg[0]=d;
|
||||
arg[1]=n;
|
||||
@ -1774,11 +1776,11 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
||||
if (connect == UNDEFINED)
|
||||
cout << "no control socket?" << endl;
|
||||
else if (connect == OK){
|
||||
num = controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
num = controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||
num = controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret!=FAIL) {
|
||||
num = controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
} else {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
@ -1912,7 +1914,6 @@ 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};
|
||||
|
||||
|
||||
@ -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);
|
||||
string settingsfname = ostfn.str();
|
||||
#ifdef VERBOSE
|
||||
printf("Settings File is %s\n", settingsfname1.c_str());
|
||||
printf("Settings File is %s\n", settingsfname.c_str());
|
||||
#endif
|
||||
//read the files
|
||||
myMod=createModule();
|
||||
@ -3806,18 +3807,18 @@ int slsDetector::updateDetectorNoWait() {
|
||||
enum readOutFlags ro;
|
||||
// int ret=OK;
|
||||
enum detectorSettings t;
|
||||
int thr, n, nm;
|
||||
int thr, n = 0, nm;
|
||||
// int it;
|
||||
int64_t retval;// tns=-1;
|
||||
char lastClientIP[INET_ADDRSTRLEN];
|
||||
|
||||
n = controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
n += controlSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
#ifdef VERBOSE
|
||||
cout << "Updating detector last modified by " << lastClientIP << std::endl;
|
||||
#endif
|
||||
n = controlSocket->ReceiveDataOnly(&nm,sizeof(nm));
|
||||
n += controlSocket->ReceiveDataOnly(&nm,sizeof(nm));
|
||||
thisDetector->nMod[X]=nm;
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
/// Should be overcome at a certain point!
|
||||
|
||||
if (thisDetector->myDetectorType==MYTHEN) {
|
||||
@ -3839,13 +3840,13 @@ int slsDetector::updateDetectorNoWait() {
|
||||
if (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;
|
||||
|
||||
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dataBytes=nm;
|
||||
//t=setSettings(GET_SETTINGS);
|
||||
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||
n += controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||
thisDetector->currentSettings=t;
|
||||
|
||||
if((thisDetector->myDetectorType!= GOTTHARD)&&
|
||||
@ -3853,49 +3854,49 @@ int slsDetector::updateDetectorNoWait() {
|
||||
(thisDetector->myDetectorType!= JUNGFRAU)&&
|
||||
(thisDetector->myDetectorType!= MOENCH) && (thisDetector->myDetectorType!= JUNGFRAUCTB)){
|
||||
//thr=getThresholdEnergy();
|
||||
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||
n += controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||
thisDetector->currentThresholdEV=thr;
|
||||
}
|
||||
|
||||
//retval=setFrames(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
||||
// retval=setExposureTime(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
//retval=setSubFrameExposureTime(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
||||
}
|
||||
//retval=setPeriod(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||
//retval=setDelay(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||
// retval=setGates(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[GATES_NUMBER]=retval;
|
||||
|
||||
//retval=setProbes(tns);
|
||||
if (thisDetector->myDetectorType == MYTHEN){
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
||||
}
|
||||
|
||||
|
||||
//retval=setTrains(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
||||
|
||||
//retval=setProbes(tns);
|
||||
if (thisDetector->myDetectorType == JUNGFRAUCTB){
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
if (retval>=0)
|
||||
thisDetector->timerValue[SAMPLES_JCTB]=retval;
|
||||
n = controlSocket->ReceiveDataOnly( &ro,sizeof(ro));
|
||||
n += controlSocket->ReceiveDataOnly( &ro,sizeof(ro));
|
||||
|
||||
thisDetector->roFlags=ro;
|
||||
|
||||
@ -3905,6 +3906,11 @@ int slsDetector::updateDetectorNoWait() {
|
||||
// thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!n)
|
||||
printf("n: %d\n", n);
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
@ -4315,7 +4321,6 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
int64_t retval = -1;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret=OK;
|
||||
int n=0;
|
||||
|
||||
if (index!=MEASUREMENTS_NUMBER) {
|
||||
|
||||
@ -4327,7 +4332,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&index,sizeof(index));
|
||||
n=controlSocket->SendDataOnly(&t,sizeof(t));
|
||||
controlSocket->SendDataOnly(&t,sizeof(t));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
@ -4823,7 +4828,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) {
|
||||
int retval=-1;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret=OK;
|
||||
int n=0;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Setting speed variable"<< sp << " to " << value << std::endl;
|
||||
#endif
|
||||
@ -4831,7 +4836,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&sp,sizeof(sp));
|
||||
n=controlSocket->SendDataOnly(&value,sizeof(value));
|
||||
controlSocket->SendDataOnly(&value,sizeof(value));
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sent "<< n << " bytes " << std::endl;
|
||||
#endif
|
||||
@ -5078,7 +5083,7 @@ int slsDetector::sendROI(int n,ROI roiLimits[]){
|
||||
if (ret!=FAIL){
|
||||
controlSocket->ReceiveDataOnly(&retvalsize,sizeof(retvalsize));
|
||||
nrec = controlSocket->ReceiveDataOnly(retval,retvalsize*sizeof(ROI));
|
||||
if(nrec!=(retvalsize*sizeof(ROI))){
|
||||
if(nrec!=(retvalsize*(int)sizeof(ROI))){
|
||||
ret=FAIL;
|
||||
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;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int64_t arg = t;
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Setting Rate Correction to " << arg << endl;
|
||||
#endif
|
||||
@ -6617,13 +6622,17 @@ int slsDetector::readConfigurationFile(string const fname){
|
||||
//char *args[1000];
|
||||
|
||||
string sargname, sargval;
|
||||
int iline=0;
|
||||
#ifdef VERBOSE
|
||||
int iline=0;
|
||||
std::cout<< "config file name "<< fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
iline=readConfigurationFile(infile);
|
||||
#else
|
||||
readConfigurationFile(infile);
|
||||
#endif
|
||||
infile.close();
|
||||
} else {
|
||||
std::cout<< "Error opening configuration file " << fname << " for reading" << std::endl;
|
||||
@ -6711,11 +6720,16 @@ int slsDetector::writeConfigurationFile(string const fname){
|
||||
|
||||
|
||||
ofstream outfile;
|
||||
#ifdef VERBOSE
|
||||
int ret;
|
||||
|
||||
#endif
|
||||
outfile.open(fname.c_str(),ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
ret=writeConfigurationFile(outfile);
|
||||
#ifdef VERBOSE
|
||||
ret=writeConfigurationFile(outfile);
|
||||
#else
|
||||
writeConfigurationFile(outfile);
|
||||
#endif
|
||||
outfile.close();
|
||||
}
|
||||
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);
|
||||
|
||||
@ -6844,7 +6858,6 @@ int slsDetector::programFPGA(string fname){
|
||||
int ret=FAIL;
|
||||
int fnum=F_PROGRAM_FPGA;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int64_t retval = -1;
|
||||
size_t filesize=0;
|
||||
char* fpgasrc = NULL;
|
||||
|
||||
@ -7449,6 +7462,7 @@ string slsDetector::checkReceiverOnline() {
|
||||
return string("");
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@ -8026,30 +8040,32 @@ string slsDetector::getReceiverLastClientIP(){
|
||||
|
||||
int slsDetector::updateReceiverNoWait() {
|
||||
|
||||
int n,ind;
|
||||
int n = 0,ind;
|
||||
char path[MAX_STR_LENGTH];
|
||||
char lastClientIP[INET_ADDRSTRLEN];
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
n += dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
#ifdef VERBOSE
|
||||
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
||||
#endif
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFileIndex(ind);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFilePath(path);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
pthread_mutex_lock(&ms);
|
||||
fileIO::setFileName(path);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
if (!n) printf("n: %d\n", n);
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
@ -8550,9 +8566,9 @@ int slsDetector::setReceiverFifoDepth(int i){
|
||||
int slsDetector::setCTBPattern(string fname) {
|
||||
|
||||
|
||||
int fnum=F_SET_CTB_PATTERN;
|
||||
int ret = FAIL;
|
||||
char retval[MAX_STR_LENGTH]="";
|
||||
//int fnum=F_SET_CTB_PATTERN;
|
||||
//int ret = FAIL;
|
||||
//char retval[MAX_STR_LENGTH]="";
|
||||
|
||||
|
||||
// if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
|
Reference in New Issue
Block a user