corrections to the angular conversion made at the beamline

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@536 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
x04sa
2013-04-29 08:46:47 +00:00
parent 689a8a6b44
commit 3c3ab6fc9d
6 changed files with 136 additions and 97 deletions

View File

@ -39,9 +39,9 @@ double* angularConversionStatic::convertAngles(double pos, int nch, int *chansPe
enc=pos;
for (int ip=0; ip<nch; ip++) {
#ifdef VERBOSE
// cout << "ip " << ip << " ch0 " << ch0 << " chlast " << chlast << " imod " << imod << endl;
#endif
//#ifdef VERBOSE
cout << "ip " << ip << " ch0 " << ch0 << " chlast " << chlast << " imod " << imod << endl;
//#endif
if (ip>chlast) {
imod++;
p=angOff[imod];
@ -50,6 +50,11 @@ double* angularConversionStatic::convertAngles(double pos, int nch, int *chansPe
else
enc=pos;
if (p)
cout << enc << endl << fo+go << endl << p->r_conversion << endl << p->center << endl << p->offset << endl << p->tilt << angdir << endl;
else
cout << "no ang conv " << endl;
ch0=chlast+1;
nchmod=chansPerMod[imod];
if (nchmod>0)
@ -65,6 +70,7 @@ double* angularConversionStatic::convertAngles(double pos, int nch, int *chansPe
p->offset, \
p->tilt, \
angdir );
cout << "ip " << ip << " ch0 " << ch0 << " chlast " << chlast << " imod " << imod << endl;
}
return ang;
}
@ -76,6 +82,10 @@ double* angularConversionStatic::convertAngles(double pos, int nch, int *chansPe
double angularConversionStatic::convertAngle(double pos, int ich, angleConversionConstant *p, int mF, double fo, double go, int angdir) {
// if (p)
// cout << pos << endl << fo+go << endl << p->r_conversion << endl << p->center << endl << p->offset << endl << mF << endl << angdir << endl;
// else
// cout << "no ang conv " << endl;
double enc=0, trans=0;
double ang;
@ -115,7 +125,7 @@ double angularConversionStatic::convertAngle(double pos, int ich, angleConversio
p->offset, \
trans, \
angdir );
// cout << ich << " " << ang << endl << endl;
return ang;
@ -198,14 +208,16 @@ int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod,
//" module %i center %E +- %E conversion %E +- %E offset %f +- %f \n"
while (infile.good() and interrupt==0) {
getline(infile,str);
#ifdef VERBOSE
//#ifdef VERBOSE
cout << "** mod " << nm << " " ;
std::cout<< str << std::endl;
#endif
//#endif
istringstream ssstr(str);
ssstr >> ss >> mod;
ssstr >> ss >> center;
if (ss==string("center"))
newangconv=0;
else
newangconv=1;
ssstr >> ss >> ecenter;
if (newangconv) {
@ -216,23 +228,29 @@ int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod,
ssstr >> ss >> er_conv;
ssstr >> ss >> off;
ssstr >> ss >> eoff;
cout << nm << " " << nmod << endl;
if (nm<nmod && nm>=0 ) {
if (newangconv==0) {
angOff[nm].center=center;
angOff[nm].r_conversion=r_conv;
angOff[nm].offset=off;
angOff[nm].ecenter=ecenter;
angOff[nm].er_conversion=er_conv;
angOff[nm].eoffset=eoff;
} else {
if (newangconv!=0) {
// } else {
angOff[nm].tilt=pitch;
angOff[nm].etilt=epitch;
}
// cout << angOff[nm].center << " " << \
// angOff[nm].r_conversion << " " << \
// angOff[nm].offset << endl;
} else
break;
//cout << nm<<" " << angOff[nm].offset << endl;
cout << nm<<" " << angOff[nm].offset << endl;
nm++;
if (nm>=nmod)
break;

View File

@ -633,6 +633,12 @@ void postProcessing::initDataset(int r) {
angRad[im]=p->r_conversion;
angOff[im]=p->offset;
angCenter[im]=p->center;
cout << im << " " << angCenter[im] << " " << angRad[im] << " " << angOff[im] << endl;
}
sx=getAngularConversionParameter(SAMPLE_X);
sy=getAngularConversionParameter(SAMPLE_Y);

View File

@ -1,6 +1,7 @@
#include "postProcessingFuncs.h"
#include "angleConversionConstant.h"
#define VERBOSE
postProcessingFuncs::postProcessingFuncs(int *nModules,int *chPerMod,int modMask[],int badCh[], double ffcoeff[], double fferr[], double* t, int *dir, double angRadius[], double angOffset[], double angCentre[], double* to, double* bs, double *sX, double *sY):
nMods(0), chansPerMod(NULL), moduleMask(NULL), badChannelMask(NULL), ffCoeff(NULL), ffErr(NULL), tDead(0), angDir(1), angConv(NULL), totalOffset(0), binSize(0), sampleX(0), sampleY(0), totalChans(0), nBins(0), mp(NULL), mv(NULL), me(NULL), mm(NULL)
@ -144,17 +145,17 @@ int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double
if (nBins) {
//angconv
#ifdef VERBOSE
cout << "ppFuncs angconv" << endl;
#endif
//check module mask?!?!?!?
// #ifdef VERBOSE
// cout << "ppFuncs angconv" << endl;
// #endif
// //check module mask?!?!?!?
p1=convertAngle(*pos,ich-ch0,angConv[imod],moduleMask[imod],totalOffset,0,angDir);
#ifdef VERBOSE
cout << "ppFuncs merge" << endl;
#endif
// #ifdef VERBOSE
// cout << "ppFuncs merge" << endl;
// #endif
addPointToMerging(p1,vout,eout,mp,mv,me,mm, binSize, nBins);
@ -191,6 +192,11 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
nMods=*nModules;
else
nMods=0;
#ifdef VERBOSE
cout << nMods << endl;
#endif
#ifdef VERBOSE
cout << "tdead " << endl;
#endif
@ -198,8 +204,11 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
if (t)
tDead=*t;
else
t=0;
tDead=0;
#ifdef VERBOSE
cout << tDead << endl;
#endif
#ifdef VERBOSE
cout << "toffset " << endl;
#endif
@ -207,7 +216,10 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
if (to)
totalOffset=*to;
else
to=0;
totalOffset=0;
#ifdef VERBOSE
cout << totalOffset << endl;
#endif
#ifdef VERBOSE
@ -218,6 +230,10 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
else
binSize=0;
#ifdef VERBOSE
cout << binSize << endl;
#endif
#ifdef VERBOSE
cout << "samplex " << endl;
#endif
@ -226,6 +242,9 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
else
sampleX=0;
#ifdef VERBOSE
cout << sampleX << endl;
#endif
#ifdef VERBOSE
cout << "sampley " << endl;
#endif
@ -233,7 +252,10 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
sampleY=*sY;
else
sampleY=0;
#ifdef VERBOSE
cout << sampleY << endl;
#endif
#ifdef VERBOSE
cout << "angdir " << endl;
#endif
@ -242,6 +264,9 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
else
angDir=1;
#ifdef VERBOSE
cout << angDir << endl;
#endif
totalChans=0;
@ -256,19 +281,19 @@ int postProcessingFuncs::initDataset(int *nModules,int *chPerMod,int modMask[],i
angConv=new angleConversionConstant*[nMods];
nBins=(int)(360./binSize)+1;
}
cout << "nBins " << nBins << endl;
for (int im=0; im<nMods; im++) {
#ifdef VERBOSE
cout << "MODULE "<< im << endl;
#endif
//#ifdef VERBOSE
// cout << "MODULE "<< im << endl;
//#endif
chansPerMod[im]=chPerMod[im];
moduleMask[im]=modMask[im];
totalChans+=chansPerMod[im];
if (angConv) {
angConv[im]=new angleConversionConstant(angCenter[im], angRadius[im], angOffset[im], 0);
}
// cout << angCenter[im] << " " << chansPerMod[im] << " " << angRadius[im] << " " << angOffset[im] << " " << moduleMask[im] << endl;
}