slsDetectorCalibration updated to latest version

This commit is contained in:
2019-09-26 11:34:11 +02:00
parent 52f74142b1
commit 2c09d394a6
77 changed files with 2714 additions and 6703 deletions

View File

@ -33,7 +33,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
{
double sDum[2][2];
double tot, totquad;
double etax,etay;
double etax=0,etay=0;
int corner;
corner=calcQuad(data, tot, totquad, sDum);
@ -49,7 +49,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
{
double sDum[2][2];
double tot, totquad;
double etax,etay;
double etax=0,etay=0;
int corner;
corner=calcQuad(data, tot, totquad, sDum);
@ -71,7 +71,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &int_x, double &int_y) {
double cc[2][2];
int xoff, yoff;
int xoff=0, yoff=0;
switch (quad) {
case BOTTOM_LEFT:
xoff=0;
@ -92,7 +92,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
default:
;
}
double etax, etay;
double etax=0, etay=0;
if (nSubPixels>2) {
cc[0][0]=cl[xoff+3*yoff];
cc[1][0]=cl[xoff+3*(yoff+1)];
@ -100,6 +100,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
cc[1][1]=cl[xoff+1+3*(yoff+1)];
calcEta(totquad,cc,etax,etay);
}
return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y);
}
@ -109,7 +110,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cl,double &int_x, double &int_y) {
double cc[2][2];
int xoff, yoff;
int xoff=0, yoff=0;
switch (quad) {
case BOTTOM_LEFT:
@ -131,7 +132,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
default:
;
}
double etax, etay;
double etax=0, etay=0;
if (nSubPixels>2) {
cc[0][0]=cl[xoff+3*yoff];
cc[1][0]=cl[xoff+3*(yoff+1)];
@ -222,7 +223,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay) {
double cc[2][2];
int xoff, yoff;
int xoff=0, yoff=0;
switch (quad) {
case BOTTOM_LEFT:
@ -260,7 +261,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay) {
double cc[2][2];
int xoff, yoff;
int xoff=0, yoff=0;
switch (quad) {
case BOTTOM_LEFT:
@ -308,11 +309,12 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
virtual int addToFlatField(double *cluster, double &etax, double &etay){
double sDum[2][2];
double tot, totquad;
int corner;
corner=calcQuad(cluster, tot, totquad, sDum);
// int corner;
//corner=
calcQuad(cluster, tot, totquad, sDum);
double xpos_eta,ypos_eta;
double dX,dY;
//double xpos_eta,ypos_eta;
//double dX,dY;
calcEta(totquad, sDum, etax, etay);
@ -324,11 +326,12 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
virtual int addToFlatField(int *cluster, double &etax, double &etay){
double sDum[2][2];
double tot, totquad;
int corner;
corner=calcQuad(cluster, tot, totquad, sDum);
//int corner;
//corner=
calcQuad(cluster, tot, totquad, sDum);
double xpos_eta,ypos_eta;
double dX,dY;
// double xpos_eta,ypos_eta;
//double dX,dY;
calcEta(totquad, sDum, etax, etay);

View File

@ -59,10 +59,10 @@ class eta3InterpolationBase : public virtual etaInterpolationBase {
//////////// /*It return position hit for the event in input */ //////////////
virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y)
{
double tot, totquad;
double tot;
double etax,etay;
int corner=calcEta3(data,etax,etay, totquad);
int corner=calcEta3(data,etax,etay, tot);
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
@ -72,11 +72,11 @@ class eta3InterpolationBase : public virtual etaInterpolationBase {
virtual void getInterpolatedPosition(int x, int y, double *data, double &int_x, double &int_y)
{
double sDum[2][2];
double tot, totquad;
//double sDum[2][2];
double tot;
double etax,etay;
int corner=calcEta3(data,etax,etay, totquad);
int corner=calcEta3(data,etax,etay, tot);
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);

View File

@ -190,7 +190,7 @@ float *gethhx()
void debugSaveAll(int ind=0) {
int ib, ibx, iby;
int ibx, iby;
char tit[10000];
float tot_eta=0;
@ -204,7 +204,7 @@ float *gethhx()
etah[ii]=heta[ii];
tot_eta+=heta[ii];
}
sprintf(tit,"/scratch/eta.tiff",ind);
sprintf(tit,"/scratch/eta_%d.tiff",ind);
WriteToTiff(etah, tit, etabins, etabins);
@ -284,7 +284,7 @@ float *gethhx()
double calcDiff(double avg, float *hx, float *hy) {
//double p_tot=0;
double diff=0, d;
double bsize=1./nSubPixels;
//double bsize=1./nSubPixels;
int nbad=0;
double p_tot_x[nSubPixels], p_tot_y[nSubPixels], p_tot[nSubPixels*nSubPixels];
double maxdiff=0, mindiff=avg*nSubPixels*nSubPixels;
@ -351,9 +351,9 @@ float *gethhx()
return sqrt(diff);
}
int *heta;
float *hhx;
float *hhy;
int *heta;
int nbeta;
double etamin, etamax, etastep;
double rangeMin, rangeMax;

View File

@ -35,7 +35,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
///*Eta Distribution Rebinning*///
double bsize=1./nSubPixels; //precision
// double bsize=1./nSubPixels; //precision
// cout<<"nPixelsX = "<<nPixelsX<<" nPixelsY = "<<nPixelsY<<" nSubPixels = "<<nSubPixels<<endl;
double tot_eta=0;
double tot_eta_x=0;
@ -50,8 +50,8 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
double hy[nbeta]; //profile y
double hix[nbeta]; //integral of projection x
double hiy[nbeta]; //integral of projection y
int ii=0;
double etax, etay;
// int ii=0;
double etax;//, etay;
for (int ib=0; ib<nbeta; ib++) {
tot_eta_x=0;
@ -81,7 +81,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
hiy[iby]=hiy[iby-1]+hy[iby];
}
ii=0;
// ii=0;
tot_eta_x=hix[nbeta-1]+1;
tot_eta_y=hiy[nbeta-1]+1;
@ -98,7 +98,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
/* if (ii!=(nSubPixels-1)) */
/* cout << ib << " x " << tot_eta_x << " " << (ii+1)*tot_eta_x*bsize << " " << ii << " " << hix[nbeta-1]<< endl; */
ii=0;
//ii=0;
for (int ibx=0; ibx<nbeta; ibx++) {
if (tot_eta_y<=0) {

View File

@ -0,0 +1,52 @@
#ifndef INTERPOLATION_ETAVEL_H
#define INTERPOLATION_ETAVEL_H
#include <slsInterpolation.h>
#include "EtaVEL.h"
#include "TH2F.h"
//#include "EtaVEL.cpp"
//class EtaVEL;
class interpolation_EtaVEL: public slsInterpolation {
public:
interpolation_EtaVEL(int nx=40, int ny=160, int ns=25, double etamin=-0.02, double etamax=1.02, int p=0);
~interpolation_EtaVEL();
//create eta distribution, eta rebinnining etc.
//returns flat field image
void prepareInterpolation(int &ok){prepareInterpolation(ok,10000);};
void prepareInterpolation(int &ok, int maxit);
//create interpolated image
//returns interpolated image
//return position inside the pixel for the given photon
void getInterpolatedPosition(Int_t x, Int_t y, Double_t *data, Double_t &int_x, Double_t &int_y);
void getInterpolatedBin(Double_t *cluster, Int_t &int_x, Int_t &int_y);
int addToFlatField(Double_t *cluster, Double_t &etax, Double_t &etay);
int addToFlatField(Double_t etax, Double_t etay);
int setPlot(int p=-1) {if (p>=0) plot=p; return plot;};
int WriteH(){newEta->Write("newEta"); heta->Write("heta");};
EtaVEL *setEta(EtaVEL *ev){if (ev) {delete newEta; newEta=ev;} return newEta;};
TH2F *setEta(TH2F *ev){if (ev) {delete heta; heta=ev;} return heta;};
void iterate();
void DrawH();
double getChiSq(){return newEta->getChiSq();};
protected:
EtaVEL *newEta;
TH2F *heta;
int plot;
// ClassDefNV(interpolation_EtaVEL,1);
// #pragma link C++ class interpolation_EtaVEL-;
};
#endif