Commit d6adb5e7 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

Merge branch 'TrackingCorrection' into 'preprod'

Correct bug in the sphere distance calculation

See merge request IPNL_GAMMA/narval_emulator!57
parents 5924ea4d ab62d15f
......@@ -63,7 +63,7 @@ void distances(double r_3d[intmax*intmax], /*Distance physique dans le detect
///**********************************///
///New sphere calculation
///New sphere calculation
/*
Here we calculate the real Ge distances
For this we need the depth in detector from front face, "z relative"
......@@ -83,22 +83,6 @@ void distances(double r_3d[intmax*intmax], /*Distance physique dans le detect
r_ge[i*intmax+i]=z_rel/cosgo;
if(r_ge[i*intmax+i] < 0)r_ge[i*intmax+i]=uncertainty;
for (j = i + 1; j < number; j++) {
r_3d[i*intmax+j] = sqrt(SQ(pos[i].x - pos[j].x) + SQ(pos[i].y - pos[j].y) + SQ(pos[i].z - pos[j].z));
r_3d[j*intmax+i] = r_3d[i*intmax+j];
ri = ri_orig;
rj = sqrt(SQ(pos[j].x) + SQ(pos[j].y) + SQ(pos[j].z));
if (ri > rj) {
k = j;
l = i;
} else {
k = i;
l = j;
}
///**********************************///
///Old calculation
......@@ -120,23 +104,22 @@ void distances(double r_3d[intmax*intmax], /*Distance physique dans le detect
// }
// if(r_ge[i*intmax+i] < 0)r_ge[i*intmax+i]=uncertainty;
// for (j = i + 1; j < number; j++) {
// r_3d[i*intmax+j] = sqrt(SQ(pos[i].x - pos[j].x) + SQ(pos[i].y - pos[j].y) + SQ(pos[i].z - pos[j].z));
// r_3d[j*intmax+i] = r_3d[i*intmax+j];
// ri = ri_orig;
// rj = sqrt(SQ(pos[j].x) + SQ(pos[j].y) + SQ(pos[j].z));
// if (ri > rj) {
// k = j;
// l = i;
// } else {
// k = i;
// l = j;
// }
///**********************************///
if(r_ge[i*intmax+i] < 0)r_ge[i*intmax+i]=uncertainty;
for (j = i + 1; j < number; j++) {
r_3d[i*intmax+j] = sqrt(SQ(pos[i].x - pos[j].x) + SQ(pos[i].y - pos[j].y) + SQ(pos[i].z - pos[j].z));
r_3d[j*intmax+i] = r_3d[i*intmax+j];
ri = ri_orig;
rj = sqrt(SQ(pos[j].x) + SQ(pos[j].y) + SQ(pos[j].z));
if (ri > rj) {
k = j;
l = i;
} else {
k = i;
l = j;
}
/* vector (interaction point i -center) */
Ax = - pos[k].x;
......
......@@ -56,6 +56,7 @@ void oft_process_event(OftStruct *mydata, unsigned int *error_code) {
if (mydata->angtheta[j] < mydata->angtheta[i]) {
swapd(mydata->eh, i, j);
swapp(mydata->ipos, i, j);
swapi(mydata->DetId, i, j);
swapd(mydata->angtheta, i, j);
swapd(mydata->angphi, i, j);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment