10 template<
class T>
inline constexpr
T square(
const T&
x) {
return x*
x;}
13 template<
class T>
T radius(
const T&
x,
const T&
y)
22 return Eigen::Matrix<float,3,1>(doublePos(0), doublePos(1), doublePos(2));
43 std::cerr <<
"Couldn't identify cluster surface. Returning NAN"
70 std::cout <<
"ActsGeometry::getGlobalPositionTpc - this is the wrong global transform for silicon or MM's clusters! Returning zero" << std::endl;
79 std::cerr <<
"Couldn't identify cluster surface. Returning NAN"
87 double surfaceZCenter = 52.89;
89 double zloc = surfaceZCenter - zdriftlength;
91 if(side == 0) zloc = -zloc;
111 if(mapIter ==
maps().m_tpcSurfaceMap.end())
113 std::cout <<
"Error: hitsetkey not found in ActsGeometry::get_tpc_surface_from_coords, hitsetkey = "
114 << hitsetkey << std::endl;
118 double world_phi = atan2(world[1], world[0]);
119 double world_z = world[2];
121 std::vector<Surface>& surf_vec = mapIter->second;
122 unsigned int surf_index = 999;
126 double fraction = (world_phi + M_PI) / (2.0 * M_PI);
127 double rounded_nsurf =
round( (
double) (surf_vec.size()/2) * fraction - 0.5);
128 unsigned int nsurfm = (
unsigned int) rounded_nsurf;
131 { nsurfm += surf_vec.size()/2; }
133 unsigned int nsurf = nsurfm % surf_vec.size();
135 Surface this_surf = surf_vec[nsurf];
137 auto vec3d = this_surf->center(
geometry().getGeoContext());
138 std::vector<double> surf_center = {vec3d(0) / 10.0, vec3d(1) / 10.0, vec3d(2) / 10.0};
139 double surf_z = surf_center[2];
140 double surf_phi = atan2(surf_center[1], surf_center[0]);
144 if( (world_phi > surf_phi - surfStepPhi / 2.0 && world_phi < surf_phi + surfStepPhi / 2.0 ) &&
145 (world_z > surf_z - surfStepZ / 2.0 && world_z < surf_z + surfStepZ / 2.0) )
155 return surf_vec[surf_index];
164 Eigen::AngleAxisd
alpha(rot(0), Eigen::Vector3d::UnitX());
165 Eigen::AngleAxisd beta(rot(1), Eigen::Vector3d::UnitY());
166 Eigen::AngleAxisd gamma(rot(2), Eigen::Vector3d::UnitZ());
167 Eigen::Quaternion<double> q = gamma*beta*
alpha;
168 actsAffine.linear() = q.matrix();
170 Eigen::Vector3d
translation(trans(0),trans(1),trans(2));
183 double surfaceZCenter = 52.89;
185 double zloc = surfaceZCenter - zdriftlength;
187 if(side == 0) zloc = -zloc;