frame index in file name, increments instead of file index for real time acquisitions

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@330 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi
2012-10-30 15:52:40 +00:00
parent 2f9dea8341
commit 96d08d61d0
14 changed files with 307 additions and 124 deletions

View File

@ -1273,6 +1273,7 @@ int slsDetector::setNumberOfModules(int n, dimension d){
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (controlSocket) {
cout << "connected" << endl;
if (controlSocket->Connect()>=0) {
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&arg,sizeof(arg));
@ -1287,8 +1288,10 @@ int slsDetector::setNumberOfModules(int n, dimension d){
if (ret==FORCE_UPDATE)
updateDetector();
}
}
} else
cout << "no control socket?!??!?" << endl;
} else {
cout << "offline" << endl;
ret=OK;
if (n==GET_FLAG)
;
@ -1389,7 +1392,7 @@ int slsDetector::getMaxNumberOfModules(dimension d){
std::cout<< "Max number of modules in dimension "<< d <<" is " << retval << std::endl;
#endif
if (ret==FAIL) {
std::cout<< "Get max number of modules failed " << std::endl;
std::cout<< "Get max number of modules failed " << retval << std::endl;
return retval;
} else {
thisDetector->nModMax[d]=retval;

View File

@ -109,7 +109,9 @@ int slsDetectorUsers::getPositions(double *pos){
}
int slsDetectorUsers::setDetectorSize(int x0, int y0, int nx, int ny){
return myDetector->setNumberOfModules(nx/myDetector->getChansPerMod(0))*myDetector->getChansPerMod(0);}
int nmod=nx/(myDetector->getChansPerMod(0));
cout << myDetector->getChansPerMod(0) << " " << nx << " " << nmod << endl;
return myDetector->setNumberOfModules(nmod)*myDetector->getChansPerMod(0);}
int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
y0=0;

View File

@ -25,12 +25,39 @@ class multiSlsDetector;
using namespace std;
/**
@libdoc The slsDetectorUsers class is a minimal purely virtual interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration file tha can be read/written.
This class contains the functions accessible by the users to control the slsDetectors (both multiSlsDetector and slsDetector)
\mainpage
<img src="psi_logo_150.gif" alt="Paul Scherrer Institut">
<CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
<HR>
Although the SLS detectors group delvelops several types of detectors (1/2D, counting/integrating etc.) it is common interest of the group to use a common platfor for data acquisition
The architecture of the acquisitions system is intended as follows:
\li A socket server running on the detector (or more than one in some special cases)
\li C++ classes common to all detectors for client-server communication. These can be supplied to users as libraries and embedded also in acquisition systems which are not developed by the SLS
\li the possibility of using a Qt-based graphical user interface (with eventually root analisys capabilities)
\li the possibility of running all commands from command line. In order to ensure a fast operation of this so called "text client" the detector parameters should not be re-initialized everytime. For this reason a shared memory block is allocated where the main detector flags and parameters are stored
\li a Root library for data postprocessing and detector calibration (energy, angle).
* @short This is the base class for detector functionalities of interest for the users.
The slsDetectorUsers class is a minimal purely virtual interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration file tha can be read/written.
\authors <a href="mailto:anna.bergamaschi@psi.ch">Anna Bergamaschi</a>, <a href="mailto:dhanya.maliakal@psi.ch">Dhanya Maliakal</a>
@version 0.2
<H2>Currently supported detectors</H2>
\li MYTHEN
\li GOTTHARD controls
<H3>Coming soon</H3>
\li GOTTHARD data receiver
\li EIGER
@libdoc The slsDetectorUsers class is a minimal purely virtual interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.
*/
/**
@short This is the base class for detector functionalities of interest for the users. Can be emebedded in the users custom interface e.g. EPICS, Lima etc.
*/

View File

@ -89,6 +89,7 @@ void slsDetectorUtils::acquire(int delflag){
if (nm<1)
nm=1;
int np=getNumberOfPositions();
if (np<1)
np=1;
@ -129,9 +130,9 @@ void slsDetectorUtils::acquire(int delflag){
//loop measurements
pthread_mutex_lock(&mp);
setStartIndex(*fileIndex);
pthread_mutex_unlock(&mp);
// pthread_mutex_lock(&mp);
// setStartIndex(*fileIndex);
// pthread_mutex_unlock(&mp);
//cout << "action at start" << endl;
if (*stoppedFlag==0) {
@ -216,11 +217,19 @@ void slsDetectorUtils::acquire(int delflag){
get_i0(0, IOarg);
}
if ((timerValue[FRAME_NUMBER]*timerValue[CYCLES_NUMBER])>1) {
setFrameIndex(0);
} else {
setFrameIndex(-1);
}
startAndReadAll();
#ifdef VERBOSE
cout << "returned! " << endl;
#endif
if (*correctionMask&(1<< I0_NORMALIZATION)) {
if (get_i0)
currentI0=get_i0(1,IOarg); // this is the correct i0!!!!!
@ -259,13 +268,14 @@ void slsDetectorUtils::acquire(int delflag){
usleep(100000);
}
closeDataFile();
pthread_mutex_lock(&mp);
if (*stoppedFlag==0) {
executeAction(headerAfter);
setLastIndex(*fileIndex);
// setLastIndex(*fileIndex);
} else {
setLastIndex(*fileIndex);
// setLastIndex(*fileIndex);
break;
}
pthread_mutex_unlock(&mp);
@ -277,9 +287,9 @@ void slsDetectorUtils::acquire(int delflag){
#endif
break;
} else if (ip<(np-1)) {
pthread_mutex_lock(&mp);
*fileIndex=setStartIndex();
pthread_mutex_unlock(&mp);
// pthread_mutex_lock(&mp);
// *fileIndex=setStartIndex();
// pthread_mutex_unlock(&mp);
}
} // loop on position finished
@ -296,9 +306,9 @@ void slsDetectorUtils::acquire(int delflag){
#endif
break;
} else if (is1<(ns1-1)) {
pthread_mutex_lock(&mp);
*fileIndex=setStartIndex();
pthread_mutex_unlock(&mp);
// pthread_mutex_lock(&mp);
// *fileIndex=setStartIndex();
// pthread_mutex_unlock(&mp);
}
}
@ -311,22 +321,32 @@ void slsDetectorUtils::acquire(int delflag){
#endif
break;
} else if (is0<(ns0-1)) {
pthread_mutex_lock(&mp);
*fileIndex=setStartIndex();
pthread_mutex_unlock(&mp);
// pthread_mutex_lock(&mp);
// *fileIndex=setStartIndex();
// pthread_mutex_unlock(&mp);
}
} //end scan0 loop is0
pthread_mutex_lock(&mp);
*fileIndex=setLastIndex();
pthread_mutex_unlock(&mp);
// pthread_mutex_lock(&mp);
// *fileIndex=setLastIndex();
// pthread_mutex_unlock(&mp);
if (*stoppedFlag==0) {
executeAction(stopScript);
} else
break;
// loop measurements
#ifdef VERBOSE
cout << "findex incremented " << endl;
#endif
if(*correctionMask&(1<<WRITE_FILE))
IncrementFileIndex();
if (measurement_finished)
@ -337,6 +357,7 @@ void slsDetectorUtils::acquire(int delflag){
}
// loop measurements
}
// waiting for the data processing thread to finish!
@ -358,7 +379,6 @@ void slsDetectorUtils::acquire(int delflag){
delete eclog;
if (acquisition_finished)
acquisition_finished(getCurrentProgress(),getDetectorStatus(),acqFinished_p);