mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
9833a7d330 | |||
e658cbacda | |||
4142328437 | |||
6c797988c7 | |||
215c262981 | |||
9468b9ca1e | |||
d7982e178e | |||
9cf5714a5b | |||
0c9ac8911a | |||
4730c8c0a9 | |||
43efb8acfd | |||
6ecca8fcb0 | |||
17cb63a57f | |||
4f83fcb001 | |||
ab94af6d29 | |||
7c725cc69b | |||
f0198d2d2e | |||
5ddccbdee4 | |||
8fb39b8c7e | |||
bd5293f4b1 | |||
b91180f5b2 | |||
7c3b5065a5 | |||
9aef802bea | |||
f7d85231f2 | |||
5b3a911e8d | |||
65f5e1c1ab |
@ -5,17 +5,17 @@
|
|||||||
CC = g++
|
CC = g++
|
||||||
CXX = $(CC)
|
CXX = $(CC)
|
||||||
ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
|
ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
|
||||||
LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread
|
LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
|
||||||
LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread
|
LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
|
||||||
FLAGS= -Wall #-DEIGER_DEBUG2 -DEIGER_DEBUG -DEIGER_DEBUG3 #-DFIFO_DEBUG
|
FLAGS= -Wall -pthread #-DEIGER_DEBUG2 -DEIGER_DEBUG -DEIGER_DEBUG3 #-DFIFO_DEBUG
|
||||||
# -DVERBOSE
|
# -DVERBOSE
|
||||||
|
|
||||||
# Setting up the verbose flags
|
# Setting up the verbose flags
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
FLAGS = -Wall -DVERBOSE
|
FLAGS = -Wall -pthread -DVERBOSE
|
||||||
endif
|
endif
|
||||||
ifeq ($(DEBUG),2)
|
ifeq ($(DEBUG),2)
|
||||||
FLAGS = -Wall -DVERYVERBOSE
|
FLAGS = -Wall -pthread -DVERYVERBOSE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
@ -2,8 +2,8 @@ INCLUDES = -I .
|
|||||||
SRC_DET = mainClient.cpp
|
SRC_DET = mainClient.cpp
|
||||||
SRC_REC = mainReceiver.cpp
|
SRC_REC = mainReceiver.cpp
|
||||||
LIBDIR = ../../bin
|
LIBDIR = ../../bin
|
||||||
LDFLAG_DET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread
|
LDFLAG_DET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
|
||||||
LDFLAG_REC = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread
|
LDFLAG_REC = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
|
||||||
DESTDIR ?= ../docs
|
DESTDIR ?= ../docs
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
This file is an example of how to implement the slsDetectorUsers class
|
This file is an example of how to implement the slsDetectorUsers class
|
||||||
You can compile it linking it to the slsDetector library
|
You can compile it linking it to the slsDetector library
|
||||||
|
|
||||||
gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread
|
gcc mainClient.cpp -L lib -l SlsDetector -lm -pthread
|
||||||
|
|
||||||
where lib is the location of libSlsDetector.so
|
where lib is the location of libSlsDetector.so
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
This file is an example of how to implement the slsDetectorUsers class
|
This file is an example of how to implement the slsDetectorUsers class
|
||||||
You can compile it linking it to the slsDetector library
|
You can compile it linking it to the slsDetector library
|
||||||
|
|
||||||
gcc mainReceiver.cpp -L lib -l SlsDetector -lm -lpthread
|
gcc mainReceiver.cpp -L lib -l SlsDetector -lm -pthread
|
||||||
|
|
||||||
where lib is the location of libSlsDetector.so
|
where lib is the location of libSlsDetector.so
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CC = g++
|
CC = g++
|
||||||
CLAGS += -DVERBOSE #VERYBOSE
|
CLAGS += -DVERBOSE #VERYBOSE
|
||||||
LDLIBS += -lm -lstdc++ -lpthread
|
LDLIBS += -lm -lstdc++ -pthread
|
||||||
|
|
||||||
LDIR = ../../slsDetectorSoftware
|
LDIR = ../../slsDetectorSoftware
|
||||||
RDIR = ../../slsReceiverSoftware
|
RDIR = ../../slsReceiverSoftware
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorGui
|
Path: slsDetectorsPackage/slsDetectorGui
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
|
||||||
Repsitory UUID: c43f58653a9b90aade45b9649810ff11225ca844
|
Repsitory UUID: bddd126e382c1b2e8082419ff393f6e1fb17526a
|
||||||
Revision: 379
|
Revision: 381
|
||||||
Branch: 2.3-rc
|
Branch: 2.3.1
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 379
|
Last Changed Rev: 381
|
||||||
Last Changed Date: 2016-12-16 14:46:02 +0100
|
Last Changed Date: 2017-04-07 14:25:09 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "c43f58653a9b90aade45b9649810ff11225ca844"
|
#define SVNREPUUID "bddd126e382c1b2e8082419ff393f6e1fb17526a"
|
||||||
//#define SVNREV 0x379
|
//#define SVNREV 0x381
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x379
|
#define SVNREV 0x381
|
||||||
#define SVNDATE 0x20161216
|
#define SVNDATE 0x20170407
|
||||||
//
|
//
|
||||||
|
@ -69,14 +69,14 @@ gotthardVirtualServer: $(SRC_MYTHEN_SVC)
|
|||||||
|
|
||||||
|
|
||||||
%.o : %.cpp %.h Makefile
|
%.o : %.cpp %.h Makefile
|
||||||
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread -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
|
||||||
|
|
||||||
|
|
||||||
$(DESTDIR)/libSlsDetector.so: $(OBJS)
|
$(DESTDIR)/libSlsDetector.so: $(OBJS)
|
||||||
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread -lrt $(LIBZMQ)
|
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread -lrt $(LIBZMQ)
|
||||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||||
mv libSlsDetector.so $(DESTDIR)
|
mv libSlsDetector.so $(DESTDIR)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 3618c87c5cd000fff7799ddd8cd07a4162d9fdec
|
Repsitory UUID: 7a0a1ee8734440dc4e1e638d6fec1eaa9d2404ae
|
||||||
Revision: 1340
|
Revision: 1348
|
||||||
Branch: 2.3
|
Branch: 2.3.1
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1340
|
Last Changed Rev: 1348
|
||||||
Last Changed Date: 2017-03-23 13:46:02 +0100
|
Last Changed Date: 2017-04-11 13:39:28 +0200
|
||||||
|
@ -1173,11 +1173,11 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
|
|||||||
if (ret==-100)
|
if (ret==-100)
|
||||||
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1191,7 +1191,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) {
|
||||||
@ -1225,10 +1225,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1273,10 +1273,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1436,7 +1436,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){
|
||||||
@ -1455,7 +1455,6 @@ int* multiSlsDetector::getDataFromDetector() {
|
|||||||
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
|
||||||
@ -1662,10 +1661,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2105,7 +2104,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];
|
||||||
@ -2120,7 +2118,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)
|
||||||
@ -2332,7 +2329,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);
|
||||||
@ -2604,7 +2601,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3334,8 +3331,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);
|
||||||
@ -3356,6 +3351,7 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
|||||||
//doing nothing with the return values
|
//doing nothing with the return values
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
delete sret[idet];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4000,10 +3996,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4098,10 +4094,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4175,10 +4171,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4223,10 +4219,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4511,9 +4507,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()) {
|
||||||
@ -4526,7 +4520,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);
|
||||||
@ -4544,6 +4538,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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4555,7 +4550,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;
|
||||||
@ -4882,10 +4877,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4944,10 +4939,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5186,19 +5181,19 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
|||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
// htype is an array of strings
|
// htype is an array of strings
|
||||||
rapidjson::Value::Array htype = d["htype"].GetArray();
|
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;
|
std::cout << isocket << "htype: " << htype[i].GetString() << std::endl;
|
||||||
// shape is an array of ints
|
// shape is an array of ints
|
||||||
rapidjson::Value::Array shape = d["shape"].GetArray();
|
rapidjson::Value::Array shape = d["shape"].GetArray();
|
||||||
cout << isocket << "shape: ";
|
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 << isocket << shape[i].GetInt() << " ";
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
cout << isocket << "type: " << d["type"].GetString() << endl;
|
cout << isocket << "type: " << d["type"].GetString() << endl;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
if(d["acqIndex"].GetUint64()!=-1){ //!isocket &&
|
if(d["acqIndex"].GetUint64()!= (long long unsigned int)-1){ //!isocket &&
|
||||||
acqIndex = d["acqIndex"].GetUint64();
|
acqIndex = d["acqIndex"].GetUint64();
|
||||||
frameIndex = d["fIndex"].GetUint64();
|
frameIndex = d["fIndex"].GetUint64();
|
||||||
subframeIndex = -1;
|
subframeIndex = -1;
|
||||||
@ -5212,7 +5207,7 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
|||||||
cout << "Subframe index: " << subframeIndex << endl;
|
cout << "Subframe index: " << subframeIndex << endl;
|
||||||
cout << "File name: " << filename << endl;
|
cout << "File name: " << filename << endl;
|
||||||
#endif
|
#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
|
// close the message
|
||||||
zmq_msg_close(&message);
|
zmq_msg_close(&message);
|
||||||
@ -5243,7 +5238,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);
|
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);
|
image[i] = (image[i] & 0x3FFF3FFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5571,7 +5566,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
|
||||||
@ -5804,10 +5799,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;
|
||||||
}
|
}
|
||||||
@ -5918,10 +5913,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5955,10 +5950,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5992,10 +5987,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
/** flag for acquiring */
|
/** flag for acquiring */
|
||||||
bool acquiringFlag;
|
bool acquiringFlag;
|
||||||
|
|
||||||
};
|
}sharedMultiSlsDetector;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "3618c87c5cd000fff7799ddd8cd07a4162d9fdec"
|
#define SVNREPUUIDLIB "7a0a1ee8734440dc4e1e638d6fec1eaa9d2404ae"
|
||||||
//#define SVNREV 0x1340
|
//#define SVNREV 0x1348
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||||
#define SVNREVLIB 0x1340
|
#define SVNREVLIB 0x1348
|
||||||
#define SVNDATELIB 0x20170323
|
#define SVNDATELIB 0x20170411
|
||||||
//
|
//
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -511,7 +511,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());
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
|
||||||
slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||||
|
|
||||||
myDet=det;
|
myDet=det;
|
||||||
@ -3426,7 +3427,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", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3436,37 +3441,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", 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", 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", 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", 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", 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", retval);
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
return string("unknown id mode ")+cmd;
|
return string("unknown id mode ")+cmd;
|
||||||
@ -4491,7 +4520,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)
|
||||||
@ -4870,7 +4899,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]);
|
||||||
@ -4886,7 +4915,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]);
|
||||||
@ -4903,7 +4932,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]);
|
||||||
@ -5174,7 +5203,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]);
|
||||||
@ -5197,7 +5226,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]);
|
||||||
@ -5215,7 +5244,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]);
|
||||||
@ -5334,13 +5363,11 @@ 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");
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -798,7 +798,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";
|
||||||
@ -878,6 +877,8 @@ 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";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -908,6 +909,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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +919,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
|
||||||
|
@ -17,20 +17,20 @@ int energyConversion::readCalibrationFile(string fname, double &gain, double &of
|
|||||||
string str;
|
string str;
|
||||||
ifstream infile;
|
ifstream infile;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Opening file "<< fname << std::endl;
|
printf( "Opening file %s \n", fname.c_str() );
|
||||||
#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()) {
|
||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< str << std::endl;
|
printf( "%s \n", str.c_str() );
|
||||||
#endif
|
#endif
|
||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
ssstr >> offset >> gain;
|
ssstr >> offset >> gain;
|
||||||
infile.close();
|
infile.close();
|
||||||
cout << "Calibration file loaded: " << fname << endl;
|
printf( "Calibration file loaded: %s \n", fname.c_str() );
|
||||||
} else {
|
} else {
|
||||||
std::cout<< "Could not open calibration file "<< fname << std::endl;
|
printf( "Could not open calibration file %s \n", fname.c_str() );
|
||||||
gain=0.;
|
gain=0.;
|
||||||
offset=0.;
|
offset=0.;
|
||||||
#ifndef MYROOT
|
#ifndef MYROOT
|
||||||
@ -45,7 +45,7 @@ int energyConversion::readCalibrationFile(string fname, double &gain, double &of
|
|||||||
};
|
};
|
||||||
|
|
||||||
int energyConversion::writeCalibrationFile(string fname, double gain, double offset){
|
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;
|
ofstream outfile;
|
||||||
outfile.open (fname.c_str());
|
outfile.open (fname.c_str());
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ int energyConversion::writeCalibrationFile(string fname, double gain, double off
|
|||||||
if (outfile.is_open()) {
|
if (outfile.is_open()) {
|
||||||
outfile << offset << " " << gain << std::endl;
|
outfile << offset << " " << gain << std::endl;
|
||||||
} else {
|
} 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
|
#ifndef MYROOT
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#endif
|
#endif
|
||||||
@ -76,7 +76,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
|||||||
double o,g;
|
double o,g;
|
||||||
int ig=0;
|
int ig=0;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Opening file "<< fname << std::endl;
|
printf( "Opening file %s \n", fname.c_str() );
|
||||||
#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()) {
|
||||||
@ -85,7 +85,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
|||||||
//while ( (getline(infile,str)) > -1) {
|
//while ( (getline(infile,str)) > -1) {
|
||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< str << std::endl;
|
printf( "%s \n", str.c_str() );
|
||||||
#endif
|
#endif
|
||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
ssstr >> o >> g;
|
ssstr >> o >> g;
|
||||||
@ -96,9 +96,9 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
infile.close();
|
infile.close();
|
||||||
cout << "Calibration file loaded: " << fname << endl;
|
printf( "Calibration file loaded: %s \n", fname.c_str() );
|
||||||
} else {
|
} else {
|
||||||
cout << "Could not open calibration file: "<< fname << std::endl;
|
printf( "Could not open calibration file: %s \n", fname.c_str() );
|
||||||
gain[0]=0;
|
gain[0]=0;
|
||||||
offset[0]=0;
|
offset[0]=0;
|
||||||
#ifndef MYROOT
|
#ifndef MYROOT
|
||||||
@ -114,7 +114,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
|
|||||||
};
|
};
|
||||||
|
|
||||||
int energyConversion::writeCalibrationFile(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;
|
ofstream outfile;
|
||||||
outfile.open (fname.c_str());
|
outfile.open (fname.c_str());
|
||||||
// >> i/o operations here <<
|
// >> i/o operations here <<
|
||||||
@ -122,7 +122,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset)
|
|||||||
for (int ig=0; ig<4; ig++)
|
for (int ig=0; ig<4; ig++)
|
||||||
outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl;
|
outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl;
|
||||||
} else {
|
} 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
|
#ifndef MYROOT
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#endif
|
#endif
|
||||||
@ -251,16 +251,16 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
names[id++]="VDAC15";
|
names[id++]="VDAC15";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cout << "Unknown detector type - unknown format for settings file" << endl;
|
printf( "Unknown detector type - unknown format for settings file \n" );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#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
|
#endif
|
||||||
myfname=fname;
|
myfname=fname;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "file name is "<< myfname << std::endl;
|
printf( "file name is %s \n", myfname.c_str() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (myDetectorType) {
|
switch (myDetectorType) {
|
||||||
@ -274,7 +274,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
ssstr >> sargname >> ival;
|
ssstr >> sargname >> ival;
|
||||||
#ifdef VERBOSE
|
#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
|
#endif
|
||||||
myMod->dacs[idac]=ival;
|
myMod->dacs[idac]=ival;
|
||||||
idac++;
|
idac++;
|
||||||
@ -283,24 +283,24 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
iline++;
|
iline++;
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
std::cout<< str << std::endl;
|
printf( "%s \n", str.c_str() );
|
||||||
#endif
|
#endif
|
||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
ssstr >> sargname >> ival;
|
ssstr >> sargname >> ival;
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
std::cout<< "chip " << ichip << " " << sargname << " is " << ival << std::endl;
|
printf( "chip %d %s is %d \n", ichip, sargname.c_str(), ival );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myMod->chipregs[ichip]=ival;
|
myMod->chipregs[ichip]=ival;
|
||||||
for (ichan=0; ichan<nch; ichan++) {
|
for (ichan=0; ichan<nch; ichan++) {
|
||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
std::cout<< str << std::endl;
|
printf( " %s \n", str.c_str() );
|
||||||
#endif
|
#endif
|
||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
|
|
||||||
#ifdef VERYVERBOSE
|
#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
|
#endif
|
||||||
iline++;
|
iline++;
|
||||||
myMod->chanregs[ichip*nch+ichan]=0;
|
myMod->chanregs[ichip*nch+ichan]=0;
|
||||||
@ -310,42 +310,42 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
switch (iarg) {
|
switch (iarg) {
|
||||||
case 0:
|
case 0:
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
std::cout<< "trimbits " << ival ;
|
printf( "trimbits %d", ival );
|
||||||
#endif
|
#endif
|
||||||
myMod->chanregs[ichip*nch+ichan]|=ival&TRIMBITMASK;
|
myMod->chanregs[ichip*nch+ichan]|=ival&TRIMBITMASK;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
std::cout<< " compen " << ival ;
|
printf( " compen %d", ival );
|
||||||
#endif
|
#endif
|
||||||
myMod->chanregs[ichip*nch+ichan]|=ival<<9;
|
myMod->chanregs[ichip*nch+ichan]|=ival<<9;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
std::cout<< " anen " << ival ;
|
printf( " anen %d", ival );
|
||||||
#endif
|
#endif
|
||||||
myMod->chanregs[ichip*nch+ichan]|=ival<<8;
|
myMod->chanregs[ichip*nch+ichan]|=ival<<8;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
std::cout<< " calen " << ival ;
|
printf( " calen %d", ival ) ;
|
||||||
#endif
|
#endif
|
||||||
myMod->chanregs[ichip*nch+ichan]|=ival<<7;
|
myMod->chanregs[ichip*nch+ichan]|=ival<<7;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< " outcomp " << ival ;
|
printf( " outcomp %d", ival ) ;
|
||||||
#endif
|
#endif
|
||||||
myMod->chanregs[ichip*nch+ichan]|=ival<<10;
|
myMod->chanregs[ichip*nch+ichan]|=ival<<10;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< " counts " << ival << std::endl;
|
printf( " counts %d \n", ival );
|
||||||
#endif
|
#endif
|
||||||
myMod->chanregs[ichip*nch+ichan]|=ival<<11;
|
myMod->chanregs[ichip*nch+ichan]|=ival<<11;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cout<< " too many columns" << std::endl;
|
printf( " too many columns \n" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "read " << ichan*ichip << " channels" <<std::endl;
|
printf( "read %d channels \n", ichan*ichip );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
infile.close();
|
infile.close();
|
||||||
@ -375,12 +375,12 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
for(int i=0;i<myMod->ndac;i++)
|
for(int i=0;i<myMod->ndac;i++)
|
||||||
std::cout << "dac " << i << ":" << myMod->dacs[i] << std::endl;
|
printf( "dac %d:%d \n", i, myMod->dacs[i] );
|
||||||
std::cout << "iodelay:" << iodelay << std::endl;
|
printf( "iodelay:%d \n", iodelay );
|
||||||
std::cout << "tau:" << tau << std::endl;
|
printf( "tau:%d \n", tau );
|
||||||
#endif
|
#endif
|
||||||
if(infile.eof()){
|
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)
|
if (nflag)
|
||||||
deleteModule(myMod);
|
deleteModule(myMod);
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
iline++;
|
iline++;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< str << std::endl;
|
printf( "str: %s \n", str.c_str() );
|
||||||
#endif
|
#endif
|
||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
ssstr >> sargname >> ival;
|
ssstr >> sargname >> ival;
|
||||||
@ -415,7 +415,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
myMod->dacs[i]=ival;
|
myMod->dacs[i]=ival;
|
||||||
idac++;
|
idac++;
|
||||||
#ifdef VERBOSE
|
#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
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -423,10 +423,10 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
}
|
}
|
||||||
if (i < id) {
|
if (i < id) {
|
||||||
#ifdef VERBOSE
|
#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
|
#endif
|
||||||
}else
|
}else
|
||||||
std::cout<< "Unknown dac " << sargname << std::endl;
|
printf( "Unknown dac %s \n", sargname.c_str() );
|
||||||
|
|
||||||
infile.close();
|
infile.close();
|
||||||
strcpy(settingsFile,fname.c_str());
|
strcpy(settingsFile,fname.c_str());
|
||||||
@ -439,7 +439,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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();
|
infile.close();
|
||||||
deleteModule(myMod);
|
deleteModule(myMod);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
|||||||
names[id++]="VDAC15";
|
names[id++]="VDAC15";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cout << "Unknown detector type - unknown format for settings file" << endl;
|
printf( "Unknown detector type - unknown format for settings file \n" );
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,13 +532,13 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
|||||||
iv = 1150;
|
iv = 1150;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
for(int i=0;i<mod.ndac;i++)
|
for(int i=0;i<mod.ndac;i++)
|
||||||
std::cout << "dac " << i << ":" << mod.dacs[i] << std::endl;
|
printf( "dac %d:%d \n", i, mod.dacs[i] );
|
||||||
std::cout << "iodelay: " << iodelay << std::endl;
|
printf( "iodelay: %d \n", iodelay );
|
||||||
std::cout << "tau: " << tau << std::endl;
|
printf( "tau: %d", tau);
|
||||||
#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();
|
||||||
@ -587,7 +587,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
|||||||
outfile.close();
|
outfile.close();
|
||||||
return OK;
|
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;
|
return FAIL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
@ -422,10 +422,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) {
|
||||||
@ -456,7 +455,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;
|
||||||
@ -880,10 +879,14 @@ 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
|
||||||
ret = pthread_setschedparam(dataProcessingThread, policy, ¶m);
|
ret = pthread_setschedparam(dataProcessingThread, policy, ¶m);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ INCLUDES?= -I../commonFiles -I../slsDetector -I ../MySocketTCP -I../usersFuncti
|
|||||||
LIBDIR?=../
|
LIBDIR?=../
|
||||||
LIBS?= -L$(LIBDIR) -lSlsDetector
|
LIBS?= -L$(LIBDIR) -lSlsDetector
|
||||||
|
|
||||||
LDFLAG= -L/usr/lib64/ -lpthread
|
LDFLAG= -L/usr/lib64/ -pthread
|
||||||
|
|
||||||
|
|
||||||
DESTDIR ?= bin
|
DESTDIR ?= bin
|
||||||
|
@ -2,7 +2,7 @@ CFLAGS= -DC_ONLY
|
|||||||
FLAGS=-DVERBOSE
|
FLAGS=-DVERBOSE
|
||||||
INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector -I../slsDetectorSoftware/slsDetectorAnalysis
|
INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector -I../slsDetectorSoftware/slsDetectorAnalysis
|
||||||
LIBS= -L../slsDetectorSoftware/
|
LIBS= -L../slsDetectorSoftware/
|
||||||
LDFLAG= -lSlsDetector -lpthread
|
LDFLAG= -lSlsDetector -pthread
|
||||||
|
|
||||||
EPICSFLAGS=-DEPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom
|
EPICSFLAGS=-DEPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom
|
||||||
|
|
||||||
|
@ -2,20 +2,20 @@ OBJPATH=bin/obj
|
|||||||
EXAMPLEPATH=bin/example
|
EXAMPLEPATH=bin/example
|
||||||
|
|
||||||
all:
|
all:
|
||||||
g++ CondVar.cpp -lpthread -c -g -o $(OBJPATH)/CondVar.o
|
g++ CondVar.cpp -pthread -c -g -o $(OBJPATH)/CondVar.o
|
||||||
g++ Mutex.cpp -lpthread -c -g -o $(OBJPATH)/Mutex.o
|
g++ Mutex.cpp -pthread -c -g -o $(OBJPATH)/Mutex.o
|
||||||
#g++ Task.cpp -lpthread -c -g -o $(OBJPATH)/Task.o
|
#g++ Task.cpp -pthread -c -g -o $(OBJPATH)/Task.o
|
||||||
g++ ThreadPool.cpp -lpthread -c -g -o $(OBJPATH)/ThreadPool.o
|
g++ ThreadPool.cpp -pthread -c -g -o $(OBJPATH)/ThreadPool.o
|
||||||
g++ Multi.cpp -lpthread -c -g -o $(OBJPATH)/Multi.o
|
g++ Multi.cpp -pthread -c -g -o $(OBJPATH)/Multi.o
|
||||||
#g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/Task.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -lpthread -I . -g -o $(EXAMPLEPATH)threadpool_test
|
#g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/Task.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -pthread -I . -g -o $(EXAMPLEPATH)threadpool_test
|
||||||
g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -lpthread -I . -g -o $(EXAMPLEPATH)threadpool_test
|
g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -pthread -I . -g -o $(EXAMPLEPATH)threadpool_test
|
||||||
|
|
||||||
#all:
|
#all:
|
||||||
# g++ threadpool.cpp -lpthread -fpic -c -o bin/obj/threadpool.o
|
# g++ threadpool.cpp -pthread -fpic -c -o bin/obj/threadpool.o
|
||||||
# g++ -L./bin bin/obj/threadpool.o -lpthread threadpool_test.cpp -o bin/example/threadpool_test
|
# g++ -L./bin bin/obj/threadpool.o -pthread threadpool_test.cpp -o bin/example/threadpool_test
|
||||||
|
|
||||||
#threadpool:
|
#threadpool:
|
||||||
# g++ threadpool.cpp -lpthread -fpic -c -o bin/obj/threadpool.o
|
# g++ threadpool.cpp -pthread -fpic -c -o bin/obj/threadpool.o
|
||||||
# g++ -shared -fPIC bin/obj/threadpool.o -o bin/lib/libthreadpool.so
|
# g++ -shared -fPIC bin/obj/threadpool.o -o bin/lib/libthreadpool.so
|
||||||
#example:
|
#example:
|
||||||
# g++ -L./bin/lib -lthreadpool threadpool_test.cpp -o threadpool_test
|
# g++ -L./bin/lib -lthreadpool threadpool_test.cpp -o threadpool_test
|
||||||
|
@ -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;
|
||||||
|
@ -54,7 +54,7 @@ $(BUILDDIR)/%.o : $(SRCDIR)/%.cpp Makefile
|
|||||||
ifeq ($(ROOTSLS),yes)
|
ifeq ($(ROOTSLS),yes)
|
||||||
$(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -L/usr/lib64/ $(FLAGS)
|
$(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -L/usr/lib64/ $(FLAGS)
|
||||||
else
|
else
|
||||||
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -lpthread $(FLAGS) $(LIBZMQ) -lrt
|
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -pthread $(FLAGS) $(LIBZMQ) -lrt
|
||||||
endif
|
endif
|
||||||
|
|
||||||
lib: $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
|
lib: $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
|
||||||
@ -63,7 +63,7 @@ receiver: $(DESTDIR)/slsReceiver
|
|||||||
|
|
||||||
|
|
||||||
$(DESTDIR)/libSlsReceiver.so: $(OBJS)
|
$(DESTDIR)/libSlsReceiver.so: $(OBJS)
|
||||||
$(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread $(LIBZMQ) -lrt
|
$(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread $(LIBZMQ) -lrt
|
||||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||||
mv libSlsReceiver.so $(DESTDIR)
|
mv libSlsReceiver.so $(DESTDIR)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||||
Repsitory UUID: a453c1d55d73fecc18af9df6ada21621a989ee4b
|
Repsitory UUID: db080a125daed36a1fa85b00df7a239e22ae5130
|
||||||
Revision: 514
|
Revision: 521
|
||||||
Branch: 2.3
|
Branch: 2.3.1
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 514
|
Last Changed Rev: 521
|
||||||
Last Changed Date: 2017-03-24 13:41:56 +0100
|
Last Changed Date: 2017-04-11 13:39:35 +0200
|
||||||
|
@ -739,7 +739,7 @@ private:
|
|||||||
|
|
||||||
//***data call back thread parameters***
|
//***data call back thread parameters***
|
||||||
/** Ensures if zmq threads created successfully */
|
/** Ensures if zmq threads created successfully */
|
||||||
bool zmqThreadStarted;
|
volatile bool zmqThreadStarted;
|
||||||
|
|
||||||
/** Number of data callback Threads */
|
/** Number of data callback Threads */
|
||||||
int numberofDataCallbackThreads;
|
int numberofDataCallbackThreads;
|
||||||
@ -760,7 +760,7 @@ private:
|
|||||||
|
|
||||||
//***general and listening thread parameters***
|
//***general and listening thread parameters***
|
||||||
/** Ensures if threads created successfully */
|
/** Ensures if threads created successfully */
|
||||||
bool threadStarted;
|
volatile bool threadStarted;
|
||||||
|
|
||||||
/** Current Thread Index*/
|
/** Current Thread Index*/
|
||||||
int currentThreadIndex;
|
int currentThreadIndex;
|
||||||
|
@ -134,7 +134,7 @@ bool CircularFifo<Element>::isEmpty() const
|
|||||||
template<typename Element>
|
template<typename Element>
|
||||||
bool CircularFifo<Element>::isFull() const
|
bool CircularFifo<Element>::isFull() const
|
||||||
{
|
{
|
||||||
int tailCheck = (tail+1) % Capacity;
|
int tailCheck = increment(tail);
|
||||||
return (tailCheck == head);
|
return (tailCheck == head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "a453c1d55d73fecc18af9df6ada21621a989ee4b"
|
#define SVNREPUUID "db080a125daed36a1fa85b00df7a239e22ae5130"
|
||||||
//#define SVNREV 0x514
|
//#define SVNREV 0x521
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x514
|
#define SVNREV 0x521
|
||||||
#define SVNDATE 0x20170324
|
#define SVNDATE 0x20170411
|
||||||
//
|
//
|
||||||
|
@ -7,16 +7,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ansi.h>
|
#include <ansi.h>
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
#define FILELOG_MAX_LEVEL logDEBUG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VERYVERBOSE
|
|
||||||
#define FILELOG_MAX_LEVEL logDEBUG4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FIFODEBUG
|
#ifdef FIFODEBUG
|
||||||
#define FILELOG_MAX_LEVEL logDEBUG5
|
#define FILELOG_MAX_LEVEL logDEBUG5
|
||||||
|
#elif VERYVERBOSE
|
||||||
|
#define FILELOG_MAX_LEVEL logDEBUG4
|
||||||
|
#elif VERBOSE
|
||||||
|
#define FILELOG_MAX_LEVEL logDEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FILELOG_MAX_LEVEL
|
#ifndef FILELOG_MAX_LEVEL
|
||||||
@ -126,14 +123,18 @@ inline std::string NowTime()
|
|||||||
inline std::string NowTime()
|
inline std::string NowTime()
|
||||||
{
|
{
|
||||||
char buffer[11];
|
char buffer[11];
|
||||||
|
const int buffer_len = sizeof(buffer);
|
||||||
time_t t;
|
time_t t;
|
||||||
time(&t);
|
time(&t);
|
||||||
tm r = {0};
|
tm r = {0};
|
||||||
strftime(buffer, sizeof(buffer), "%X", localtime_r(&t, &r));
|
strftime(buffer, buffer_len, "%X", localtime_r(&t, &r));
|
||||||
|
buffer[buffer_len - 1] = 0;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, 0);
|
gettimeofday(&tv, 0);
|
||||||
char result[100] = {0};
|
char result[100];
|
||||||
sprintf(result, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
|
const int result_len = sizeof(result);
|
||||||
|
snprintf(result, result_len, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
|
||||||
|
result[result_len - 1] = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +148,8 @@ template <typename T> std::ostringstream& Log<T>::Get(TLogLevel level)
|
|||||||
lev = level;
|
lev = level;
|
||||||
os << "- " << NowTime();
|
os << "- " << NowTime();
|
||||||
os << " " << ToString(level) << ": ";
|
os << " " << ToString(level) << ": ";
|
||||||
os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t');
|
if (level > logDEBUG)
|
||||||
|
os << std::string(level - logDEBUG, '\t');
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,14 +221,15 @@ inline void Output2FILE::Output(const std::string& msg, TLogLevel level)
|
|||||||
FILE* pStream = Stream();
|
FILE* pStream = Stream();
|
||||||
if (!pStream)
|
if (!pStream)
|
||||||
return;
|
return;
|
||||||
|
bool out = true;
|
||||||
switch(level){
|
switch(level){
|
||||||
case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break;
|
case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break;
|
||||||
case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break;
|
case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break;
|
||||||
case logINFO: cprintf(GRAY,"%s",msg.c_str());break;
|
case logINFO: cprintf(GRAY,"%s",msg.c_str());break;
|
||||||
// case logINFO: cprintf(DARKGRAY BOLD,"%s",msg.c_str());break;
|
// case logINFO: cprintf(DARKGRAY BOLD,"%s",msg.c_str());break;
|
||||||
default: fprintf(pStream,"%s",msg.c_str()); break;
|
default: fprintf(pStream,"%s",msg.c_str()); out = false; break;
|
||||||
}
|
}
|
||||||
fflush(pStream);
|
fflush(out ? stdout : pStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <zmq.h> //zmq
|
#include <zmq.h> //zmq
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <inttypes.h> //printf of uint64_t etc
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -1531,11 +1532,12 @@ int UDPStandardImplementation::setupWriter(){
|
|||||||
tempname=tempname.substr(0,uscore);
|
tempname=tempname.substr(0,uscore);
|
||||||
startAcquisitionCallBack(filePath, (char*)tempname.c_str(),fileIndex, (uint32_t)bufferSize,pStartAcquisition);
|
startAcquisitionCallBack(filePath, (char*)tempname.c_str(),fileIndex, (uint32_t)bufferSize,pStartAcquisition);
|
||||||
}
|
}
|
||||||
if (rawDataReadyCallBack)
|
if (rawDataReadyCallBack) {
|
||||||
FILE_LOG(logINFO) << "Data Write has been defined externally";
|
FILE_LOG(logINFO) << "Data Write has been defined externally";
|
||||||
if (!fileWriteEnable)
|
}
|
||||||
|
if (!fileWriteEnable) {
|
||||||
FILE_LOG(logINFO) << "Data will not be saved";
|
FILE_LOG(logINFO) << "Data will not be saved";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//creating first file
|
//creating first file
|
||||||
@ -1808,7 +1810,6 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
char buf[1000];
|
char buf[1000];
|
||||||
uint64_t acquisitionIndex = -1;
|
uint64_t acquisitionIndex = -1;
|
||||||
uint64_t frameIndex = -1;
|
uint64_t frameIndex = -1;
|
||||||
uint32_t subframeIndex = -1;
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int oldpnum = -1;
|
int oldpnum = -1;
|
||||||
#endif
|
#endif
|
||||||
@ -1832,7 +1833,6 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
//update frame details
|
//update frame details
|
||||||
frameIndex = fnum;
|
frameIndex = fnum;
|
||||||
acquisitionIndex = fnum - startAcquisitionIndex;
|
acquisitionIndex = fnum - startAcquisitionIndex;
|
||||||
if(dynamicRange == 32) subframeIndex = snum;
|
|
||||||
int len = sprintf(buf,jsonFmt,
|
int len = sprintf(buf,jsonFmt,
|
||||||
SLS_DETECTOR_JSON_HEADER_VERSION, acquisitionIndex, frameIndex, dynamicRange, npixelsx, npixelsy,completeFileName[ithread],
|
SLS_DETECTOR_JSON_HEADER_VERSION, acquisitionIndex, frameIndex, dynamicRange, npixelsx, npixelsy,completeFileName[ithread],
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );/* will not work for other detectors*/
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );/* will not work for other detectors*/
|
||||||
@ -1952,7 +1952,6 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
//update frame details
|
//update frame details
|
||||||
frameIndex = fnum;
|
frameIndex = fnum;
|
||||||
acquisitionIndex = fnum - startAcquisitionIndex;
|
acquisitionIndex = fnum - startAcquisitionIndex;
|
||||||
if(dynamicRange == 32) subframeIndex = snum;
|
|
||||||
int len = sprintf(buf,jsonFmt,
|
int len = sprintf(buf,jsonFmt,
|
||||||
SLS_DETECTOR_JSON_HEADER_VERSION, acquisitionIndex, frameIndex, dynamicRange, npixelsx, npixelsy,completeFileName[ithread],
|
SLS_DETECTOR_JSON_HEADER_VERSION, acquisitionIndex, frameIndex, dynamicRange, npixelsx, npixelsy,completeFileName[ithread],
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );/* will not work for other detectors*/
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );/* will not work for other detectors*/
|
||||||
@ -1990,7 +1989,6 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
//update frame details
|
//update frame details
|
||||||
frameIndex = fnum;
|
frameIndex = fnum;
|
||||||
acquisitionIndex = fnum - startAcquisitionIndex;
|
acquisitionIndex = fnum - startAcquisitionIndex;
|
||||||
if(dynamicRange == 32) subframeIndex = snum;
|
|
||||||
int len = sprintf(buf,jsonFmt,
|
int len = sprintf(buf,jsonFmt,
|
||||||
SLS_DETECTOR_JSON_HEADER_VERSION, acquisitionIndex, frameIndex, dynamicRange, npixelsx, npixelsy,completeFileName[ithread],
|
SLS_DETECTOR_JSON_HEADER_VERSION, acquisitionIndex, frameIndex, dynamicRange, npixelsx, npixelsy,completeFileName[ithread],
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );/* will not work for other detectors*/
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );/* will not work for other detectors*/
|
||||||
@ -2346,7 +2344,7 @@ int UDPStandardImplementation::prepareAndListenBufferCompleteFrames(int ithread)
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(!ithread)
|
if(!ithread)
|
||||||
cprintf(BLUE,
|
cprintf(BLUE,
|
||||||
"framenumber:%llu\tsubfnum:%u\tpnum:%u\tbunchid:%llu\txcoord:%u\tdettype:%u\tversion:%u\n",
|
"framenumber:%lu\tsubfnum:%u\tpnum:%u\tbunchid:%lu\txcoord:%u\tdettype:%u\tversion:%u\n",
|
||||||
header->frameNumber, header->expLength, header->packetNumber,
|
header->frameNumber, header->expLength, header->packetNumber,
|
||||||
header->bunchId, header->xCoord, header->detType, header->version);
|
header->bunchId, header->xCoord, header->detType, header->version);
|
||||||
#endif
|
#endif
|
||||||
@ -2521,8 +2519,7 @@ uint32_t UDPStandardImplementation::processListeningBuffer(int ithread, int &cSi
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cprintf(RED,"Listening_Thread %d: Error: This detector %s is not implemented in the receiver\n",
|
cprintf(RED,"Listening_Thread %d: Error: This detector is not implemented in the receiver\n", ithread);
|
||||||
ithread, getDetectorType(myDetectorType).c_str());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3304,7 +3301,6 @@ void UDPStandardImplementation::handleDataCompression(int ithread, char* wbuffer
|
|||||||
int once = 0;
|
int once = 0;
|
||||||
int xmax = 0, ymax = 0; //max pixels in x and y direction
|
int xmax = 0, ymax = 0; //max pixels in x and y direction
|
||||||
int xmin = 1, ymin = 1; //min pixels in x and y direction
|
int xmin = 1, ymin = 1; //min pixels in x and y direction
|
||||||
double tot, tl, tr, bl, br;
|
|
||||||
|
|
||||||
//determining xmax and ymax
|
//determining xmax and ymax
|
||||||
switch(myDetectorType){
|
switch(myDetectorType){
|
||||||
@ -3325,7 +3321,7 @@ void UDPStandardImplementation::handleDataCompression(int ithread, char* wbuffer
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(buff[0] = receiverData[ithread]->findNextFrame(data,ndata,remainingsize)){
|
while((buff[0] = receiverData[ithread]->findNextFrame(data,ndata,remainingsize))){
|
||||||
|
|
||||||
//remaining number of packets
|
//remaining number of packets
|
||||||
np = ndata/onePacketSize;
|
np = ndata/onePacketSize;
|
||||||
@ -3350,11 +3346,6 @@ void UDPStandardImplementation::handleDataCompression(int ithread, char* wbuffer
|
|||||||
for(int iy = ymin - 1; iy < ymax+1; iy++){
|
for(int iy = ymin - 1; iy < ymax+1; iy++){
|
||||||
thisEvent=singlePhotonDetectorObject[ithread]->getEventType(buff[0], ix, iy, commonModeSubtractionEnable);
|
thisEvent=singlePhotonDetectorObject[ithread]->getEventType(buff[0], ix, iy, commonModeSubtractionEnable);
|
||||||
if (nf>1000) {
|
if (nf>1000) {
|
||||||
tot=0;
|
|
||||||
tl=0;
|
|
||||||
tr=0;
|
|
||||||
bl=0;
|
|
||||||
br=0;
|
|
||||||
if (thisEvent==PHOTON_MAX) {
|
if (thisEvent==PHOTON_MAX) {
|
||||||
receiverData[ithread]->getFrameNumber(buff[0]);
|
receiverData[ithread]->getFrameNumber(buff[0]);
|
||||||
//iFrame=receiverData[ithread]->getFrameNumber(buff);
|
//iFrame=receiverData[ithread]->getFrameNumber(buff);
|
||||||
|
@ -2,8 +2,8 @@ WD = $(shell pwd)
|
|||||||
LIBDIR = $(WD)/../bin
|
LIBDIR = $(WD)/../bin
|
||||||
LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware
|
LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware
|
||||||
LIBRARYDETDIR = $(WD)/../slsDetectorSoftware
|
LIBRARYDETDIR = $(WD)/../slsDetectorSoftware
|
||||||
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread
|
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
|
||||||
LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread
|
LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
|
||||||
INCLUDESRXR = -I $(LIBRARYRXRDIR)/include
|
INCLUDESRXR = -I $(LIBRARYRXRDIR)/include
|
||||||
INCLUDESDET = -I $(LIBRARYRXRDIR)/include -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis
|
INCLUDESDET = -I $(LIBRARYRXRDIR)/include -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ WD = $(shell pwd)
|
|||||||
LIBDIR = $(WD)/../bin
|
LIBDIR = $(WD)/../bin
|
||||||
LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware
|
LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware
|
||||||
LIBRARYDETDIR = $(WD)/../slsDetectorSoftware
|
LIBRARYDETDIR = $(WD)/../slsDetectorSoftware
|
||||||
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread
|
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
|
||||||
LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread
|
LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
|
||||||
INCLUDESRXR = -I $(LIBRARYRXRDIR)/include
|
INCLUDESRXR = -I $(LIBRARYRXRDIR)/include
|
||||||
INCLUDESDET = -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis
|
INCLUDESDET = -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis
|
||||||
|
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
This file is an example of how to implement the slsDetectorUsers class
|
This file is an example of how to implement the slsDetectorUsers class
|
||||||
You can compile it linking it to the slsDetector library
|
You can compile it linking it to the slsDetector library
|
||||||
|
|
||||||
gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread
|
gcc mainClient.cpp -L lib -l SlsDetector -lm -pthread
|
||||||
|
|
||||||
where lib is the location of libSlsDetector.so
|
where lib is the location of libSlsDetector.so
|
||||||
gcc mainClient.cpp -L . -l SlsDetector -lm -lpthread -o users
|
gcc mainClient.cpp -L . -l SlsDetector -lm -pthread -o users
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
This file is an example of how to implement the slsDetectorUsers class
|
This file is an example of how to implement the slsDetectorUsers class
|
||||||
You can compile it linking it to the slsDetector library
|
You can compile it linking it to the slsDetector library
|
||||||
|
|
||||||
gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread
|
gcc mainClient.cpp -L lib -l SlsDetector -lm -pthread
|
||||||
|
|
||||||
where lib is the location of libSlsDetector.so
|
where lib is the location of libSlsDetector.so
|
||||||
gcc mainClient.cpp -L . -l SlsDetector -lm -lpthread -o users
|
gcc mainClient.cpp -L . -l SlsDetector -lm -pthread -o users
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user