reshuffling by Anna

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@179 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi
2012-05-14 13:39:18 +00:00
parent b484ad7f20
commit b5e966bb58
19 changed files with 528 additions and 631 deletions

View File

@ -3,7 +3,7 @@
#define ANGULARCONVERSION_H
#include "sls_detector_defs.h"
#include "slsDetectorBase.h"
#include <string>
#include <fstream>
@ -38,7 +38,7 @@ class containing the methods to set/unset the angular conversion and merge the d
The angular conversion itself is defined by the angle() function defined in usersFunctions.cpp
*/
class angularConversion : public slsDetectorDefs {
class angularConversion : public virtual slsDetectorBase {
public:
/** default constructor */
@ -281,12 +281,7 @@ class angularConversion : public slsDetectorDefs {
*/
float getAngularConversionParameter(angleConversionParameter c);
/**
pure virtual function
\returns total number of channels of the (multi)detector
*/
virtual int getTotalNumberOfChannels()=0;
/**
@ -385,11 +380,6 @@ class angularConversion : public slsDetectorDefs {
*/
virtual int getMoveFlag(int imod)=0;
/**
returns current position index
*/
int getCurrentPositionIndex() {return currentPositionIndex;};
/**
returns number of positions
*/
@ -428,6 +418,7 @@ class angularConversion : public slsDetectorDefs {
*/
float currentPosition;
/**
current position index of the detector
*/
@ -441,6 +432,11 @@ class angularConversion : public slsDetectorDefs {
*/
virtual int setAngularCorrectionMask(int i=-1)=0;
/**
returns current position index
*/
int getCurrentPositionIndex() {return currentPositionIndex;};
void incrementPositionIndex() {currentPositionIndex++;};
private:
/** merging bins */

View File

@ -10,7 +10,7 @@ using namespace std;
*/
class energyConversion: public slsDetectorDefs {
class energyConversion: private virtual slsDetectorDefs {
public:
/** default constrauctor */

View File

@ -1,7 +1,7 @@
#ifndef FILEIO_H
#define FILEIO_H
#include "sls_detector_defs.h"
#include "slsDetectorBase.h"
#include <iostream>
#include <fstream>
#include <iomanip>
@ -15,7 +15,8 @@ using namespace std;
/**
@short class handling the data file I/O flags
*/
class fileIO : public slsDetectorDefs {
class fileIO : public virtual slsDetectorBase {
@ -47,6 +48,8 @@ class fileIO : public slsDetectorDefs {
*/
int setFileIndex(int i) {*fileIndex=i; return *fileIndex;};
/**
\returns the output files path
@ -91,15 +94,14 @@ class fileIO : public slsDetectorDefs {
static string createFileName(char *filepath, char *filename, int aMask, float sv0, int prec0, float sv1, int prec1, int pindex, int npos, int findex);
/** generates file name without extension */
virtual string createFileName();
string createFileName();
/** static function that returns the file index from the file name
\param fname file name
\returns file index
*/
static int getFileIndexFromFileName(string fname);
int getFileIndexFromFileName(string fname);
/** static function that returns the variables from the file name
\param fname file name
@ -372,36 +374,13 @@ class fileIO : public slsDetectorDefs {
static int readDataFile(ifstream &infile, short int *data, int nch, int offset);
/**
\returns action mask
*/
virtual int getActionMask()=0;// {return 0;};
/**
\param index scan level index
\returns current scan variable
*/
virtual float getCurrentScanVariable(int index)=0;// {return 0;};
/**
\param index scan level index
\returns current scan variable precision (for file name)
*/
virtual int getScanPrecision(int index)=0;// {return 0;};
/**
\returns current position index
*/
virtual int getCurrentPositionIndex()=0;// {return 0;};
/**
\returns number of positions
*/
virtual int getNumberOfPositions()=0;// {return 0;};
/**
\returns total number of channels
*/
virtual int getTotalNumberOfChannels()=0;
protected:
void incrementFileIndex() { (*fileIndex)++;};
string getCurrentFileName(){return currentFileName;};
string currentFileName;

View File

@ -219,16 +219,16 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
if (*correctionMask!=0) {
if (*correctionMask&(1<< ANGULAR_CONVERSION))
ang=convertAngles(currentPosition);
ang=convertAngles();
writeDataFile (fname+ext, ffcdata, ffcerr,ang);
}
if (*correctionMask&(1<< ANGULAR_CONVERSION) && (*numberOfPositions)>0) {
if (*correctionMask&(1<< ANGULAR_CONVERSION) && getNumberOfPositions()>0) {
#ifdef VERBOSE
cout << "**************Current position index is " << currentPositionIndex << endl;
cout << "**************Current position index is " << getCurrentPositionIndex() << endl;
#endif
// if (*numberOfPositions>0) {
if (currentPositionIndex<=1) {
if (getCurrentPositionIndex()<=1) {
#ifdef VERBOSE
cout << "reset merging " << endl;
@ -237,7 +237,7 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
}
#ifdef VERBOSE
cout << "add to merging "<< currentPositionIndex << endl;
cout << "add to merging "<< getCurrentPositionIndex() << endl;
#endif
if (*correctionMask&(1<< ANGULAR_CONVERSION))
@ -245,20 +245,20 @@ void postProcessing::doProcessing(float *fdata, int delflag, string fname) {
#ifdef VERBOSE
cout << currentPositionIndex << " " << (*numberOfPositions) << endl;
cout << getCurrentPositionIndex() << " " << getNumberOfPositions() << endl;
#endif
pthread_mutex_lock(&mp);
if ((currentPositionIndex>=(*numberOfPositions) && posfinished==1 && queuesize==1)) {
if ((getCurrentPositionIndex()>=getNumberOfPositions() && posfinished==1 && queuesize==1)) {
#ifdef VERBOSE
cout << "finalize merging " << currentPositionIndex<< endl;
cout << "finalize merging " << getCurrentPositionIndex()<< endl;
#endif
np=finalizeMerging();
/** file writing */
currentPositionIndex++;
incrementPositionIndex();
pthread_mutex_unlock(&mp);
@ -329,8 +329,6 @@ int postProcessing::fillBadChannelMask() {
int nbad=0;
if (*correctionMask&(1<< DISCARD_BAD_CHANNELS)) {
nbad=getBadChannelCorrection();
#ifdef VERBOSE

View File

@ -2,8 +2,8 @@
#define POSTPROCESSING_H
#include "sls_detector_defs.h"
#include "detectorData.h"
#include "slsDetectorBase.h"
#include "angularConversion.h"
#include "fileIO.h"
#include <string>
@ -31,7 +31,9 @@ using namespace std;
(including thread for writing data files and plotting in parallel with the acquisition)
*/
class postProcessing : public angularConversion, public fileIO {
class postProcessing : public angularConversion, public fileIO
//: public virtual angularConversion, public virtual fileIO
{
@ -48,7 +50,7 @@ class postProcessing : public angularConversion, public fileIO {
\returns 0 if bad channel disabled or no bad channels, >0 otherwise
*/
virtual int getBadChannelCorrection(int *bad=NULL)=0;
/**
get flat field corrections
@ -232,18 +234,6 @@ s
virtual void incrementProgress()=0;
virtual float getCurrentProgress()=0;
virtual void incrementFileIndex()=0;
virtual int setTotalProgress()=0;
virtual float* decodeData(int *datain, float *fdata=NULL)=0;
virtual int getTotalNumberOfChannels()=0;
virtual int rateCorrect(float*, float*, float*, float*)=0;
virtual int flatFieldCorrect(float*, float*, float*, float*)=0;
@ -361,6 +351,19 @@ s
float *fdata;
// private:
/* virtual void incrementProgress()=0; */
/* virtual float getCurrentProgress()=0; */
/* virtual void incrementFileIndex()=0; */
/* virtual int setTotalProgress()=0; */
/* virtual float* decodeData(int *datain, float *fdata=NULL)=0; */
/* virtual int getTotalNumberOfChannels()=0; */
};