mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
solved bug with multidetector angular conversion
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@180 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -36,21 +36,40 @@ angularConversion::~angularConversion(){
|
||||
|
||||
|
||||
float* angularConversion::convertAngles(float pos) {
|
||||
int imod;
|
||||
int imod=0;
|
||||
float *ang=new float[getTotalNumberOfChannels()];
|
||||
float enc=pos;
|
||||
angleConversionConstant *p=NULL;
|
||||
|
||||
int ch0=0;
|
||||
int chlast=getChansPerMod(0);
|
||||
int nchmod=getChansPerMod(0);
|
||||
p=getAngularConversionPointer(imod);
|
||||
if (getMoveFlag(imod)==0)
|
||||
enc=0;
|
||||
else
|
||||
enc=pos;
|
||||
|
||||
for (int ip=0; ip<getTotalNumberOfChannels(); ip++) {
|
||||
imod=ip/(getChansPerMod(0)); // always for module 0?????
|
||||
p=getAngularConversionPointer(imod);
|
||||
|
||||
if (getMoveFlag(imod)==0)
|
||||
enc=0;
|
||||
else
|
||||
enc=pos;
|
||||
|
||||
#ifdef VERBOSE
|
||||
// cout << "ip " << ip << " ch0 " << ch0 << " chlast " << chlast << " imod " << imod << endl;
|
||||
#endif
|
||||
if (ip>=chlast) {
|
||||
imod++;
|
||||
p=getAngularConversionPointer(imod);
|
||||
if (getMoveFlag(imod)==0)
|
||||
enc=0;
|
||||
else
|
||||
enc=pos;
|
||||
|
||||
ch0=chlast;
|
||||
nchmod=getChansPerMod(imod);
|
||||
if (nchmod>0)
|
||||
chlast+=nchmod;
|
||||
}
|
||||
|
||||
if (p)
|
||||
ang[ip]=angle(ip%(getChansPerMod()), \
|
||||
ang[ip]=angle(ip-ch0, \
|
||||
enc, \
|
||||
(*fineOffset)+(*globalOffset), \
|
||||
p->r_conversion, \
|
||||
|
@ -417,8 +417,6 @@ class angularConversion : public virtual slsDetectorBase {
|
||||
current position of the detector
|
||||
*/
|
||||
float currentPosition;
|
||||
|
||||
|
||||
/**
|
||||
current position index of the detector
|
||||
*/
|
||||
|
@ -137,15 +137,17 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
||||
fname=createFileName();
|
||||
|
||||
|
||||
//uses static function?!?!?!?
|
||||
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
|
||||
|
||||
doProcessing(fdata,delflag, fname);
|
||||
//uses static function?!?!?!?
|
||||
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
|
||||
|
||||
doProcessing(fdata,delflag, fname);
|
||||
|
||||
delete [] myData;
|
||||
myData=NULL;
|
||||
fdata=NULL;
|
||||
|
||||
delete [] myData;
|
||||
myData=NULL;
|
||||
#ifdef VERBOSE
|
||||
// cout << "Pop data queue " << *fileIndex << endl;
|
||||
cout << "Pop data queue " << *fileIndex << endl;
|
||||
#endif
|
||||
|
||||
pthread_mutex_lock(&mp);
|
||||
@ -159,7 +161,7 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
||||
|
||||
|
||||
|
||||
void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
|
||||
void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
|
||||
|
||||
|
||||
/** write raw data file */
|
||||
@ -187,13 +189,13 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
|
||||
if (*correctionMask&(1<<RATE_CORRECTION)) {
|
||||
rcdata=new float[getTotalNumberOfChannels()];
|
||||
rcerr=new float[getTotalNumberOfChannels()];
|
||||
rateCorrect(fdata,NULL,rcdata,rcerr);
|
||||
delete [] fdata;
|
||||
fdata=NULL;
|
||||
rateCorrect(lfdata,NULL,rcdata,rcerr);
|
||||
delete [] lfdata;
|
||||
} else {
|
||||
rcdata=fdata;
|
||||
fdata=NULL;
|
||||
rcdata=lfdata;
|
||||
}
|
||||
lfdata=NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -250,6 +252,7 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
|
||||
#endif
|
||||
|
||||
|
||||
cout << "lock 1" << endl;
|
||||
pthread_mutex_lock(&mp);
|
||||
if ((getCurrentPositionIndex()>=getNumberOfPositions() && posfinished==1 && queuesize==1)) {
|
||||
|
||||
@ -259,6 +262,7 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
|
||||
np=finalizeMerging();
|
||||
/** file writing */
|
||||
incrementPositionIndex();
|
||||
cout << "unlock 1" << endl;
|
||||
pthread_mutex_unlock(&mp);
|
||||
|
||||
|
||||
@ -279,16 +283,21 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
|
||||
} else {
|
||||
thisData=new detectorData(getMergedCounts(),getMergedErrors(),getMergedPositions(),getCurrentProgress(),(fname+ext).c_str(),np);
|
||||
|
||||
cout << "lock 2" << endl;
|
||||
pthread_mutex_lock(&mg);
|
||||
finalDataQueue.push(thisData);
|
||||
cout << "unlock 2" << endl;
|
||||
pthread_mutex_unlock(&mg);
|
||||
}
|
||||
cout << "lock 3" << endl;
|
||||
pthread_mutex_lock(&mp);
|
||||
}
|
||||
cout << "unlock 3" << endl;
|
||||
pthread_mutex_unlock(&mp);
|
||||
|
||||
if (ffcdata)
|
||||
delete [] ffcdata;
|
||||
|
||||
ffcdata=NULL;
|
||||
|
||||
if (ffcerr)
|
||||
@ -317,8 +326,10 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
|
||||
}
|
||||
|
||||
incrementFileIndex();
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "fdata is " << fdata << endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -449,9 +460,15 @@ void* postProcessing::processData(int delflag) {
|
||||
dum=0;
|
||||
}
|
||||
|
||||
if (fdata)
|
||||
if (fdata) {
|
||||
#ifdef VERBOSE
|
||||
cout << "delete fdata" << endl;
|
||||
#endif
|
||||
delete [] fdata;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "done " << endl;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user