Interpolation has problems. To be checked

This commit is contained in:
2019-12-17 17:09:50 +01:00
parent 27f2321d64
commit f7695113b8
9 changed files with 923 additions and 843 deletions

View File

@ -4,8 +4,6 @@
//#include "tiffIO.h"
#include "etaInterpolationBase.h"
#include "eta2InterpolationBase.h"
#include "eta3InterpolationBase.h"
class etaInterpolationPosXY : public virtual etaInterpolationBase{
public:
@ -44,9 +42,8 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
double hiy[nbetaY]; //integral of projection y
// int ii=0;
double etax, etay;
for (int ib=0; ib<nbetaX; ib++) {
for (int ib=0; ib<nbetaX; ib++) {
//tot_eta_y=0;
for (int iby=0; iby<nbetaY; iby++) {
@ -54,10 +51,10 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
//cout << etax << endl;
// tot_eta_x+=hx[iby];
if (etay>=0 && etay<=1)
// if (etay>=0 && etay<=1)
hy[iby]=heta[ib+iby*nbetaX];
else
hy[iby]=0;
// else
// hy[iby]=0;
// tot_eta_y+=hy[iby];
}
@ -71,7 +68,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
tot_eta_y=hiy[nbetaY-1]+1;
for (int iby=0; iby<nbetaY; iby++) {
if (tot_eta_y<=0) {
if (tot_eta_y<=1) {
hhy[ib+iby*nbetaX]=-1;
//ii=(ibx*nSubPixels)/nbeta;
} else {
@ -80,7 +77,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
}
}
}
cout << "hhy filled " << endl;
for (int ib=0; ib<nbetaY; ib++) {
@ -88,11 +85,11 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
for (int ibx=0; ibx<nbetaX; ibx++) {
etax=etamin+ibx*etastepX;
//cout << etax << endl;
if (etax>=0 && etax<=1)
// if (etax>=0 && etax<=1)
hx[ibx]=heta[ibx+ib*nbetaX];
else {
hx[ibx]=0;
}
// else {
// hx[ibx]=0;
// }
}
hix[0]=hx[0];
@ -104,7 +101,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
tot_eta_x=hix[nbetaX-1]+1;
for (int ibx=0; ibx<nbetaX; ibx++) {
if (tot_eta_x<=0) {
if (tot_eta_x<=1) {
hhx[ibx+ib*nbetaX]=-1;
}
else {
@ -122,40 +119,49 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
hhx[ibx+ib*nbetaX]=hix[ibx]/tot_eta_x;
}
}
}
}
int ibx, iby, ib;
/* cout << "hhx filled " << endl; */
/* int ibx, iby, ib; */
iby=0;
while (hhx[iby*nbetaY+nbetaY/2]<0) iby++;
for (ib=0; ib<iby;ib++) {
for (ibx=0; ibx<nbetaX;ibx++)
hhx[ibx+nbetaX*ib]=hhx[ibx+nbetaX*iby];
}
iby=nbetaY-1;
/* iby=0; */
/* while (hhx[iby*nbetaY+nbetaY/2]<0 && iby<nbetaY/2) iby++; */
/* for (ib=0; ib<iby;ib++) { */
/* for (ibx=0; ibx<nbetaX;ibx++) */
/* hhx[ibx+nbetaX*ib]=hhx[ibx+nbetaX*iby]; */
/* } */
while (hhx[iby*nbetaY+nbetaY/2]<0) iby--;
for (ib=iby+1; ib<nbetaY;ib++) {
for (ibx=0; ibx<nbetaX;ibx++)
hhx[ibx+nbetaX*ib]=hhx[ibx+nbetaX*iby];
}
iby=0;
while (hhy[nbetaX/2*nbetaX+iby]<0) iby++;
for (ib=0; ib<iby;ib++) {
for (ibx=0; ibx<nbetaY;ibx++)
hhy[ib+nbetaX*ibx]=hhy[iby+nbetaX*ibx];
}
iby=nbetaX-1;
while (hhy[nbetaX/2*nbetaX+iby]<0) iby--;
for (ib=iby+1; ib<nbetaX;ib++) {
for (ibx=0; ibx<nbetaY;ibx++)
hhy[ib+nbetaX*ibx]=hhy[iby+nbetaX*ibx];
}
/* cout << "hhx low optimized" << endl; */
/* iby=nbetaY-1; */
/* while (hhx[iby*nbetaY+nbetaY/2]<0 && iby>0) iby--; */
/* for (ib=iby+1; ib<nbetaY;ib++) { */
/* for (ibx=0; ibx<nbetaX;ibx++){ */
/* cout << iby << " " << ib << " " << ibx << " " << ibx+nbetaX*ib << " " << ibx+nbetaX*iby << " " << nbetaX*nbetaY << endl; */
/* hhx[ibx+nbetaX*ib]=hhx[ibx+nbetaX*iby]; */
/* } */
/* } */
/* cout << "hhx high optimized" << endl; */
/* iby=0; */
/* while (hhy[nbetaX/2*nbetaX+iby]<0 && iby<nbetaX) iby++; */
/* for (ib=0; ib<iby;ib++) { */
/* for (ibx=0; ibx<nbetaY;ibx++) */
/* hhy[ib+nbetaX*ibx]=hhy[iby+nbetaX*ibx]; */
/* } */
/* cout << "hhy low optimized" << endl; */
/* iby=nbetaX-1; */
/* while (hhy[nbetaX/2*nbetaX+iby]<0 && iby>) iby--; */
/* for (ib=iby+1; ib<nbetaX;ib++) { */
/* for (ibx=0; ibx<nbetaY;ibx++) */
/* hhy[ib+nbetaX*ibx]=hhy[iby+nbetaX*ibx]; */
/* } */
/* cout << "hhy high optimized" << endl; */
@ -180,7 +186,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
class eta2InterpolationPosXY : public virtual eta2InterpolationBase, public virtual etaInterpolationPosXY {
public:
eta2InterpolationPosXY(int nx=400, int ny=400, int ns=25, int nsy=25, int nb=-1, int nby=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny, ns, nsy, nb, nby, emin, emax),eta2InterpolationBase(nx,ny, ns, nsy, nb, nby, emin, emax),etaInterpolationPosXY(nx,ny, ns, nsy, nb, nby, emin, emax){
// cout << "e2pxy " << nb << " " << emin << " " << emax << endl;
cout << "e2pxy " << nbetaX << " " << nbetaY << etamin << " " << etamax << " " << nSubPixelsX<< " " << nSubPixelsY << endl;
};
eta2InterpolationPosXY(eta2InterpolationPosXY *orig): etaInterpolationBase(orig), etaInterpolationPosXY(orig) {};
@ -189,12 +195,12 @@ class eta2InterpolationPosXY : public virtual eta2InterpolationBase, public virt
};
//
class eta3InterpolationPosXY : public virtual eta3InterpolationBase, public virtual etaInterpolationPosXY {
public:
eta3InterpolationPosXY(int nx=400, int ny=400, int ns=25, int nsy=25, int nb=-1, int nby=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny, ns, nsy, nb, nby, emin, emax),eta3InterpolationBase(nx,ny, ns, nsy, nb, nby, emin, emax), etaInterpolationPosXY(nx,ny, ns, nsy, nb, nby, emin, emax){
// cout << "e3pxy " << nbeta << " " << etamin << " " << etamax << " " << nSubPixels<< endl;
eta3InterpolationPosXY(int nx=400, int ny=400, int ns=25, int nsy=25, int nb=-1, int nby=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny, ns, nsy, nb, nby, emin, emax), eta3InterpolationBase(nx,ny, ns, nsy, nb, nby, emin, emax), etaInterpolationPosXY(nx,ny, ns, nsy, nb, nby, emin, emax){
cout << "e3pxy " << nbetaX << " " << nbetaY << etamin << " " << etamax << " " << nSubPixelsX<< " " << nSubPixelsY << endl;
};
eta3InterpolationPosXY(eta3InterpolationPosXY *orig): etaInterpolationBase(orig), etaInterpolationPosXY(orig) {};