mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-27 16:50:02 +02:00
solved warnings except sscanf for uint64_t
This commit is contained in:
parent
65f5e1c1ab
commit
5b3a911e8d
@ -69,7 +69,7 @@ gotthardVirtualServer: $(SRC_MYTHEN_SVC)
|
||||
|
||||
|
||||
%.o : %.cpp %.h Makefile
|
||||
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread -lrt $(LIBZMQ) #$(FLAGS)
|
||||
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread -lrt $(LIBZMQ) $(FLAGS)
|
||||
|
||||
|
||||
package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
|
||||
|
@ -1173,11 +1173,11 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200))
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
ret=-1;
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1191,7 +1191,7 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
||||
|
||||
slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
|
||||
|
||||
int i, posmin, posmax;
|
||||
int posmin, posmax;
|
||||
int ret=-100;
|
||||
|
||||
if (pos<0) {
|
||||
@ -1225,10 +1225,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=GET_SETTINGS;
|
||||
delete iret[idet];
|
||||
}else ret=GET_SETTINGS;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1273,10 +1273,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=GET_SETTINGS;
|
||||
delete iret[idet];
|
||||
}else ret=GET_SETTINGS;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1662,10 +1662,10 @@ int multiSlsDetector::startAndReadAllNoWait(){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2332,7 +2332,7 @@ int multiSlsDetector::setFlatFieldCorrection(string fname){
|
||||
char ffffname[MAX_STR_LENGTH*2];
|
||||
int nch;//nbad=0,
|
||||
//int badlist[MAX_BADCHANS];
|
||||
int im=0;
|
||||
//int im=0;
|
||||
|
||||
if (fname=="default") {
|
||||
fname=string(thisMultiDetector->flatFieldFile);
|
||||
@ -3334,8 +3334,6 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
|
||||
if (s.find('+')==string::npos) {
|
||||
|
||||
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
|
||||
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return getNetworkParameter(p);
|
||||
@ -3356,6 +3354,7 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
//doing nothing with the return values
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete sret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4000,10 +3999,10 @@ int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imo
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4098,10 +4097,10 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4175,10 +4174,10 @@ int multiSlsDetector::setAllTrimbits(int val, int imod){
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4223,10 +4222,10 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4511,9 +4510,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
||||
|
||||
|
||||
ofstream outfile;
|
||||
#ifdef VERBOSE
|
||||
int ret;
|
||||
#endif
|
||||
int iline = 0;
|
||||
|
||||
outfile.open(fname.c_str(),ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
@ -4526,7 +4523,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
||||
cout << iv << " " << names[iv] << endl;
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
||||
|
||||
iline++;
|
||||
// single detector configuration
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||
// sprintf(ext,".det%d",i);
|
||||
@ -4544,6 +4541,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
||||
cout << iv << " " << names[iv] << endl;
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
||||
iline++;
|
||||
}
|
||||
|
||||
|
||||
@ -4555,7 +4553,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "wrote " <<ret << " lines to configuration file " << std::endl;
|
||||
std::cout<< "wrote " << iline << " lines to configuration file " << std::endl;
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
@ -4882,10 +4880,10 @@ int multiSlsDetector::startReceiver(){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4944,10 +4942,10 @@ int multiSlsDetector::stopReceiver(){
|
||||
if(iret[idet] != NULL){
|
||||
if(*iret[idet] != OK)
|
||||
ret = FAIL;
|
||||
delete iret[idet];
|
||||
}else ret = FAIL;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5186,19 +5184,19 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
||||
#ifdef VERYVERBOSE
|
||||
// htype is an array of strings
|
||||
rapidjson::Value::Array htype = d["htype"].GetArray();
|
||||
for(int i=0; i< htype.Size(); i++)
|
||||
for(int i=0; i< (signed int)htype.Size(); i++)
|
||||
std::cout << isocket << "htype: " << htype[i].GetString() << std::endl;
|
||||
// shape is an array of ints
|
||||
rapidjson::Value::Array shape = d["shape"].GetArray();
|
||||
cout << isocket << "shape: ";
|
||||
for(int i=0; i< shape.Size(); i++)
|
||||
for(int i=0; i< (signed int) shape.Size(); i++)
|
||||
cout << isocket << shape[i].GetInt() << " ";
|
||||
cout << endl;
|
||||
|
||||
cout << isocket << "type: " << d["type"].GetString() << endl;
|
||||
|
||||
#endif
|
||||
if(d["acqIndex"].GetUint64()!=-1){ //!isocket &&
|
||||
if(d["acqIndex"].GetUint64()!= (long long unsigned int)-1){ //!isocket &&
|
||||
acqIndex = d["acqIndex"].GetUint64();
|
||||
frameIndex = d["fIndex"].GetUint64();
|
||||
subframeIndex = -1;
|
||||
@ -5212,7 +5210,7 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
||||
cout << "Subframe index: " << subframeIndex << endl;
|
||||
cout << "File name: " << filename << endl;
|
||||
#endif
|
||||
if(frameIndex ==-1) cprintf(RED,"multi frame index -1!!\n");
|
||||
if(frameIndex == (long long unsigned int)-1) cprintf(RED,"multi frame index -1!!\n");
|
||||
}
|
||||
// close the message
|
||||
zmq_msg_close(&message);
|
||||
@ -5243,7 +5241,7 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
||||
//jungfrau masking adcval
|
||||
if(masking){
|
||||
int snel = size/sizeof(int);
|
||||
for(unsigned int i=0;i<snel;++i){
|
||||
for(unsigned int i=0;i<(unsigned int) snel;++i){
|
||||
image[i] = (image[i] & 0x3FFF3FFF);
|
||||
}
|
||||
}
|
||||
@ -5571,7 +5569,7 @@ string multiSlsDetector::getErrorMessage(int &critical){
|
||||
slsMask=detectors[idet]->getErrorMask();
|
||||
#ifdef VERYVERBOSE
|
||||
//append sls det error mask
|
||||
sprintf(sNumber,"0x%x",slsMask);
|
||||
sprintf(sNumber,"0x%lx",slsMask);
|
||||
retval.append("Error Mask " + string(sNumber)+string("\n"));
|
||||
#endif
|
||||
//get the error critical level
|
||||
@ -5804,10 +5802,10 @@ uint64_t multiSlsDetector::setCTBWord(int addr,uint64_t word) {
|
||||
ret1=detectors[idet]->setCTBWord(addr, word);
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
if(ret==-100)
|
||||
if(ret== (long long unsigned int)-100)
|
||||
ret=ret1;
|
||||
else if (ret!=ret1)
|
||||
ret=-1;
|
||||
ret=(long long unsigned int)-1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -5918,10 +5916,10 @@ int multiSlsDetector::pulsePixel(int n,int x,int y) {
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5955,10 +5953,10 @@ int multiSlsDetector::pulsePixelNMove(int n,int x,int y) {
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5992,10 +5990,10 @@ int multiSlsDetector::pulseChip(int n) {
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
delete iret[idet];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
/** flag for acquiring */
|
||||
bool acquiringFlag;
|
||||
|
||||
};
|
||||
}sharedMultiSlsDetector;
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,7 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
|
||||
myDet=det;
|
||||
@ -3426,7 +3427,11 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
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,"%llx", (long long unsigned int)retval);
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -3436,37 +3441,61 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
if (cmd=="moduleversion") {
|
||||
int ival=-1;
|
||||
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,"%llx", (long long unsigned int)retval);
|
||||
return string(answer);
|
||||
} else
|
||||
return string("undefined module number");
|
||||
}
|
||||
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,"%llx", (long long unsigned int)retval);
|
||||
return string(answer);
|
||||
}
|
||||
if (cmd.find("modulenumber")!=string::npos) {
|
||||
int ival=-1;
|
||||
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,"%llx", (long long unsigned int)retval);
|
||||
return string(answer);
|
||||
} else
|
||||
return string("undefined module number");
|
||||
}
|
||||
|
||||
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,"%llx", (long long unsigned int)retval);
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
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,"%llx", (long long unsigned int)retval);
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
if (cmd=="receiverversion") {
|
||||
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,"%llx", (long long unsigned int)retval);
|
||||
return string(answer);
|
||||
}
|
||||
return string("unknown id mode ")+cmd;
|
||||
@ -4491,7 +4520,7 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
||||
if (action==GET_ACTION)
|
||||
return string("cannot get");
|
||||
#ifdef VERBOSE
|
||||
std::cout<< " resetting fpga " << sval << std::endl;
|
||||
std::cout<< " resetting fpga " << std::endl;
|
||||
#endif
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if(myDet->resetFPGA() == OK)
|
||||
|
@ -798,7 +798,6 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
slsDetectorCommand *cmd;
|
||||
string names[100];
|
||||
int nvar=0;
|
||||
int nvar1=0;
|
||||
|
||||
names[nvar++]="fname";
|
||||
names[nvar++]="index";
|
||||
@ -878,6 +877,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
names[nvar++]="patnloop2";
|
||||
names[nvar++]="patwait2";
|
||||
names[nvar++]="patwaittime2";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -908,6 +909,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
names[nvar++]="flatfield";
|
||||
names[nvar++]="badchannels";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@ -916,7 +919,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
case MYTHEN:
|
||||
names[nvar++]="trimbits";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// char ext[100];
|
||||
|
@ -255,8 +255,8 @@ int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod,
|
||||
angOff[nm].etilt=epitch;
|
||||
|
||||
}
|
||||
// cout << angOff[nm].center << " " << \
|
||||
// angOff[nm].r_conversion << " " << \
|
||||
// cout << angOff[nm].center << " " <<
|
||||
// angOff[nm].r_conversion << " " <<
|
||||
// angOff[nm].offset << endl;
|
||||
|
||||
} else
|
||||
|
@ -17,20 +17,20 @@ int energyConversion::readCalibrationFile(string fname, double &gain, double &of
|
||||
string str;
|
||||
ifstream infile;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Opening file "<< fname << std::endl;
|
||||
printf( "Opening file %s \n", fname.c_str() );
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
getline(infile,str);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
printf( "%s \n", str.c_str() );
|
||||
#endif
|
||||
istringstream ssstr(str);
|
||||
ssstr >> offset >> gain;
|
||||
infile.close();
|
||||
cout << "Calibration file loaded: " << fname << endl;
|
||||
printf( "Calibration file loaded: %s \n", fname.c_str() );
|
||||
} else {
|
||||
std::cout<< "Could not open calibration file "<< fname << std::endl;
|
||||
printf( "Could not open calibration file %s \n", fname.c_str() );
|
||||
gain=0.;
|
||||
offset=0.;
|
||||
#ifndef MYROOT
|
||||
@ -45,7 +45,7 @@ int energyConversion::readCalibrationFile(string fname, double &gain, double &of
|
||||
};
|
||||
|
||||
int energyConversion::writeCalibrationFile(string fname, double gain, double offset){
|
||||
//std::cout<< "Function not yet implemented " << std::endl;
|
||||
//printf( "Function not yet implemented \n" );
|
||||
ofstream outfile;
|
||||
outfile.open (fname.c_str());
|
||||
|
||||
@ -53,7 +53,7 @@ int energyConversion::writeCalibrationFile(string fname, double gain, double off
|
||||
if (outfile.is_open()) {
|
||||
outfile << offset << " " << gain << std::endl;
|
||||
} else {
|
||||
std::cout<< "Could not open calibration file "<< fname << " for writing" << std::endl;
|
||||
printf( "Could not open calibration file %s for writing \n", fname.c_str() );
|
||||
#ifndef MYROOT
|
||||
return FAIL;
|
||||
#endif
|
||||
@ -76,7 +76,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
||||
double o,g;
|
||||
int ig=0;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Opening file "<< fname << std::endl;
|
||||
printf( "Opening file %s \n", fname.c_str() );
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
@ -85,7 +85,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
||||
//while ( (getline(infile,str)) > -1) {
|
||||
getline(infile,str);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
printf( "%s \n", str.c_str() );
|
||||
#endif
|
||||
istringstream ssstr(str);
|
||||
ssstr >> o >> g;
|
||||
@ -96,9 +96,9 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
||||
break;
|
||||
}
|
||||
infile.close();
|
||||
cout << "Calibration file loaded: " << fname << endl;
|
||||
printf( "Calibration file loaded: %s \n", fname.c_str() );
|
||||
} else {
|
||||
cout << "Could not open calibration file: "<< fname << std::endl;
|
||||
printf( "Could not open calibration file: %s \n", fname.c_str() );
|
||||
gain[0]=0;
|
||||
offset[0]=0;
|
||||
#ifndef MYROOT
|
||||
@ -114,7 +114,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
||||
};
|
||||
|
||||
int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset){
|
||||
//std::cout<< "Function not yet implemented " << std::endl;
|
||||
//printf( "Function not yet implemented \n" );
|
||||
ofstream outfile;
|
||||
outfile.open (fname.c_str());
|
||||
// >> i/o operations here <<
|
||||
@ -122,7 +122,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset)
|
||||
for (int ig=0; ig<4; ig++)
|
||||
outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl;
|
||||
} else {
|
||||
std::cout<< "Could not open calibration file "<< fname << " for writing" << std::endl;
|
||||
printf( "Could not open calibration file %s for writing \n", fname.c_str() );
|
||||
#ifndef MYROOT
|
||||
return FAIL;
|
||||
#endif
|
||||
@ -251,16 +251,16 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
names[id++]="VDAC15";
|
||||
break;
|
||||
default:
|
||||
cout << "Unknown detector type - unknown format for settings file" << endl;
|
||||
printf( "Unknown detector type - unknown format for settings file \n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "reading settings file for module number "<< myMod->module << std::endl;
|
||||
printf( " reading settings file for module number %d \n", myMod->module );
|
||||
#endif
|
||||
myfname=fname;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "file name is "<< myfname << std::endl;
|
||||
printf( "file name is %s \n", myfname.c_str() );
|
||||
#endif
|
||||
|
||||
switch (myDetectorType) {
|
||||
@ -274,7 +274,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
istringstream ssstr(str);
|
||||
ssstr >> sargname >> ival;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl;
|
||||
printf( "%s dac nr. %d is %d \n", sargname.c_str(), idac, ival );
|
||||
#endif
|
||||
myMod->dacs[idac]=ival;
|
||||
idac++;
|
||||
@ -283,24 +283,24 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
getline(infile,str);
|
||||
iline++;
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
printf( "%s \n", str.c_str() );
|
||||
#endif
|
||||
istringstream ssstr(str);
|
||||
ssstr >> sargname >> ival;
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< "chip " << ichip << " " << sargname << " is " << ival << std::endl;
|
||||
printf( "chip %d %s is %d \n", ichip, sargname.c_str(), ival );
|
||||
#endif
|
||||
|
||||
myMod->chipregs[ichip]=ival;
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
getline(infile,str);
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
printf( " %s \n", str.c_str() );
|
||||
#endif
|
||||
istringstream ssstr(str);
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< "channel " << ichan+ichip*thisDetector->nChans <<" iline " << iline<< std::endl;
|
||||
printf( "channel %d iline %d \n", ichan+ichip*myMod->nchan, iline );
|
||||
#endif
|
||||
iline++;
|
||||
myMod->chanregs[ichip*nch+ichan]=0;
|
||||
@ -310,42 +310,42 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
switch (iarg) {
|
||||
case 0:
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< "trimbits " << ival ;
|
||||
printf( "trimbits %d", ival );
|
||||
#endif
|
||||
myMod->chanregs[ichip*nch+ichan]|=ival&TRIMBITMASK;
|
||||
break;
|
||||
case 1:
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< " compen " << ival ;
|
||||
printf( " compen %d", ival );
|
||||
#endif
|
||||
myMod->chanregs[ichip*nch+ichan]|=ival<<9;
|
||||
break;
|
||||
case 2:
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< " anen " << ival ;
|
||||
printf( " anen %d", ival );
|
||||
#endif
|
||||
myMod->chanregs[ichip*nch+ichan]|=ival<<8;
|
||||
break;
|
||||
case 3:
|
||||
#ifdef VERYVERBOSE
|
||||
std::cout<< " calen " << ival ;
|
||||
printf( " calen %d", ival ) ;
|
||||
#endif
|
||||
myMod->chanregs[ichip*nch+ichan]|=ival<<7;
|
||||
break;
|
||||
case 4:
|
||||
#ifdef VERBOSE
|
||||
std::cout<< " outcomp " << ival ;
|
||||
printf( " outcomp %d", ival ) ;
|
||||
#endif
|
||||
myMod->chanregs[ichip*nch+ichan]|=ival<<10;
|
||||
break;
|
||||
case 5:
|
||||
#ifdef VERBOSE
|
||||
std::cout<< " counts " << ival << std::endl;
|
||||
printf( " counts %d \n", ival );
|
||||
#endif
|
||||
myMod->chanregs[ichip*nch+ichan]|=ival<<11;
|
||||
break;
|
||||
default:
|
||||
std::cout<< " too many columns" << std::endl;
|
||||
printf( " too many columns \n" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -353,7 +353,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
// }
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "read " << ichan*ichip << " channels" <<std::endl;
|
||||
printf( "read %d channels \n", ichan*ichip );
|
||||
#endif
|
||||
|
||||
infile.close();
|
||||
@ -375,12 +375,12 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||
#ifdef VERBOSE
|
||||
for(int i=0;i<myMod->ndac;i++)
|
||||
std::cout << "dac " << i << ":" << myMod->dacs[i] << std::endl;
|
||||
std::cout << "iodelay:" << iodelay << std::endl;
|
||||
std::cout << "tau:" << tau << std::endl;
|
||||
printf( "dac %d:%d \n", i, myMod->dacs[i] );
|
||||
printf( "iodelay:%d \n", iodelay );
|
||||
printf( "tau:%d \n", tau );
|
||||
#endif
|
||||
if(infile.eof()){
|
||||
cout<<endl<<"Error, could not load trimbits end of file, "<<myfname<<", reached."<<endl<<endl;
|
||||
printf( "Error, could not load trimbits end of file reached: %s \n\n", myfname.c_str() );
|
||||
if (nflag)
|
||||
deleteModule(myMod);
|
||||
|
||||
@ -406,7 +406,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
getline(infile,str);
|
||||
iline++;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
printf( "str: %s \n", str.c_str() );
|
||||
#endif
|
||||
istringstream ssstr(str);
|
||||
ssstr >> sargname >> ival;
|
||||
@ -415,7 +415,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
myMod->dacs[i]=ival;
|
||||
idac++;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl;
|
||||
printf( " %s dac nr. %d is %d \n", sargname.c_str(), idac, ival );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -423,10 +423,10 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
}
|
||||
if (i < id) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl;
|
||||
printf( " %s dac nr. %d is %d \n", sargname.c_str(), idac, ival );
|
||||
#endif
|
||||
}else
|
||||
std::cout<< "Unknown dac " << sargname << std::endl;
|
||||
printf( "Unknown dac %s \n", sargname.c_str() );
|
||||
|
||||
infile.close();
|
||||
strcpy(settingsFile,fname.c_str());
|
||||
@ -439,7 +439,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cout<< "Unknown detector type - don't know how to read file" << myfname << std::endl;
|
||||
printf( "Unknown detector type - don't know how to read file %s\n", myfname.c_str());
|
||||
infile.close();
|
||||
deleteModule(myMod);
|
||||
return NULL;
|
||||
@ -517,7 +517,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
||||
names[id++]="VDAC15";
|
||||
break;
|
||||
default:
|
||||
cout << "Unknown detector type - unknown format for settings file" << endl;
|
||||
printf( "Unknown detector type - unknown format for settings file \n" );
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -532,9 +532,9 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
||||
iv = 1150;
|
||||
#ifdef VERBOSE
|
||||
for(int i=0;i<mod.ndac;i++)
|
||||
std::cout << "dac " << i << ":" << mod.dacs[i] << std::endl;
|
||||
std::cout << "iodelay: " << iodelay << std::endl;
|
||||
std::cout << "tau: " << tau << std::endl;
|
||||
printf( "dac %d:%d \n", i, mod.dacs[i] );
|
||||
printf( "iodelay: %d \n", iodelay );
|
||||
printf( "tau: %d", tau);
|
||||
#endif
|
||||
outfile.write((char*)mod.dacs, sizeof(dacs_t)*(mod.ndac));
|
||||
outfile.write((char*)iodelay, sizeof(iodelay));
|
||||
@ -587,7 +587,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
||||
outfile.close();
|
||||
return OK;
|
||||
}
|
||||
std::cout<< "could not open SETTINGS file " << fname << std::endl;
|
||||
printf( "could not open SETTINGS file %s \n", fname.c_str() );
|
||||
return FAIL;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
mp=mp1;
|
||||
pthread_mutex_init(&mp, NULL);
|
||||
@ -422,10 +422,9 @@ void* postProcessing::processData(int delflag) {
|
||||
|
||||
|
||||
int *myData;
|
||||
char *p;
|
||||
int dum=1;
|
||||
int nf=1, ii, nch;
|
||||
int jctb=0;
|
||||
// int nf=1, ii, nch;
|
||||
// int jctb=0;
|
||||
|
||||
|
||||
// if (getDetectorsType()==JUNGFRAUCTB) {
|
||||
@ -456,7 +455,7 @@ void* postProcessing::processData(int delflag) {
|
||||
|
||||
|
||||
// if (jctb) {
|
||||
// p=(char*)myData;
|
||||
// char* p=(char*)myData;
|
||||
// for (ii=0; ii<nf; ii++) {
|
||||
// processFrame((int*)p,delflag, 1);
|
||||
// p+=2*nch;
|
||||
|
@ -24,8 +24,8 @@ public:
|
||||
~func00_t() {}
|
||||
void operator()() const {((m_ptr->*m_fn)());}
|
||||
private:
|
||||
_Class* m_ptr;
|
||||
_Ret (_Class::*m_fn)();
|
||||
_Class* m_ptr;
|
||||
};
|
||||
|
||||
template<typename _Ret, typename _Class, typename _Store>
|
||||
@ -36,8 +36,8 @@ public:
|
||||
~func0_t() {}
|
||||
void operator()() const {*m_store = ((m_ptr->*m_fn)());}
|
||||
private:
|
||||
_Class* m_ptr;
|
||||
_Ret (_Class::*m_fn)();
|
||||
_Class* m_ptr;
|
||||
_Store* m_store;
|
||||
};
|
||||
|
||||
@ -49,8 +49,8 @@ public:
|
||||
~func1_t() {}
|
||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1));}
|
||||
private:
|
||||
_Class* m_ptr;
|
||||
_Ret (_Class::*m_fn)(_Arg1);
|
||||
_Class* m_ptr;
|
||||
_Arg1 m_arg1;
|
||||
_Store* m_store;
|
||||
};
|
||||
@ -63,8 +63,8 @@ public:
|
||||
~func2_t() {}
|
||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2));}
|
||||
private:
|
||||
_Class* m_ptr;
|
||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2);
|
||||
_Class* m_ptr;
|
||||
_Arg1 m_arg1;
|
||||
_Arg2 m_arg2;
|
||||
_Store* m_store;
|
||||
@ -78,8 +78,8 @@ public:
|
||||
~func3_t() {}
|
||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3));}
|
||||
private:
|
||||
_Class* m_ptr;
|
||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3);
|
||||
_Class* m_ptr;
|
||||
_Arg1 m_arg1;
|
||||
_Arg2 m_arg2;
|
||||
_Arg3 m_arg3;
|
||||
@ -94,8 +94,8 @@ public:
|
||||
~func4_t() {}
|
||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3,m_arg4));}
|
||||
private:
|
||||
_Class* m_ptr;
|
||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3,_Arg4);
|
||||
_Class* m_ptr;
|
||||
_Arg1 m_arg1;
|
||||
_Arg2 m_arg2;
|
||||
_Arg3 m_arg3;
|
||||
|
@ -85,7 +85,8 @@ int ThreadPool::destroy_threadpool(){
|
||||
}
|
||||
|
||||
void* ThreadPool::execute_thread(){
|
||||
int ithread = current_thread_number;
|
||||
//for debugging seting ithread value
|
||||
// int ithread = current_thread_number;
|
||||
thread_started = true;
|
||||
Task* task = NULL;
|
||||
m_tasks_loaded = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user