mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 15:50:03 +02:00
solved bug in angular conversion
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@186 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
0a561c1c1f
commit
ed84d21da0
@ -204,13 +204,17 @@ int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm,
|
||||
int np=0;
|
||||
for (int ibin=0; ibin<nb; ibin++) {
|
||||
if (mm[ibin]>0) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "finalize " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
||||
#endif
|
||||
mp[np]=mp[ibin]/mm[ibin];
|
||||
mv[np]=mv[ibin]/mm[ibin];
|
||||
me[np]=me[ibin]/mm[ibin];
|
||||
me[np]=sqrt(me[ibin]);
|
||||
mm[np]=mm[ibin];
|
||||
np++;
|
||||
}
|
||||
me[np]=me[ibin]/mm[ibin];
|
||||
me[np]=sqrt(me[ibin]);
|
||||
mm[np]=mm[ibin];
|
||||
np++;
|
||||
}
|
||||
}
|
||||
return np;
|
||||
}
|
||||
@ -218,6 +222,7 @@ int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm,
|
||||
//static
|
||||
int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int nchans, float binsize,int nbins, int *badChanMask ) {
|
||||
|
||||
|
||||
float binmi=-180.;
|
||||
int ibin=0;
|
||||
|
||||
@ -238,23 +243,24 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp,
|
||||
if (nchans==0)
|
||||
return FAIL;
|
||||
|
||||
if (binsize==0)
|
||||
if (binsize<=0)
|
||||
return FAIL;
|
||||
if (nbins==0)
|
||||
|
||||
if (nbins<=0)
|
||||
return FAIL;
|
||||
|
||||
|
||||
for (int ip=0; ip<nchans; ip++) {
|
||||
if (badChanMask) {
|
||||
if (badChanMask[ip]) {
|
||||
#ifdef VERBOSE
|
||||
cout << "channel " << ip << " is bad " << endl;
|
||||
#endif
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ibin=(int)((p1[ip]-binmi)/binsize);
|
||||
|
||||
|
||||
if (ibin<nbins && ibin>=0) {
|
||||
mp[ibin]+=p1[ip];
|
||||
mv[ibin]+=v1[ip];
|
||||
@ -263,6 +269,10 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp,
|
||||
else
|
||||
me[ibin]+=v1[ip];
|
||||
mm[ibin]++;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "add " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
||||
#endif
|
||||
} else
|
||||
return FAIL;
|
||||
}
|
||||
@ -287,6 +297,7 @@ int angularConversion::deleteMerging() {
|
||||
|
||||
|
||||
int angularConversion::resetMerging() {
|
||||
getAngularConversionParameter(BIN_SIZE);
|
||||
|
||||
mergingBins=new float[nBins];
|
||||
|
||||
@ -304,6 +315,7 @@ int angularConversion::resetMerging() {
|
||||
}
|
||||
|
||||
int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm) {
|
||||
getAngularConversionParameter(BIN_SIZE);
|
||||
if (nBins)
|
||||
return resetMerging(mp, mv, me, mm,nBins);
|
||||
else
|
||||
@ -327,7 +339,6 @@ int angularConversion::finalizeMerging() {
|
||||
|
||||
|
||||
int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm) {
|
||||
|
||||
if (nBins)
|
||||
return finalizeMerging(mp, mv, me, mm, nBins);
|
||||
else
|
||||
@ -335,7 +346,7 @@ int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm)
|
||||
}
|
||||
|
||||
int angularConversion::addToMerging(float *p1, float *v1, float *e1, int *badChanMask ) {
|
||||
|
||||
|
||||
return addToMerging(p1,v1,e1,mergingBins,mergingCounts, mergingErrors, mergingMultiplicity, badChanMask);
|
||||
|
||||
|
||||
@ -344,20 +355,24 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, int *badCh
|
||||
|
||||
int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int *badChanMask ) {
|
||||
|
||||
|
||||
int del=0;
|
||||
|
||||
if (*binSize==0)
|
||||
return FAIL;
|
||||
|
||||
if (nBins==0)
|
||||
if (getAngularConversionParameter(BIN_SIZE)==0){
|
||||
cout << "no bin size " << endl;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (nBins==0) {
|
||||
cout << "no bins " << endl;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (p1==NULL) {
|
||||
del=1;
|
||||
p1=convertAngles();
|
||||
}
|
||||
|
||||
|
||||
int ret=addToMerging(p1, v1, e1, mp, mv,me, mm,getTotalNumberOfChannels(), *binSize,nBins, badChanMask );
|
||||
|
||||
|
||||
@ -429,7 +444,11 @@ float angularConversion::getAngularConversionParameter(angleConversionParameter
|
||||
return *globalOffset;
|
||||
case FINE_OFFSET:
|
||||
return *fineOffset;
|
||||
case BIN_SIZE:
|
||||
case BIN_SIZE:
|
||||
if (*binSize>0)
|
||||
nBins=360./(*binSize);
|
||||
else
|
||||
nBins=0;
|
||||
return *binSize;
|
||||
case MOVE_FLAG:
|
||||
if (moveFlag)
|
||||
|
@ -227,7 +227,7 @@ class angularConversion : public virtual slsDetectorBase {
|
||||
\param bs bin size to be set
|
||||
\returns actual bin size
|
||||
*/
|
||||
float setBinSize(float bs){return setAngularConversionParameter(BIN_SIZE,bs);};
|
||||
float setBinSize(float bs){if (bs>0) nBins=360/bs; return setAngularConversionParameter(BIN_SIZE,bs);};
|
||||
|
||||
/**
|
||||
get detector bin size
|
||||
|
@ -181,7 +181,6 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
|
||||
// ;
|
||||
// } else {
|
||||
|
||||
|
||||
|
||||
|
||||
float *rcdata=NULL, *rcerr=NULL;
|
||||
@ -235,7 +234,7 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
|
||||
ang=convertAngles();
|
||||
writeDataFile (fname+ext, ffcdata, ffcerr,ang);
|
||||
}
|
||||
|
||||
|
||||
if (*correctionMask&(1<< ANGULAR_CONVERSION) && getNumberOfPositions()>0) {
|
||||
#ifdef VERBOSE
|
||||
cout << "**************Current position index is " << getCurrentPositionIndex() << endl;
|
||||
@ -252,10 +251,8 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
|
||||
#ifdef VERBOSE
|
||||
cout << "add to merging "<< getCurrentPositionIndex() << endl;
|
||||
#endif
|
||||
|
||||
if (*correctionMask&(1<< ANGULAR_CONVERSION))
|
||||
|
||||
addToMerging(ang, ffcdata, ffcerr, badChannelMask );
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << getCurrentPositionIndex() << " " << getNumberOfPositions() << endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user