ATLAS Offline Software
Loading...
Searching...
No Matches
SpacePointConversionUtilities.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
10namespace TrackingUtilities {
11
13 xAOD::SpacePoint& xaodSpacePoint)
14 {
15 unsigned int idHash = trkSpacePoint.elementIdList().first;
16 const auto& globPos = trkSpacePoint.globalPosition();
17
18 const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(trkSpacePoint.clusterList().first);
19 const InDetDD::SiDetectorElement *de = c->detectorElement();
20 const Amg::Transform3D &Tp = de->surface().transform();
21
22 float r_3 = static_cast<float>( Tp(0,2) );
23 float r_4 = static_cast<float>( Tp(1,2) );
24 float r_5 = static_cast<float>( Tp(2,2) );
25
26 const Amg::MatrixX& v = c->localCovariance();
27 float f22 = static_cast<float>( v(1,1) );
28 float wid = static_cast<float>( c->width().z() );
29 float cov = wid*wid*.08333;
30 if(cov < f22) cov = f22;
31 float covr = 6 * cov * (r_5*r_5);
32 float covz = 6 * cov * (r_3*r_3 + r_4*r_4);
33
34 xaodSpacePoint.setSpacePoint(idHash,
35 globPos.cast<float>(),
36 covr,
37 covz,
38 {});
39
40 return StatusCode::SUCCESS;
41 }
42
44 const Amg::Vector3D& vertex,
45 xAOD::SpacePoint& xaodSpacePoint)
46 {
47 std::pair<unsigned int, unsigned int> idHashes = trkSpacePoint.elementIdList();
48 const auto& globPos = trkSpacePoint.globalPosition();
49
50 const InDet::SiCluster *c0 = static_cast<const InDet::SiCluster *>(trkSpacePoint.clusterList().first);
51 const InDet::SiCluster *c1 = static_cast<const InDet::SiCluster *>(trkSpacePoint.clusterList().second);
52 const InDetDD::SiDetectorElement *d0 = c0->detectorElement();
53 const InDetDD::SiDetectorElement *d1 = c1->detectorElement();
54
55 Amg::Vector2D lc0 = c0->localPosition();
56 Amg::Vector2D lc1 = c1->localPosition();
57
58 std::pair<Amg::Vector3D, Amg::Vector3D> e0 =
59 (d0->endsOfStrip(InDetDD::SiLocalPosition(lc0.y(), lc0.x(), 0.)));
60 std::pair<Amg::Vector3D, Amg::Vector3D> e1 =
61 (d1->endsOfStrip(InDetDD::SiLocalPosition(lc1.y(), lc1.x(), 0.)));
62
63 auto stripCenter_1 = 0.5 * (e0.first + e0.second);
64 auto stripDir_1 = e0.first - e0.second;
65 auto trajDir_1 = 2. * ( stripCenter_1 - vertex);
66
67 auto stripCenter_2 = 0.5 * (e1.first + e1.second);
68 auto stripDir_2 = e1.first - e1.second;
69
70 float topHalfStripLength = 0.5 * stripDir_1.norm();
71 Eigen::Matrix<double, 3, 1> topStripDirection = - stripDir_1 / (2. * topHalfStripLength);
72 Eigen::Matrix<double, 3, 1> topStripCenter = 0.5 * trajDir_1;
73 float bottomHalfStripLength = 0.5 * stripDir_2.norm();
74 Eigen::Matrix<double, 3, 1> bottomStripDirection = - stripDir_2 / (2. * bottomHalfStripLength);
75 Eigen::Matrix<double, 3, 1> stripCenterDistance = stripCenter_1 - stripCenter_2;
76
77 const Amg::MatrixX& v = trkSpacePoint.localCovariance();
78 float f22 = static_cast<float>( v(1,1) );
79
80 float covr = d0->isBarrel() ? .1 : 8.*f22;
81 float covz = d0->isBarrel() ? 8.*f22 : .1;
82
83 xaodSpacePoint.setSpacePoint({idHashes.first, idHashes.second},
84 globPos.cast<float>(),
85 covr,
86 covz,
87 {},
88 topHalfStripLength,
89 bottomHalfStripLength,
90 topStripDirection.cast<float>(),
91 bottomStripDirection.cast<float>(),
92 stripCenterDistance.cast<float>(),
93 topStripCenter.cast<float>());
94
95 return StatusCode::SUCCESS;
96 }
97
98}
static Double_t Tp(Double_t *t, Double_t *par)
#define z
Class to hold geometrical description of a silicon detector element.
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
Trk::Surface & surface()
Element Surface.
A PixelSpacePoint is created from a PixelCluster.
An SCT_SpacePoint is created from two SCT_Cluster's from two different wafers.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
virtual const Amg::Vector3D & globalPosition() const override final
Interface method to get the global Position.
const std::pair< IdentifierHash, IdentifierHash > & elementIdList() const
return the pair of Ids of the element by reference
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
void setSpacePoint(DetectorIDHashType idHash, const Eigen::Matrix< float, 3, 1 > &globPos, float cov_r, float cov_z, std::vector< const xAOD::UncalibratedMeasurement * > &&measurementIndexes)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
StatusCode convertTrkToXaodStripSpacePoint(const InDet::SCT_SpacePoint &trkSpacePoint, const Amg::Vector3D &vertex, xAOD::SpacePoint &xaodSpacePoint)
StatusCode convertTrkToXaodPixelSpacePoint(const InDet::PixelSpacePoint &trkSpacePoint, xAOD::SpacePoint &xaodSpacePoint)