Same (almost) as FastCircle but with arbitrary number of hits.
Strandlie, Wroldsen, Frühwirth NIM A 488 (2002) 332-341. Frühwirth, Strandlie, Waltenberger NIM A 490 (2002) 366-378.
Definition at line 27 of file FastCircleFit.h.
template<typename P , typename E , typename C >
void FastCircleFit::calculate |
( |
const P & |
points, |
|
|
const E & |
errors, |
|
|
C & |
x, |
|
|
C & |
y, |
|
|
C & |
z, |
|
|
C & |
weight |
|
) |
| |
|
private |
Definition at line 82 of file FastCircleFit.h.
References funct::A, EnergyCorrector::c, chi2_, HLT_FULL_cff::distance, i, timingPdfMaker::mean, N, gen::n, AlCaHLTBitMon_ParallelJobs::p, point, PRINT, rho_, S(), sqr(), mathSSE::sqrt(), tmp, w, x0_, and y0_.
Referenced by FastCircleFit().
83 const auto N = points.size();
86 for(
size_t i=0;
i<
N; ++
i) {
87 const auto&
point = points[
i];
88 const auto p =
point.basicVector();
97 const float w = 1.f/(
point.perp2()*phiErr2);
100 PRINT <<
" point " <<
p.x()
102 <<
" transformed " <<
x[
i]
108 const float invTotWeight = 1.f/std::accumulate(
weight.begin(),
weight.end(), 0.f);
109 PRINT <<
" invTotWeight " << invTotWeight;
111 Eigen::Vector3f
mean = Eigen::Vector3f::Zero();
112 for(
size_t i=0;
i<
N; ++
i) {
118 mean *= invTotWeight;
119 PRINT <<
" mean " << mean[0] <<
" " << mean[1] <<
" " << mean[2] << std::endl;
121 Eigen::Matrix3f
A = Eigen::Matrix3f::Zero();
122 for(
size_t i=0;
i<
N; ++
i) {
123 const auto diff_x =
x[
i] - mean[0];
124 const auto diff_y =
y[
i] - mean[1];
125 const auto diff_z =
z[
i] - mean[2];
130 A(0,0) += w * diff_x * diff_x;
131 A(1,0) += w * diff_y * diff_x;
132 A(1,1) += w * diff_y * diff_y;
133 A(2,0) += w * diff_z * diff_x;
134 A(2,1) += w * diff_z * diff_y;
135 A(2,2) += w * diff_z * diff_z;
136 PRINT <<
" i " <<
i <<
" A " <<
A(0,0) <<
" " <<
A(0,1) <<
" " <<
A(0,2) << std::endl
137 <<
" " <<
A(1,0) <<
" " <<
A(1,1) <<
" " <<
A(1,2) << std::endl
138 <<
" " <<
A(2,0) <<
" " <<
A(2,1) <<
" " <<
A(2,2) << std::endl;
140 A *= 1./
static_cast<float>(
N);
142 PRINT <<
" A " <<
A(0,0) <<
" " <<
A(0,1) <<
" " <<
A(0,2) << std::endl
143 <<
" " <<
A(1,0) <<
" " <<
A(1,1) <<
" " <<
A(1,2) << std::endl
144 <<
" " <<
A(2,0) <<
" " <<
A(2,1) <<
" " <<
A(2,2) << std::endl;
147 Eigen::SelfAdjointEigenSolver<Eigen::Matrix3f> eigen(A);
148 const auto& eigenValues = eigen.eigenvalues();
149 const auto& eigenVectors = eigen.eigenvectors();
152 PRINT <<
" eigenvalues " << eigenValues[0]
153 <<
" " << eigenValues[1]
154 <<
" " << eigenValues[2]
157 PRINT <<
" eigen " << eigenVectors(0,0) <<
" " << eigenVectors(0,1) <<
" " << eigenVectors(0,2) << std::endl
158 <<
" " << eigenVectors(1,0) <<
" " << eigenVectors(1,1) <<
" " << eigenVectors(1,2) << std::endl
159 <<
" " << eigenVectors(2,0) <<
" " << eigenVectors(2,1) <<
" " << eigenVectors(2,2) << std::endl;
162 auto n = eigenVectors.col(0);
163 PRINT <<
" n (unit) " <<
n[0] <<
" " <<
n[1] <<
" " <<
n[2] << std::endl;
165 const float c = -1.f * (
n[0]*mean[0] +
n[1]*mean[1] +
n[2]*mean[2]);
167 PRINT <<
" c " << c << std::endl;
170 const auto tmp = 0.5f * 1.f/
n[2];
173 const float rho2 = (1 -
sqr(
n[2]) - 4*c*
n[2]) *
sqr(tmp);
178 for(
size_t i=0;
i<
N; ++
i) {
180 #if defined(MK_DEBUG) || defined(EDM_ML_DEBUG)
183 <<
" chi2 incr " << incr
184 <<
" d(hit, circle) " << distance
double S(const TLorentzVector &, const TLorentzVector &)
std::vector< std::vector< double > > tmp
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point