mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
some more details fixed
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@4 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -2372,6 +2372,16 @@ int* slsDetector::popDataQueue() {
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
detectorData* slsDetector::popFinalDataQueue() {
|
||||
detectorData *retval=NULL;
|
||||
if( !finalDataQueue.empty() ) {
|
||||
retval=finalDataQueue.front();
|
||||
finalDataQueue.pop();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
set or read the acquisition timers
|
||||
enum timerIndex {
|
||||
@ -2587,7 +2597,7 @@ enum readOutFlags {
|
||||
setReadOutFlags(STORE_IN_RAM,
|
||||
READ_HITS,
|
||||
ZERO_COMPRESSION,
|
||||
BACKGROUND_CORRECTIONS
|
||||
BACKGROUND_CORRECTION
|
||||
}{};
|
||||
|
||||
*/
|
||||
@ -2773,7 +2783,7 @@ float* slsDetector::decodeData(int *datain) {
|
||||
return dataout;
|
||||
}
|
||||
|
||||
//Corrections
|
||||
//Correction
|
||||
/*
|
||||
enum correctionFlags {
|
||||
DISCARD_BAD_CHANNELS,
|
||||
@ -2796,7 +2806,7 @@ int slsDetector::setFlatFieldCorrection(string fname){
|
||||
|
||||
if (fname=="") {
|
||||
#ifdef VERBOSE
|
||||
cout << "disabling flat field corrections" << endl;
|
||||
cout << "disabling flat field correction" << endl;
|
||||
#endif
|
||||
thisDetector->correctionMask&=~(1<<FLAT_FIELD_CORRECTION);
|
||||
} else {
|
||||
@ -2860,7 +2870,7 @@ int slsDetector::setFlatFieldCorrection(string fname){
|
||||
return thisDetector->correctionMask&(1<<FLAT_FIELD_CORRECTION);
|
||||
}
|
||||
|
||||
int slsDetector::getFlatFieldCorrections(float *corr, float *ecorr) {
|
||||
int slsDetector::getFlatFieldCorrection(float *corr, float *ecorr) {
|
||||
if (thisDetector->correctionMask&(1<<FLAT_FIELD_CORRECTION)) {
|
||||
#ifdef VERBOSE
|
||||
cout << "Flat field correction is enabled" << endl;
|
||||
@ -2933,7 +2943,7 @@ int slsDetector::setRateCorrection(float t){
|
||||
|
||||
if (t==0) {
|
||||
#ifdef VERBOSE
|
||||
cout << "unsetting rate corrections" << endl;
|
||||
cout << "unsetting rate correction" << endl;
|
||||
#endif
|
||||
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
||||
} else {
|
||||
@ -2945,14 +2955,14 @@ int slsDetector::setRateCorrection(float t){
|
||||
thisDetector->tDead=tdead[thisDetector->currentSettings];
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting rate corrections with dead time "<< thisDetector->tDead << endl;
|
||||
cout << "Setting rate correction with dead time "<< thisDetector->tDead << endl;
|
||||
#endif
|
||||
}
|
||||
return thisDetector->correctionMask&(1<<RATE_CORRECTION);
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::getRateCorrections(float &t){
|
||||
int slsDetector::getRateCorrection(float &t){
|
||||
|
||||
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||
#ifdef VERBOSE
|
||||
@ -2967,7 +2977,7 @@ int slsDetector::getRateCorrections(float &t){
|
||||
return 0;
|
||||
};
|
||||
|
||||
int slsDetector::getRateCorrections(){
|
||||
int slsDetector::getRateCorrection(){
|
||||
|
||||
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||
return 1;
|
||||
@ -3073,7 +3083,7 @@ int slsDetector::setBadChannelCorrection(string fname){
|
||||
return thisDetector->nBadChans;
|
||||
}
|
||||
|
||||
int slsDetector::getBadChannelCorrections(int *bad) {
|
||||
int slsDetector::getBadChannelCorrection(int *bad) {
|
||||
int ichan;
|
||||
if (thisDetector->correctionMask&(1<< DISCARD_BAD_CHANNELS)) {
|
||||
if (bad) {
|
||||
|
@ -41,6 +41,45 @@ extern "C" {
|
||||
|
||||
#define defaultTDead {170,90,750} /**< should be changed in order to have it separate for the different detector types */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
data structure to hold the detector data after postprocessing (e.g. to plot, store in a root tree etc.)
|
||||
*/
|
||||
class detectorData {
|
||||
public:
|
||||
/** The constructor
|
||||
\param val pointer to the data
|
||||
\param err pointer to errors
|
||||
\param ang pointer to the angles
|
||||
\param f_ind file index
|
||||
\param fname file name to which the data are saved
|
||||
\param np number of points defaults to the number of detector channels
|
||||
*/
|
||||
detectorData(float *val=NULL, float *err=NULL, float *ang=NULL, int f_ind=-1, char *fname="", int np=-1) : values(val), errors(err), angles(ang), fileIndex(f_ind), npoints(np){strcpy(fileName,fname);};
|
||||
/**
|
||||
the destructor
|
||||
deletes also the arrays pointing to data/errors/angles if not NULL
|
||||
*/
|
||||
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles;};
|
||||
//private:
|
||||
float *values; /**< pointer to the data */
|
||||
float *errors; /**< pointer to the errors */
|
||||
float *angles;/**< pointer to the angles */
|
||||
int fileIndex;/**< file index */
|
||||
char fileName[1000];/**< file name */
|
||||
int npoints;/**< number of points */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace std;
|
||||
/**
|
||||
\mainpage Common C++ library for SLS detectors data acquisition
|
||||
@ -868,6 +907,12 @@ typedef struct sharedSlsDetector {
|
||||
*/
|
||||
int* popDataQueue();
|
||||
|
||||
/**
|
||||
pops the data from thepostprocessed data queue
|
||||
\returns pointer to the popped data or NULL if the queue is empty.
|
||||
\sa finalDataQueue
|
||||
*/
|
||||
detectorData* popFinalDataQueue();
|
||||
/**
|
||||
set/get timer value
|
||||
\param index timer index
|
||||
@ -945,7 +990,7 @@ typedef struct sharedSlsDetector {
|
||||
\param ecorr if !=NULL will be filled with the correction coefficients errors
|
||||
\returns 0 if ff correction disabled, >0 otherwise
|
||||
*/
|
||||
int getFlatFieldCorrections(float *corr=NULL, float *ecorr=NULL);
|
||||
int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL);
|
||||
|
||||
/**
|
||||
set rate correction
|
||||
@ -960,13 +1005,13 @@ typedef struct sharedSlsDetector {
|
||||
\param t reference for dead time
|
||||
\returns 0 if rate correction disabled, >0 otherwise
|
||||
*/
|
||||
int getRateCorrections(float &t);
|
||||
int getRateCorrection(float &t);
|
||||
|
||||
/**
|
||||
get rate correction
|
||||
\returns 0 if rate correction disabled, >0 otherwise
|
||||
*/
|
||||
int getRateCorrections();
|
||||
int getRateCorrection();
|
||||
|
||||
/**
|
||||
set bad channels correction
|
||||
@ -980,7 +1025,7 @@ typedef struct sharedSlsDetector {
|
||||
\param bad pointer to array that if bad!=NULL will be filled with the bad channel list
|
||||
\returns 0 if bad channel disabled or no bad channels, >0 otherwise
|
||||
*/
|
||||
int getBadChannelCorrections(int *bad=NULL);
|
||||
int getBadChannelCorrection(int *bad=NULL);
|
||||
|
||||
/** returns the bad channel list file */
|
||||
char *getBadChannelCorrectionFile() {return thisDetector->badChanFile;};
|
||||
@ -1177,9 +1222,10 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
/** pure virtual function
|
||||
function for processing data
|
||||
/param delflag if 1 the data are processed, written to file and then deleted. If 0 they are added to the finalDataQueue
|
||||
\sa mythenDetector::processData
|
||||
*/
|
||||
virtual void* processData()=0; // thread function
|
||||
virtual void* processData(int delflag=1)=0; // thread function
|
||||
/** Allocates the memory for a sls_detector_module structure and initializes it
|
||||
\returns myMod the pointer to the allocate dmemory location
|
||||
|
||||
@ -1200,10 +1246,11 @@ typedef struct sharedSlsDetector {
|
||||
reads the IC (if required) <br>
|
||||
reads the encoder (iof required for angualr conversion) <br>
|
||||
processes the data (flat field, rate, angular conversion and merging ::processData())
|
||||
/param delflag if 1 the data are processed, written to file and then deleted. If 0 they are added to the finalDataQueue
|
||||
\sa mythenDetector::acquire()
|
||||
*/
|
||||
|
||||
virtual void acquire()=0;
|
||||
virtual void acquire(int delflag=1)=0;
|
||||
|
||||
protected:
|
||||
|
||||
@ -1246,12 +1293,14 @@ typedef struct sharedSlsDetector {
|
||||
data queue
|
||||
*/
|
||||
queue<int*> dataQueue;
|
||||
|
||||
/**
|
||||
data processing thread???
|
||||
queue containing the postprocessed data
|
||||
*/
|
||||
pthread_t dataProcessingThread;
|
||||
queue<detectorData*> finalDataQueue;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
current position of the detector
|
||||
*/
|
||||
|
Reference in New Issue
Block a user