Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer

This commit is contained in:
maliakal_d 2018-05-28 19:17:37 +02:00
commit 15aaa93130
10 changed files with 5234 additions and 6175 deletions

View File

@ -521,7 +521,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
}
}
else if(action==actionLoadTrimbits){
QString fName = QString(myDet->getSettingsDir());
QString fName = QString( (myDet->getSettingsDir()).c_str());
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
//gotthard
if(actionLoadTrimbits->text().contains("Settings")){
@ -568,7 +568,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
cout << "Saving Settings" << endl;
#endif
//different output directory so as not to overwrite
QString fName = QString(myDet->getSettingsDir());
QString fName = QString( (myDet->getSettingsDir()).c_str() );
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Settings"),fName,
@ -585,7 +585,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
#ifdef VERBOSE
cout << "Saving Trimbits" << endl;
#endif//different output directory so as not to overwrite
QString fName = QString(myDet->getSettingsDir());
QString fName = QString( (myDet->getSettingsDir()).c_str() );
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Trimbits"),fName,
@ -603,7 +603,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
#ifdef VERBOSE
cout << "Loading Calibration Data" << endl;
#endif
QString fName = QString(myDet->getCalDir());
QString fName = QString( (myDet->getCalDir()).c_str() );
qDefs::checkErrorMessage(myDet);
//so that even nonexisting files can be selected
@ -626,7 +626,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
#ifdef VERBOSE
cout << "Saving Calibration Data" << endl;
#endif//different output directory so as not to overwrite
QString fName = QString(myDet->getCalDir());
QString fName = QString( (myDet->getCalDir()).c_str() );
qDefs::checkErrorMessage(myDet);
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Calibration Data"),fName,

View File

@ -38,7 +38,10 @@ void qTabSettings::SetupWidgetWindow(){
detType=myDet->getDetectorsType();
// Settings
SetupDetectorSettings();
if (detType != slsReceiverDefs::JUNGFRAUCTB) {
SetupDetectorSettings();
} else
comboSettings->setEnabled(false);
//threshold
if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::EIGER))
@ -104,8 +107,7 @@ void qTabSettings::SetupDetectorSettings(){
int sett = (int)myDet->getSettings();cout<<"sett:"<<sett<<endl;
qDefs::checkErrorMessage(myDet,"qTabSettings::SetupDetectorSettings");
if(sett==-1) sett = Undefined;
if(detType == slsDetectorDefs::JUNGFRAUCTB && sett > slsDetectorDefs::UNDEFINED) sett = Uninitialized;
else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized;
// To be able to index items on a combo box
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
@ -167,7 +169,6 @@ void qTabSettings::SetupDetectorSettings(){
item[(int)VeryLowGain]->setEnabled(false);
break;
case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::JUNGFRAUCTB:
item[(int)Standard]->setEnabled(false);
item[(int)Fast]->setEnabled(false);
item[(int)HighGain]->setEnabled(false);
@ -208,7 +209,8 @@ void qTabSettings::SetupDetectorSettings(){
void qTabSettings::Initialization(){
// Settings
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
if (detType != slsReceiverDefs::JUNGFRAUCTB)
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
// Number of Modules
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
// Dynamic Range
@ -226,8 +228,7 @@ void qTabSettings::setSettings(int index){
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
int sett = (int)myDet->getSettings();
if(sett==-1) sett = Undefined;
if(detType == slsDetectorDefs::JUNGFRAUCTB && sett > slsDetectorDefs::UNDEFINED) sett = Uninitialized;
else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized;
comboSettings->setCurrentIndex(sett);
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
@ -320,7 +321,8 @@ void qTabSettings::Refresh(){
cout << endl << "**Updating Settings Tab" << endl;
#endif
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
if (detType != slsReceiverDefs::JUNGFRAUCTB)
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
disconnect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
@ -339,35 +341,35 @@ void qTabSettings::Refresh(){
GetDynamicRange();
// Settings
if (detType != slsReceiverDefs::JUNGFRAUCTB) {
#ifdef VERBOSE
cout << "Getting settings" << endl;
cout << "Getting settings" << endl;
#endif
int sett = (int)myDet->getSettings();
if(sett==-1) sett = Undefined;//slsDetectorDefs::UNDEFINED;
if(detType == slsDetectorDefs::JUNGFRAUCTB && sett > slsDetectorDefs::UNDEFINED) sett = Uninitialized;
else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized;
comboSettings->setCurrentIndex(sett);
int sett = (int)myDet->getSettings();
if(sett==-1) sett = Undefined;//slsDetectorDefs::UNDEFINED;
if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined;
else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized;
comboSettings->setCurrentIndex(sett);
//threshold
sett = comboSettings->currentIndex();
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
if((sett==Undefined)||(sett==Uninitialized)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true);
//threshold
sett = comboSettings->currentIndex();
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
if((sett==Undefined)||(sett==Uninitialized)){
lblThreshold->setEnabled(false);
spinThreshold->setEnabled(false);
}else{
lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true);
#ifdef VERBOSE
cout << "Getting threshold energy" << endl;
cout << "Getting threshold energy" << endl;
#endif
spinThreshold->setValue(myDet->getThresholdEnergy());
spinThreshold->setValue(myDet->getThresholdEnergy());
}
}
}
}
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
if (detType != slsReceiverDefs::JUNGFRAUCTB)
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));

File diff suppressed because it is too large Load Diff

View File

@ -1042,24 +1042,55 @@ class multiSlsDetector : public slsDetectorUtils {
//virtual runStatus getRunStatus()=0;
runStatus getRunStatus();
void setErrorMaskFromAllDetectors();
template<typename T>
bool allElemetsEqual(const std::vector<T>&);
template<typename T>
T callDetectorMember(T (slsDetector::*somefunc)());
std::string callDetectorMember(std::string(slsDetector::*somefunc)());
template<typename T, typename V>
T callDetectorMember(T (slsDetector::*somefunc)(V), V value);
template<typename T, typename P1, typename P2>
T callDetectorMember(T (slsDetector::*somefunc)(P1, P2), P1 par1, P2 par2);
//func0_t
template<typename T>
T parallelCallDetectorMember(T (slsDetector::*somefunc)());
//func1_t
template<typename T, typename P1>
T parallelCallDetectorMember(T (slsDetector::*somefunc)(P1), P1 value); //Should probably be templated
//func2_t
template<typename T, typename P1, typename P2>
T parallelCallDetectorMember(T (slsDetector::*somefunc)(P1, P2), P1 par1, P2 par2);
int parallelCallDetectorMember(int (slsDetector::*somefunc)(int, int, int), int v0, int v1, int v2); //Should probably be templated
template<typename T>
T minusOneIfDifferent(const std::vector<T>&);
/** returns the detector trimbit/settings directory \sa sharedSlsDetector */
char* getSettingsDir();
std::string getSettingsDir();
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
char* setSettingsDir(std::string s);
std::string setSettingsDir(std::string s);
/**
returns the location of the calibration files
\sa sharedSlsDetector
*/
char* getCalDir();
std::string getCalDir();
/**
sets the location of the calibration files
\sa sharedSlsDetector
*/
char* setCalDir(std::string s);
std::string setCalDir(std::string s);
std::string getNetworkParameter(networkParameter);

View File

@ -1316,7 +1316,7 @@ int slsDetector::setOnline(int off) {
string slsDetector::checkOnline() {
string retval = string("");
string retval;
if(!controlSocket){
//this already sets the online/offline flag
setTCPSocket();

View File

@ -490,9 +490,9 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
/* I/O */
/** returns the detector trimbit/settings directory \sa sharedSlsDetector */
char* getSettingsDir() {return thisDetector->settingsDir;};
std::string getSettingsDir() {return std::string(thisDetector->settingsDir);};
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
char* setSettingsDir(string s) {sprintf(thisDetector->settingsDir, s.c_str()); return thisDetector->settingsDir;};
std::string setSettingsDir(string s) {sprintf(thisDetector->settingsDir, s.c_str()); return thisDetector->settingsDir;};
@ -500,12 +500,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
returns the location of the calibration files
\sa sharedSlsDetector
*/
char* getCalDir() {return thisDetector->calDir;};
std::string getCalDir() {return thisDetector->calDir;};
/**
sets the location of the calibration files
\sa sharedSlsDetector
*/
char* setCalDir(string s) {sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;};
std::string setCalDir(string s) {sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;};

View File

@ -3047,9 +3047,9 @@ string slsDetectorCommand::cmdSettingsDir(int narg, char *args[], int action){
if (action==PUT_ACTION) {
myDet->setSettingsDir(string(args[1]));
}
if (myDet->getSettingsDir()==NULL)
if (myDet->getSettingsDir()=="")
return string("undefined");
return string(myDet->getSettingsDir());
return myDet->getSettingsDir();
}
@ -3077,9 +3077,9 @@ string slsDetectorCommand::cmdCalDir(int narg, char *args[], int action){
if (action==PUT_ACTION) {
myDet->setCalDir(string(args[1]));
}
if (myDet->getCalDir()==NULL)
if ( (myDet->getCalDir()).empty() )
return string("undefined");
return string(myDet->getCalDir());
return myDet->getCalDir();
}

View File

@ -405,20 +405,20 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/**
returns the detector trimbit/settings directory
*/
virtual char* getSettingsDir()=0;
virtual std::string getSettingsDir()=0;
/** sets the detector trimbit/settings directory */
virtual char* setSettingsDir(std::string s)=0;
virtual std::string setSettingsDir(std::string s)=0;
/**
returns the location of the calibration files
*/
virtual char* getCalDir()=0;
virtual std::string getCalDir()=0;
/**
sets the location of the calibration files
*/
virtual char* setCalDir(std::string s)=0;
virtual std::string setCalDir(std::string s)=0;
/** Frees the shared memory - should not be used except for debugging*/
virtual int freeSharedMemory()=0;

View File

@ -519,7 +519,7 @@ class EigerData : public GeneralData {
packetSize = headerSizeinPacket + dataSize;
packetsPerFrame = 256;
imageSize = dataSize*packetsPerFrame;
maxFramesPerFile = 5;//EIGER_MAX_FRAMES_PER_FILE;
maxFramesPerFile = EIGER_MAX_FRAMES_PER_FILE;
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_detector_header);
defaultFifoDepth = 100;
threadsPerReceiver = 2;

View File

@ -22,7 +22,7 @@ typedef int int32_t;
#define MAX_FRAMES_PER_FILE 20000
#define SHORT_MAX_FRAMES_PER_FILE 100000
#define MOENCH_MAX_FRAMES_PER_FILE 1000
#define EIGER_MAX_FRAMES_PER_FILE 2000
#define EIGER_MAX_FRAMES_PER_FILE 10000
#define JFRAU_MAX_FRAMES_PER_FILE 10000
#define JFCTB_MAX_FRAMES_PER_FILE 100000