11 #include <tracking/dataobjects/DATCONSVDSpacePoint.h>
17 DATCONSVDSpacePoint::DATCONSVDSpacePoint(std::vector<const SVDCluster*>& clusters,
22 B2ASSERT(
"You have to insert 1 or two SVD Clusters, but gave: " << clusters.size(), ((clusters.size() == 1)
23 || (clusters.size() == 2)));
26 for (
auto && cluster : clusters) {
27 B2ASSERT(
"An (DATCON)SVDCluster Pointer is a nullptr!", cluster !=
nullptr);
31 if (clusters.size() == 2) {
32 B2ASSERT(
"Clusters are on different Sensors.", clusters[0]->getSensorID() == clusters[1]->getSensorID());
33 B2ASSERT(
"Clusters are of same direction type.", clusters[0]->isUCluster() != clusters[1]->isUCluster());
37 m_vxdID = clusters[0]->getSensorID();
40 if (aSensorInfo == NULL) {
41 aSensorInfo = &VXD::GeoCache::getInstance().getSensorInfo(m_vxdID);
44 m_sensorType = aSensorInfo->
getType();
49 m_assignedDATCONSVDClusters.clear();
51 const SVDCluster* vCluster(NULL), *uCluster(NULL);
53 m_assignedDATCONSVDClusters.push_back(*aCluster);
54 if (aCluster->isUCluster() ==
true) {
55 m_clustersAssigned.first =
true;
56 uCoord = aCluster->getPosition();
59 m_clustersAssigned.second =
true;
66 vCluster != NULL && uCluster != NULL)
69 m_position = aSensorInfo->
pointToGlobal(TVector3(uCoord, vCoord, 0));
70 m_normalizedLocal = convertLocalToNormalizedCoordinates({ uCoord, vCoord } , m_vxdID, aSensorInfo);
75 std::pair<double, double> DATCONSVDSpacePoint::convertLocalToNormalizedCoordinates(
76 const std::pair<double, double>& hitLocal,
VxdID vxdID,
81 if (aSensorInfo == NULL) {
82 aSensorInfo = &VXD::GeoCache::getInstance().getSensorInfo(vxdID);
89 double sensorSizeU = aSensorInfo->
getUSize(hitLocal.second);
90 double sensorSizeV = aSensorInfo->
getVSize();
92 double normalizedUPosition = (hitLocal.first + 0.5 * sensorSizeU) /
94 double normalizedVPosition = (hitLocal.second + 0.5 * sensorSizeV) / sensorSizeV;
96 boundaryEnforce(normalizedUPosition, normalizedVPosition, 0, 1 , 0, vxdID);
97 boundaryEnforce(normalizedVPosition, normalizedUPosition, 0, 1, 1, vxdID);
99 return { normalizedUPosition, normalizedVPosition };
104 std::pair<double, double> DATCONSVDSpacePoint::convertNormalizedToLocalCoordinates(
105 const std::pair<double, double>& hitNormalized,
VxdID vxdID,
110 if (aSensorInfo == NULL) {
111 aSensorInfo = &VXD::GeoCache::getInstance().getSensorInfo(vxdID);
116 double localVPosition = (hitNormalized.second - 0.5) * aSensorInfo->
getVSize();
117 double uSizeAtHit = aSensorInfo->
getUSize(localVPosition);
118 double localUPosition = (hitNormalized.first - 0.5) * uSizeAtHit;
120 boundaryEnforce(localVPosition, localUPosition,
123 boundaryEnforce(localUPosition, localVPosition, -0.5 * uSizeAtHit, 0.5 * uSizeAtHit,
126 return { localUPosition, localVPosition };
134 if (aSensorInfo == NULL) {
135 aSensorInfo = &VXD::GeoCache::getInstance().getSensorInfo(vxdID);
138 return aSensorInfo->
pointToGlobal(TVector3(hitLocal.first, hitLocal.second, 0));