6 using namespace std::chrono;
11 template<
class T>
inline constexpr
T square(
const T&
x) {
return x*
x;}
22 for(
int i = 0; i < 6; ++i)
24 for(
int j = 0; j < 6; ++j)
26 svtxCovariance(i,j) = track->
get_error(i,j);
38 printMatrix(
"svtx covariance, acts units: ", svtxCovariance);
40 const double px = track->
get_px();
41 const double py = track->
get_py();
42 const double pz = track->
get_pz();
43 const double p = sqrt(px*px + py*py + pz*pz);
45 const double uPx = px /
p;
46 const double uPy = py /
p;
47 const double uPz = pz /
p;
50 const double cosTheta = uPz;
51 const double sinTheta = sqrt(uPx * uPx + uPy * uPy);
52 const double invSinTheta = 1. / sinTheta;
53 const double cosPhi = uPx * invSinTheta;
54 const double sinPhi = uPy * invSinTheta;
68 sphenixRot(3,4) = 1./
p;
69 sphenixRot(4,5) = 1./
p;
70 sphenixRot(5,6) = 1./
p;
71 sphenixRot(3,7) = uPx * p *
p;
72 sphenixRot(4,7) = uPy * p *
p;
73 sphenixRot(5,7) = uPz * p *
p;
76 = sphenixRot.transpose() * svtxCovariance * sphenixRot;
96 jacobianLocalToGlobal.transpose() * rotatedMatrix * jacobianLocalToGlobal;
98 printMatrix(
"Rotated to Acts local cov : ",actsLocalCov);
109 auto covarianceMatrix = *params.covariance();
111 printMatrix(
"Initial Acts covariance: ", covarianceMatrix);
113 const double px = params.momentum()(0);
114 const double py = params.momentum()(1);
115 const double pz = params.momentum()(2);
116 const double p = params.momentum().norm();
118 const double uPx = px /
p;
119 const double uPy = py /
p;
120 const double uPz = pz /
p;
122 const double cosTheta = uPz;
123 const double sinTheta = sqrt(uPx * uPx + uPy * uPy);
124 const double invSinTheta = 1. / sinTheta;
125 const double cosPhi = uPx * invSinTheta;
126 const double sinPhi = uPy * invSinTheta;
144 = jacobianLocalToGlobal * covarianceMatrix * jacobianLocalToGlobal.transpose();
149 sphenixRot.setZero();
158 sphenixRot(3,7) = uPx * p *
p;
159 sphenixRot(4,7) = uPy * p *
p;
160 sphenixRot(5,7) = uPz * p *
p;
163 globalCov = sphenixRot * rotatedMatrix * sphenixRot.transpose();
165 printMatrix(
"Global sPHENIX cov : ", globalCov);
168 for(
int i = 0; i < 6; ++i)
170 for(
int j = 0; j < 6; ++j)
182 printMatrix(
"Global sphenix cov after unit conv: " , globalCov);
194 std::cout << std::endl << message.c_str() << std::endl;
195 for(
int i = 0 ; i < matrix.rows(); ++i)
197 std::cout << std::endl;
198 for(
int j = 0; j < matrix.cols(); ++j)
200 std::cout << matrix(i,j) <<
", ";
204 std::cout << std::endl;
217 float &dca3DzCov)
const
226 for(
int i = 0; i < 3; ++i)
228 for(
int j = 0; j < 3; ++j)
230 posCov(i,j) = cov(i,j);
235 float phi = atan2(
r(1),
r(0));
240 rot(0,1) = -sin(phi);
249 rot_T = rot.transpose();
256 dca3DxyCov = rotCov(0,0);
257 dca3DzCov = rotCov(2,2);
265 const Acts::Vector3D doublePos = getGlobalPosition(cluster,surfMaps,tGeometry);
279 std::cerr <<
"Couldn't identify cluster surface. Returning NAN"
292 global = surface->localToGlobal(tGeometry->
geoContext,
301 auto surfCenter = surface->center(tGeometry->
geoContext);
303 double surfPhiCenter = atan2(surfCenter(1), surfCenter(0));
304 double surfRadius =
radius(surfCenter(0), surfCenter(1));
305 double surfRPhiCenter = surfPhiCenter * surfRadius;
307 double clusRPhi =
local(0) + surfRPhiCenter;
308 double gclusz =
local(1) + surfCenter(2);
310 double clusphi = clusRPhi / surfRadius;
311 double gclusx = surfRadius * cos(clusphi);
312 double gclusy = surfRadius * sin(clusphi);
335 return getSiliconSurface(
hitsetkey, surfMaps);
347 auto iter = surfMap.find(hitsetkey);
348 if(iter != surfMap.end())
366 auto surfvec = iter->second;
367 return surfvec.at(surfkey);
379 return (iter == maps->
mmSurfaceMap.end()) ?
nullptr:iter->second;
383 const size_t &trackTip,
388 const auto &[trackTips, mj] = traj.trajectory();
390 mj.visitBackwards(trackTip, [&](
const auto &state)
394 const auto typeFlags = state.typeFlags();
399 if( !state.hasSmoothed())
return true;
408 state.smoothedCovariance());
411 const auto global = params.
position(geoContext);
417 const auto momentum = params.momentum();
423 const auto globalCov = rotateActsCovToSvtxTrack(params, geoContext);
424 for (
int i = 0; i < 6; ++i)
425 for (
int j = 0; j < 6; ++j)
431 std::cout <<
" inserting state with x,y,z ="
435 <<
" pathlength " << pathlength
438 <<
"covariance " << globalCov << std::endl;