ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsDataPreparation
src
CorePixelSpacePointFormationTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CorePixelSpacePointFormationTool.h
"
6
7
#include "Acts/SpacePointFormation/PixelSpacePointBuilder.hpp"
8
#include "Acts/Surfaces/Surface.hpp"
9
10
#include "
xAODMeasurementBase/UncalibratedMeasurementContainer.h
"
11
12
#include <algorithm>
13
14
namespace
ActsTrk
{
15
16
StatusCode
CorePixelSpacePointFormationTool::initialize
()
17
{
18
ATH_CHECK
(
m_trackingGeometrySvc
.retrieve());
19
m_surfaceAccessor
=
ActsTrk::detail::xAODUncalibMeasSurfAcc
(
m_trackingGeometrySvc
.get());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
25
CorePixelSpacePointFormationTool::producePixelSpacePoint
(
const
EventContext& ctx,
26
const
Acts::GeometryContext& gctx,
27
const
xAOD::PixelCluster
& cluster,
28
xAOD::SpacePoint
&
sp
,
29
const
InDetDD::SiDetectorElement
&
/*element*/
)
const
30
{
31
const
xAOD::DetectorIDHashType
idHash = cluster.
identifierHash
();
32
// The accessor is a call into libxAODInDetMeasurement, and the space point
33
// is filled with the same position the variances are computed from.
34
const
auto
globalPosition = cluster.
globalPosition
();
35
const
Acts::SquareMatrix2 localCov = cluster.
localCovariance
<2>().cast<double>();
36
37
// Clusters come grouped by module: look up the surface only when the module changes.
38
auto
lookupReferenceFrame = [
this
, &gctx, &cluster, idHash](Acts::RotationMatrix3& rot) -> StatusCode {
39
const
Acts::Surface* surface =
m_surfaceAccessor
.get(&cluster);
40
if
(surface ==
nullptr
) {
41
ATH_MSG_FATAL
(
"No ACTS surface for pixel cluster with identifier hash "
<< idHash);
42
return
StatusCode::FAILURE;
43
}
44
// Position and direction are unused by plane and disc surfaces
45
rot = surface->referenceFrame(gctx, Acts::Vector3::Zero(), Acts::Vector3::Zero());
46
return
StatusCode::SUCCESS;
47
};
48
49
// Returned in the order (z, r)
50
Acts::Vector2 variance;
51
if
(
m_useSurfaceCache
) {
52
SurfaceCache
& cache = *m_surfaceCache.get(ctx);
53
if
(cache.idHash != idHash or cache.evt != ctx.evt()) {
54
// Key updated only on success, so a failed look-up leaves no stale frame.
55
ATH_CHECK
( lookupReferenceFrame(cache.rotLocalToGlobal) );
56
cache.idHash = idHash;
57
cache.evt = ctx.evt();
58
}
59
variance = Acts::PixelSpacePointBuilder::computeVarianceZR(cache.rotLocalToGlobal,
60
globalPosition.cast<
double
>(), localCov);
61
}
else
{
62
Acts::RotationMatrix3 rotLocalToGlobal;
63
ATH_CHECK
( lookupReferenceFrame(rotLocalToGlobal) );
64
variance = Acts::PixelSpacePointBuilder::computeVarianceZR(rotLocalToGlobal,
65
globalPosition.cast<
double
>(), localCov);
66
}
67
68
float
cov_z =
static_cast<
float
>
(variance[0]);
69
float
cov_r =
static_cast<
float
>
(variance[1]);
70
71
if
(
m_useMaxVariance
) {
72
cov_z = std::min(cov_z,
m_maxVarianceZ
.value());
73
cov_r = std::min(cov_r,
m_maxVarianceR
.value());
74
}
75
76
sp
.setSpacePoint(idHash,
77
globalPosition,
78
cov_r,
79
cov_z,
80
std::vector< const xAOD::UncalibratedMeasurement* >({&cluster}));
81
82
return
StatusCode::SUCCESS;
83
}
84
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
CorePixelSpacePointFormationTool.h
sp
static Double_t sp
Definition
LArPhysWaveHECTool.cxx:37
UncalibratedMeasurementContainer.h
ActsTrk::CorePixelSpacePointFormationTool::initialize
virtual StatusCode initialize() override
Definition
CorePixelSpacePointFormationTool.cxx:16
ActsTrk::CorePixelSpacePointFormationTool::m_trackingGeometrySvc
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
Definition
CorePixelSpacePointFormationTool.h:49
ActsTrk::CorePixelSpacePointFormationTool::m_useSurfaceCache
Gaudi::Property< bool > m_useSurfaceCache
Definition
CorePixelSpacePointFormationTool.h:62
ActsTrk::CorePixelSpacePointFormationTool::m_maxVarianceZ
Gaudi::Property< float > m_maxVarianceZ
Definition
CorePixelSpacePointFormationTool.h:67
ActsTrk::CorePixelSpacePointFormationTool::m_maxVarianceR
Gaudi::Property< float > m_maxVarianceR
Definition
CorePixelSpacePointFormationTool.h:68
ActsTrk::CorePixelSpacePointFormationTool::producePixelSpacePoint
virtual StatusCode producePixelSpacePoint(const EventContext &ctx, const Acts::GeometryContext &gctx, const xAOD::PixelCluster &cluster, xAOD::SpacePoint &sp, const InDetDD::SiDetectorElement &element) const override
Definition
CorePixelSpacePointFormationTool.cxx:25
ActsTrk::CorePixelSpacePointFormationTool::m_useMaxVariance
Gaudi::Property< bool > m_useMaxVariance
Cap the covariance terms, as PixelSpacePointFormationTool does.
Definition
CorePixelSpacePointFormationTool.h:66
ActsTrk::CorePixelSpacePointFormationTool::m_surfaceAccessor
ActsTrk::detail::xAODUncalibMeasSurfAcc m_surfaceAccessor
Definition
CorePixelSpacePointFormationTool.h:51
ActsTrk::detail::xAODUncalibMeasSurfAcc
Helper class to access the Acts::surface associated with an Uncalibrated xAOD measurement.
Definition
xAODUncalibMeasSurfAcc.h:22
InDetDD::SiDetectorElement
Class to hold geometrical description of a silicon detector element.
Definition
SiDetectorElement.h:109
xAOD::PixelCluster_v1::globalPosition
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the pixel cluster.
Definition
PixelCluster_v1.cxx:16
xAOD::UncalibratedMeasurement_v1::localCovariance
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
xAOD::UncalibratedMeasurement_v1::identifierHash
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash).
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
xAOD::SpacePoint
SpacePoint_v1 SpacePoint
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/SpacePoint.h:12
xAOD::PixelCluster
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/PixelCluster.h:13
xAOD::DetectorIDHashType
unsigned int DetectorIDHashType
@ detector ID element hash
Definition
MeasurementDefs.h:48
ActsTrk::CorePixelSpacePointFormationTool::SurfaceCache
Reference frame of the last module seen, keyed on the identifier hash and stamped with the event so a...
Definition
CorePixelSpacePointFormationTool.h:55
Generated on
for ATLAS Offline Software by
1.17.0