mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
giving priority to command line than config files for receivers, introducing variable to check moench receiver with gotthard detector
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@532 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -466,7 +466,7 @@ int slsDetectorUtils::setTotalProgress() {
|
|||||||
|
|
||||||
if (timerValue[FRAME_NUMBER])
|
if (timerValue[FRAME_NUMBER])
|
||||||
nf=timerValue[FRAME_NUMBER];
|
nf=timerValue[FRAME_NUMBER];
|
||||||
if(getDetectorsType() == MOENCH) nf/=20;/**TEMP SOLUTION:need to be removed when the proper moench is used*/
|
|
||||||
if (timerValue[CYCLES_NUMBER]>0)
|
if (timerValue[CYCLES_NUMBER]>0)
|
||||||
nc=timerValue[CYCLES_NUMBER];
|
nc=timerValue[CYCLES_NUMBER];
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
|
|||||||
registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//receiver->registerCallBackAcquisitionFinished(func,arg);
|
//receiver->registerCallBackAcquisitionFinished(func,arg);
|
||||||
|
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ int main(int argc, char *argv[]) {
|
|||||||
registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg);
|
registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg);
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//receiver->registerCallBackRawDataReady(func,arg);
|
//receiver->registerCallBackRawDataReady(func,arg);
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ using namespace std;
|
|||||||
FILE* slsReceiverFunctionList::sfilefd(NULL);
|
FILE* slsReceiverFunctionList::sfilefd(NULL);
|
||||||
int slsReceiverFunctionList::listening_thread_running(0);
|
int slsReceiverFunctionList::listening_thread_running(0);
|
||||||
|
|
||||||
slsReceiverFunctionList::slsReceiverFunctionList(detectorType det):
|
slsReceiverFunctionList::slsReceiverFunctionList(detectorType det,bool moenchwithGotthardTest):
|
||||||
myDetectorType(det),
|
myDetectorType(det),
|
||||||
maxFramesPerFile(MAX_FRAMES_PER_FILE),
|
maxFramesPerFile(MAX_FRAMES_PER_FILE),
|
||||||
enableFileWrite(1),
|
enableFileWrite(1),
|
||||||
@ -65,7 +65,8 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det):
|
|||||||
acquisitionFinishedCallBack(NULL),
|
acquisitionFinishedCallBack(NULL),
|
||||||
pAcquisitionFinished(NULL),
|
pAcquisitionFinished(NULL),
|
||||||
rawDataReadyCallBack(NULL),
|
rawDataReadyCallBack(NULL),
|
||||||
pRawDataReady(NULL)
|
pRawDataReady(NULL),
|
||||||
|
withGotthard(moenchwithGotthardTest)
|
||||||
|
|
||||||
{
|
{
|
||||||
if(myDetectorType == MOENCH){
|
if(myDetectorType == MOENCH){
|
||||||
@ -100,7 +101,8 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det):
|
|||||||
buffer+=aligned_frame_size;
|
buffer+=aligned_frame_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(withGotthard)
|
||||||
|
cout << "Testing MOENCH Receiver with GOTTHARD Detector" << endl;
|
||||||
#ifdef TESTWRITE
|
#ifdef TESTWRITE
|
||||||
//to test write receiver data call back
|
//to test write receiver data call back
|
||||||
registerWriteReceiverDataCallback(&defaultWriteReceiverDataFunc, NULL);
|
registerWriteReceiverDataCallback(&defaultWriteReceiverDataFunc, NULL);
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
slsReceiverFunctionList(detectorType det);
|
slsReceiverFunctionList(detectorType det, bool moenchwithGotthardTest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
@ -359,6 +359,9 @@ private:
|
|||||||
* 2 we open, close, write file, callback does not do anything */
|
* 2 we open, close, write file, callback does not do anything */
|
||||||
int cbAction;
|
int cbAction;
|
||||||
|
|
||||||
|
/**temporary variable to test moench with gotthard module*/
|
||||||
|
bool withGotthard;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
ifstream infile;
|
ifstream infile;
|
||||||
string sLine,sargname;
|
string sLine,sargname;
|
||||||
int iline = 0;
|
int iline = 0;
|
||||||
|
int withGotthard = 0;
|
||||||
|
|
||||||
success=OK;
|
success=OK;
|
||||||
string fname = "";
|
string fname = "";
|
||||||
@ -53,22 +54,7 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
}else
|
}else
|
||||||
fname.assign(argv[iarg+1]);
|
fname.assign(argv[iarg+1]);
|
||||||
}
|
}
|
||||||
if(!strcasecmp(argv[iarg],"-type")){
|
|
||||||
if(iarg+1==argc){
|
|
||||||
cout << "no detector type given after -type in command line. Exiting." << endl;
|
|
||||||
success=FAIL;
|
|
||||||
}else{
|
|
||||||
if(!strcasecmp(argv[iarg+1],"gotthard"));
|
|
||||||
else if(!strcasecmp(argv[iarg+1],"moench"))
|
|
||||||
slsReceiverFuncs::myDetectorType = MOENCH;
|
|
||||||
else{
|
|
||||||
cout << "could not decode detector type in command line. Exiting." << endl;
|
|
||||||
success=FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!fname.empty()) && (success == OK)){
|
if((!fname.empty()) && (success == OK)){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "config file name "<< fname << std::endl;
|
std::cout<< "config file name "<< fname << std::endl;
|
||||||
@ -93,14 +79,11 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
continue;
|
continue;
|
||||||
}else{
|
}else{
|
||||||
istringstream sstr(sLine);
|
istringstream sstr(sLine);
|
||||||
|
|
||||||
//parameter name
|
//parameter name
|
||||||
if(sstr.good())
|
if(sstr.good())
|
||||||
sstr >> sargname;
|
sstr >> sargname;
|
||||||
|
|
||||||
|
//tcp port
|
||||||
|
|
||||||
//value
|
|
||||||
if(sargname=="rx_tcpport"){
|
if(sargname=="rx_tcpport"){
|
||||||
if(sstr.good()) {
|
if(sstr.good()) {
|
||||||
sstr >> sargname;
|
sstr >> sargname;
|
||||||
@ -112,7 +95,7 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//type
|
||||||
else if(sargname=="type"){
|
else if(sargname=="type"){
|
||||||
if(sstr.good()) {
|
if(sstr.good()) {
|
||||||
sstr >> sargname;
|
sstr >> sargname;
|
||||||
@ -121,7 +104,7 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
else if(!strcasecmp(sargname.c_str(),"moench"))
|
else if(!strcasecmp(sargname.c_str(),"moench"))
|
||||||
slsReceiverFuncs::myDetectorType = MOENCH;
|
slsReceiverFuncs::myDetectorType = MOENCH;
|
||||||
else{
|
else{
|
||||||
cout << "could not decode detector type in config file. Exiting." << endl;
|
cout << "could not decode detector type in config file.\nOptions are:\ngotthard\nmoench.\n\nExiting." << endl;
|
||||||
success=FAIL;
|
success=FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,8 +125,72 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//parse command line for type etc.. more priority
|
||||||
|
if(success == OK){
|
||||||
|
for(int iarg=1;iarg<argc;iarg++){
|
||||||
|
//type
|
||||||
|
if(!strcasecmp(argv[iarg],"-type")){
|
||||||
|
if(iarg+1==argc){
|
||||||
|
cout << "no detector type given after -type in command line. Exiting." << endl;
|
||||||
|
success=FAIL;
|
||||||
|
}else{
|
||||||
|
if(!strcasecmp(argv[iarg+1],"gotthard"))
|
||||||
|
slsReceiverFuncs::myDetectorType = GOTTHARD;
|
||||||
|
else if(!strcasecmp(argv[iarg+1],"moench"))
|
||||||
|
slsReceiverFuncs::myDetectorType = MOENCH;
|
||||||
|
else{
|
||||||
|
cout << "could not decode detector type in command line. \nOptions are:\ngotthard\nmoench.\n\nExiting." << endl;
|
||||||
|
success=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//test with gotthard module
|
||||||
|
else if(!strcasecmp(argv[iarg],"-test")){
|
||||||
|
if(iarg+1==argc){
|
||||||
|
cout << "no test condition given after -test in command line. Exiting." << endl;
|
||||||
|
success=FAIL;
|
||||||
|
}else{
|
||||||
|
if(!strcasecmp(argv[iarg+1],"with_gotthard"))
|
||||||
|
withGotthard = 1;
|
||||||
|
else{
|
||||||
|
cout << "could not decode test condition in command line. \nOptions are:\nwith_gotthard.\n\nExiting." << endl;
|
||||||
|
success=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(success == OK){
|
||||||
|
|
||||||
|
//display detector message
|
||||||
|
switch(myDetectorType){
|
||||||
|
case GOTTHARD:
|
||||||
|
if(withGotthard){
|
||||||
|
cout << "Option -test with_gotthard exists only for MOENCH detectors. Exiting" << endl;
|
||||||
|
exit(-1);
|
||||||
|
}else
|
||||||
|
cout << "This is a GOTTHARD Receiver" << endl;
|
||||||
|
break;
|
||||||
|
case MOENCH:
|
||||||
|
if(withGotthard)
|
||||||
|
cout << "This is a MOENCH Receiver using a GOTTHARD Detector."
|
||||||
|
"\nNote:Packet numbers are not matched for its corresponding frames." << endl;
|
||||||
|
else
|
||||||
|
cout << "This is a MOENCH Receiver" << endl;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cout << "Unknown Receiver" << endl;
|
||||||
|
success=FAIL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//create socket
|
||||||
if(success == OK){
|
if(success == OK){
|
||||||
//create socket
|
|
||||||
socket = new MySocketTCP(port_no);
|
socket = new MySocketTCP(port_no);
|
||||||
if (socket->getErrorStatus()) {
|
if (socket->getErrorStatus()) {
|
||||||
success = FAIL;
|
success = FAIL;
|
||||||
@ -156,10 +203,10 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
strcpy(mess,"dummy message");
|
strcpy(mess,"dummy message");
|
||||||
|
|
||||||
function_table();
|
function_table();
|
||||||
slsReceiverList = new slsReceiverFunctionList(myDetectorType);
|
slsReceiverList = new slsReceiverFunctionList(myDetectorType,withGotthard);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Function table assigned." << endl;
|
cout << "Function table assigned." << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
file_des=socket->getFileDes();
|
file_des=socket->getFileDes();
|
||||||
@ -169,11 +216,6 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(myDetectorType){
|
|
||||||
case GOTTHARD: cout << "This is a GOTTHARD Receiver" << endl; break;
|
|
||||||
case MOENCH: cout << "This is a MOENCH Receiver" << endl; break;
|
|
||||||
default: cout << "Unknown Receiver" << endl;success=FAIL;break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void slsReceiverFuncs::start(){
|
void slsReceiverFuncs::start(){
|
||||||
|
Reference in New Issue
Block a user