9#include "arich/modules/arichReconstruction/Utility.h"
10#include <Math/Vector3D.h>
11#include <Math/Rotation3D.h>
26 const double HF = Z1 / 2;
27 const double C1 = 0.56418958;
29 const double P10 = +3.6767877;
30 const double Q10 = +3.2584593;
31 const double P11 = -9.7970465E-2;
33 static const double P2[5] = { 7.3738883, 6.8650185, 3.0317993, 0.56316962, 4.3187787e-5 };
34 static const double Q2[5] = { 7.3739609, 15.184908, 12.79553, 5.3542168, 1. };
36 const double P30 = -1.2436854E-1;
37 const double Q30 = +4.4091706E-1;
38 const double P31 = -9.6821036E-2;
46 H = x * (P10 + P11 * Y) / (Q10 + Y);
51 for (
int c1 = 3; c1 >= 0; c1--) {
55 H = 1 - exp(-V * V) * AP / AQ;
58 H = 1 - exp(-V * V) * (C1 + Y * (P30 + P31 * Y) / (Q30 + Y)) / V;
69 ROOT::Math::XYZVector Refraction(
const ROOT::Math::XYZVector s,
const double n)
74 if (x * x + y * y > 1)
return ROOT::Math::XYZVector();
75 if (s.Z() < 0)
return ROOT::Math::XYZVector(x, y, -
sqrt(1 - x * x - y * y));
76 else return ROOT::Math::XYZVector(x, y,
sqrt(1 - x * x - y * y));
81 int Refraction(ROOT::Math::XYZVector s, ROOT::Math::XYZVector norm,
double n, ROOT::Math::XYZVector
84 double sp = s.Dot(norm);
85 double sign = (sp > 0) * 2 - 1;
86 ROOT::Math::XYZVector vsth = (s - sp * norm) * (1 / n);
87 double cth =
sqrt(1 - vsth.Mag2());
88 newdir = vsth + cth * norm * sign;
93 ROOT::Math::XYZVector setThetaPhi(
double theta,
double fi)
95 ROOT::Math::XYZVector r;
96 r.SetXYZ(cos(fi) * sin(theta),
104 ROOT::Math::Rotation3D TransformToFixed(ROOT::Math::XYZVector r)
108 ROOT::Math::XYZVector fX, fY, fZ;
110 double ss = 1 - r.Y() * r.Y();
114 fX = ROOT::Math::XYZVector(fZ.Z() / ss, 0, -fZ.X() / ss);
117 fZ = ROOT::Math::XYZVector(0, 1, 0);
118 fX = ROOT::Math::XYZVector(0, 0, 1);
119 fY = ROOT::Math::XYZVector(1, 0, 0);
121 ROOT::Math::Rotation3D transform;
122 transform.SetComponents(fX, fY, fZ);
127 ROOT::Math::Rotation3D TransformFromFixed(ROOT::Math::XYZVector r)
131 ROOT::Math::XYZVector fX, fY, fZ;
133 double ss = 1 - r.Y() * r.Y();
137 fX = ROOT::Math::XYZVector(fZ.Z() / ss, 0, -fZ.X() / ss);
140 fZ = ROOT::Math::XYZVector(0, 1, 0);
141 fX = ROOT::Math::XYZVector(0, 0, 1);
142 fY = ROOT::Math::XYZVector(1, 0, 0);
144 ROOT::Math::Rotation3D transform;
145 transform.SetComponents(fX, fY, fZ);
150 double ExpectedCherenkovAngle(
double p,
double mass,
double refind)
161 if (mass <= 0 || p < 0)
return 0;
163 double b = a /
sqrt(1 + a * a) * refind;
164 if (b > 1)
return acos(1 / b);
168 double SquareInt(
double aaa,
double fi,
double mean,
double sigma)
171 double aa = aaa /
sqrt(2);
173 fi = fi / (2 * M_PI);
174 fi = 8 * (fi - floor(fi));
176 if (fi < 0) fi += 16;
177 if (fi > 8) fi = 16 - fi;
178 if (fi > 4) fi = 8 - fi;
179 if (fi > 2) fi = 4 - fi;
180 if (fi > 1) fi = 2 - fi;
183 double sf = aa * sin(fi);
184 double cf = aa * cos(fi);
188 double n0 = 2 * aa * aa / (cf + sf);
190 const double sq2pi = 1 /
sqrt(2.*M_PI);
191 double sqrt2sigma = 1 / (M_SQRT2 * sigma);
194 a[0] = (mean + sf) * sqrt2sigma;
195 a[1] = (mean - sf) * sqrt2sigma;
196 a[2] = (mean + cf) * sqrt2sigma;
197 a[3] = (mean - cf) * sqrt2sigma;
199 for (
int i = 0; i < 4; i++) b[i] = exp(-a[i] * a[i]);
200 for (
int i = 0; i < 4; i++) a[i] = Erf(a[i]);
203 const double dsf = 0.001;
204 if (fabs(sf) > dsf) gint += 0.5 * n0 * (a[0] - a[1]);
206 double dy = (cf - sf);
207 double dx = (cf + sf);
209 if (fabs(dx) > dsf && fabs(dy) > dsf) {
211 double k = dy / dx + dx / dy;
216 sq2pi * k * sigma * (-b[0] - b[1] + b[2] + b[3]) +
217 0.5 * k * mean * (-a[0] - a[1] + a[2] + a[3]) +
218 0.5 * n * (-a[0] + a[1] + a[2] - a[3]);
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.