now updating max number of modules when reading the number of modules

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@265 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi
2012-09-20 15:28:54 +00:00
parent dc9d295860
commit ae9b39fba3
3 changed files with 70 additions and 5 deletions

View File

@ -2893,9 +2893,16 @@ int multiSlsDetector::getMaxMods() {
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) {
ret1=detectors[idet]->getMaxMods();
#ifdef VERBOSE
cout << "detector " << idet << " maxmods " << ret1 << endl;
#endif
ret+=ret1;
}
}
#ifdef VERBOSE
cout << "max mods is " << ret << endl;
#endif
return ret;
}
@ -2948,14 +2955,15 @@ int multiSlsDetector::setNumberOfModules(int p, dimension d) {
int multiSlsDetector::decodeNMod(int i, int &id, int &im) {
#ifdef VERBOSE
cout << " Module " << i << " belongs to detector " << id ;
cout << " Module " << i << " belongs to detector " << id << endl;;
cout << getMaxMods();
#endif
if (i<0 || i>=getMaxMods()) {
id=-1;
im=-1;
#ifdef VERBOSE
cout << "A---------" << id << " position " << im << endl;
cout << " A---------" << id << " position " << im << endl;
#endif
return -1;
@ -2968,7 +2976,7 @@ int multiSlsDetector::decodeNMod(int i, int &id, int &im) {
id=idet;
im=i;
#ifdef VERBOSE
cout << "B---------" <<id << " position " << im << endl;
cout << " B---------" <<id << " position " << im << endl;
#endif
return im;
} else {
@ -2979,7 +2987,7 @@ int multiSlsDetector::decodeNMod(int i, int &id, int &im) {
id=-1;
im=-1;
#ifdef VERBOSE
cout <<"C---------" << id << " position " << im << endl;
cout <<" C---------" << id << " position " << im << endl;
#endif
return -1;

View File

@ -1324,6 +1324,25 @@ int slsDetector::setNumberOfModules(int n, dimension d){
} else {
thisDetector->nMod[d]=retval;
thisDetector->nMods=thisDetector->nMod[X]*thisDetector->nMod[Y];
if (thisDetector->nModsMax<thisDetector->nMods)
thisDetector->nModsMax=thisDetector->nMods;
if (thisDetector->nModMax[X]<thisDetector->nMod[X])
thisDetector->nModMax[X]=thisDetector->nMod[X];
if (thisDetector->nModMax[Y]<thisDetector->nMod[Y])
thisDetector->nModMax[Y]=thisDetector->nMod[Y];
int dr=thisDetector->dynamicRange;
if (dr==24)
dr=32;
@ -2848,6 +2867,14 @@ int slsDetector::updateDetectorNoWait() {
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
thisDetector->nMod[Y]=nm;
thisDetector->nMods=thisDetector->nMod[Y]*thisDetector->nMod[X];
if (thisDetector->nModsMax<thisDetector->nMods)
thisDetector->nModsMax=thisDetector->nMods;
if (thisDetector->nModMax[X]<thisDetector->nMod[X])
thisDetector->nModMax[X]=thisDetector->nMod[X];
if (thisDetector->nModMax[Y]<thisDetector->nMod[Y])
thisDetector->nModMax[Y]=thisDetector->nMod[Y];
n = controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
thisDetector->dynamicRange=nm;

View File

@ -94,10 +94,17 @@ fname=createFileName();
if(*correctionMask&(1<<WRITE_FILE))
{
#ifdef VERBOSE
cout << "writing raw data " << endl;
#endif
//uses static function?!?!?!?
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
#ifdef VERBOSE
cout << "done " << endl;
#endif
}
doProcessing(fdata,delflag, fname);
@ -146,10 +153,16 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
/** rate correction */
if (*correctionMask&(1<<RATE_CORRECTION)) {
#ifdef VERBOSE
cout << "rate correcting " << endl;
#endif
rcdata=new double[getTotalNumberOfChannels()];
rcerr=new double[getTotalNumberOfChannels()];
rateCorrect(lfdata,NULL,rcdata,rcerr);
delete [] lfdata;
#ifdef VERBOSE
cout << "done " << endl;
#endif
} else {
rcdata=lfdata;
}
@ -161,6 +174,9 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
/** flat field correction */
if (*correctionMask&(1<<FLAT_FIELD_CORRECTION)) {
#ifdef VERBOSE
cout << "ff correcting " << endl;
#endif
ffcdata=new double[getTotalNumberOfChannels()];
ffcerr=new double[getTotalNumberOfChannels()];
flatFieldCorrect(rcdata,rcerr,ffcdata,ffcerr);
@ -169,6 +185,10 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
if (rcerr)
delete [] rcerr;
rcerr=NULL;
#ifdef VERBOSE
cout << "done " << endl;
#endif
} else {
ffcdata=rcdata;
ffcerr=rcerr;
@ -179,9 +199,19 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
// writes angualr converted files
if (*correctionMask!=0) {
if (*correctionMask&(1<< ANGULAR_CONVERSION))
if (*correctionMask&(1<< ANGULAR_CONVERSION)) {
#ifdef VERBOSE
cout << "ang conv " << endl;
#endif
ang=convertAngles();
#ifdef VERBOSE
cout << "done - write position data file " << endl;
#endif
}
writeDataFile (fname+ext, ffcdata, ffcerr,ang);
#ifdef VERBOSE
cout << "done " << endl;
#endif
}
// if (*correctionMask&(1<< ANGULAR_CONVERSION) && getNumberOfPositions()>0) {