mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
sharedmem: working, need to add replace
This commit is contained in:
parent
0b140111b3
commit
a0016cb005
2
Makefile
2
Makefile
@ -23,7 +23,7 @@ CALIBDIR = $(WD)/slsDetectorCalibration
|
|||||||
TABSPACE := "\t"
|
TABSPACE := "\t"
|
||||||
|
|
||||||
|
|
||||||
INCLUDES=-I. -I$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(ASM)
|
INCLUDES=-I. -I$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles --I$(LIBRARYDIR)/sharedMemory I$(ASM)
|
||||||
|
|
||||||
INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/include -I$(CALIBDIR) -I$(ASM)
|
INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/include -I$(CALIBDIR) -I$(ASM)
|
||||||
#LIBFLAGRXR +=
|
#LIBFLAGRXR +=
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
set(SOURCES
|
set(SOURCES
|
||||||
multiSlsDetector/multiSlsDetector.cpp
|
multiSlsDetector/multiSlsDetector.cpp
|
||||||
|
sharedMemory/SharedMemory.cpp
|
||||||
slsDetector/slsDetectorUsers.cpp
|
slsDetector/slsDetectorUsers.cpp
|
||||||
slsDetector/slsDetectorUtils.cpp
|
slsDetector/slsDetectorUtils.cpp
|
||||||
slsDetector/slsDetectorCommand.cpp
|
slsDetector/slsDetectorCommand.cpp
|
||||||
@ -24,6 +25,7 @@ set(HEADERS
|
|||||||
include_directories(
|
include_directories(
|
||||||
commonFiles
|
commonFiles
|
||||||
multiSlsDetector
|
multiSlsDetector
|
||||||
|
sharedMemory
|
||||||
slsDetector
|
slsDetector
|
||||||
slsDetectorUtils
|
slsDetectorUtils
|
||||||
slsDetectorCommand
|
slsDetectorCommand
|
||||||
@ -57,6 +59,9 @@ set(PUBLICHEADERS
|
|||||||
commonFiles/sls_detector_defs.h
|
commonFiles/sls_detector_defs.h
|
||||||
commonFiles/sls_detector_funcs.h
|
commonFiles/sls_detector_funcs.h
|
||||||
commonFiles/error_defs.h
|
commonFiles/error_defs.h
|
||||||
|
commonFiles/sls_detector_exceptions.h
|
||||||
|
commonFiles/versionAPI.h
|
||||||
|
sharedMemory/SharedMemory.h
|
||||||
slsDetector/slsDetectorUtils.h
|
slsDetector/slsDetectorUtils.h
|
||||||
slsDetector/slsDetector.h
|
slsDetector/slsDetector.h
|
||||||
slsDetector/slsDetectorActions.h
|
slsDetector/slsDetectorActions.h
|
||||||
|
@ -36,9 +36,10 @@ multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
|||||||
thisMultiDetector(0),
|
thisMultiDetector(0),
|
||||||
client_downstream(false),
|
client_downstream(false),
|
||||||
threadpool(0) {
|
threadpool(0) {
|
||||||
bool created = initSharedMemory(verify);
|
if (initSharedMemory(verify))
|
||||||
initializeDetectorStructure(created, verify);
|
// shared memory just created, so initialize the structure
|
||||||
initializeMembers();
|
initializeDetectorStructure();
|
||||||
|
initializeMembers(verify);
|
||||||
if (update)
|
if (update)
|
||||||
updateUserdetails();
|
updateUserdetails();
|
||||||
}
|
}
|
||||||
@ -615,12 +616,11 @@ void multiSlsDetector::freeSharedMemory(int multiId) {
|
|||||||
// get number of detectors
|
// get number of detectors
|
||||||
int numDetectors = 0;
|
int numDetectors = 0;
|
||||||
SharedMemory* shm = new SharedMemory(multiId, -1);
|
SharedMemory* shm = new SharedMemory(multiId, -1);
|
||||||
std::string shmname = shm->GetName();
|
|
||||||
|
|
||||||
// shm not created before
|
// shm not created before
|
||||||
if (SharedMemory::IsExisting(shmname)) {
|
if (SharedMemory::IsExisting(shm->GetName())) {
|
||||||
sharedMultiDet* mdet = (sharedMultiSlsDetector*)shm->OpenSharedMemory(
|
sharedMultiSlsDetector* mdet = (sharedMultiSlsDetector*)shm->OpenSharedMemory(
|
||||||
sizeof(sharedMultiSlsDetector), false);
|
sizeof(sharedMultiSlsDetector));
|
||||||
numDetectors = mdet->numberOfDetectors;
|
numDetectors = mdet->numberOfDetectors;
|
||||||
shm->UnmapSharedMemory(mdet);
|
shm->UnmapSharedMemory(mdet);
|
||||||
shm->RemoveSharedMemory();
|
shm->RemoveSharedMemory();
|
||||||
@ -647,7 +647,7 @@ void multiSlsDetector::freeSharedMemory() {
|
|||||||
|
|
||||||
// multi detector
|
// multi detector
|
||||||
if (sharedMemory) {
|
if (sharedMemory) {
|
||||||
sharedMemory->Unmap(thisMultiDetector);
|
sharedMemory->UnmapSharedMemory(thisMultiDetector);
|
||||||
sharedMemory->RemoveSharedMemory();
|
sharedMemory->RemoveSharedMemory();
|
||||||
delete sharedMemory;
|
delete sharedMemory;
|
||||||
}
|
}
|
||||||
@ -722,8 +722,7 @@ bool multiSlsDetector::initSharedMemory(bool verify) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void multiSlsDetector::initializeDetectorStructure(bool created, bool verify) {
|
void multiSlsDetector::initializeDetectorStructure() {
|
||||||
if (created) {
|
|
||||||
thisMultiDetector->shmversion = MULTI_SHMVERSION;
|
thisMultiDetector->shmversion = MULTI_SHMVERSION;
|
||||||
thisMultiDetector->numberOfDetectors = 0;
|
thisMultiDetector->numberOfDetectors = 0;
|
||||||
thisMultiDetector->numberOfDetector[X] = 0;
|
thisMultiDetector->numberOfDetector[X] = 0;
|
||||||
@ -753,22 +752,23 @@ void multiSlsDetector::initializeDetectorStructure(bool created, bool verify) {
|
|||||||
for (int i = 0; i < MAX_TIMERS; ++i) {
|
for (int i = 0; i < MAX_TIMERS; ++i) {
|
||||||
thisMultiDetector->timerValue[i] = 0;
|
thisMultiDetector->timerValue[i] = 0;
|
||||||
}
|
}
|
||||||
thisMultiDetector->currentSettings = -1;
|
thisMultiDetector->currentSettings = GET_SETTINGS;
|
||||||
thisMultiDetector->currentThresholdEV = -1;
|
thisMultiDetector->currentThresholdEV = -1;
|
||||||
thisMultiDetector->progressIndex = 0;
|
thisMultiDetector->progressIndex = 0;
|
||||||
thisMultiDetector->totalProgress = 1;
|
thisMultiDetector->totalProgress = 1;
|
||||||
thisMultiDetector->fileIndex = 0;
|
thisMultiDetector->fileIndex = 0;
|
||||||
strncpy(thisMultiDetector->fileName, "run", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector->fileName, "run");
|
||||||
strncpy(thisMultiDetector->filePath, "/", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector->filePath, "/");
|
||||||
thisMultiDetector->framesPerFile = 1;
|
thisMultiDetector->framesPerFile = 1;
|
||||||
thisMultiDetector->fileFormatType = ASCII;
|
thisMultiDetector->fileFormatType = ASCII;
|
||||||
thisMultiDetector->correctionMask = (1 << WRITE_FILE) | (1 << OVERWRITE_FILE);
|
thisMultiDetector->correctionMask = (1 << WRITE_FILE) | (1 << OVERWRITE_FILE);
|
||||||
thisMultiDetector->threadedProcessing = 1;
|
thisMultiDetector->threadedProcessing = 1;
|
||||||
thisMultiDetector->tDead = 0;
|
thisMultiDetector->tDead = 0;
|
||||||
strncpy(flatFieldDir, getenv("HOME"), MAX_STR_LENGTH);
|
strncpy(thisMultiDetector->flatFieldDir, getenv("HOME"), MAX_STR_LENGTH-1);
|
||||||
strncpy(flatFieldFile, "none", MAX_STR_LENGTH);
|
thisMultiDetector->flatFieldDir[MAX_STR_LENGTH-1] = 0;
|
||||||
strncpy(thisMultiDetector->badChanFile, "none", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector->flatFieldFile, "none");
|
||||||
strncpy(thisMultiDetector->angConvFile, "none", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector->badChanFile, "none");
|
||||||
|
strcpy(thisMultiDetector->angConvFile, "none");
|
||||||
thisMultiDetector->angDirection = 1;
|
thisMultiDetector->angDirection = 1;
|
||||||
thisMultiDetector->fineOffset = 0;
|
thisMultiDetector->fineOffset = 0;
|
||||||
thisMultiDetector->globalOffset = 0;
|
thisMultiDetector->globalOffset = 0;
|
||||||
@ -782,15 +782,18 @@ void multiSlsDetector::initializeDetectorStructure(bool created, bool verify) {
|
|||||||
}
|
}
|
||||||
thisMultiDetector->actionMask = 0;
|
thisMultiDetector->actionMask = 0;
|
||||||
for (int i = 0; i < MAX_ACTIONS; ++i) {
|
for (int i = 0; i < MAX_ACTIONS; ++i) {
|
||||||
strncpy(thisMultiDetector->actionScript[i], "none", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector->actionScript[i], "none");
|
||||||
strncpy(thisMultiDetector->actionParameter[i], "none", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector->actionParameter[i], "none");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < MAX_SCAN_LEVELS; ++i) {
|
for (int i = 0; i < MAX_SCAN_LEVELS; ++i) {
|
||||||
thisMultiDetector->scanMode[i] = 0;
|
thisMultiDetector->scanMode[i] = 0;
|
||||||
strncpy(thisMultiDetector->scanScript[i], "none", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector->scanScript[i], "none");
|
||||||
strncpy(thisMultiDetector-> scanParameter[i], "none", MAX_STR_LENGTH);
|
strcpy(thisMultiDetector-> scanParameter[i], "none");
|
||||||
thisMultiDetector->nScanSteps[i] = 0;
|
thisMultiDetector->nScanSteps[i] = 0;
|
||||||
thisMultiDetector->scanSteps[i] = 0.0;
|
{
|
||||||
|
double initValue = 0;
|
||||||
|
std::fill_n(thisMultiDetector->scanSteps[i], MAX_SCAN_STEPS, initValue);
|
||||||
|
}
|
||||||
thisMultiDetector->scanPrecision[i] = 0;
|
thisMultiDetector->scanPrecision[i] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -798,17 +801,9 @@ void multiSlsDetector::initializeDetectorStructure(bool created, bool verify) {
|
|||||||
thisMultiDetector->externalgui = false;
|
thisMultiDetector->externalgui = false;
|
||||||
thisMultiDetector->receiverOnlineFlag = OFFLINE_FLAG;
|
thisMultiDetector->receiverOnlineFlag = OFFLINE_FLAG;
|
||||||
thisMultiDetector->receiver_upstream = false;
|
thisMultiDetector->receiver_upstream = false;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// get objects from single det shared memory (open)
|
|
||||||
for (int i = 0; i < thisMultiDetector->numberOfDetectors; i++) {
|
|
||||||
slsDetector* sdet = new slsDetector(detId, i, verify, this);
|
|
||||||
detectors.push_back(sdet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::initializeMembers() {
|
void multiSlsDetector::initializeMembers(bool verify) {
|
||||||
//slsDetectorUtils
|
//slsDetectorUtils
|
||||||
stoppedFlag = &thisMultiDetector->stoppedFlag;
|
stoppedFlag = &thisMultiDetector->stoppedFlag;
|
||||||
timerValue = thisMultiDetector->timerValue;
|
timerValue = thisMultiDetector->timerValue;
|
||||||
@ -822,7 +817,6 @@ void multiSlsDetector::initializeMembers() {
|
|||||||
framesPerFile = &thisMultiDetector->framesPerFile;
|
framesPerFile = &thisMultiDetector->framesPerFile;
|
||||||
fileFormatType = &thisMultiDetector->fileFormatType;
|
fileFormatType = &thisMultiDetector->fileFormatType;
|
||||||
|
|
||||||
|
|
||||||
//postprocessing
|
//postprocessing
|
||||||
threadedProcessing = &thisMultiDetector->threadedProcessing;
|
threadedProcessing = &thisMultiDetector->threadedProcessing;
|
||||||
correctionMask = &thisMultiDetector->correctionMask;
|
correctionMask = &thisMultiDetector->correctionMask;
|
||||||
@ -832,10 +826,6 @@ void multiSlsDetector::initializeMembers() {
|
|||||||
badChannelMask = NULL;
|
badChannelMask = NULL;
|
||||||
fdata = NULL;
|
fdata = NULL;
|
||||||
thisData = NULL;
|
thisData = NULL;
|
||||||
ppFun = NULL;
|
|
||||||
ang = NULL;
|
|
||||||
val = NULL;
|
|
||||||
err = NULL;
|
|
||||||
|
|
||||||
//slsDetectorActions
|
//slsDetectorActions
|
||||||
actionMask = &thisMultiDetector->actionMask;
|
actionMask = &thisMultiDetector->actionMask;
|
||||||
@ -874,6 +864,12 @@ void multiSlsDetector::initializeMembers() {
|
|||||||
|
|
||||||
updateOffsets();
|
updateOffsets();
|
||||||
createThreadPool();
|
createThreadPool();
|
||||||
|
|
||||||
|
// get objects from single det shared memory (open)
|
||||||
|
for (int i = 0; i < thisMultiDetector->numberOfDetectors; i++) {
|
||||||
|
slsDetector* sdet = new slsDetector(detId, i, verify, this);
|
||||||
|
detectors.push_back(sdet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -882,17 +878,20 @@ void multiSlsDetector::updateUserdetails() {
|
|||||||
memset(thisMultiDetector->lastUser, 0, SHORT_STRING_LENGTH);
|
memset(thisMultiDetector->lastUser, 0, SHORT_STRING_LENGTH);
|
||||||
memset(thisMultiDetector->lastDate, 0, SHORT_STRING_LENGTH);
|
memset(thisMultiDetector->lastDate, 0, SHORT_STRING_LENGTH);
|
||||||
try {
|
try {
|
||||||
strncpy(thisMultiDetector->lastUser, exec("whoami").c_str(), SHORT_STRING_LENGTH);
|
strncpy(thisMultiDetector->lastUser, exec("whoami").c_str(), SHORT_STRING_LENGTH-1);
|
||||||
strncpy(thisMultiDetector->lastDate, exec("date").c_str(), DATE_LENGTH);
|
thisMultiDetector->lastUser[SHORT_STRING_LENGTH-1] = 0;
|
||||||
|
strncpy(thisMultiDetector->lastDate, exec("date").c_str(), DATE_LENGTH-1);
|
||||||
|
thisMultiDetector->lastDate[DATE_LENGTH-1] = 0;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
strncpy(thisMultiDetector->lastUser, exec("errorreading").c_str(), SHORT_STRING_LENGTH);
|
strcpy(thisMultiDetector->lastUser, "errorreading");
|
||||||
strncpy(thisMultiDetector->lastDate, exec("errorreading").c_str(), SHORT_STRING_LENGTH);
|
strcpy(thisMultiDetector->lastDate, "errorreading");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string multiSlsDetector::exec(const char* cmd) {
|
std::string multiSlsDetector::exec(const char* cmd) {
|
||||||
int bufsize = 1char buffer[bufsize];
|
int bufsize = 128;
|
||||||
|
char buffer[bufsize];
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
FILE* pipe = popen(cmd, "r");
|
FILE* pipe = popen(cmd, "r");
|
||||||
if (!pipe) throw std::exception();
|
if (!pipe) throw std::exception();
|
||||||
@ -911,14 +910,13 @@ std::string multiSlsDetector::exec(const char* cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void multiSlsDetector::setHostname(string s) {
|
void multiSlsDetector::setHostname(const char* name) {
|
||||||
freeSharedMemory(detId);
|
|
||||||
size_t p1 = 0;
|
size_t p1 = 0;
|
||||||
string temp = string(s);
|
string temp = string(name);
|
||||||
size_t p2 = temp.find('+', p1);
|
size_t p2 = temp.find('+', p1);
|
||||||
//single
|
//single
|
||||||
if (p2 == string::npos) {
|
if (p2 == string::npos) {
|
||||||
addSlsDetector(s);
|
addSlsDetector(temp);
|
||||||
}
|
}
|
||||||
// multi
|
// multi
|
||||||
else {
|
else {
|
||||||
@ -1227,7 +1225,7 @@ void multiSlsDetector::updateOffsets() {
|
|||||||
"prevChanY_gp:" << prevChanY_gp << endl;
|
"prevChanY_gp:" << prevChanY_gp << endl;
|
||||||
#endif
|
#endif
|
||||||
//cout<<" totalchan:"<< detectors[idet]->getTotalNumberOfChannels(Y)
|
//cout<<" totalchan:"<< detectors[idet]->getTotalNumberOfChannels(Y)
|
||||||
<<" maxChanY:"<<maxChanY<<endl;
|
//<<" maxChanY:"<<maxChanY<<endl;
|
||||||
//incrementing in both direction
|
//incrementing in both direction
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
//incrementing in both directions
|
//incrementing in both directions
|
||||||
@ -1392,9 +1390,10 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
|||||||
clearAllErrorMask();
|
clearAllErrorMask();
|
||||||
freeSharedMemory();
|
freeSharedMemory();
|
||||||
|
|
||||||
bool created = initSharedMemory(verify);
|
if (initSharedMemory())
|
||||||
initializeDetectorStructure(created, verify);
|
// shared memory just created, so initialize the structure
|
||||||
initializeMembers(); // also deletes zmq objects and destroys threadpool
|
initializeDetectorStructure();
|
||||||
|
initializeMembers(true); // also deletes zmq objects and destroys threadpool
|
||||||
updateUserdetails();
|
updateUserdetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1420,7 +1419,7 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
|||||||
sargval = "0";
|
sargval = "0";
|
||||||
getline(infile, str);
|
getline(infile, str);
|
||||||
++iline;
|
++iline;
|
||||||
str.erase(str.find('#'), str.end());
|
str.erase(str.find('#'), string::npos);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << str << std::endl;
|
std::cout << str << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -2015,8 +2014,7 @@ slsDetectorDefs::synchronizationMode multiSlsDetector::setSynchronization(synchr
|
|||||||
ret1 = detectors[idet]->setSynchronization(sync);
|
ret1 = detectors[idet]->setSynchronization(sync);
|
||||||
if (detectors[idet]->getErrorMask())
|
if (detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask() | (1 << idet));
|
setErrorMask(getErrorMask() | (1 << idet));
|
||||||
|
if (idet == 0)
|
||||||
if (id == 0)
|
|
||||||
ret = ret1;
|
ret = ret1;
|
||||||
else if (ret != ret1)
|
else if (ret != ret1)
|
||||||
ret = GET_SYNCHRONIZATION_MODE;
|
ret = GET_SYNCHRONIZATION_MODE;
|
||||||
@ -2643,7 +2641,7 @@ dacs_t multiSlsDetector::setDAC(dacs_t val, dacIndex idac, int mV, int imod) {
|
|||||||
{
|
{
|
||||||
int id = -1, im = -1;
|
int id = -1, im = -1;
|
||||||
if (decodeNMod(imod, id, im) >= 0) {
|
if (decodeNMod(imod, id, im) >= 0) {
|
||||||
if (if < 0 && id >= detectors.size())
|
if (id < 0 && id >= detectors.size())
|
||||||
return -1;
|
return -1;
|
||||||
ret = detectors[id]->setDAC(val, idac, mV, im);
|
ret = detectors[id]->setDAC(val, idac, mV, im);
|
||||||
if (detectors[id]->getErrorMask())
|
if (detectors[id]->getErrorMask())
|
||||||
@ -2700,7 +2698,7 @@ dacs_t multiSlsDetector::getADC(dacIndex idac, int imod) {
|
|||||||
{
|
{
|
||||||
int id = -1, im = -1;
|
int id = -1, im = -1;
|
||||||
if (decodeNMod(imod, id, im) >= 0) {
|
if (decodeNMod(imod, id, im) >= 0) {
|
||||||
if (if < 0 && id >= detectors.size())
|
if (id < 0 && id >= detectors.size())
|
||||||
return -1;
|
return -1;
|
||||||
ret = detectors[id]->getADC(idac, im);
|
ret = detectors[id]->getADC(idac, im);
|
||||||
if (detectors[id]->getErrorMask())
|
if (detectors[id]->getErrorMask())
|
||||||
@ -3168,7 +3166,7 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[]) {
|
|||||||
cout << "det:" << idet << "\t" << xmin << "\t" << ymin
|
cout << "det:" << idet << "\t" << xmin << "\t" << ymin
|
||||||
<< "\t" << channelX << "\t" << channelY << endl;
|
<< "\t" << channelX << "\t" << channelY << endl;
|
||||||
#endif
|
#endif
|
||||||
if (idet < 0 || id >= detectors.size) {
|
if (idet < 0 || idet >= detectors.size()) {
|
||||||
cout << "invalid roi" << endl;
|
cout << "invalid roi" << endl;
|
||||||
invalidroi = true;
|
invalidroi = true;
|
||||||
break;
|
break;
|
||||||
@ -4325,7 +4323,7 @@ angleConversionConstant* multiSlsDetector::getAngularConversionPointer(int imod)
|
|||||||
#endif
|
#endif
|
||||||
if (decodeNMod(imod, id, im) >= 0) {
|
if (decodeNMod(imod, id, im) >= 0) {
|
||||||
if (id < 0 || id >= detectors.size())
|
if (id < 0 || id >= detectors.size())
|
||||||
return -1;
|
return NULL;
|
||||||
return detectors[id]->getAngularConversionPointer(im);
|
return detectors[id]->getAngularConversionPointer(im);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -4431,7 +4429,7 @@ string multiSlsDetector::setFileName(string s) {
|
|||||||
return string("");
|
return string("");
|
||||||
} else {
|
} else {
|
||||||
string* sret[detectors.size()];
|
string* sret[detectors.size()];
|
||||||
if (detectors[idet]) {
|
for (int idet = 0; idet < posmax; ++idet) {
|
||||||
sret[idet] = new string("error");
|
sret[idet] = new string("error");
|
||||||
Task* task = new Task(new func1_t<string, string>(&slsDetector::setFileName,
|
Task* task = new Task(new func1_t<string, string>(&slsDetector::setFileName,
|
||||||
detectors[idet], s, sret[idet]));
|
detectors[idet], s, sret[idet]));
|
||||||
@ -4469,7 +4467,7 @@ int multiSlsDetector::setReceiverFramesPerFile(int f) {
|
|||||||
return parallelCallDetectorMember(&slsDetector::setReceiverFramesPerFile, f);
|
return parallelCallDetectorMember(&slsDetector::setReceiverFramesPerFile, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
fileFormat multiSlsDetector::getFileFormat() {
|
slsReceiverDefs::fileFormat multiSlsDetector::getFileFormat() {
|
||||||
return setFileFormat();
|
return setFileFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4763,12 +4761,12 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
|||||||
detectors[i / numSocketsPerDetector]->getClientStreamingIP().c_str(),
|
detectors[i / numSocketsPerDetector]->getClientStreamingIP().c_str(),
|
||||||
portnum);
|
portnum);
|
||||||
zmqSocket.push_back(z);
|
zmqSocket.push_back(z);
|
||||||
|
printf("Zmq Client[%d] at %s\n", i, z->GetZmqServerAddress());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
||||||
createReceivingDataSockets(true);
|
createReceivingDataSockets(true);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
printf("Zmq Client[%d] at %s\n", i, z->GetZmqServerAddress());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
client_downstream = true;
|
client_downstream = true;
|
||||||
|
@ -489,7 +489,7 @@ public:
|
|||||||
* @param pos position in the multi list
|
* @param pos position in the multi list
|
||||||
* @returns slsDetector object
|
* @returns slsDetector object
|
||||||
*/
|
*/
|
||||||
slsDetector *operator();
|
slsDetector *operator()(int pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free shared memory from the command line
|
* Free shared memory from the command line
|
||||||
@ -513,9 +513,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Sets the hostname of all sls detectors in shared memory
|
* Sets the hostname of all sls detectors in shared memory
|
||||||
* Connects to them to set up online flag
|
* Connects to them to set up online flag
|
||||||
* @param s concatenated hostname of all the sls detectors
|
* @param name concatenated hostname of all the sls detectors
|
||||||
*/
|
*/
|
||||||
void setHostname(std::string s);
|
void setHostname(const char* name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the hostname of detector at particular position
|
* Gets the hostname of detector at particular position
|
||||||
@ -554,7 +554,7 @@ public:
|
|||||||
* Creates all the threads in the threadpool
|
* Creates all the threads in the threadpool
|
||||||
* throws an exception if it cannot create threads
|
* throws an exception if it cannot create threads
|
||||||
*/
|
*/
|
||||||
int createThreadPool();
|
void createThreadPool();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys all the threads in the threadpool
|
* Destroys all the threads in the threadpool
|
||||||
@ -1822,16 +1822,15 @@ private:
|
|||||||
bool initSharedMemory(bool verify = true);
|
bool initSharedMemory(bool verify = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize detector structure
|
* Initialize detector structure for the shared memory just created
|
||||||
* @param created true if shared memory was just created now
|
|
||||||
* @param verify true to verify if shm size matches existing one
|
|
||||||
*/
|
*/
|
||||||
void initializeDetectorStructure(bool created, bool verify = true);
|
void initializeDetectorStructure();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize class members (and from parent classes)
|
* Initialize class members (and from parent classes)
|
||||||
|
* @param verify true to verify if shm size matches existing one
|
||||||
*/
|
*/
|
||||||
void initializeMembers();
|
void initializeMembers(bool verify = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update user details in detector structure
|
* Update user details in detector structure
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "multiSlsDetector.h"
|
#include "multiSlsDetector.h"
|
||||||
#include "multiSlsDetectorCommand.h"
|
#include "multiSlsDetectorCommand.h"
|
||||||
|
#include "sls_detector_exceptions.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -54,7 +55,7 @@ public:
|
|||||||
// sls pos scanned
|
// sls pos scanned
|
||||||
iv=sscanf(argv[0],"%d:%s", &pos, cmd); \
|
iv=sscanf(argv[0],"%d:%s", &pos, cmd); \
|
||||||
if (iv != 2 ) \
|
if (iv != 2 ) \
|
||||||
pos = 0; \
|
pos = -1; \
|
||||||
if (iv == 2 && pos >= 0) { \
|
if (iv == 2 && pos >= 0) { \
|
||||||
argv[0] = cmd; \
|
argv[0] = cmd; \
|
||||||
cout << pos << ":" ; \
|
cout << pos << ":" ; \
|
||||||
@ -62,8 +63,12 @@ public:
|
|||||||
|
|
||||||
if ((action==slsDetectorDefs::READOUT_ACTION) && (pos != -1) ) { \
|
if ((action==slsDetectorDefs::READOUT_ACTION) && (pos != -1) ) { \
|
||||||
cout << "pos " << pos << "is not allowed for readout!" << endl; \
|
cout << "pos " << pos << "is not allowed for readout!" << endl; \
|
||||||
|
return; \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
if (!strlen(cmd)) \
|
||||||
|
strcpy(cmd, argv[0]); \
|
||||||
|
|
||||||
// special commands
|
// special commands
|
||||||
string scmd = cmd; \
|
string scmd = cmd; \
|
||||||
// free without calling multiSlsDetector constructor
|
// free without calling multiSlsDetector constructor
|
||||||
@ -74,6 +79,17 @@ public:
|
|||||||
multiSlsDetector::freeSharedMemory(id); \
|
multiSlsDetector::freeSharedMemory(id); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
|
// (sls level): give error message
|
||||||
|
// (multi level): free before calling multiSlsDetector constructor
|
||||||
|
else if (scmd == "hostname") { \
|
||||||
|
if (pos != -1) { \
|
||||||
|
cout << "pos " << pos << "not allowed for hostname. " \
|
||||||
|
"Only from multi detector level." << endl; \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
multiSlsDetector::freeSharedMemory(id); \
|
||||||
|
} \
|
||||||
// get user details without verify sharedMultiSlsDetector version
|
// get user details without verify sharedMultiSlsDetector version
|
||||||
else if ((scmd == "userdetails") && (action==slsDetectorDefs::GET_ACTION)) {\
|
else if ((scmd == "userdetails") && (action==slsDetectorDefs::GET_ACTION)) {\
|
||||||
verify = false; \
|
verify = false; \
|
||||||
@ -107,7 +123,7 @@ public:
|
|||||||
return; \
|
return; \
|
||||||
}; \
|
}; \
|
||||||
|
|
||||||
|
cout<<"id:"<<id<<" pos:"<<pos<<endl;
|
||||||
// call multi detector command line
|
// call multi detector command line
|
||||||
myCmd=new multiSlsDetectorCommand(myDetector); \
|
myCmd=new multiSlsDetectorCommand(myDetector); \
|
||||||
answer=myCmd->executeLine(argc, argv, action, pos); \
|
answer=myCmd->executeLine(argc, argv, action, pos); \
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "multiSlsDetector.h"
|
||||||
|
#include "sls_detector_exceptions.h"
|
||||||
#include "SharedMemory.h"
|
#include "SharedMemory.h"
|
||||||
#include "receiverInterface.h"
|
#include "receiverInterface.h"
|
||||||
#include "gitInfoLib.h"
|
#include "gitInfoLib.h"
|
||||||
@ -21,7 +22,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
slsDetector::slsDetector(detectorType type, int multiId, int id, bool verify, MultiDet* m)
|
slsDetector::slsDetector(detectorType type, int multiId, int id, bool verify, multiSlsDetector* m)
|
||||||
: slsDetectorUtils(),
|
: slsDetectorUtils(),
|
||||||
detId(id),
|
detId(id),
|
||||||
sharedMemory(0),
|
sharedMemory(0),
|
||||||
@ -45,8 +46,7 @@ slsDetector::slsDetector(detectorType type, int multiId, int id, bool verify, Mu
|
|||||||
|
|
||||||
// ensure shared memory was not created before
|
// ensure shared memory was not created before
|
||||||
SharedMemory* shm = new SharedMemory(multiId, id);
|
SharedMemory* shm = new SharedMemory(multiId, id);
|
||||||
std::string shmname = shm->GetName();
|
if (SharedMemory::IsExisting(shm->GetName())) {
|
||||||
if (SharedMemory::IsExisting(shmname)) {
|
|
||||||
cprintf(YELLOW BOLD,"Warning: Weird, this shared memory should have been "
|
cprintf(YELLOW BOLD,"Warning: Weird, this shared memory should have been "
|
||||||
"deleted before! %s. Freeing it again.\n", shm->GetName().c_str());
|
"deleted before! %s. Freeing it again.\n", shm->GetName().c_str());
|
||||||
freeSharedMemory(multiId, id);
|
freeSharedMemory(multiId, id);
|
||||||
@ -60,7 +60,7 @@ slsDetector::slsDetector(detectorType type, int multiId, int id, bool verify, Mu
|
|||||||
initializeDetectorStructurePointers();
|
initializeDetectorStructurePointers();
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetector::slsDetector(int multiId, int id, bool verify, MultiDet* m)
|
slsDetector::slsDetector(int multiId, int id, bool verify, multiSlsDetector* m)
|
||||||
: slsDetectorUtils(),
|
: slsDetectorUtils(),
|
||||||
detId(id),
|
detId(id),
|
||||||
sharedMemory(0),
|
sharedMemory(0),
|
||||||
@ -85,7 +85,7 @@ slsDetector::slsDetector(int multiId, int id, bool verify, MultiDet* m)
|
|||||||
|
|
||||||
// ensure shared memory is existing
|
// ensure shared memory is existing
|
||||||
SharedMemory* shm = new SharedMemory(multiId, id);
|
SharedMemory* shm = new SharedMemory(multiId, id);
|
||||||
if (!SharedMemory::IsExisting(shmname)) {
|
if (!SharedMemory::IsExisting(shm->GetName())) {
|
||||||
cprintf(YELLOW BOLD,"Warning: Corrupted shared memory. It should have been "
|
cprintf(YELLOW BOLD,"Warning: Corrupted shared memory. It should have been "
|
||||||
"created before! %s.\n", shm->GetName().c_str());
|
"created before! %s.\n", shm->GetName().c_str());
|
||||||
delete shm; /* is this necessary ?*/
|
delete shm; /* is this necessary ?*/
|
||||||
@ -93,14 +93,14 @@ slsDetector::slsDetector(int multiId, int id, bool verify, MultiDet* m)
|
|||||||
}
|
}
|
||||||
delete shm;
|
delete shm;
|
||||||
|
|
||||||
detectorType type = GetDetectorTypeFromShm(multiId, verify);
|
detectorType type = getDetectorTypeFromShm(multiId, verify);
|
||||||
initSharedMemory(false, type, multiId, verify);
|
initSharedMemory(false, type, multiId, verify);
|
||||||
initializeMembers();
|
initializeMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetector::~slsDetector() {
|
slsDetector::~slsDetector() {
|
||||||
if (sharedMemory) {
|
if (sharedMemory) {
|
||||||
sharedMemory->UnmapSharedMemory(thisMultiDetector);
|
sharedMemory->UnmapSharedMemory(thisDetector);
|
||||||
delete sharedMemory;
|
delete sharedMemory;
|
||||||
}
|
}
|
||||||
if(thisReceiver)
|
if(thisReceiver)
|
||||||
@ -211,7 +211,6 @@ int64_t slsDetector::clearAllErrorMask() {
|
|||||||
clearErrorMask();
|
clearErrorMask();
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
for(int i=0;i<multiDet->getNumberOfDetectors();++i){
|
for(int i=0;i<multiDet->getNumberOfDetectors();++i){
|
||||||
if(multiDet->getDetectorId(i) == getDetectorId())
|
|
||||||
multiDet->setErrorMask(multiDet->getErrorMask()|(0<<i));
|
multiDet->setErrorMask(multiDet->getErrorMask()|(0<<i));
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
@ -401,7 +400,7 @@ int64_t slsDetector::getId( idMode mode, int imod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void slsDetector::FreeSharedMemory(int multiId, int slsId) {
|
void slsDetector::freeSharedMemory(int multiId, int slsId) {
|
||||||
SharedMemory* shm = new SharedMemory(multiId, slsId);
|
SharedMemory* shm = new SharedMemory(multiId, slsId);
|
||||||
shm->RemoveSharedMemory();
|
shm->RemoveSharedMemory();
|
||||||
delete shm;
|
delete shm;
|
||||||
@ -420,7 +419,7 @@ void slsDetector::setHostname(const char *name) {
|
|||||||
setTCPSocket(string(name));
|
setTCPSocket(string(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
string slsDetector::getHostname(int pos = -1) {
|
string slsDetector::getHostname(int pos) {
|
||||||
return string(thisDetector->hostname);
|
return string(thisDetector->hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,22 +438,22 @@ void slsDetector::initSharedMemory(bool created, detectorType type, int multiId,
|
|||||||
// create
|
// create
|
||||||
if (created) {
|
if (created) {
|
||||||
try {
|
try {
|
||||||
thisSingleDet = (sharedSingleDet*)sharedMemory->CreateSharedMemory(sz);
|
thisDetector = (sharedSlsDetector*)sharedMemory->CreateSharedMemory(sz);
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
sharedMemory->RemoveSharedMemory();
|
sharedMemory->RemoveSharedMemory();
|
||||||
thisSingleDet = 0;
|
thisDetector = 0;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// open and verify version
|
// open and verify version
|
||||||
else {
|
else {
|
||||||
thisSingleDet = (sharedSingleDet*)sharedMemory->OpenSharedMemory(sz, verify);
|
thisDetector = (sharedSlsDetector*)sharedMemory->OpenSharedMemory(sz);
|
||||||
if (verify && thisDetector->shmversion != SLS_SHMVERSION) {
|
if (verify && thisDetector->shmversion != SLS_SHMVERSION) {
|
||||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||||
"(expected 0x%x but got 0x%x)\n",
|
"(expected 0x%x but got 0x%x)\n",
|
||||||
multiId, detId, SLS_SHMVERSION, thisDetector->shmversion);
|
multiId, detId, SLS_SHMVERSION, thisDetector->shmversion);
|
||||||
shm->UnmapSharedMemory(sdet); /** is this unncessary? */
|
sharedMemory->UnmapSharedMemory(thisDetector); /** is this unncessary? */
|
||||||
delete shm;/** is this unncessary? */
|
delete sharedMemory;/** is this unncessary? */
|
||||||
throw SharedMemoryException();
|
throw SharedMemoryException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,136 +463,136 @@ void slsDetector::initSharedMemory(bool created, detectorType type, int multiId,
|
|||||||
void slsDetector::setDetectorSpecificParameters(detectorType type, detParameterList& list) {
|
void slsDetector::setDetectorSpecificParameters(detectorType type, detParameterList& list) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MYTHEN:
|
case MYTHEN:
|
||||||
detlist.nModMaxX = 24;
|
list.nModMaxX = 24;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 128;
|
list.nChanX = 128;
|
||||||
detlist.nChanY = 1;
|
list.nChanY = 1;
|
||||||
detlist.nChipX = 10;
|
list.nChipX = 10;
|
||||||
detlist.nChipY = 1;
|
list.nChipY = 1;
|
||||||
detlist.nDacs = 6;
|
list.nDacs = 6;
|
||||||
detlist.nAdcs = 0;
|
list.nAdcs = 0;
|
||||||
detlist.nGain = 0;
|
list.nGain = 0;
|
||||||
detlist.nOffset = 0;
|
list.nOffset = 0;
|
||||||
detlist.dynamicRange = 24;
|
list.dynamicRange = 24;
|
||||||
detlist.moveFlag = 1;
|
list.moveFlag = 1;
|
||||||
detlist.nGappixelsX = 0;
|
list.nGappixelsX = 0;
|
||||||
detlist.nGappixelsY = 0;
|
list.nGappixelsY = 0;
|
||||||
break;
|
break;
|
||||||
case PICASSO: /** is this needed?*/
|
case PICASSO: /** is this needed?*/
|
||||||
detlist.nModMaxX = 24;
|
list.nModMaxX = 24;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 128;
|
list.nChanX = 128;
|
||||||
detlist.nChanY = 1;
|
list.nChanY = 1;
|
||||||
detlist.nChipX = 12;
|
list.nChipX = 12;
|
||||||
detlist.nChipY = 1;
|
list.nChipY = 1;
|
||||||
detlist.nDacs = 6;
|
list.nDacs = 6;
|
||||||
detlist.nAdcs = 0;
|
list.nAdcs = 0;
|
||||||
detlist.nGain = 0;
|
list.nGain = 0;
|
||||||
detlist.nOffset = 0;
|
list.nOffset = 0;
|
||||||
detlist.dynamicRange = 24;
|
list.dynamicRange = 24;
|
||||||
detlist.moveFlag = 0;
|
list.moveFlag = 0;
|
||||||
detlist.nGappixelsX = 0;
|
list.nGappixelsX = 0;
|
||||||
detlist.nGappixelsY = 0;
|
list.nGappixelsY = 0;
|
||||||
break;
|
break;
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
detlist.nModMaxX = 1;
|
list.nModMaxX = 1;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 128;
|
list.nChanX = 128;
|
||||||
detlist.nChanY = 1;
|
list.nChanY = 1;
|
||||||
detlist.nChipX = 10;
|
list.nChipX = 10;
|
||||||
detlist.nChipY = 1;
|
list.nChipY = 1;
|
||||||
detlist.nDacs = 8;
|
list.nDacs = 8;
|
||||||
detlist.nAdcs = 5;
|
list.nAdcs = 5;
|
||||||
detlist.nGain = 0;
|
list.nGain = 0;
|
||||||
detlist.nOffset = 0;
|
list.nOffset = 0;
|
||||||
detlist.dynamicRange = 16;
|
list.dynamicRange = 16;
|
||||||
detlist.moveFlag = 0;
|
list.moveFlag = 0;
|
||||||
detlist.nGappixelsX = 0;
|
list.nGappixelsX = 0;
|
||||||
detlist.nGappixelsY = 0;
|
list.nGappixelsY = 0;
|
||||||
break;
|
break;
|
||||||
case PROPIX:
|
case PROPIX:
|
||||||
detlist.nModMaxX = 1;
|
list.nModMaxX = 1;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 22;
|
list.nChanX = 22;
|
||||||
detlist.nChanY = 22;
|
list.nChanY = 22;
|
||||||
detlist.nChipX = 1;
|
list.nChipX = 1;
|
||||||
detlist.nChipY = 1;
|
list.nChipY = 1;
|
||||||
detlist.nDacs = 8;
|
list.nDacs = 8;
|
||||||
detlist.nAdcs = 5;
|
list.nAdcs = 5;
|
||||||
detlist.nGain = 0;
|
list.nGain = 0;
|
||||||
detlist.nOffset = 0;
|
list.nOffset = 0;
|
||||||
detlist.dynamicRange = 16;
|
list.dynamicRange = 16;
|
||||||
detlist.moveFlag = 0;
|
list.moveFlag = 0;
|
||||||
detlist.nGappixelsX = 0;
|
list.nGappixelsX = 0;
|
||||||
detlist.nGappixelsY = 0;
|
list.nGappixelsY = 0;
|
||||||
break;
|
break;
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
detlist.nModMaxX = 1;
|
list.nModMaxX = 1;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 160;
|
list.nChanX = 160;
|
||||||
detlist.nChanY = 160;
|
list.nChanY = 160;
|
||||||
detlist.nChipX = 1;
|
list.nChipX = 1;
|
||||||
detlist.nChipY = 1;
|
list.nChipY = 1;
|
||||||
detlist.nDacs = 8;
|
list.nDacs = 8;
|
||||||
detlist.nAdcs = 1;
|
list.nAdcs = 1;
|
||||||
detlist.nGain = 0;
|
list.nGain = 0;
|
||||||
detlist.nOffset = 0;
|
list.nOffset = 0;
|
||||||
detlist.dynamicRange = 16;
|
list.dynamicRange = 16;
|
||||||
detlist.moveFlag = 0;
|
list.moveFlag = 0;
|
||||||
detlist.nGappixelsX = 0;
|
list.nGappixelsX = 0;
|
||||||
detlist.nGappixelsY = 0;
|
list.nGappixelsY = 0;
|
||||||
break;
|
break;
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
detlist.nModMaxX = 1;
|
list.nModMaxX = 1;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 256;
|
list.nChanX = 256;
|
||||||
detlist.nChanY = 256;
|
list.nChanY = 256;
|
||||||
detlist.nChipX = 4;
|
list.nChipX = 4;
|
||||||
detlist.nChipY = 2;
|
list.nChipY = 2;
|
||||||
detlist.nDacs = 16;
|
list.nDacs = 16;
|
||||||
detlist.nAdcs = 0;
|
list.nAdcs = 0;
|
||||||
detlist.nGain = 0;
|
list.nGain = 0;
|
||||||
detlist.nOffset = 0;
|
list.nOffset = 0;
|
||||||
detlist.dynamicRange = 16;
|
list.dynamicRange = 16;
|
||||||
detlist.moveFlag = 0;
|
list.moveFlag = 0;
|
||||||
detlist.nGappixelsX = 0;
|
list.nGappixelsX = 0;
|
||||||
detlist.nGappixelsY = 0;
|
list.nGappixelsY = 0;
|
||||||
break;
|
break;
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
detlist.nModMaxX = 1;
|
list.nModMaxX = 1;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 36;
|
list.nChanX = 36;
|
||||||
detlist.nChanY = 1;
|
list.nChanY = 1;
|
||||||
detlist.nChipX = 1;
|
list.nChipX = 1;
|
||||||
detlist.nChipY = 1;
|
list.nChipY = 1;
|
||||||
detlist.nDacs = 16;
|
list.nDacs = 16;
|
||||||
detlist.nAdcs = 9;//???? When calculating size, only d+a=16 how come?FIXME
|
list.nAdcs = 9;//???? When calculating size, only d+a=16 how come?FIXME
|
||||||
detlist.nGain = 0;
|
list.nGain = 0;
|
||||||
detlist.nOffset = 0;
|
list.nOffset = 0;
|
||||||
detlist.dynamicRange =16;
|
list.dynamicRange =16;
|
||||||
detlist.moveFlag = 0;
|
list.moveFlag = 0;
|
||||||
detlist.nGappixelsX = 0;
|
list.nGappixelsX = 0;
|
||||||
detlist.nGappixelsY = 0;
|
list.nGappixelsY = 0;
|
||||||
break;
|
break;
|
||||||
case EIGER:
|
case EIGER:
|
||||||
detlist.nModMaxX = 1;
|
list.nModMaxX = 1;
|
||||||
detlist.nModMaxY = 1;
|
list.nModMaxY = 1;
|
||||||
detlist.nChanX = 256;
|
list.nChanX = 256;
|
||||||
detlist.nChanY = 256;
|
list.nChanY = 256;
|
||||||
detlist.nChipX = 4;
|
list.nChipX = 4;
|
||||||
detlist.nChipY = 1;
|
list.nChipY = 1;
|
||||||
detlist.nDacs = 16;
|
list.nDacs = 16;
|
||||||
detlist.nAdcs = 0;
|
list.nAdcs = 0;
|
||||||
detlist.nGain = 0; // can be set back to 4 in case we require it again
|
list.nGain = 0; // can be set back to 4 in case we require it again
|
||||||
detlist.nOffset = 0; // can be set back to 4 in case we require it again
|
list.nOffset = 0; // can be set back to 4 in case we require it again
|
||||||
detlist.dynamicRange = 16;
|
list.dynamicRange = 16;
|
||||||
detlist.moveFlag = 0;
|
list.moveFlag = 0;
|
||||||
detlist.nGappixelsX = 6;
|
list.nGappixelsX = 6;
|
||||||
detlist.nGappixelsY = 1;
|
list.nGappixelsY = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cprintf(RED,"Unknown detector type!\n");
|
cprintf(RED,"Unknown detector type!\n");
|
||||||
throw Exception();
|
throw exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,34 +628,37 @@ int slsDetector::calculateSharedMemorySize(detectorType type) {
|
|||||||
|
|
||||||
|
|
||||||
void slsDetector::initializeDetectorStructure(detectorType type) {
|
void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||||
char *goff = (char*)thisDetector;
|
|
||||||
thisDetector->shmversion = SLS_SHMVERSION;
|
thisDetector->shmversion = SLS_SHMVERSION;
|
||||||
thisDetector->onlineFlag = OFFLINE_FLAG;
|
thisDetector->onlineFlag = OFFLINE_FLAG;
|
||||||
thisDetector->stoppedFlag = 0;
|
thisDetector->stoppedFlag = 0;
|
||||||
strncpy(thisDetector->hostname, DEFAULT_HOSTNAME, strlen(DEFAULT_HOSTNAME));
|
strncpy(thisDetector->hostname, DEFAULT_HOSTNAME, MAX_STR_LENGTH-1);
|
||||||
|
thisDetector->hostname[MAX_STR_LENGTH-1] = 0;
|
||||||
thisDetector->controlPort = DEFAULT_PORTNO;
|
thisDetector->controlPort = DEFAULT_PORTNO;
|
||||||
thisDetector->stopPort = DEFAULT_PORTNO + 1;
|
thisDetector->stopPort = DEFAULT_PORTNO + 1;
|
||||||
thisDetector->myDetectorType = type;
|
thisDetector->myDetectorType = type;
|
||||||
strncpy(thisDetector->settingsDir, getenv("HOME"), strlen(getenv("HOME")));
|
strncpy(thisDetector->settingsDir, getenv("HOME"), MAX_STR_LENGTH-1);
|
||||||
strncpy(thisDetector->calDir, getenv("HOME"), strlen(getenv("HOME")));
|
thisDetector->settingsDir[MAX_STR_LENGTH-1] = 0;
|
||||||
|
strncpy(thisDetector->calDir, getenv("HOME"), MAX_STR_LENGTH-1);
|
||||||
|
thisDetector->calDir[MAX_STR_LENGTH-1] = 0;
|
||||||
thisDetector->nTrimEn = 0;
|
thisDetector->nTrimEn = 0;
|
||||||
thisDetector->trimEnergies[100];
|
thisDetector->trimEnergies[100];
|
||||||
thisDetector->progressIndex = 0;
|
thisDetector->progressIndex = 0;
|
||||||
thisDetector->totalProgress = 1;
|
thisDetector->totalProgress = 1;
|
||||||
strncpy(thisDetector->filePath, "/", strlen("/"));
|
strcpy(thisDetector->filePath, "/");
|
||||||
thisDetector->correctionMask = 0;
|
thisDetector->correctionMask = 0;
|
||||||
thisDetector->threadedProcessing = 1;
|
thisDetector->threadedProcessing = 1;
|
||||||
thisDetector->tDead = 0;
|
thisDetector->tDead = 0;
|
||||||
strncpy(thisDetector->flatFieldDir, getenv("HOME"), strlen(getenv("HOME")));
|
strncpy(thisDetector->flatFieldDir, getenv("HOME"), MAX_STR_LENGTH-1);
|
||||||
strncpy(thisDetector->flatFieldFile, "none", strlen("none"));
|
thisDetector->flatFieldDir[MAX_STR_LENGTH-1] = 0;
|
||||||
|
strcpy(thisDetector->flatFieldFile, "none");
|
||||||
thisDetector->nBadChans = 0;
|
thisDetector->nBadChans = 0;
|
||||||
strncpy(thisDetector->badChanFile, "none", strlen("none"));
|
strcpy(thisDetector->badChanFile, "none");
|
||||||
thisDetector->nBadFF = 0;
|
thisDetector->nBadFF = 0;
|
||||||
for (int i = 0; i < MAX_BADCHANS; ++i) {
|
for (int i = 0; i < MAX_BADCHANS; ++i) {
|
||||||
thisDetector->badChansList[i] = 0;
|
thisDetector->badChansList[i] = 0;
|
||||||
thisDetector->badFFList[i] = 0;
|
thisDetector->badFFList[i] = 0;
|
||||||
}
|
}
|
||||||
strncpy(thisDetector->angConvFile, "none", strlen("none"));
|
strcpy(thisDetector->angConvFile, "none");
|
||||||
memset(thisDetector->angOff, 0, MAXMODS * sizeof(angleConversionConstant));
|
memset(thisDetector->angOff, 0, MAXMODS * sizeof(angleConversionConstant));
|
||||||
thisDetector->angDirection = 1;
|
thisDetector->angDirection = 1;
|
||||||
thisDetector->fineOffset = 0;
|
thisDetector->fineOffset = 0;
|
||||||
@ -669,7 +671,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
|||||||
thisDetector->nROI = 0;
|
thisDetector->nROI = 0;
|
||||||
memset(thisDetector->roiLimits, 0, MAX_ROIS * sizeof(ROI));
|
memset(thisDetector->roiLimits, 0, MAX_ROIS * sizeof(ROI));
|
||||||
thisDetector->roFlags = NORMAL_READOUT;
|
thisDetector->roFlags = NORMAL_READOUT;
|
||||||
strncpy(thisDetector->settingsFile, "none", strlen("none"));
|
strcpy(thisDetector->settingsFile, "none");
|
||||||
thisDetector->currentSettings = UNINITIALIZED;
|
thisDetector->currentSettings = UNINITIALIZED;
|
||||||
thisDetector->currentThresholdEV = -1;
|
thisDetector->currentThresholdEV = -1;
|
||||||
thisDetector->timerValue[FRAME_NUMBER] = 1;
|
thisDetector->timerValue[FRAME_NUMBER] = 1;
|
||||||
@ -691,25 +693,30 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
|||||||
thisDetector->timerValue[SUBFRAME_PERIOD] = 0;
|
thisDetector->timerValue[SUBFRAME_PERIOD] = 0;
|
||||||
thisDetector->actionMask = 0;
|
thisDetector->actionMask = 0;
|
||||||
for (int i = 0; i < MAX_ACTIONS; ++i) {
|
for (int i = 0; i < MAX_ACTIONS; ++i) {
|
||||||
strncpy(thisDetector->actionScript[i], "none", strlen("none"));
|
strcpy(thisDetector->actionScript[i], "none");
|
||||||
strncpy(thisDetector->actionParameter[i], "none", strlen("none"));
|
strcpy(thisDetector->actionParameter[i], "none");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < MAX_SCAN_LEVELS; ++i) {
|
for (int i = 0; i < MAX_SCAN_LEVELS; ++i) {
|
||||||
thisDetector->scanMode[i] = 0;
|
thisDetector->scanMode[i] = 0;
|
||||||
strncpy(thisDetector->scanScript[i], "none", strlen("none"));
|
strcpy(thisDetector->scanScript[i], "none");
|
||||||
strncpy(thisDetector->scanParameter[i], "none", strlen("none"));
|
strcpy(thisDetector->scanParameter[i], "none");
|
||||||
thisDetector->nScanSteps[i] = 0;
|
thisDetector->nScanSteps[i] = 0;
|
||||||
thisDetector->scanSteps[i] = 0.0;
|
{
|
||||||
|
double initValue = 0;
|
||||||
|
std::fill_n(thisDetector->scanSteps[i], MAX_SCAN_STEPS, initValue);
|
||||||
|
}
|
||||||
thisDetector->scanPrecision[i] = 0;
|
thisDetector->scanPrecision[i] = 0;
|
||||||
}
|
}
|
||||||
strncpy(thisDetector->receiver_hostname, "none", strlen("none"));
|
strcpy(thisDetector->receiver_hostname, "none");
|
||||||
thisDetector->receiverTCPPort = DEFAULT_PORTNO+2;
|
thisDetector->receiverTCPPort = DEFAULT_PORTNO+2;
|
||||||
thisDetector->receiverUDPPort = DEFAULT_UDP_PORTNO;
|
thisDetector->receiverUDPPort = DEFAULT_UDP_PORTNO;
|
||||||
thisDetector->receiverUDPPort2 = DEFAULT_UDP_PORTNO + 1;
|
thisDetector->receiverUDPPort2 = DEFAULT_UDP_PORTNO + 1;
|
||||||
strncpy(thisDetector->receiverUDPIP, "none", strlen("none"));
|
strcpy(thisDetector->receiverUDPIP, "none");
|
||||||
strncpy(thisDetector->receiverUDPMAC, "none", strlen("none"));
|
strcpy(thisDetector->receiverUDPMAC, "none");
|
||||||
strncpy(thisDetector->detectorMAC, DEFAULT_DET_MAC, strlen(DEFAULT_DET_MAC));
|
strncpy(thisDetector->detectorMAC, DEFAULT_DET_MAC, MAX_STR_LENGTH-1);
|
||||||
strncpy(thisDetector->detectorIP, DEFAULT_DET_IP, strlen(DEFAULT_DET_IP));
|
thisDetector->detectorMAC[MAX_STR_LENGTH-1] = 0;
|
||||||
|
strncpy(thisDetector->detectorIP, DEFAULT_DET_IP, MAX_STR_LENGTH-1);
|
||||||
|
thisDetector->detectorIP[MAX_STR_LENGTH-1] = 0;
|
||||||
thisDetector->receiverOnlineFlag = OFFLINE_FLAG;
|
thisDetector->receiverOnlineFlag = OFFLINE_FLAG;
|
||||||
thisDetector->tenGigaEnable = 0;
|
thisDetector->tenGigaEnable = 0;
|
||||||
thisDetector->flippedData[X] = 0;
|
thisDetector->flippedData[X] = 0;
|
||||||
@ -813,6 +820,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
|||||||
void slsDetector::initializeMembers() {
|
void slsDetector::initializeMembers() {
|
||||||
// slsdetector
|
// slsdetector
|
||||||
// assign addresses
|
// assign addresses
|
||||||
|
char *goff = (char*)thisDetector;
|
||||||
ffcoefficients = (double*)(goff + thisDetector->ffoff);
|
ffcoefficients = (double*)(goff + thisDetector->ffoff);
|
||||||
fferrors = (double*)(goff + thisDetector->fferroff);
|
fferrors = (double*)(goff + thisDetector->fferroff);
|
||||||
detectorModules = (sls_detector_module*)(goff + thisDetector->modoff);
|
detectorModules = (sls_detector_module*)(goff + thisDetector->modoff);
|
||||||
@ -839,6 +847,7 @@ void slsDetector::initializeMembers() {
|
|||||||
fileIndex=multiDet->fileIndex;
|
fileIndex=multiDet->fileIndex;
|
||||||
framesPerFile=multiDet->framesPerFile;
|
framesPerFile=multiDet->framesPerFile;
|
||||||
fileFormatType=multiDet->fileFormatType;
|
fileFormatType=multiDet->fileFormatType;
|
||||||
|
|
||||||
if (thisDetector->myDetectorType != MYTHEN)
|
if (thisDetector->myDetectorType != MYTHEN)
|
||||||
fileIO::setFileFormat(BINARY);
|
fileIO::setFileFormat(BINARY);
|
||||||
switch(thisDetector->myDetectorType) {
|
switch(thisDetector->myDetectorType) {
|
||||||
@ -870,10 +879,6 @@ void slsDetector::initializeMembers() {
|
|||||||
badChannelMask = NULL;
|
badChannelMask = NULL;
|
||||||
fdata = NULL;
|
fdata = NULL;
|
||||||
thisData = NULL;
|
thisData = NULL;
|
||||||
ppFun = NULL;
|
|
||||||
ang = NULL;
|
|
||||||
val = NULL;
|
|
||||||
err = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
// slsDetectorActions
|
// slsDetectorActions
|
||||||
@ -913,12 +918,17 @@ void slsDetector::initializeMembers() {
|
|||||||
|
|
||||||
|
|
||||||
void slsDetector::initializeDetectorStructurePointers() {
|
void slsDetector::initializeDetectorStructurePointers() {
|
||||||
// initialize with defaults
|
sls_detector_module* thisMod;
|
||||||
ffcoefficients??
|
|
||||||
fferrors??
|
|
||||||
sls_detector_module *thisMod;
|
|
||||||
for (int imod = 0; imod < thisDetector->nModsMax; ++imod) {
|
for (int imod = 0; imod < thisDetector->nModsMax; ++imod) {
|
||||||
|
|
||||||
|
// initializes the ffcoefficients values to 0
|
||||||
|
for (int i = 0; i < thisDetector->nChans * thisDetector->nChips; ++i) {
|
||||||
|
*(ffcoefficients + i + thisDetector->nChans * thisDetector->nChips * imod) = 0;
|
||||||
|
}
|
||||||
|
// initializes the fferrors values to 0
|
||||||
|
for (int i = 0; i < thisDetector->nChans * thisDetector->nChips; ++i) {
|
||||||
|
*(fferrors + i + thisDetector->nChans * thisDetector->nChips * imod) = 0;
|
||||||
|
}
|
||||||
// set thisMod to point to one of the detector structure modules
|
// set thisMod to point to one of the detector structure modules
|
||||||
thisMod = detectorModules + imod;
|
thisMod = detectorModules + imod;
|
||||||
|
|
||||||
@ -968,7 +978,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t) {
|
slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType type) {
|
||||||
// get the detector parameters based on type
|
// get the detector parameters based on type
|
||||||
detParameterList detlist;
|
detParameterList detlist;
|
||||||
int nch = 0, nc = 0, nd = 0, na = 0;
|
int nch = 0, nc = 0, nd = 0, na = 0;
|
||||||
@ -979,7 +989,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
|||||||
nd = detlist.nDacs;
|
nd = detlist.nDacs;
|
||||||
na = detlist.nAdcs;
|
na = detlist.nAdcs;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
// FIXME do what here?
|
;// FIXME do what here?
|
||||||
}
|
}
|
||||||
dacs_t *dacs=new dacs_t[nd];
|
dacs_t *dacs=new dacs_t[nd];
|
||||||
dacs_t *adcs=new dacs_t[na];
|
dacs_t *adcs=new dacs_t[na];
|
||||||
@ -1228,20 +1238,18 @@ int slsDetector::receiveModule(sls_detector_module* myMod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
detectorType slsDetector::getDetectorTypeFromShm(int multiId) {
|
slsReceiverDefs::detectorType slsDetector::getDetectorTypeFromShm(int multiId, bool verify) {
|
||||||
SharedMemory* shm = new SharedMemory(multiId, detId);
|
SharedMemory* shm = new SharedMemory(multiId, detId);
|
||||||
std::string shmname = shm->GetName();
|
|
||||||
|
|
||||||
// shm not created before
|
// shm not created before
|
||||||
if (!SharedMemory::IsExisting(shmname)) {
|
if (!SharedMemory::IsExisting(shm->GetName())) {
|
||||||
cprintf(RED,"Shared memory %s does not exist.\n"
|
cprintf(RED,"Shared memory %s does not exist.\n"
|
||||||
"Corrupted Multi Shared memory. Please free shared memory.\n",
|
"Corrupted Multi Shared memory. Please free shared memory.\n",
|
||||||
shmname.c_str());
|
shm->GetName().c_str());
|
||||||
throw SharedMemoryException();
|
throw SharedMemoryException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// map basic size of sls detector structure (no need of offsets, just version is required)
|
// map basic size of sls detector structure (no need of offsets, just version is required)
|
||||||
slsDetector* sdet = 0;
|
sharedSlsDetector* sdet = 0;
|
||||||
size_t sz = sizeof(sharedSlsDetector);
|
size_t sz = sizeof(sharedSlsDetector);
|
||||||
|
|
||||||
// open, map, verify version, get type
|
// open, map, verify version, get type
|
||||||
@ -1254,7 +1262,7 @@ detectorType slsDetector::getDetectorTypeFromShm(int multiId) {
|
|||||||
delete shm;/** is this unncessary? */
|
delete shm;/** is this unncessary? */
|
||||||
throw SharedMemoryException();
|
throw SharedMemoryException();
|
||||||
}
|
}
|
||||||
detectorType type = sdet->type;
|
detectorType type = sdet->myDetectorType;
|
||||||
|
|
||||||
// unmap
|
// unmap
|
||||||
shm->UnmapSharedMemory(sdet);
|
shm->UnmapSharedMemory(sdet);
|
||||||
@ -1376,7 +1384,7 @@ slsDetectorDefs::detectorType slsDetector::getDetectorsType(int pos) {
|
|||||||
return thisDetector->myDetectorType;
|
return thisDetector->myDetectorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
string slsDetector::sgetDetectorsType(int pos=-1) {
|
string slsDetector::sgetDetectorsType(int pos) {
|
||||||
return getDetectorType(getDetectorsType(pos));
|
return getDetectorType(getDetectorsType(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1581,11 +1589,11 @@ std::cout<< "nModX " << thisDetector->nMod[X] << " nModY " << thisDetector->nMod
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::getChansPerMod(int imod=0) {
|
int slsDetector::getChansPerMod(int imod) {
|
||||||
return thisDetector->nChans*thisDetector->nChips;
|
return thisDetector->nChans*thisDetector->nChips;
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetector::getChansPerMod( dimension d,int imod=0) {
|
int slsDetector::getChansPerMod( dimension d,int imod) {
|
||||||
return thisDetector->nChan[d]*thisDetector->nChip[d];
|
return thisDetector->nChan[d]*thisDetector->nChip[d];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2545,8 +2553,8 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
f
|
|
||||||
int nsig=4;//-1;
|
int nsig=4;
|
||||||
int iv=0;
|
int iv=0;
|
||||||
char *args[100];
|
char *args[100];
|
||||||
char myargs[100][1000];
|
char myargs[100][1000];
|
||||||
@ -4418,8 +4426,8 @@ int slsDetector::setDynamicRange(int n) {
|
|||||||
}
|
}
|
||||||
if(thisDetector->myDetectorType==MYTHEN){
|
if(thisDetector->myDetectorType==MYTHEN){
|
||||||
if (thisDetector->timerValue[PROBES_NUMBER]!=0) {
|
if (thisDetector->timerValue[PROBES_NUMBER]!=0) {
|
||||||
thisDetector->dataBytes=thisDetector->nMod[X]*t
|
thisDetector->dataBytes=thisDetector->nMod[X]*
|
||||||
hisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
|
thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
|
||||||
thisDetector->dataBytesInclGapPixels =
|
thisDetector->dataBytesInclGapPixels =
|
||||||
(thisDetector->nMod[X] * thisDetector->nChip[X] *
|
(thisDetector->nMod[X] * thisDetector->nChip[X] *
|
||||||
thisDetector->nChan[X] + thisDetector->gappixels *
|
thisDetector->nChan[X] + thisDetector->gappixels *
|
||||||
@ -6169,15 +6177,12 @@ int slsDetector::activate(int const enable) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetector::getFlippedData(dimension d) {
|
||||||
int slsDetector::getFlippedData(dimension d=X) {
|
|
||||||
return thisDetector->flippedData[d];
|
return thisDetector->flippedData[d];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::setFlippedData(dimension d, int value) {
|
int slsDetector::setFlippedData(dimension d, int value) {
|
||||||
int retval=-1;
|
int retval=-1;
|
||||||
int fnum=F_SET_FLIPPED_DATA_RECEIVER;
|
int fnum=F_SET_FLIPPED_DATA_RECEIVER;
|
||||||
@ -6335,8 +6340,7 @@ int slsDetector::enableGapPixels(int val) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::setTrimEn(int nen, int *en=NULL) {
|
int slsDetector::setTrimEn(int nen, int *en) {
|
||||||
{
|
|
||||||
if (en) {
|
if (en) {
|
||||||
for (int ien=0; ien<nen; ien++)
|
for (int ien=0; ien<nen; ien++)
|
||||||
thisDetector->trimEnergies[ien]=en[ien];
|
thisDetector->trimEnergies[ien]=en[ien];
|
||||||
@ -6346,12 +6350,12 @@ int slsDetector::setTrimEn(int nen, int *en=NULL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::getTrimEn(int *en=NULL) {
|
int slsDetector::getTrimEn(int *en) {
|
||||||
if (en) {
|
if (en) {
|
||||||
for (int ien=0; ien<thisDetector->nTrimEn; ien++)
|
for (int ien=0; ien<thisDetector->nTrimEn; ien++)
|
||||||
en[ien]=thisDetector->trimEnergies[ien];
|
en[ien]=thisDetector->trimEnergies[ien];
|
||||||
}
|
}
|
||||||
return (thisDetector->nTrimEn);};
|
return (thisDetector->nTrimEn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8136,7 +8140,7 @@ int slsDetector::getAngularConversion(int &direction, angleConversionConstant *
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
angleConversionConstant* slsDetector::getAngularConversionPointer(int imod=0) {
|
angleConversionConstant* slsDetector::getAngularConversionPointer(int imod) {
|
||||||
return &thisDetector->angOff[imod];
|
return &thisDetector->angOff[imod];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8738,7 +8742,7 @@ slsReceiverDefs::fileFormat slsDetector::setFileFormat(fileFormat f) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
fileFormat slsDetector::getFileFormat() {
|
slsReceiverDefs::fileFormat slsDetector::getFileFormat() {
|
||||||
return setFileFormat();
|
return setFileFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9141,7 +9145,7 @@ int slsDetector::setReceiverReadTimer(int time_in_ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::enableDataStreamingToClient(int enable=-1) {
|
int slsDetector::enableDataStreamingToClient(int enable) {
|
||||||
cprintf(RED,"ERROR: Must be called from the multi Detector level\n");
|
cprintf(RED,"ERROR: Must be called from the multi Detector level\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ public:
|
|||||||
* @param verify true to verify if shared memory version matches existing one
|
* @param verify true to verify if shared memory version matches existing one
|
||||||
* @param m multiSlsDetector reference
|
* @param m multiSlsDetector reference
|
||||||
*/
|
*/
|
||||||
slsDetector(detectorType type, int multiId = 0, int id = 0, bool verify = true, MultiDet* m = NULL);
|
slsDetector(detectorType type, int multiId = 0, int id = 0, bool verify = true, multiSlsDetector* m = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor called when opening existing shared memory
|
* Constructor called when opening existing shared memory
|
||||||
@ -399,7 +399,7 @@ public:
|
|||||||
* @param verify true to verify if shared memory version matches existing one
|
* @param verify true to verify if shared memory version matches existing one
|
||||||
* @param m multiSlsDetector reference
|
* @param m multiSlsDetector reference
|
||||||
*/
|
*/
|
||||||
slsDetector(int multiId = 0, int id = 0, bool verify = true, MultiDet* m = NULL);
|
slsDetector(int multiId = 0, int id = 0, bool verify = true, multiSlsDetector* m = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
@ -484,7 +484,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Sets the hostname of all sls detectors in shared memory
|
* Sets the hostname of all sls detectors in shared memory
|
||||||
* Connects to them to set up online flag
|
* Connects to them to set up online flag
|
||||||
* @param s hostname
|
* @param name hostname
|
||||||
*/
|
*/
|
||||||
void setHostname(const char *name);
|
void setHostname(const char *name);
|
||||||
|
|
||||||
@ -495,6 +495,39 @@ public:
|
|||||||
*/
|
*/
|
||||||
string getHostname(int pos = -1);
|
string getHostname(int pos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to the control port
|
||||||
|
* @returns OK, FAIL or undefined
|
||||||
|
*/
|
||||||
|
int connectControl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect the control port
|
||||||
|
*/
|
||||||
|
void disconnectControl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to the data port
|
||||||
|
* @returns OK, FAIL or undefined
|
||||||
|
*/
|
||||||
|
int connectData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect the data port
|
||||||
|
*/
|
||||||
|
void disconnectData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to the stop port
|
||||||
|
* @returns OK, FAIL or undefined
|
||||||
|
*/
|
||||||
|
int connectStop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect the stop port
|
||||||
|
*/
|
||||||
|
void disconnectStop();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get detector type by connecting to the detector without creating an object
|
* Get detector type by connecting to the detector without creating an object
|
||||||
* @param name hostname of detector
|
* @param name hostname of detector
|
||||||
@ -1195,6 +1228,153 @@ public:
|
|||||||
*/
|
*/
|
||||||
string getNetworkParameter(networkParameter index);
|
string getNetworkParameter(networkParameter index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the detector MAC address\sa sharedSlsDetector
|
||||||
|
* @returns the detector MAC address
|
||||||
|
*/
|
||||||
|
string getDetectorMAC();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the detector IP address\sa sharedSlsDetector
|
||||||
|
* @returns the detector IP address
|
||||||
|
*/
|
||||||
|
string getDetectorIP();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the receiver IP address\sa sharedSlsDetector
|
||||||
|
* @returns the receiver IP address
|
||||||
|
*/
|
||||||
|
string getReceiver();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the receiver UDP IP address\sa sharedSlsDetector
|
||||||
|
* @returns the receiver UDP IP address
|
||||||
|
*/
|
||||||
|
string getReceiverUDPIP();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the receiver UDP MAC address\sa sharedSlsDetector
|
||||||
|
* @returns the receiver UDP MAC address
|
||||||
|
*/
|
||||||
|
string getReceiverUDPMAC();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the receiver UDP port\sa sharedSlsDetector
|
||||||
|
* @returns the receiver UDP port
|
||||||
|
*/
|
||||||
|
string getReceiverUDPPort();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
||||||
|
* @returns the receiver UDP port 2 of same interface
|
||||||
|
*/
|
||||||
|
string getReceiverUDPPort2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the client zmq port \sa sharedSlsDetector
|
||||||
|
* @returns the client zmq port
|
||||||
|
*/
|
||||||
|
string getClientStreamingPort();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the receiver zmq port \sa sharedSlsDetector
|
||||||
|
* @returns the receiver zmq port
|
||||||
|
*/
|
||||||
|
string getReceiverStreamingPort();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the client zmq ip \sa sharedSlsDetector
|
||||||
|
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||||
|
*/
|
||||||
|
string getClientStreamingIP();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the receiver zmq ip \sa sharedSlsDetector
|
||||||
|
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||||
|
*/
|
||||||
|
string getReceiverStreamingIP();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
|
||||||
|
* @param detectorMAC detector MAC address
|
||||||
|
* @returns the detector MAC address
|
||||||
|
*/
|
||||||
|
string setDetectorMAC(string detectorMAC);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the format of the detector IP address and sets it \sa sharedSlsDetector
|
||||||
|
* @param detectorIP detector IP address
|
||||||
|
* @returns the detector IP address
|
||||||
|
*/
|
||||||
|
string setDetectorIP(string detectorIP);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates and sets the receiver.
|
||||||
|
* Also updates the receiver with all the shared memory parameters significant for the receiver
|
||||||
|
* Also configures the detector to the receiver as UDP destination
|
||||||
|
* @param receiver receiver hostname or IP address
|
||||||
|
* @returns the receiver IP address from shared memory
|
||||||
|
*/
|
||||||
|
string setReceiver(string receiver);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the format of the receiver UDP IP address and sets it \sa sharedSlsDetector
|
||||||
|
* @param udpip receiver UDP IP address
|
||||||
|
* @returns the receiver UDP IP address
|
||||||
|
*/
|
||||||
|
string setReceiverUDPIP(string udpip);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the format of the receiver UDP MAC address and sets it \sa sharedSlsDetector
|
||||||
|
* @param udpmac receiver UDP MAC address
|
||||||
|
* @returns the receiver UDP MAC address
|
||||||
|
*/
|
||||||
|
string setReceiverUDPMAC(string udpmac);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the receiver UDP port\sa sharedSlsDetector
|
||||||
|
* @param udpport receiver UDP port
|
||||||
|
* @returns the receiver UDP port
|
||||||
|
*/
|
||||||
|
int setReceiverUDPPort(int udpport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the receiver UDP port 2\sa sharedSlsDetector
|
||||||
|
* @param udpport receiver UDP port 2
|
||||||
|
* @returns the receiver UDP port 2
|
||||||
|
*/
|
||||||
|
int setReceiverUDPPort2(int udpport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the client zmq port\sa sharedSlsDetector
|
||||||
|
* @param port client zmq port (includes "multi" at the end if it should
|
||||||
|
* calculate individual ports)
|
||||||
|
* @returns the client zmq port
|
||||||
|
*/
|
||||||
|
string setClientStreamingPort(string port);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the receiver zmq port\sa sharedSlsDetector
|
||||||
|
* @param port receiver zmq port (includes "multi" at the end if it should
|
||||||
|
* calculate individual ports)
|
||||||
|
* @returns the receiver zmq port
|
||||||
|
*/
|
||||||
|
string setReceiverStreamingPort(string port);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the client zmq ip\sa sharedSlsDetector
|
||||||
|
* @param sourceIP client zmq ip
|
||||||
|
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||||
|
*/
|
||||||
|
string setClientStreamingIP(string sourceIP);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the receiver zmq ip\sa sharedSlsDetector
|
||||||
|
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname
|
||||||
|
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||||
|
*/
|
||||||
|
string setReceiverStreamingIP(string sourceIP);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a digital test (Gotthard, Mythen)
|
* Execute a digital test (Gotthard, Mythen)
|
||||||
* @param mode testmode type
|
* @param mode testmode type
|
||||||
@ -1310,7 +1490,7 @@ public:
|
|||||||
* @param d axis across which data is flipped
|
* @param d axis across which data is flipped
|
||||||
* @returns 1 for flipped, else 0
|
* @returns 1 for flipped, else 0
|
||||||
*/
|
*/
|
||||||
int getFlippedData(dimension d=X){return thisDetector->flippedData[d];};
|
int getFlippedData(dimension d=X);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the enable which determines if
|
* Sets the enable which determines if
|
||||||
@ -1831,7 +2011,7 @@ public:
|
|||||||
* Returns file index
|
* Returns file index
|
||||||
* @returns file index
|
* @returns file index
|
||||||
*/
|
*/
|
||||||
int getFileIndex(){return setFileIndex();};
|
int getFileIndex();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the file index
|
* Sets up the file index
|
||||||
@ -2080,10 +2260,10 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Allocates the memory for a sls_detector_module structure and initializes it
|
* Allocates the memory for a sls_detector_module structure and initializes it
|
||||||
* Has detector type
|
* Has detector type
|
||||||
* @param myDetectorType detector type
|
* @param type detector type
|
||||||
* @returns myMod the pointer to the allocate dmemory location
|
* @returns myMod the pointer to the allocate dmemory location
|
||||||
*/
|
*/
|
||||||
sls_detector_module* createModule(detectorType myDetectorType);
|
sls_detector_module* createModule(detectorType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frees the memory for a sls_detector_module structure
|
* Frees the memory for a sls_detector_module structure
|
||||||
@ -2091,39 +2271,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
void deleteModule(sls_detector_module *myMod);
|
void deleteModule(sls_detector_module *myMod);
|
||||||
|
|
||||||
/**
|
|
||||||
* Connect to the control port
|
|
||||||
* @returns OK, FAIL or undefined
|
|
||||||
*/
|
|
||||||
int connectControl();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disconnect the control port
|
|
||||||
*/
|
|
||||||
void disconnectControl();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Connect to the data port
|
|
||||||
* @returns OK, FAIL or undefined
|
|
||||||
*/
|
|
||||||
int connectData();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disconnect the data port
|
|
||||||
*/
|
|
||||||
int disconnectData();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Connect to the stop port
|
|
||||||
* @returns OK, FAIL or undefined
|
|
||||||
*/
|
|
||||||
int connectStop();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disconnect the stop port
|
|
||||||
*/
|
|
||||||
int disconnectStop();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a sls_detector_channel structure over socket
|
* Send a sls_detector_channel structure over socket
|
||||||
* @param myChan channel structure to send
|
* @param myChan channel structure to send
|
||||||
@ -2166,72 +2313,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
int receiveModule(sls_detector_module* myMod);
|
int receiveModule(sls_detector_module* myMod);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the detector MAC address\sa sharedSlsDetector
|
|
||||||
* @returns the detector MAC address
|
|
||||||
*/
|
|
||||||
string getDetectorMAC();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the detector IP address\sa sharedSlsDetector
|
|
||||||
* @returns the detector IP address
|
|
||||||
*/
|
|
||||||
string getDetectorIP();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the receiver IP address\sa sharedSlsDetector
|
|
||||||
* @returns the receiver IP address
|
|
||||||
*/
|
|
||||||
string getReceiver();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the receiver UDP IP address\sa sharedSlsDetector
|
|
||||||
* @returns the receiver UDP IP address
|
|
||||||
*/
|
|
||||||
string getReceiverUDPIP();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the receiver UDP MAC address\sa sharedSlsDetector
|
|
||||||
* @returns the receiver UDP MAC address
|
|
||||||
*/
|
|
||||||
string getReceiverUDPMAC();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the receiver UDP port\sa sharedSlsDetector
|
|
||||||
* @returns the receiver UDP port
|
|
||||||
*/
|
|
||||||
string getReceiverUDPPort();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
|
||||||
* @returns the receiver UDP port 2 of same interface
|
|
||||||
*/
|
|
||||||
string getReceiverUDPPort2();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the client zmq port \sa sharedSlsDetector
|
|
||||||
* @returns the client zmq port
|
|
||||||
*/
|
|
||||||
string getClientStreamingPort();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the receiver zmq port \sa sharedSlsDetector
|
|
||||||
* @returns the receiver zmq port
|
|
||||||
*/
|
|
||||||
string getReceiverStreamingPort();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the client zmq ip \sa sharedSlsDetector
|
|
||||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
|
||||||
*/
|
|
||||||
string getClientStreamingIP();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the receiver zmq ip \sa sharedSlsDetector
|
|
||||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
|
||||||
*/
|
|
||||||
string getReceiverStreamingIP();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the additional json header \sa sharedSlsDetector
|
* Returns the additional json header \sa sharedSlsDetector
|
||||||
* @returns the additional json header, returns "none" if default setting and no custom ip set
|
* @returns the additional json header, returns "none" if default setting and no custom ip set
|
||||||
@ -2250,87 +2331,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
string getReceiverRealUDPSocketBufferSize();
|
string getReceiverRealUDPSocketBufferSize();
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
|
|
||||||
* @param detectorMAC detector MAC address
|
|
||||||
* @returns the detector MAC address
|
|
||||||
*/
|
|
||||||
string setDetectorMAC(string detectorMAC);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates the format of the detector IP address and sets it \sa sharedSlsDetector
|
|
||||||
* @param detectorIP detector IP address
|
|
||||||
* @returns the detector IP address
|
|
||||||
*/
|
|
||||||
string setDetectorIP(string detectorIP);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates and sets the receiver.
|
|
||||||
* Also updates the receiver with all the shared memory parameters significant for the receiver
|
|
||||||
* Also configures the detector to the receiver as UDP destination
|
|
||||||
* @param receiver receiver hostname or IP address
|
|
||||||
* @returns the receiver IP address from shared memory
|
|
||||||
*/
|
|
||||||
string setReceiver(string receiver);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates the format of the receiver UDP IP address and sets it \sa sharedSlsDetector
|
|
||||||
* @param udpip receiver UDP IP address
|
|
||||||
* @returns the receiver UDP IP address
|
|
||||||
*/
|
|
||||||
string setReceiverUDPIP(string udpip);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates the format of the receiver UDP MAC address and sets it \sa sharedSlsDetector
|
|
||||||
* @param udpmac receiver UDP MAC address
|
|
||||||
* @returns the receiver UDP MAC address
|
|
||||||
*/
|
|
||||||
string setReceiverUDPMAC(string udpmac);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the receiver UDP port\sa sharedSlsDetector
|
|
||||||
* @param udpport receiver UDP port
|
|
||||||
* @returns the receiver UDP port
|
|
||||||
*/
|
|
||||||
int setReceiverUDPPort(int udpport);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the receiver UDP port 2\sa sharedSlsDetector
|
|
||||||
* @param udpport receiver UDP port 2
|
|
||||||
* @returns the receiver UDP port 2
|
|
||||||
*/
|
|
||||||
int setReceiverUDPPort2(int udpport);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the client zmq port\sa sharedSlsDetector
|
|
||||||
* @param port client zmq port (includes "multi" at the end if it should
|
|
||||||
* calculate individual ports)
|
|
||||||
* @returns the client zmq port
|
|
||||||
*/
|
|
||||||
string setClientStreamingPort(string port);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the receiver zmq port\sa sharedSlsDetector
|
|
||||||
* @param port receiver zmq port (includes "multi" at the end if it should
|
|
||||||
* calculate individual ports)
|
|
||||||
* @returns the receiver zmq port
|
|
||||||
*/
|
|
||||||
string setReceiverStreamingPort(string port);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the client zmq ip\sa sharedSlsDetector
|
|
||||||
* @param sourceIP client zmq ip
|
|
||||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
|
||||||
*/
|
|
||||||
string setClientStreamingIP(string sourceIP);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the receiver zmq ip\sa sharedSlsDetector
|
|
||||||
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname
|
|
||||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
|
||||||
*/
|
|
||||||
string setReceiverStreamingIP(string sourceIP);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the additional json header\sa sharedSlsDetector
|
* Sets the additional json header\sa sharedSlsDetector
|
||||||
* @param jsonheader additional json header
|
* @param jsonheader additional json header
|
||||||
|
@ -264,14 +264,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page config
|
/*! \page config
|
||||||
- \b add Adds a detector at the end of the multi-detector structure. \c put argument is the hostname or IP adress. Returns the chained list of detector hostnames.
|
- \b add Adds a detector at the end of the multi-detector structure. \c put argument is the hostname or IP adress. cannot get. \c Returns the current list of detector hostnames. \c (string)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName="add";//OK
|
descrToFuncMap[i].m_pFuncName="add";//OK
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdd;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdHostname;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page config
|
/*! \page config
|
||||||
- <b>hostname</b> \c put adds the hostname (ot IP adress) at the end of the multi-detector structure. If used for a single controlled (i:) replaces the current hostname. Returns the list of the hostnames of the multi-detector structure. \c Returns \c (string)
|
- <b>hostname</b> \c put frees shared memory and sets the hostname (or IP adress).\c Returns the list of the hostnames of the multi-detector structure. \c Returns \c (string)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName="hostname"; //OK
|
descrToFuncMap[i].m_pFuncName="hostname"; //OK
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdHostname;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdHostname;
|
||||||
@ -2697,7 +2697,7 @@ string slsDetectorCommand::helpFree(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
string slsDetectorCommand::cmdAdd(int narg, char *args[], int action) {
|
string slsDetectorCommand::cmdAdd(int narg, char *args[], int action) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||||
@ -2733,7 +2733,7 @@ string slsDetectorCommand::helpAdd(int narg, char *args[], int action){
|
|||||||
"det can either be the detector hostname or the detector id. "
|
"det can either be the detector hostname or the detector id. "
|
||||||
"Returns hostnames in the multi detector structure\n");
|
"Returns hostnames in the multi detector structure\n");
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
string slsDetectorCommand::cmdReplace(int narg, char *args[], int action){
|
string slsDetectorCommand::cmdReplace(int narg, char *args[], int action){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||||
@ -2764,6 +2764,9 @@ string slsDetectorCommand::cmdHostname(int narg, char *args[], int action){
|
|||||||
if (action==HELP_ACTION) {
|
if (action==HELP_ACTION) {
|
||||||
return helpHostname(narg,args,HELP_ACTION);
|
return helpHostname(narg,args,HELP_ACTION);
|
||||||
}
|
}
|
||||||
|
if ((action==GET_ACTION) && (cmd == "add")) {
|
||||||
|
return string("cannot get");
|
||||||
|
}
|
||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
|
|
||||||
@ -2780,7 +2783,6 @@ string slsDetectorCommand::cmdHostname(int narg, char *args[], int action){
|
|||||||
if(narg>2)
|
if(narg>2)
|
||||||
strcat(hostname,"+");
|
strcat(hostname,"+");
|
||||||
}
|
}
|
||||||
myDet->freeSharedMemory();
|
|
||||||
myDet->setHostname(hostname);
|
myDet->setHostname(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2795,9 +2797,13 @@ string slsDetectorCommand::helpHostname(int narg, char *args[], int action){
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
if (action==GET_ACTION || action==HELP_ACTION)
|
if (action==GET_ACTION || action==HELP_ACTION)
|
||||||
os << string("hostname \t returns the hostname(s) of the detector structure.");
|
os << string("hostname \t returns the hostname(s) of the detector structure.");
|
||||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||||
os << string("hostname name [name name]\t frees shared memory and "
|
os << string("hostname name [name name]\t frees shared memory and "
|
||||||
"configures the hostnames of the detector structure.\n");
|
"configures the hostnames of the detector structure.\n");
|
||||||
|
os << string ("add det [det det]\t appends a detector(s) to the multi detector structure. "
|
||||||
|
"det can either be the detector hostname or the detector id. "
|
||||||
|
"Returns hostnames in the multi detector structure\n");
|
||||||
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
static std::string helpStatus(int narg, char *args[], int action);
|
static std::string helpStatus(int narg, char *args[], int action);
|
||||||
static std::string helpDataStream(int narg, char *args[], int action);
|
static std::string helpDataStream(int narg, char *args[], int action);
|
||||||
static std::string helpFree(int narg, char *args[], int action);
|
static std::string helpFree(int narg, char *args[], int action);
|
||||||
static std::string helpAdd(int narg, char *args[], int action);
|
// static std::string helpAdd(int narg, char *args[], int action);
|
||||||
// static std::string helpReplace(int narg, char *args[], int action);
|
// static std::string helpReplace(int narg, char *args[], int action);
|
||||||
static std::string helpHostname(int narg, char *args[], int action);
|
static std::string helpHostname(int narg, char *args[], int action);
|
||||||
static std::string helpMaster(int narg, char *args[], int action);
|
static std::string helpMaster(int narg, char *args[], int action);
|
||||||
@ -112,7 +112,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
std::string cmdStatus(int narg, char *args[], int action);
|
std::string cmdStatus(int narg, char *args[], int action);
|
||||||
std::string cmdDataStream(int narg, char *args[], int action);
|
std::string cmdDataStream(int narg, char *args[], int action);
|
||||||
std::string cmdFree(int narg, char *args[], int action);
|
std::string cmdFree(int narg, char *args[], int action);
|
||||||
std::string cmdAdd(int narg, char *args[], int action);
|
//std::string cmdAdd(int narg, char *args[], int action);
|
||||||
//std::string cmdReplace(int narg, char *args[], int action);
|
//std::string cmdReplace(int narg, char *args[], int action);
|
||||||
std::string cmdHostname(int narg, char *args[], int action);
|
std::string cmdHostname(int narg, char *args[], int action);
|
||||||
std::string cmdMaster(int narg, char *args[], int action);
|
std::string cmdMaster(int narg, char *args[], int action);
|
||||||
|
@ -204,10 +204,8 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
|
|
||||||
/** sets the detector hostname
|
/** sets the detector hostname
|
||||||
\param name hostname
|
\param name hostname
|
||||||
\param pos position in the multi detector structure (is -1 expects concatenated hostnames divided by a +)
|
|
||||||
\returns hostname
|
|
||||||
*/
|
*/
|
||||||
virtual std::string setHostname(const char* name, int pos=-1)=0;
|
virtual void setHostname(const char* name)=0;
|
||||||
|
|
||||||
|
|
||||||
/** returns the detector type
|
/** returns the detector type
|
||||||
@ -216,25 +214,6 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
*/
|
*/
|
||||||
virtual std::string sgetDetectorsType(int pos=-1)=0;
|
virtual std::string sgetDetectorsType(int pos=-1)=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Gets the detector id (shared memory id) of an slsDetector
|
|
||||||
\param i position in the multiSlsDetector structure
|
|
||||||
\return id or -1 if FAIL
|
|
||||||
*/
|
|
||||||
virtual int getDetectorId(int i=-1)=0;
|
|
||||||
|
|
||||||
/** Sets the detector id (shared memory id) of an slsDetector in a multiSlsDetector structure
|
|
||||||
\param ival id to be set
|
|
||||||
\param i position in the multiSlsDetector structure
|
|
||||||
\return id or -1 if FAIL (e.g. in case of an slsDetector)
|
|
||||||
*/
|
|
||||||
virtual int setDetectorId(int ival, int i=-1){return -1;};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
gets the network parameters (implemented for gotthard)
|
gets the network parameters (implemented for gotthard)
|
||||||
\param i network parameter type can be RECEIVER_IP, RECEIVER_MAC, SERVER_MAC
|
\param i network parameter type can be RECEIVER_IP, RECEIVER_MAC, SERVER_MAC
|
||||||
@ -415,7 +394,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
virtual std::string setCalDir(std::string s)=0;
|
virtual std::string setCalDir(std::string s)=0;
|
||||||
|
|
||||||
/** Frees the shared memory - should not be used except for debugging*/
|
/** Frees the shared memory - should not be used except for debugging*/
|
||||||
virtual int freeSharedMemory()=0;
|
virtual void freeSharedMemory()=0;
|
||||||
|
|
||||||
|
|
||||||
/** adds the detector with ID id in postion pos
|
/** adds the detector with ID id in postion pos
|
||||||
|
@ -160,14 +160,22 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
|||||||
\param i detector index to be set
|
\param i detector index to be set
|
||||||
\returns actual detector index
|
\returns actual detector index
|
||||||
*/
|
*/
|
||||||
virtual int setDetectorIndex(int i) {detIndex=i;return detIndex;};
|
virtual int setDetectorIndex(int i) {
|
||||||
|
pthread_mutex_lock(&mf);
|
||||||
|
detIndex=i;
|
||||||
|
pthread_mutex_unlock(&mf);
|
||||||
|
return detIndex;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
sets the default file format
|
sets the default file format
|
||||||
\param i file format to be set
|
\param i file format to be set
|
||||||
\returns actual file frame format
|
\returns actual file frame format
|
||||||
*/
|
*/
|
||||||
virtual fileFormat setFileFormat(int i) {*fileFormatType=(fileFormat)i; return *fileFormatType;};
|
virtual fileFormat setFileFormat(int i) {
|
||||||
|
pthread_mutex_lock(&mf);
|
||||||
|
*fileFormatType=(fileFormat)i;
|
||||||
|
pthread_mutex_unlock(&mf);
|
||||||
|
return *fileFormatType; };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user