11from ROOT
import Belle2
12from ROOT
import gSystem
13import matplotlib.pyplot
as plt
17import matplotlib
as mpl
21gSystem.Load(
'libframework')
22gSystem.Load(
'libtracking')
23gSystem.Load(
'libtracking_trackFindingCDC')
27 return logging.getLogger(__name__)
35center_phi = np.arctan2(center_y, center_x)
46curvature_estimates = []
47curvature_variances = []
51 for i_toy
in range(n_toys):
54 chis = np.random.uniform(0, np.pi, n_points)
57 chis = np.linspace(0, np.pi, n_points)
59 ls = np.random.normal(0, 10 * np.sqrt(pos_var), n_points)
60 dls = np.random.normal(0, np.sqrt(pos_var), n_points)
62 xs = (radius + ls + dls) * np.cos(chis + center_phi - np.pi) + center_x
63 ys = (radius + ls + dls) * np.sin(chis + center_phi - np.pi) + center_y
67 for x, y, l
in zip(xs, ys, ls):
69 observations.fill(x, y, l, weight)
72 trajectory = fitter.fit(observations)
74 circle = trajectory.getGlobalCircle()
75 if circle.curvature() < 0:
78 curvature_estimates.append(circle.curvature())
79 curvature_variances.append(trajectory.getLocalVariance(0))
80 chi2s.append(trajectory.getChi2())
82 circle_points = [circle.atArcLength(chi * radius)
for chi
in np.linspace(0, np.pi, 50)]
83 circle_xs = [p.x()
for p
in circle_points]
84 circle_ys = [p.y()
for p
in circle_points]
87 plt.plot(circle_xs, circle_ys)
92 curvature_residuals = np.array(curvature_estimates) - 1 / radius
94 plt.hist(curvature_residuals, bins=100)
95 plt.title(
"Curvature residual")
98 plt.hist(curvature_residuals / np.sqrt(curvature_variances), bins=100, normed=
True)
100 normal_xs = np.linspace(-4, 4, 50)
101 normal_ys = np.exp(-normal_xs * normal_xs / 2) / np.sqrt(2 * np.pi)
102 plt.plot(normal_xs, normal_ys)
103 plt.title(
"Curvature pull")
106 plt.hist(chi2s, bins=100)
110 p_values = prob(chi2s, ndfs)
111 plt.hist(p_values, bins=100, normed=
True)
112 plt.plot([0, 1], [1, 1])
116if __name__ ==
"__main__":
Class serving as a storage of observed drift circles to present to the Riemann fitter.
static const CDCRiemannFitter & getFitter()
Static getter for a general Riemann fitter.