mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 18:40:42 +02:00
dataReady called
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@288 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
7f8f89f89d
commit
b75b09cc7b
@ -238,6 +238,9 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
|||||||
flatFieldFile=thisMultiDetector->flatFieldFile;
|
flatFieldFile=thisMultiDetector->flatFieldFile;
|
||||||
badChanFile=thisMultiDetector->badChanFile;
|
badChanFile=thisMultiDetector->badChanFile;
|
||||||
timerValue=thisMultiDetector->timerValue;
|
timerValue=thisMultiDetector->timerValue;
|
||||||
|
|
||||||
|
expTime=&timerValue[ACQUISITION_TIME];
|
||||||
|
|
||||||
currentSettings=&thisMultiDetector->currentSettings;
|
currentSettings=&thisMultiDetector->currentSettings;
|
||||||
currentThresholdEV=&thisMultiDetector->currentThresholdEV;
|
currentThresholdEV=&thisMultiDetector->currentThresholdEV;
|
||||||
filePath=thisMultiDetector->filePath;
|
filePath=thisMultiDetector->filePath;
|
||||||
@ -1675,8 +1678,9 @@ int multiSlsDetector::setFlatFieldCorrection(string fname){
|
|||||||
chpm[im]=getChansPerMod(im);
|
chpm[im]=getChansPerMod(im);
|
||||||
mMask[im]=im;
|
mMask[im]=im;
|
||||||
}
|
}
|
||||||
|
fillModuleMask(mMask);
|
||||||
if ((postProcessingFuncs::calculateFlatField(&nm, chpm, mMask, badChannelMask, data, ffcoefficients, fferrors))) {
|
|
||||||
|
if ((postProcessingFuncs::calculateFlatField(&nm, chpm, mMask, badChannelMask, data, ffcoefficients, fferrors))>=0) {
|
||||||
strcpy(thisMultiDetector->flatFieldFile,fname.c_str());
|
strcpy(thisMultiDetector->flatFieldFile,fname.c_str());
|
||||||
|
|
||||||
|
|
||||||
@ -1684,7 +1688,8 @@ int multiSlsDetector::setFlatFieldCorrection(string fname){
|
|||||||
|
|
||||||
setFlatFieldCorrection(ffcoefficients, fferrors);
|
setFlatFieldCorrection(ffcoefficients, fferrors);
|
||||||
|
|
||||||
}
|
} else
|
||||||
|
std::cout<< "Calculated flat field from file " << fname << " is not valid " << nch << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout<< "Flat field from file " << fname << " is not valid " << nch << std::endl;
|
std::cout<< "Flat field from file " << fname << " is not valid " << nch << std::endl;
|
||||||
}
|
}
|
||||||
@ -1693,6 +1698,25 @@ int multiSlsDetector::setFlatFieldCorrection(string fname){
|
|||||||
return thisMultiDetector->correctionMask&(1<<FLAT_FIELD_CORRECTION);
|
return thisMultiDetector->correctionMask&(1<<FLAT_FIELD_CORRECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int multiSlsDetector::fillModuleMask(int *mM) {
|
||||||
|
int imod=0, off=0;
|
||||||
|
if (mM) {
|
||||||
|
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
|
if (detectors[i]) {
|
||||||
|
for (int im=0; im<detectors[i]->getNMods(); im++) {
|
||||||
|
mM[imod]=im+off;
|
||||||
|
imod++;
|
||||||
|
}
|
||||||
|
off+=detectors[i]->getMaxMods();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getNMods();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
int multiSlsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
||||||
int ichdet=0;
|
int ichdet=0;
|
||||||
|
@ -1079,7 +1079,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
string getReceiverLastClientIP();
|
string getReceiverLastClientIP();
|
||||||
|
|
||||||
|
|
||||||
|
int fillModuleMask(int *mM);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
@ -657,6 +657,8 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
flatFieldFile=thisDetector->flatFieldFile;
|
flatFieldFile=thisDetector->flatFieldFile;
|
||||||
badChanFile=thisDetector->badChanFile;
|
badChanFile=thisDetector->badChanFile;
|
||||||
timerValue=thisDetector->timerValue;
|
timerValue=thisDetector->timerValue;
|
||||||
|
expTime=&timerValue[ACQUISITION_TIME];
|
||||||
|
|
||||||
currentSettings=&thisDetector->currentSettings;
|
currentSettings=&thisDetector->currentSettings;
|
||||||
currentThresholdEV=&thisDetector->currentThresholdEV;
|
currentThresholdEV=&thisDetector->currentThresholdEV;
|
||||||
filePath=thisDetector->filePath;
|
filePath=thisDetector->filePath;
|
||||||
@ -4087,8 +4089,9 @@ int slsDetector::setFlatFieldCorrection(string fname)
|
|||||||
chpm[im]=getChansPerMod(im);
|
chpm[im]=getChansPerMod(im);
|
||||||
mMask[im]=im;
|
mMask[im]=im;
|
||||||
}
|
}
|
||||||
|
fillModuleMask(mMask);
|
||||||
|
|
||||||
if ((postProcessingFuncs::calculateFlatField(&nm, chpm, mMask, badChannelMask, data, ffcoefficients, fferrors))) {
|
if ((postProcessingFuncs::calculateFlatField(&nm, chpm, mMask, badChannelMask, data, ffcoefficients, fferrors))>=0) {
|
||||||
strcpy(thisDetector->flatFieldFile,fname.c_str());
|
strcpy(thisDetector->flatFieldFile,fname.c_str());
|
||||||
|
|
||||||
|
|
||||||
@ -4107,7 +4110,13 @@ int slsDetector::setFlatFieldCorrection(string fname)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int slsDetector::fillModuleMask(int *mM){
|
||||||
|
if (mM)
|
||||||
|
for (int i=0; i<getNMods(); i++)
|
||||||
|
mM[i]=i;
|
||||||
|
|
||||||
|
return getNMods();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
||||||
|
@ -1452,8 +1452,7 @@ typedef struct sharedSlsDetector {
|
|||||||
/returns OK
|
/returns OK
|
||||||
*/
|
*/
|
||||||
int updateReceiver();
|
int updateReceiver();
|
||||||
|
int fillModuleMask(int *mM);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ slsDetectorUtils::slsDetectorUtils() {
|
|||||||
cout << "done " << endl;
|
cout << "done " << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
expTime=timerValue+ACQUISITION_TIME;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +61,7 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)) || getActionMode(angCalLog) || (getScanMode(0)==positionScan)|| (getScanMode(0)==positionScan)) {
|
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)) || getActionMode(angCalLog) || (getScanMode(0)==positionScan)|| (getScanMode(1)==positionScan)) {
|
||||||
if (connectChannels==0)
|
if (connectChannels==0)
|
||||||
if (connect_channels) {
|
if (connect_channels) {
|
||||||
connect_channels(CCarg);
|
connect_channels(CCarg);
|
||||||
@ -176,8 +175,10 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
pthread_mutex_lock(&mp);
|
||||||
createFileName();
|
createFileName();
|
||||||
|
pthread_mutex_unlock(&mp);
|
||||||
|
|
||||||
if (*stoppedFlag==0) {
|
if (*stoppedFlag==0) {
|
||||||
executeAction(scriptBefore);
|
executeAction(scriptBefore);
|
||||||
|
@ -108,7 +108,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
|||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int writeDataFile(ofstream &outfile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1, int offset=0);
|
virtual int writeDataFile(ofstream &outfile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1, int offset=0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +126,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
|||||||
\param offset start channel number
|
\param offset start channel number
|
||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
*/
|
*/
|
||||||
int writeDataFile(ofstream &outfile, int *data, int offset=0);
|
virtual int writeDataFile(ofstream &outfile, int *data, int offset=0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
|||||||
\param offset start channel number
|
\param offset start channel number
|
||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
*/
|
*/
|
||||||
int writeDataFile(ofstream &outfile, short int *data, int offset=0);
|
virtual int writeDataFile(ofstream &outfile, short int *data, int offset=0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,7 +208,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
void incrementFileIndex() { (*fileIndex)++;};
|
void incrementFileIndex() { (*fileIndex)++; };
|
||||||
|
|
||||||
string getCurrentFileName(){return currentFileName;};
|
string getCurrentFileName(){return currentFileName;};
|
||||||
|
|
||||||
|
@ -142,7 +142,10 @@ class fileIOStatic {
|
|||||||
|
|
||||||
static int writeDataFile(string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \
|
static int writeDataFile(string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \
|
||||||
ofstream outfile; \
|
ofstream outfile; \
|
||||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
if (data==NULL) { \
|
||||||
|
cout << "No data to write!" << endl; \
|
||||||
|
return slsDetectorDefs::FAIL; \
|
||||||
|
} \
|
||||||
outfile.open (fname.c_str(),ios_base::out); \
|
outfile.open (fname.c_str(),ios_base::out); \
|
||||||
if (outfile.is_open()) { \
|
if (outfile.is_open()) { \
|
||||||
writeDataFile(outfile, nch, data, err, ang, dataformat, 0); \
|
writeDataFile(outfile, nch, data, err, ang, dataformat, 0); \
|
||||||
@ -167,8 +170,10 @@ class fileIOStatic {
|
|||||||
*/
|
*/
|
||||||
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; \
|
int idata; \
|
||||||
if (data==NULL) \
|
if (data==NULL) { \
|
||||||
|
cout << "No data to write!" << endl; \
|
||||||
return slsDetectorDefs::FAIL; \
|
return slsDetectorDefs::FAIL; \
|
||||||
|
} \
|
||||||
for (int ichan=0; ichan<nch; ichan++) { \
|
for (int ichan=0; ichan<nch; ichan++) { \
|
||||||
if (ang==NULL) { \
|
if (ang==NULL) { \
|
||||||
outfile << ichan+offset << " "; \
|
outfile << ichan+offset << " "; \
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
postProcessing::postProcessing(): expTime(NULL){
|
postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL){
|
||||||
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
||||||
mp=mp1;
|
mp=mp1;
|
||||||
pthread_mutex_init(&mp, NULL);
|
pthread_mutex_init(&mp, NULL);
|
||||||
@ -45,37 +45,39 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
|||||||
// double *fdata=NULL;
|
// double *fdata=NULL;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "start processing"<< endl;
|
cout << "start processing"<< endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
incrementProgress();
|
incrementProgress();
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "prog incremented"<< endl;
|
cout << "prog incremented"<< endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** decode data */
|
/** decode data */
|
||||||
|
|
||||||
fdata=decodeData(myData, fdata);
|
fdata=decodeData(myData, fdata);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "decode"<< endl;
|
cout << "decode"<< endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
fname=createFileName();
|
pthread_mutex_lock(&mp);
|
||||||
#ifdef VERBOSE
|
fname=createFileName();
|
||||||
|
pthread_mutex_unlock(&mp);
|
||||||
|
#ifdef VERBOSE
|
||||||
cout << "fname is " << fname << endl;
|
cout << "fname is " << fname << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Checking for write flag
|
//Checking for write flag
|
||||||
if(*correctionMask&(1<<WRITE_FILE)) {
|
if((*correctionMask)&(1<<WRITE_FILE)) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "writing raw data " << endl;
|
cout << "writing raw data " << endl;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//uses static function?!?!?!?
|
//uses static function?!?!?!?
|
||||||
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
|
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -92,15 +94,24 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
|||||||
cout << "done" << endl;
|
cout << "done" << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*correctionMask & ~(1<<WRITE_FILE))
|
if ((*correctionMask) & ~(1<<WRITE_FILE)) {
|
||||||
doProcessing(fdata,delflag, fname);
|
doProcessing(fdata,delflag, fname);
|
||||||
|
} else
|
||||||
|
if (dataReady) {
|
||||||
|
thisData=new detectorData(NULL,fdata,NULL,getCurrentProgress(),(fname+string(".raw")).c_str(),getTotalNumberOfChannels());
|
||||||
|
dataReady(thisData, pCallbackArg);
|
||||||
|
delete thisData;
|
||||||
|
fdata=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
delete [] myData;
|
delete [] myData;
|
||||||
delete [] fdata;
|
if (fdata)
|
||||||
|
delete [] fdata;
|
||||||
myData=NULL;
|
myData=NULL;
|
||||||
fdata=NULL;
|
fdata=NULL;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Pop data queue " << *fileIndex << endl;
|
cout << "Pop data queue " << *fileIndex << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -113,7 +124,7 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
|||||||
#endif
|
#endif
|
||||||
popDataQueue(); //remove the data from the queue
|
popDataQueue(); //remove the data from the queue
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Pop data queue " << *fileIndex << endl;
|
cout << "Pop data queue " << *fileIndex << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -133,12 +144,14 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
cout << "do processing - data size is " << arraySize << endl;
|
cout << "do processing - data size is " << arraySize << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (*correctionMask&(1<< ANGULAR_CONVERSION))
|
||||||
|
ang=new double[arraySize];
|
||||||
|
else
|
||||||
|
ang=NULL;
|
||||||
|
|
||||||
double *ang=new double[arraySize];
|
val=new double[arraySize];
|
||||||
double *val=new double[arraySize];
|
err=new double[arraySize];
|
||||||
double *err=new double[arraySize];
|
|
||||||
int np;
|
int np;
|
||||||
detectorData *thisData;
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "arrays allocated " << endl;
|
cout << "arrays allocated " << endl;
|
||||||
@ -153,10 +166,10 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
|
|
||||||
double t=0;
|
double t=0;
|
||||||
|
|
||||||
// if (expTime)
|
if (expTime)
|
||||||
// t=(*expTime)*1E-9;
|
t=(*expTime)*1E-9;
|
||||||
//else
|
else
|
||||||
// cout << "no pointer to exptime" << endl;
|
cout << "no pointer to exptime" << endl;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "exptime is "<< t << endl;
|
cout << "exptime is "<< t << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -172,7 +185,7 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
cout << "add frame" << endl;
|
cout << "add frame" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ppFun->addFrame(lfdata, ¤tPosition, ¤tI0, &t, (fname+ext).c_str(), NULL);
|
ppFun->addFrame(lfdata, ¤tPosition, ¤tI0, &t, (fname).c_str(), NULL);
|
||||||
|
|
||||||
if ((GetCurrentPositionIndex()>=npos && positionFinished() && dataQueueSize()) || npos==0) {
|
if ((GetCurrentPositionIndex()>=npos && positionFinished() && dataQueueSize()) || npos==0) {
|
||||||
|
|
||||||
@ -188,16 +201,27 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
pthread_mutex_unlock(&mp);
|
pthread_mutex_unlock(&mp);
|
||||||
|
|
||||||
|
|
||||||
if(*correctionMask&(1<<WRITE_FILE)) {
|
if((*correctionMask)&(1<<WRITE_FILE)) {
|
||||||
cout << "writing to file?!?!?" << endl;
|
//cout << "write to file " << fname+ext << " " << np << " " << ang<< " " << val << " " << err << endl;
|
||||||
writeDataFile (fname+ext,np,ang, val, err,'f');
|
writeDataFile (fname+ext,np,val, err,ang,'f');
|
||||||
}
|
}
|
||||||
thisData=new detectorData(ang,val,err,getCurrentProgress(),(fname+ext).c_str(),np);
|
|
||||||
|
|
||||||
if (dataReady) {
|
if (dataReady) {
|
||||||
|
thisData=new detectorData(ang,val,err,getCurrentProgress(),(fname+ext).c_str(),np);
|
||||||
dataReady(thisData, pCallbackArg);
|
dataReady(thisData, pCallbackArg);
|
||||||
|
delete thisData;
|
||||||
|
ang=NULL;
|
||||||
|
val=NULL;
|
||||||
|
err=NULL;
|
||||||
}
|
}
|
||||||
delete thisData;
|
if (ang)
|
||||||
|
delete [] ang;
|
||||||
|
if (val)
|
||||||
|
delete [] val;
|
||||||
|
if (err)
|
||||||
|
delete [] err;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +394,7 @@ int postProcessing::dataQueueSize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int* postProcessing::popDataQueue() {
|
int* postProcessing::popDataQueue() {
|
||||||
int *retval=NULL;
|
int *retval=NULL;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -448,13 +473,13 @@ void postProcessing::startThread(int delflag) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "chanspermod" << endl;
|
cout << "chanspermod" << endl;
|
||||||
#endif
|
#endif
|
||||||
mM[im]=getMoveFlag(im);
|
// mM[im]=getMoveFlag(im);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "moveflag" << endl;
|
cout << "moveflag" << endl;
|
||||||
#endif
|
#endif
|
||||||
totch+=chPM[im];
|
totch+=chPM[im];
|
||||||
}
|
}
|
||||||
|
fillModuleMask(mM);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "total channels is " << totch << endl;
|
cout << "total channels is " << totch << endl;
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,13 +221,16 @@ s
|
|||||||
virtual int flatFieldCorrect(double*, double*, double*, double*)=0;
|
virtual int flatFieldCorrect(double*, double*, double*, double*)=0;
|
||||||
|
|
||||||
|
|
||||||
|
virtual int fillModuleMask(int *mM)=0;
|
||||||
|
|
||||||
virtual int getNMods()=0;
|
virtual int getNMods()=0;
|
||||||
|
|
||||||
|
|
||||||
int GetCurrentPositionIndex(){ pthread_mutex_lock(&mp); int retval=getCurrentPositionIndex(); pthread_mutex_unlock(&mp); return retval;};
|
int GetCurrentPositionIndex(){ pthread_mutex_lock(&mp); int retval=getCurrentPositionIndex(); pthread_mutex_unlock(&mp); return retval;};
|
||||||
void IncrementPositionIndex(){ pthread_mutex_lock(&mp); incrementPositionIndex(); pthread_mutex_unlock(&mp);};
|
void IncrementPositionIndex(){ pthread_mutex_lock(&mp); incrementPositionIndex(); pthread_mutex_unlock(&mp);};
|
||||||
|
|
||||||
void IncrementFileIndex(){ pthread_mutex_lock(&mp); incrementFileIndex(); pthread_mutex_unlock(&mp); cout << "findex unlock" << endl;};
|
void IncrementFileIndex(){ pthread_mutex_lock(&mp); incrementFileIndex(); pthread_mutex_unlock(&mp); };
|
||||||
|
int GetFileIndex(){ pthread_mutex_lock(&mp); int i=*fileIndex; pthread_mutex_unlock(&mp); return i;};
|
||||||
|
|
||||||
void ResetPositionIndex(){pthread_mutex_lock(&mp); resetPositionIndex(); pthread_mutex_unlock(&mp);};
|
void ResetPositionIndex(){pthread_mutex_lock(&mp); resetPositionIndex(); pthread_mutex_unlock(&mp);};
|
||||||
|
|
||||||
@ -324,6 +327,19 @@ s
|
|||||||
|
|
||||||
|
|
||||||
postProcessingFuncs *ppFun;
|
postProcessingFuncs *ppFun;
|
||||||
|
detectorData *thisData;
|
||||||
|
|
||||||
|
|
||||||
|
double *ang;
|
||||||
|
double *val;
|
||||||
|
double *err;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -42,8 +42,9 @@ int postProcessingFuncs::finalizeDataset(double *ang, double *val, double *err,
|
|||||||
|
|
||||||
for (int ip=0; ip<(*np); ip++) {
|
for (int ip=0; ip<(*np); ip++) {
|
||||||
|
|
||||||
if (mp)
|
if (ang)
|
||||||
ang[ip]=mp[ip];
|
if (mp)
|
||||||
|
ang[ip]=mp[ip];
|
||||||
|
|
||||||
if (mv)
|
if (mv)
|
||||||
val[ip]=mv[ip]*totalI0;
|
val[ip]=mv[ip]*totalI0;
|
||||||
@ -89,9 +90,11 @@ int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double
|
|||||||
else
|
else
|
||||||
eout=0;
|
eout=0;
|
||||||
|
|
||||||
//ratecorrect
|
|
||||||
|
|
||||||
if (tDead) {
|
if (tDead) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "ppFuncs ratecorrect" << endl;
|
||||||
|
#endif
|
||||||
rateCorrect(vin, ein, vout, eout, tDead, *expTime);
|
rateCorrect(vin, ein, vout, eout, tDead, *expTime);
|
||||||
vin=vout;
|
vin=vout;
|
||||||
ein=eout;
|
ein=eout;
|
||||||
@ -99,6 +102,9 @@ int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double
|
|||||||
//ffcorrect
|
//ffcorrect
|
||||||
|
|
||||||
if (ffCoeff) {
|
if (ffCoeff) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "ppFuncs ffcorrect" << endl;
|
||||||
|
#endif
|
||||||
if (ffErr)
|
if (ffErr)
|
||||||
e=ffErr[ich];
|
e=ffErr[ich];
|
||||||
else
|
else
|
||||||
@ -109,23 +115,40 @@ int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double
|
|||||||
|
|
||||||
//i0correct
|
//i0correct
|
||||||
if (i0>0) {
|
if (i0>0) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "ppFuncs i0 norm" << endl;
|
||||||
|
#endif
|
||||||
vout/=i0;
|
vout/=i0;
|
||||||
eout/=i0;
|
eout/=i0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (badChannelMask)
|
if (badChannelMask) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "ppFuncs badchans" << endl;
|
||||||
|
#endif
|
||||||
if (badChannelMask[ich])
|
if (badChannelMask[ich])
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (nBins) {
|
if (nBins) {
|
||||||
//angconv
|
//angconv
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "ppFuncs angconv" << endl;
|
||||||
|
#endif
|
||||||
//check module mask?!?!?!?
|
//check module mask?!?!?!?
|
||||||
|
|
||||||
|
|
||||||
p1=convertAngle(*pos,ich,chansPerMod,angConv,moduleMask,totalOffset,0,angDir);
|
p1=convertAngle(*pos,ich,chansPerMod,angConv,moduleMask,totalOffset,0,angDir);
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "ppFuncs merge" << endl;
|
||||||
|
#endif
|
||||||
addPointToMerging(p1,vout,eout,mp,mv,me,mm, binSize, nBins);
|
addPointToMerging(p1,vout,eout,mp,mv,me,mm, binSize, nBins);
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "ppFuncs merge" << endl;
|
||||||
|
#endif
|
||||||
|
//mp[ich]=ich;
|
||||||
mv[ich]+=vout;
|
mv[ich]+=vout;
|
||||||
me[ich]+=eout*eout;
|
me[ich]+=eout*eout;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user