mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-09 14:20:03 +02:00
now processing all files of a sequence
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@157 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
e3ca421c3c
commit
ca896b8b30
@ -1759,31 +1759,35 @@ void* slsDetectorUtils::processData(int delflag) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "**************Current position index is " << currentPositionIndex << endl;
|
// cout << "**************Current position index is " << currentPositionIndex << endl;
|
||||||
#endif
|
#endif
|
||||||
if (currentPositionIndex<=1) {
|
|
||||||
if (*binSize>0)
|
if (*numberOfPositions>0 || delflag==0) {
|
||||||
bs=*binSize;
|
|
||||||
else
|
if (currentPositionIndex<=1) {
|
||||||
*binSize=bs;
|
if (*binSize>0)
|
||||||
|
bs=*binSize;
|
||||||
|
else
|
||||||
|
*binSize=bs;
|
||||||
|
|
||||||
|
|
||||||
nb=(int)(360./bs)+1;
|
nb=(int)(360./bs)+1;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "creating merging arrays "<< nb << endl;
|
// cout << "creating merging arrays "<< nb << endl;
|
||||||
#endif
|
#endif
|
||||||
mergingBins=new float[nb];
|
mergingBins=new float[nb];
|
||||||
mergingCounts=new float[nb];
|
mergingCounts=new float[nb];
|
||||||
mergingErrors=new float[nb];
|
mergingErrors=new float[nb];
|
||||||
mergingMultiplicity=new int[nb];
|
mergingMultiplicity=new int[nb];
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << mergingBins<< " "<< mergingCounts<< " "<< mergingErrors<< " "<< mergingMultiplicity<< " " << endl;
|
cout << mergingBins<< " "<< mergingCounts<< " "<< mergingErrors<< " "<< mergingMultiplicity<< " " << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "reset merging " << endl;
|
// cout << "reset merging " << endl;
|
||||||
#endif
|
#endif
|
||||||
resetMerging(mergingBins, mergingCounts,mergingErrors, mergingMultiplicity, bs);
|
resetMerging(mergingBins, mergingCounts,mergingErrors, mergingMultiplicity, bs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* it would be better to create an ang0 with 0 encoder position and add to merging/write to file simply specifying that offset so that when it cycles writing the data or adding to merging it also calculates the angular position */
|
/* it would be better to create an ang0 with 0 encoder position and add to merging/write to file simply specifying that offset so that when it cycles writing the data or adding to merging it also calculates the angular position */
|
||||||
|
|
||||||
@ -1792,8 +1796,8 @@ void* slsDetectorUtils::processData(int delflag) {
|
|||||||
#endif
|
#endif
|
||||||
ang=convertAngles(currentPosition);
|
ang=convertAngles(currentPosition);
|
||||||
|
|
||||||
if (*correctionMask!=0) {
|
// if (*correctionMask!=0) {
|
||||||
if (*numberOfPositions>1) {
|
// if (*numberOfPositions>1) {
|
||||||
//uses static function?!?!?!?
|
//uses static function?!?!?!?
|
||||||
//writeDataFile (fname+string(".dat"), getTotalNumberOfChannels(), ffcdata, ffcerr,ang);
|
//writeDataFile (fname+string(".dat"), getTotalNumberOfChannels(), ffcdata, ffcerr,ang);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -1801,95 +1805,98 @@ void* slsDetectorUtils::processData(int delflag) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
writeDataFile (fname+string(".dat"), ffcdata, ffcerr,ang);
|
writeDataFile (fname+string(".dat"), ffcdata, ffcerr,ang);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "add to merging "<< currentPositionIndex << endl;
|
// cout << "add to merging "<< currentPositionIndex << endl;
|
||||||
#endif
|
#endif
|
||||||
addToMerging(ang, ffcdata, ffcerr, mergingBins, mergingCounts,mergingErrors, mergingMultiplicity, getTotalNumberOfChannels(), bs, *angDirection, *correctionMask, badChannelMask );
|
if (*numberOfPositions>0 || delflag==0) {
|
||||||
|
addToMerging(ang, ffcdata, ffcerr, mergingBins, mergingCounts,mergingErrors, mergingMultiplicity, getTotalNumberOfChannels(), bs, *angDirection, *correctionMask, badChannelMask );
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << currentPositionIndex << " " << (*numberOfPositions) << endl;
|
cout << currentPositionIndex << " " << (*numberOfPositions) << endl;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
if (currentPositionIndex>=(*numberOfPositions) && posfinished==1 && queuesize==1) {
|
if ((currentPositionIndex>=(*numberOfPositions) && posfinished==1 && queuesize==1)) {
|
||||||
|
|
||||||
|
|
||||||
// if ((currentPositionIndex>=(*numberOfPositions)) || (currentPositionIndex==0)) {
|
// if ((currentPositionIndex>=(*numberOfPositions)) || (currentPositionIndex==0)) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "finalize merging " << currentPositionIndex<< endl;
|
// cout << "finalize merging " << currentPositionIndex<< endl;
|
||||||
#endif
|
#endif
|
||||||
np=finalizeMerging(mergingBins, mergingCounts,mergingErrors, mergingMultiplicity, bs);
|
np=finalizeMerging(mergingBins, mergingCounts,mergingErrors, mergingMultiplicity, bs);
|
||||||
/** file writing */
|
/** file writing */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
currentPositionIndex++;
|
currentPositionIndex++;
|
||||||
pthread_mutex_unlock(&mp);
|
pthread_mutex_unlock(&mp);
|
||||||
|
|
||||||
|
|
||||||
fname=createFileName();
|
fname=createFileName();
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "writing merged data file" << endl;
|
// cout << "writing merged data file" << endl;
|
||||||
#endif
|
#endif
|
||||||
writeDataFile (fname+string(".dat"),np,mergingCounts, mergingErrors, mergingBins,'f');
|
writeDataFile (fname+string(".dat"),np,mergingCounts, mergingErrors, mergingBins,'f');
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << " done" << endl;
|
// cout << " done" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (delflag) {
|
if (delflag) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << mergingBins<< " " << mergingCounts<< " " << mergingErrors << " " << mergingMultiplicity << " " << endl;
|
// cout << mergingBins<< " " << mergingCounts<< " " << mergingErrors << " " << mergingMultiplicity << " " << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mergingBins) {
|
if (mergingBins) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "deleting merged bins "<< mergingBins << " size " << sizeof(mergingBins) << endl;
|
// cout << "deleting merged bins "<< mergingBins << " size " << sizeof(mergingBins) << endl;
|
||||||
#endif
|
#endif
|
||||||
delete [] mergingBins;
|
delete [] mergingBins;
|
||||||
mergingBins=NULL;
|
mergingBins=NULL;
|
||||||
}
|
}
|
||||||
if (mergingCounts) {
|
if (mergingCounts) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "deleting merged counts "<< mergingCounts << endl;
|
// cout << "deleting merged counts "<< mergingCounts << endl;
|
||||||
#endif
|
#endif
|
||||||
delete [] mergingCounts;
|
delete [] mergingCounts;
|
||||||
mergingCounts=NULL;
|
mergingCounts=NULL;
|
||||||
}
|
}
|
||||||
if (mergingErrors) {
|
if (mergingErrors) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "deleting merged errors "<< mergingErrors << endl;
|
// cout << "deleting merged errors "<< mergingErrors << endl;
|
||||||
#endif
|
#endif
|
||||||
delete [] mergingErrors;
|
delete [] mergingErrors;
|
||||||
mergingErrors=NULL;
|
mergingErrors=NULL;
|
||||||
}
|
}
|
||||||
if (mergingMultiplicity){
|
if (mergingMultiplicity){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "deleting merged multiplicity "<<mergingMultiplicity << endl;
|
// cout << "deleting merged multiplicity "<<mergingMultiplicity << endl;
|
||||||
#endif
|
#endif
|
||||||
delete [] mergingMultiplicity;
|
delete [] mergingMultiplicity;
|
||||||
mergingMultiplicity=NULL;
|
mergingMultiplicity=NULL;
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// cout << "deleting merged data done " << endl;
|
// cout << "deleting merged data done " << endl;
|
||||||
|
|
||||||
// cout << mergingBins<< " " << mergingCounts<< " " << mergingErrors << " " << mergingMultiplicity << " " << endl;
|
// cout << mergingBins<< " " << mergingCounts<< " " << mergingErrors << " " << mergingMultiplicity << " " << endl;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
thisData=new detectorData(mergingCounts,mergingErrors,mergingBins,getCurrentProgress(),(fname+string(ext)).c_str(),np);
|
thisData=new detectorData(mergingCounts,mergingErrors,mergingBins,getCurrentProgress(),(fname+string(ext)).c_str(),np);
|
||||||
finalDataQueue.push(thisData);
|
|
||||||
}
|
finalDataQueue.push(thisData);
|
||||||
pthread_mutex_lock(&mp);
|
}
|
||||||
}
|
pthread_mutex_lock(&mp);
|
||||||
|
}
|
||||||
pthread_mutex_unlock(&mp);
|
pthread_mutex_unlock(&mp);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user