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:
bergamaschi
2009-12-01 14:32:14 +00:00
parent bf976342b9
commit 3f148c52a1
91 changed files with 1105 additions and 759 deletions

View File

@ -249,9 +249,14 @@ int mythenDetector::writeConfigurationFile(string const fname){
It should be possible to dump all the settings of the detector (including trimbits, threshold energy, gating/triggering, acquisition time etc.
in a file and retrieve it for repeating the measurement with identicals ettings, if necessary
*/
/* int mythenDetector::dumpDetectorSetup(string fname){};
int mythenDetector::retrieveDetectorSetup(string fname){};
*/
int mythenDetector::dumpDetectorSetup(string fname){
cout << "Function not yet implemented " << endl;
};
int mythenDetector::retrieveDetectorSetup(string fname){
cout << "Function not yet implemented " << endl;
};
@ -688,9 +693,12 @@ int mythenDetector::readCalibrationFile(string fname, float &gain, float &offset
}
return 0;
};
/*
int mythenDetector::writeCalibrationFile(string fname, float gain, float offset){};
*/
int mythenDetector::writeCalibrationFile(string fname, float gain, float offset){
cout << "Function not yet implemented " << endl;
};
/* Communication to server */
@ -953,25 +961,25 @@ void mythenDetector::acquire(){
go_to_position (thisDetector->detPositions[ip]);
currentPositionIndex=ip+1;
}
//write header before?
startAndReadAll();
if (thisDetector->correctionMask&(1<< I0_NORMALIZATION))
currentI0=get_i0();
//write header before?
startAndReadAll();
//write header after?
if (thisDetector->correctionMask&(1<< I0_NORMALIZATION))
currentI0=get_i0();
if (thisDetector->correctionMask&(1<< ANGULAR_CONVERSION))
currentPosition=get_position();
processData();
}
}
void* mythenDetector::processData() {
void* mythenDetector::processData(int delflag) {
int *myData;
float *fdata;
// float *dataout=new float[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods];
float *rcdata=NULL, *rcerr=NULL;
float *ffcdata=NULL, *ffcerr=NULL;
float *ang=NULL;
@ -980,7 +988,9 @@ void* mythenDetector::processData() {
int imod;
int nb;
int np;
while(1) {
detectorData *thisData;
// while(1) { // ???????????????????????? this was needed in case of a thread....but one should take care of the position and run indexes!!!!!!
if( !dataQueue.empty() ) {
@ -1058,38 +1068,54 @@ void* mythenDetector::processData() {
ang[ip]=angle(ip,currentPosition,thisDetector->fineOffset+thisDetector->globalOffset,thisDetector->angOff[imod].r_conversion,thisDetector->angOff[imod].center, thisDetector->angOff[imod].offset,thisDetector->angOff[imod].tilt,thisDetector->angDirection);
}
writeDataFile (createFileName().append(".dat"), ffcdata, ffcerr,ang);
if (currentPositionIndex==thisDetector->numberOfPositions || (currentPositionIndex==0) {
if ((currentPositionIndex==thisDetector->numberOfPositions) || (currentPositionIndex==0)) {
np=finalizeMerging(mergingBins, mergingCounts,mergingErrors, mergingMultiplicity);
/** file writing */
currentPositionIndex++;
writeDataFile (createFileName().append(".dat"),mergingCounts, mergingErrors, mergingBins,'f',np);
delete [] mergingBins;
delete [] mergingCounts;
delete [] mergingErrors;
delete [] mergingMultiplicity;
thisDetector->fileIndex++;
if (delflag) {
delete [] mergingBins;
delete [] mergingCounts;
delete [] mergingErrors;
delete [] mergingMultiplicity;
} else {
thisData=new detectorData(mergingCounts,mergingErrors,mergingBins,thisDetector->fileIndex,createFileName().append(".dat"),np);
finalDataQueue.push(thisData);
}
thisDetector->fileIndex++;
}
if (ffcdata)
delete [] ffcdata;
if (ffcerr)
delete [] ffcerr;
if (ang)
delete [] ang;
//}
} else {
writeDataFile (createFileName().append(".dat"), ffcdata, ffcerr);
if (delflag) {
if (ffcdata)
delete [] ffcdata;
if (ffcerr)
delete [] ffcerr;
if (ang)
delete [] ang;
} else {
thisData=new detectorData(ffcdata,ffcerr,NULL,thisDetector->fileIndex,createFileName().append(".dat"));
finalDataQueue.push(thisData);
}
thisDetector->fileIndex++;
}
if (ffcdata)
delete [] ffcdata;
if (ffcerr)
delete [] ffcerr;
if (ang)
delete [] ang;
}
}
}
// } // ????????????????????????
}

View File

@ -28,7 +28,7 @@ class mythenDetector : public slsDetector{
/**
(default) constructor
*/
mythenDetector(int id=0) : slsDetector(MYTHEN, id);
mythenDetector(int id=0) : slsDetector(MYTHEN, id){};
//slsDetector(string const fname);
// ~slsDetector(){while(dataQueue.size()>0){}};
/** destructor */
@ -274,8 +274,9 @@ class mythenDetector : public slsDetector{
/**
function for processing data
\param delflag if 1 the data are deleted, else left there for further processing (or plotting?)
*/
void* processData(); // thread function
void* processData(int delflag=1); // thread function
/** performs the complete acquisition and data processing
moves the detector to next position <br>
@ -283,9 +284,10 @@ class mythenDetector : public slsDetector{
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 deleted, else left there for further processing (or plotting?)
*/
void acquire();
void acquire(int delflag=1);
};