ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::GeometryRealmConvTool Class Reference

Implementation of the IGeometryRealmConvTool. More...

#include <GeometryRealmConvTool.h>

Inheritance diagram for ActsTrk::GeometryRealmConvTool:
Collaboration diagram for ActsTrk::GeometryRealmConvTool:

Public Member Functions

 ~GeometryRealmConvTool ()
virtual StatusCode initialize () override final
virtual SurfacePtr_t convertSurfaceToTrk (const EventContext &ctx, const Acts::Surface &actsSurface) const override final
 Translates the parsed Acts surface into a Trk::Surface via associated detector element.
virtual std::shared_ptr< const Acts::Surface > convertSurfaceToActs (const Trk::Surface &atlasSurface) const override final
 Translate the parsed Trk surface into an Acts surface.
virtual Acts::BoundTrackParameters convertTrackParametersToActs (const EventContext &ctx, const Trk::TrackParameters &atlasParameter, Trk::ParticleHypothesis hypothesis=Trk::pion) const override final
 Translates the Trk track parameters into bound Acts track parameters with a particle hypothesis.
virtual std::unique_ptr< Trk::TrackParameters > convertTrackParametersToTrk (const EventContext &ctx, const Acts::BoundTrackParameters &actsParameters) const override final
 Translates the bounded Acts track parameters to Trk parameters.

Private Member Functions

std::shared_ptr< Trk::SurfaceBounds > translateBounds (const Acts::SurfaceBounds &bounds) const
 Translate the Acts surface bounds to its equivalent in the Trk realm.
SurfacePtr_t translateFreeSurface (const EventContext &ctx, const Acts::Surface &surface) const
 Translate a surface that is not associated with any detector element.

Private Attributes

ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
ActsTrk::ContextUtility m_ctxProvider {this}
 Context provider for geometry, magnetic field and calibration contexts.
std::unordered_map< Identifier, std::shared_ptr< const Acts::Surface > > m_actsSurfaceMap {}
Gaudi::Property< bool > m_extractMuonSurfaces
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muonMgrKey {this, "MuonManagerKey", "MuonDetectorManager"}
 Detector manager to fetch the legacy Trk surfaces.

Detailed Description

Implementation of the IGeometryRealmConvTool.

At initialization stage the tool associates every Acts::Surface with an ATLAS identifier to convert the sensitive surfaces without extra memory allocation. If portals and free surfaces are converted as new free Trk::Surfaces with bounds. To return aligned muon surfaces in the Acts -> Trk conversion, the tool has a data dependency on the legacy Muon::DetectorManager

Definition at line 28 of file GeometryRealmConvTool.h.

Constructor & Destructor Documentation

◆ ~GeometryRealmConvTool()

ActsTrk::GeometryRealmConvTool::~GeometryRealmConvTool ( )
default

Member Function Documentation

◆ convertSurfaceToActs()

std::shared_ptr< const Acts::Surface > ActsTrk::GeometryRealmConvTool::convertSurfaceToActs ( const Trk::Surface & atlasSurface) const
finaloverridevirtual

Translate the parsed Trk surface into an Acts surface.

The detector element identifier of the surface needs to be filled into the internal tool's look-up map. Otherwise an exception is thrown.

Parameters
atlasSurfaceRefrence to the Trk surface to translate

Definition at line 198 of file GeometryRealmConvTool.cxx.

198 {
199 Identifier atlasID = atlasSurface.associatedDetectorElementIdentifier();
200 auto it = m_actsSurfaceMap.find(atlasID);
201 if (it != m_actsSurfaceMap.end()) {
202 return it->second;
203 }
204 const Amg::Transform3D& trf{atlasSurface.transform()};
205 switch (atlasSurface.type()){
206 using enum Trk::SurfaceType;
207 case Plane:
208 return Acts::Surface::makeShared<Acts::PlaneSurface>(trf);
209 case Perigee:
210 return Acts::Surface::makeShared<Acts::PerigeeSurface>(trf);
211 case Line:
212 return Acts::Surface::makeShared<Acts::StrawSurface>(trf);
213 // TODO - implement the missing types?
214 default: {
215 break;
216 }
217 }
218 std::stringstream surfStr{};
219 atlasSurface.dump(surfStr);
220 throw std::domain_error(std::format("Failed to translate surface {:}", surfStr.str()));
221 }
std::unordered_map< Identifier, std::shared_ptr< const Acts::Surface > > m_actsSurfaceMap
virtual MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
Definition Surface.cxx:157
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
Eigen::Affine3d Transform3D
SurfaceType
This enumerator simplifies the persistency & calculations,.

◆ convertSurfaceToTrk()

SurfacePtr_t ActsTrk::GeometryRealmConvTool::convertSurfaceToTrk ( const EventContext & ctx,
const Acts::Surface & actsSurface ) const
finaloverridevirtual

Translates the parsed Acts surface into a Trk::Surface via associated detector element.

For the ID measurements a direct link is provided and for the muon measurements the look-up is performed via the associated Identifier and the detector manager. Other surfaces trigger the creation of new free Trk surfaces

Parameters
ctxThe current event context
actsSurfaceRefrence to the acts surface to translate

Produce a new free surface

Definition at line 164 of file GeometryRealmConvTool.cxx.

165 {
166 const auto *placement = dynamic_cast<const ISurfacePlacement*>(actsSurface.surfacePlacement());
167 if (!placement) {
168 return translateFreeSurface(ctx, actsSurface);
169 }
170 switch (placement->detectorType()) {
171 using enum DetectorType;
172 case Pixel:
173 case Sct:
174 case Hgtd:
175 case Trt: {
176 const auto* actsElement = getActsDetectorElement(actsSurface);
177 if (actsElement) {
178 return SurfacePtr_t{&actsElement->atlasSurface()};
179 }
180 break;
181 } case Mdt:
182 case Rpc:
183 case Tgc:
184 case Csc:
185 case sTgc:
186 case Mm: {
187 const MuonGM::MuonDetectorManager* detMgr{nullptr};
188 if (!SG::get(detMgr, m_muonMgrKey, ctx).isSuccess() || !detMgr) {
189 THROW_EXCEPTION("Failed to retrieve the muon detector manager");
190 }
191 return SurfacePtr_t{&detMgr->getReadoutElement(placement->identify())->surface(placement->identify())};
192 } default:
193 break;
194 }
196 return translateFreeSurface(ctx, actsSurface);
197 }
const ActsDetectorElement * getActsDetectorElement(const Acts::Surface &surf)
Attempts to retrieve the ActsDetectorElement associated to the passed ActsSurface.
ActsTrk::GeometryRealmConvTool::SurfacePtr_t SurfacePtr_t
SurfacePtr_t translateFreeSurface(const EventContext &ctx, const Acts::Surface &surface) const
Translate a surface that is not associated with any detector element.
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muonMgrKey
Detector manager to fetch the legacy Trk surfaces.
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Get any read out element.
virtual const Surface & surface() const =0
Return surface associated with this detector element.
DetectorType
Simple enum to Identify the Type of the ACTS sub detector.
@ Mm
Maybe not needed in the migration.
@ Tgc
Resitive Plate Chambers.
@ sTgc
Micromegas (NSW).
@ Rpc
Monitored Drift Tubes.
@ Csc
Thin gap champers.
@ Mdt
MuonSpectrometer.
@ Pixel
Definition DetType.h:13
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ convertTrackParametersToActs()

Acts::BoundTrackParameters ActsTrk::GeometryRealmConvTool::convertTrackParametersToActs ( const EventContext & ctx,
const Trk::TrackParameters & atlasParameter,
Trk::ParticleHypothesis hypothesis = Trk::pion ) const
finaloverridevirtual

Translates the Trk track parameters into bound Acts track parameters with a particle hypothesis.

Parameters
atlasParameterThe Trk parameters to translate.
gctsGeometry context needed for special treatment of the annulus bounds
hypothesisTrack hypothesis to use

Definition at line 224 of file GeometryRealmConvTool.cxx.

226 {
227 std::shared_ptr<const Acts::Surface> actsSurface{};
228 Acts::BoundVector params{};
229 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
230
231 // get the associated surface
232 try {
233 actsSurface = convertSurfaceToActs(atlasParameter.associatedSurface());
234 } catch (const std::exception &e) {
235 ATH_MSG_ERROR("Could not find ACTS detector surface for this TrackParameter:");
236 ATH_MSG_ERROR(atlasParameter);
237 throw; // Nothing we can do, so just pass exception on...
238 }
239
240 // Construct track parameters
241 const auto& atlasParam{atlasParameter.parameters()};
242 if (actsSurface->bounds().type() == Acts::SurfaceBounds::BoundsType::eAnnulus) {
243 // Annulus surfaces are constructed differently in Acts/Trk so we need to
244 // convert local coordinates
245 const Amg::Vector3D& position{atlasParameter.position()};
246 auto result = actsSurface->globalToLocal(tgContext, position, atlasParameter.momentum());
247 if (result.ok()) {
248 params << (*result)[0], (*result)[1], atlasParam[Trk::phi0],
249 atlasParam[Trk::theta],
250 atlasParameter.charge() / (atlasParameter.momentum().mag() * 1_MeV),
251 0.;
252 } else {
253 ATH_MSG_WARNING("Unable to convert annulus surface - globalToLocal failed");
254 }
255 } else {
256 params << atlasParam[Trk::locX], atlasParam[Trk::locY],
257 atlasParam[Trk::phi0], atlasParam[Trk::theta],
258 atlasParameter.charge() / (atlasParameter.momentum().mag() * 1_MeV), 0.;
259 }
260
261 std::optional<Acts::BoundMatrix> cov{};
262 if (atlasParameter.covariance()) {
263 cov = Acts::BoundMatrix::Identity();
264 cov->topLeftCorner(5, 5) = *atlasParameter.covariance();
265
266 // Convert the covariance matrix from MeV
267 // FIXME: This needs to handle the annulus case as well - currently the cov
268 // is wrong for annulus surfaces
269 for (int i = 0; i < cov->rows(); ++i) {
270 (*cov)(i, 4) = (*cov)(i, 4) / 1_MeV;
271 }
272 for (int i = 0; i < cov->cols(); ++i) {
273 (*cov)(4, i) = (*cov)(4, i) / 1_MeV;
274 }
275 }
276 return Acts::BoundTrackParameters{std::move(actsSurface), params, std::move(cov),
277 ParticleHypothesis::convert(hypothesis)};
278 }
Scalar mag() const
mag method
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
virtual std::shared_ptr< const Acts::Surface > convertSurfaceToActs(const Trk::Surface &atlasSurface) const override final
Translate the parsed Trk surface into an Acts surface.
ActsTrk::ContextUtility m_ctxProvider
Context provider for geometry, magnetic field and calibration contexts.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
double charge() const
Returns the charge.
virtual const Surface & associatedSurface() const =0
Access to the Surface associated to the Parameters.
xAOD::ParticleHypothesis convert(Acts::ParticleHypothesis h)
Eigen::Matrix< double, 3, 1 > Vector3D
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.

◆ convertTrackParametersToTrk()

std::unique_ptr< Trk::TrackParameters > ActsTrk::GeometryRealmConvTool::convertTrackParametersToTrk ( const EventContext & ctx,
const Acts::BoundTrackParameters & actsParameters ) const
finaloverridevirtual

Translates the bounded Acts track parameters to Trk parameters.

The bound parameter surface must be translatble by the tool

Parameters
ctxEventContext
actsParameterRefrence to the bounded parameters to translate

Convert to free parameters

Back conversion to bound parameters of the helper plane

Definition at line 280 of file GeometryRealmConvTool.cxx.

281 {
282
283
284 std::optional<AmgSymMatrix(5)> cov = std::nullopt;
285 if (actsParameter.covariance()) {
286 AmgSymMatrix(5) newcov(actsParameter.covariance()->topLeftCorner<5, 5>());
287 // Convert the covariance matrix to GeV
288 for (int i = 0; i < newcov.rows(); i++) {
289 newcov(i, 4) = newcov(i, 4) * 1_MeV;
290 }
291 for (int i = 0; i < newcov.cols(); i++) {
292 newcov(4, i) = newcov(4, i) * 1_MeV;
293 }
294 cov = newcov;
295 }
296
297 const Acts::Surface &actsSurface = actsParameter.referenceSurface();
298 SurfacePtr_t trkSurface = convertSurfaceToTrk(ctx, actsSurface);
299 switch (actsSurface.type()) {
300 case Acts::Surface::SurfaceType::Cone: {
301 const auto &coneSurface = static_cast<const Trk::ConeSurface&>(*trkSurface);
302 return std::make_unique<Trk::AtaCone>(
303 actsParameter.get<Acts::eBoundLoc0>(),
304 actsParameter.get<Acts::eBoundLoc1>(),
305 actsParameter.get<Acts::eBoundPhi>(),
306 actsParameter.get<Acts::eBoundTheta>(),
307 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, coneSurface, cov);
308 } case Acts::Surface::SurfaceType::Cylinder: {
309 const auto &cylSurface{static_cast<const Trk::CylinderSurface&>(*trkSurface)};
310 return std::make_unique<Trk::AtaCylinder>(
311 actsParameter.get<Acts::eBoundLoc0>(),
312 actsParameter.get<Acts::eBoundLoc1>(),
313 actsParameter.get<Acts::eBoundPhi>(),
314 actsParameter.get<Acts::eBoundTheta>(),
315 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, cylSurface, cov);
316 } case Acts::Surface::SurfaceType::Disc: {
317 if (trkSurface->type() == Trk::SurfaceType::Disc) {
318 const auto& discSurface{static_cast<const Trk::DiscSurface&>(*trkSurface)};
319 return std::make_unique<Trk::AtaDisc>(
320 actsParameter.get<Acts::eBoundLoc0>(),
321 actsParameter.get<Acts::eBoundLoc1>(),
322 actsParameter.get<Acts::eBoundPhi>(),
323 actsParameter.get<Acts::eBoundTheta>(),
324 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, discSurface, cov);
325 } else if (trkSurface->type() == Trk::SurfaceType::Plane) {
326 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
327 auto& planeSurface{static_cast<const Trk::PlaneSurface&>(*trkSurface)};
328 // need to convert to plane position on plane surface (annulus bounds)
329 auto helperSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(planeSurface.transform());
330
331 auto covpc = actsParameter.covariance().value();
333 Acts::FreeVector freePars = Acts::transformBoundToFreeParameters(actsSurface, tgContext,
334 actsParameter.parameters());
335
337 Acts::BoundVector targetPars = Acts::transformFreeToBoundParameters(freePars,
338 *helperSurface, tgContext).value();
339
340
341 Acts::FreeMatrix freeTransportJacobian{Acts::FreeMatrix::Identity()};
342
343 Acts::FreeVector freeToPathDerivatives{Acts::FreeVector::Zero()};
344 freeToPathDerivatives.head<3>() = freePars.segment<3>(Acts::eFreeDir0);
345
346 auto boundToFreeJacobian = actsSurface.boundToFreeJacobian(tgContext,
347 freePars.segment<3>(Acts::eFreePos0),
348 freePars.segment<3>(Acts::eFreeDir0));
349
350 Acts::BoundMatrix boundToBoundJac =
351 Acts::detail::boundToBoundTransportJacobian(tgContext, freePars,
352 boundToFreeJacobian, freeTransportJacobian,
353 freeToPathDerivatives, *helperSurface);
354
355 Acts::BoundMatrix targetCov{boundToBoundJac * covpc * boundToBoundJac.transpose()};
356
357 return std::make_unique<Trk::AtaPlane>(
358 targetPars[Acts::eBoundLoc0], targetPars[Acts::eBoundLoc1],
359 targetPars[Acts::eBoundPhi], targetPars[Acts::eBoundTheta],
360 targetPars[Acts::eBoundQOverP] * 1_MeV, planeSurface,
361 targetCov.topLeftCorner<5, 5>());
362 } else {
363 throw std::domain_error("Acts::DiscSurface is not associated with ATLAS disc or plane surface");
364 }
365 break;
366 } case Acts::Surface::SurfaceType::Perigee: {
367 const auto& perSurface = static_cast<const Trk::PerigeeSurface&>(*trkSurface);
368 return std::make_unique<Trk::Perigee>(
369 actsParameter.get<Acts::eBoundLoc0>(),
370 actsParameter.get<Acts::eBoundLoc1>(),
371 actsParameter.get<Acts::eBoundPhi>(),
372 actsParameter.get<Acts::eBoundTheta>(),
373 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, perSurface, cov);
374 } case Acts::Surface::SurfaceType::Plane: {
375 auto &plaSurface{static_cast<const Trk::PlaneSurface&>(*trkSurface)};
376 return std::make_unique<Trk::AtaPlane>(
377 actsParameter.get<Acts::eBoundLoc0>(),
378 actsParameter.get<Acts::eBoundLoc1>(),
379 actsParameter.get<Acts::eBoundPhi>(),
380 actsParameter.get<Acts::eBoundTheta>(),
381 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, plaSurface, cov);
382 } case Acts::Surface::SurfaceType::Straw: {
383 auto& lineSurface{static_cast<const Trk::StraightLineSurface&>(*trkSurface)};
384 return std::make_unique<Trk::AtaStraightLine>(
385 actsParameter.get<Acts::eBoundLoc0>(),
386 actsParameter.get<Acts::eBoundLoc1>(),
387 actsParameter.get<Acts::eBoundPhi>(),
388 actsParameter.get<Acts::eBoundTheta>(),
389 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, lineSurface, cov);
390 } case Acts::Surface::SurfaceType::Curvilinear: {
391 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
392 return std::make_unique<Trk::CurvilinearParameters>(
393 actsParameter.position(tgContext), actsParameter.get<Acts::eBoundPhi>(),
394 actsParameter.get<Acts::eBoundTheta>(),
395 actsParameter.get<Acts::eBoundQOverP>() * 1_MeV, cov);
396 } case Acts::Surface::SurfaceType::Point:
397 case Acts::Surface::SurfaceType::Other: {
398 break;
399 }
400 }
401 throw std::domain_error("Surface type not found");
402 }
#define AmgSymMatrix(dim)
virtual SurfacePtr_t convertSurfaceToTrk(const EventContext &ctx, const Acts::Surface &actsSurface) const override final
Translates the parsed Acts surface into a Trk::Surface via associated detector element.

◆ initialize()

StatusCode ActsTrk::GeometryRealmConvTool::initialize ( )
finaloverridevirtual

Definition at line 54 of file GeometryRealmConvTool.cxx.

54 {
55 if (parent() != toolSvc()) {
56 ATH_MSG_ERROR("The tool is initialized as a private tool but should be public");
57 return StatusCode::FAILURE;
58 }
59 ATH_CHECK(m_ctxProvider.initialize());
61 m_trackingGeometrySvc->trackingGeometry()->visitSurfaces([&](const Acts::Surface *surface) {
62 // find acts surface with the same detector element ID
63 if (!surface->isSensitive()) {
64 return;
65 }
66 const auto *actsElement = dynamic_cast<const ISurfacePlacement*>(surface->surfacePlacement());
67 if (!actsElement) {
68 return;
69 }
70 // Conversion from Acts to ATLAS surface impossible for the TRT so the TRT
71 // surfaces are not stored in this map
72 if (actsElement->detectorType() == DetectorType::Trt) {
73 return;
74 }
75 auto [it, ok] = m_actsSurfaceMap.insert(std::make_pair(actsElement->identify(), surface->getSharedPtr()));
76 if (!ok) {
77 ATH_MSG_WARNING("ATLAS ID " << actsElement->identify()
78 << " has two ACTS surfaces: "
79 << it->second->geometryId() << " and "
80 << surface->geometryId());
81 }
82 });
84 return StatusCode::SUCCESS;
85 }
#define ATH_CHECK
Evaluate an expression and check for errors.
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
Gaudi::Property< bool > m_extractMuonSurfaces

◆ translateBounds()

std::shared_ptr< Trk::SurfaceBounds > ActsTrk::GeometryRealmConvTool::translateBounds ( const Acts::SurfaceBounds & bounds) const
private

Translate the Acts surface bounds to its equivalent in the Trk realm.

Note
Not all bounds are implemented
Parameters
boundsRefrence to the bounds to be translated

Definition at line 87 of file GeometryRealmConvTool.cxx.

87 {
88 switch (bounds.type()) {
89 using enum Acts::SurfaceBounds::BoundsType;
90 case eRectangle:{
91 using ParEnum_t = Acts::RectangleBounds::BoundValues;
92 const auto& cBounds = static_cast<const Acts::RectangleBounds&>(bounds);
93 return std::make_shared<Trk::RectangleBounds>(cBounds.get(ParEnum_t::eMaxX),
94 cBounds.get(ParEnum_t::eMaxY));
95 } case eTrapezoid: {
96 using ParEnum_t = Acts::TrapezoidBounds::BoundValues;
97 const auto& cBounds = static_cast<const Acts::TrapezoidBounds&>(bounds);
98 return std::make_shared<Trk::TrapezoidBounds>(cBounds.get(ParEnum_t::eHalfLengthXnegY),
99 cBounds.get(ParEnum_t::eHalfLengthXposY),
100 cBounds.get(ParEnum_t::eHalfLengthY));
101 } case eDisc: {
102 using ParEnum_t = Acts::RadialBounds::BoundValues;
103 const auto& cBounds = static_cast<const Acts::RadialBounds&>(bounds);
104 return std::make_shared<Trk::DiscBounds>(cBounds.get(ParEnum_t::eMinR),
105 cBounds.get(ParEnum_t::eMaxR),
106 cBounds.get(ParEnum_t::eAveragePhi),
107 cBounds.get(ParEnum_t::eHalfPhiSector));
108 } case eCylinder: {
109 using ParEnum_t = Acts::CylinderBounds::BoundValues;
110 const auto& cBounds = static_cast<const Acts::CylinderBounds&>(bounds);
111 return std::make_shared<Trk::CylinderBounds>(cBounds.get(ParEnum_t::eR),
112 cBounds.get(ParEnum_t::eHalfPhiSector),
113 cBounds.get(ParEnum_t::eAveragePhi),
114 cBounds.get(ParEnum_t::eHalfLengthZ));
115 } case eLine: {
116 using ParEnum_t = Acts::LineBounds::BoundValues;
117 const auto& cBounds = static_cast<const Acts::LineBounds&>(bounds);
118 return std::make_shared<Trk::CylinderBounds>(cBounds.get(ParEnum_t::eR),
119 cBounds.get(ParEnum_t::eHalfLengthZ));
120 } case eDiamond: {
121 using ParEnum_t = Acts::DiamondBounds::BoundValues;
122 const auto& cBounds = static_cast<const Acts::DiamondBounds&>(bounds);
123 return std::make_shared<Trk::DiamondBounds>(cBounds.get(ParEnum_t::eHalfLengthXnegY),
124 cBounds.get(ParEnum_t::eHalfLengthXzeroY),
125 cBounds.get(ParEnum_t::eHalfLengthXposY),
126 cBounds.get(ParEnum_t::eHalfLengthYneg),
127 cBounds.get(ParEnum_t::eHalfLengthYpos));
128 } case eBoundless:{
129 return nullptr;
130 } default:
131 break;
132 }
133 THROW_EXCEPTION("The bounds "<<bounds<<" cannot be translated");
134 return nullptr;
135 }

◆ translateFreeSurface()

SurfacePtr_t ActsTrk::GeometryRealmConvTool::translateFreeSurface ( const EventContext & ctx,
const Acts::Surface & surface ) const
private

Translate a surface that is not associated with any detector element.

Bounds of the surface are also translated

Parameters
ctxThe event context to access the aligned detector
surfaceReference to the Acts surface for translation

Definition at line 136 of file GeometryRealmConvTool.cxx.

137 {
138 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
139 const Amg::Transform3D& trf{surface.localToGlobalTransform(tgContext)};
140 switch (surface.type()) {
141 using enum Acts::Surface::SurfaceType;
142 case Plane:
143 return SurfacePtr_t{new Trk::PlaneSurface(trf, translateBounds(surface.bounds()))};
144 case Cylinder:
145 return SurfacePtr_t{new Trk::CylinderSurface(trf,
146 std::dynamic_pointer_cast<Trk::CylinderBounds>(translateBounds(surface.bounds())))};
147 case Perigee:
148 return SurfacePtr_t{new Trk::PerigeeSurface(trf)};
149 case Disc:
150 return SurfacePtr_t{new Trk::DiscSurface(trf,
151 std::dynamic_pointer_cast<Trk::DiscBounds>(translateBounds(surface.bounds())))};
152 case Straw: {
153 auto bounds = std::dynamic_pointer_cast<Trk::CylinderBounds>(translateBounds(surface.bounds()));
154 return SurfacePtr_t{new Trk::StraightLineSurface(trf, bounds->r(), bounds->halflengthZ())};
155 } default:
156 break;
157 }
158 THROW_EXCEPTION("ActsToTrkConverterTool() - Surface cannot be translated "
159 <<surface.toString(tgContext));
160
161 return nullptr;
162 }
std::shared_ptr< Trk::SurfaceBounds > translateBounds(const Acts::SurfaceBounds &bounds) const
Translate the Acts surface bounds to its equivalent in the Trk realm.

Member Data Documentation

◆ m_actsSurfaceMap

std::unordered_map<Identifier, std::shared_ptr<const Acts::Surface> > ActsTrk::GeometryRealmConvTool::m_actsSurfaceMap {}
private

Definition at line 66 of file GeometryRealmConvTool.h.

66{};

◆ m_ctxProvider

ActsTrk::ContextUtility ActsTrk::GeometryRealmConvTool::m_ctxProvider {this}
private

Context provider for geometry, magnetic field and calibration contexts.

Definition at line 64 of file GeometryRealmConvTool.h.

64{this};

◆ m_extractMuonSurfaces

Gaudi::Property<bool> ActsTrk::GeometryRealmConvTool::m_extractMuonSurfaces
private
Initial value:
{this, "ExtractMuonSurfaces", false,
"If True, use the MuonDetectorManager to extract the Muon surfaces"}

Definition at line 68 of file GeometryRealmConvTool.h.

68 {this, "ExtractMuonSurfaces", false,
69 "If True, use the MuonDetectorManager to extract the Muon surfaces"};

◆ m_muonMgrKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> ActsTrk::GeometryRealmConvTool::m_muonMgrKey {this, "MuonManagerKey", "MuonDetectorManager"}
private

Detector manager to fetch the legacy Trk surfaces.

Definition at line 72 of file GeometryRealmConvTool.h.

72{this, "MuonManagerKey", "MuonDetectorManager"};

◆ m_trackingGeometrySvc

ServiceHandle<ActsTrk::ITrackingGeometrySvc> ActsTrk::GeometryRealmConvTool::m_trackingGeometrySvc {this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"}
private

Definition at line 61 of file GeometryRealmConvTool.h.

61{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};

The documentation for this class was generated from the following files: