solved bug on the number of chans of multiSlsDetector

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@697 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi
2013-11-21 15:57:57 +00:00
parent 3b3e4eb8c3
commit 1ed2ba63b5
13 changed files with 125 additions and 21 deletions

View File

@ -227,6 +227,8 @@ int fileIO::writeDataFile(ofstream &outfile, int nch, double *data, double *err,
// args|=0x10; // one line per channel!
cout << "Static file " << endl;
for (int ichan=0; ichan<nch; ichan++) {
if (ang==NULL) {

View File

@ -52,6 +52,8 @@ int fileIO::writeDataFile(string fname, double *data, double *err, double *ang,
if (nch==-1)
nch=getTotalNumberOfChannels();
cout << "Write filexxx...." << endl;
return fileIOStatic::writeDataFile(fname, nch, data, err, ang, dataformat);
}
@ -59,6 +61,8 @@ int fileIO::writeDataFile(ofstream &outfile, double *data, double *err, double *
if (nch==-1)
nch=getTotalNumberOfChannels();
cout << "Write file...." << endl;
return fileIOStatic::writeDataFile(outfile, nch, data, err, ang, dataformat, offset);
}
@ -74,6 +78,7 @@ int fileIO::writeDataFile(string fname, int *data){
int fileIO::writeDataFile(ofstream &outfile, int *data, int offset){
cout << "Write raw file...." << endl;
return fileIOStatic::writeDataFile(outfile, getTotalNumberOfChannels(), data, offset);
}
@ -108,6 +113,7 @@ int fileIO::writeDataFile(void *data, int iframe) {
int fileIO::closeDataFile() {
cout << "close file...." << endl;
if (filefd)
fclose(filefd);
filefd=NULL;
@ -120,6 +126,7 @@ int fileIO::closeDataFile() {
int fileIO::writeDataFile(string fname, short int *data){
cout << "Write raw file...." << endl;
return fileIOStatic::writeDataFile(fname, getTotalNumberOfChannels(), data);
}

View File

@ -341,12 +341,12 @@ class fileIOStatic {
\param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL
*/
static int writeDataFile(ofstream &outfile, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){ \
static int writeDataFile(ofstream &outfile, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){
int idata; \
if (data==NULL) { \
if (data==NULL || nch==0) { \
cout << "No data to write!" << endl; \
return slsDetectorDefs::FAIL; \
} \
} \
for (int ichan=0; ichan<nch; ichan++) { \
if (ang==NULL) { \
outfile << ichan+offset << " "; \

View File

@ -117,6 +117,7 @@ void postProcessing::processFrame(int *myData, int delflag) {
if (getDetectorsType()==MYTHEN){
// if (fdata) {
//uses static function?!?!?!?
// cout << "write to file?!?!?!?" << endl;
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
} else {
writeDataFile ((void*)myData, currentFrameIndex);
@ -130,6 +131,9 @@ void postProcessing::processFrame(int *myData, int delflag) {
doProcessing(fdata,delflag, fname);
} else
if (dataReady){
cout << "callback arg "<< getCurrentProgress()<< " " << (fname+string(".raw")).c_str() << " " << getTotalNumberOfChannels() << endl;
thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),(fname+string(".raw")).c_str(),getTotalNumberOfChannels());
dataReady(thisData, currentFrameIndex, pCallbackArg);
delete thisData;
@ -220,6 +224,7 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
val=new double[arraySize];
err=new double[arraySize];
initDataset(0);
}
@ -250,6 +255,8 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
if (dataReady) {
cout << "callback arg "<< getCurrentProgress()<< " " << (fname+ext).c_str() << " " << np << endl;
thisData=new detectorData(val,err,ang,getCurrentProgress(),(fname+ext).c_str(),np);
dataReady(thisData, currentFrameIndex, pCallbackArg);
delete thisData;
@ -758,6 +765,9 @@ void postProcessing::initDataset(int r) {
} else {
cout << "implicit inti dataset! " << endl;
ppFun->initDataset();

View File

@ -18,9 +18,11 @@ int postProcessingFuncs::initDataset() {
me=new double[nBins];
mm=new int[nBins];
resetMerging(mp,mv,me,mm, nBins);
cout << "nbins " << nBins << endl;
} else {
mv=new double[totalChans];
me=new double[totalChans];
cout << "nchans " << totalChans << endl;
}
totalI0=0;