18 if (!truthfilename.empty())
20 forward = TFile::Open(truthfilename.c_str(),
"READ");
23 forward->GetObject(
"hIntDistortionX",
hX);
24 forward->GetObject(
"hIntDistortionY",
hY);
25 forward->GetObject(
"hIntDistortionZ",
hZ);
28 forward->GetObject(
"hIntDistortionR",
hR);
38 if (!correctionfilename.empty())
43 average = TFile::Open(correction_filename.c_str(),
"READ");
62 double x,
y,
z, xshift, yshift, zshift;
65 TVector3 shiftposition;
71 double r = position.Perp();
72 double phi = position.Phi();
73 if (position.Phi() < 0.0)
75 phi = position.Phi() + 2.0 * M_PI;
84 xshift =
hX->Interpolate(phi, r, z);
85 yshift =
hY->Interpolate(phi, r, z);
86 zshift =
hZ->Interpolate(phi, r, z);
92 double raveshift =
hRave->Interpolate(phi, r, z);
93 double paveshift =
hPhiave->Interpolate(phi, r, z);
94 double cosphi = cos(phi);
95 double sinphi = sin(phi);
96 xshift -= raveshift * cosphi - paveshift * sinphi;
97 yshift -= raveshift * sinphi + paveshift * cosphi;
99 zshift -=
hZave->Interpolate(phi, r, z);
102 TVector3 forwardshift(x + xshift, y + yshift, z + zshift);
112 TVector3 shiftposition;
114 x = forwardshift.X();
115 y = forwardshift.Y();
116 z = forwardshift.Z();
118 double rforward = forwardshift.Perp();
119 double phiforward = forwardshift.Phi();
120 if (forwardshift.Phi() < 0.0)
122 phiforward += 2.0 * M_PI;
125 double xshiftback = -1 *
hXBack->Interpolate(phiforward, rforward, z);
126 double yshiftback = -1 *
hYBack->Interpolate(phiforward, rforward, z);
127 double zshiftback = -1 *
hZBack->Interpolate(phiforward, rforward, z);
129 shiftposition.SetXYZ(x + xshiftback, y + yshiftback, z + zshiftback);
131 return shiftposition;