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

#include <TrackContainerHandlesHelper.h>

Collaboration diagram for ActsTrk::ConstTrackContainerHandlesHelper:

Public Member Functions

StatusCode initialize (const std::string &prefix)
 Sets up the handles.
template<class PropOwner>
 ConstTrackContainerHandlesHelper (PropOwner *owner)
 Constructor taking the pointer to the class holding the object used to declare the data dependency from the WriteHandleKeys to the AvalancheScheduler.
std::unique_ptr< ActsTrk::PersistentTrackContainer > build (const Acts::TrackingGeometry *geo, const Acts::GeometryContext &geoContext, const EventContext &context) const

Private Member Functions

void restoreUncalibMeasurementPtr (xAOD::TrackStateAuxContainer &statesLink) const
std::unique_ptr< ActsTrk::MultiTrajectory > buildMtj (const Acts::TrackingGeometry *geo, const EventContext &context) const

Private Attributes

SG::ReadHandleKey< xAOD::TrackStateContainer > m_statesKey
SG::ReadHandleKey< xAOD::TrackParametersContainer > m_parametersKey
SG::ReadHandleKey< xAOD::TrackJacobianContainer > m_jacobiansKey
SG::ReadHandleKey< xAOD::TrackMeasurementContainer > m_measurementsKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainer > m_surfacesKey
SG::WriteHandleKey< ActsTrk::MultiTrajectory > m_mtjKey
SG::ReadHandleKey< xAOD::TrackSummaryContainer > m_xAODTrackSummaryKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainer > m_trackSurfacesKey
SG::WriteHandleKey< ActsTrk::TrackSummaryContainer > m_trackSummaryKey

Detailed Description

Definition at line 85 of file TrackContainerHandlesHelper.h.

Constructor & Destructor Documentation

◆ ConstTrackContainerHandlesHelper()

template<class PropOwner>
ActsTrk::ConstTrackContainerHandlesHelper::ConstTrackContainerHandlesHelper ( PropOwner * owner)

Constructor taking the pointer to the class holding the object used to declare the data dependency from the WriteHandleKeys to the AvalancheScheduler.

The object should be defined in the header like ActsTrk::ConstTrackContainerHandlesHelper m_trackHelper{this};

Member Function Documentation

◆ build()

std::unique_ptr< ActsTrk::PersistentTrackContainer > ActsTrk::ConstTrackContainerHandlesHelper::build ( const Acts::TrackingGeometry * geo,
const Acts::GeometryContext & geoContext,
const EventContext & context ) const

Definition at line 251 of file TrackContainerHandlesHelper.cxx.

253 {
254
255 std::unique_ptr<ActsTrk::MultiTrajectory> mtj = buildMtj(geo,evtContext);
256 auto mtjHandle = SG::makeHandle(m_mtjKey, evtContext);
257 if (mtjHandle.record(std::move(mtj)).isFailure()) {
258 throw std::runtime_error(
259 "ConstTrackContainerHandle<C>::build failed recording MTJ");
260 }
261 DataLink<xAOD::TrackSummaryContainer> summaryLink(m_xAODTrackSummaryKey.key(),
262 evtContext);
263 if (not summaryLink.isValid()) {
264 throw std::runtime_error(
265 "ConstTrackContainerHandle::build, SummaryLink is invalid");
266 }
267
268 auto surfacesHandle = SG::makeHandle(m_trackSurfacesKey, evtContext);
269 if (not surfacesHandle.isValid()) {
270 throw std::runtime_error(
271 "ConstTrackContainerHandle::build, SurfaceHandle is invalid");
272 }
273
274 auto constTrackSummary = std::make_unique<ActsTrk::TrackSummaryContainer>(summaryLink);
275 constTrackSummary->decodeSurfaces( surfacesHandle.cptr());
276
277 auto summaryHandle = SG::makeHandle(m_trackSummaryKey, evtContext);
278 if (summaryHandle.record(std::move(constTrackSummary)).isFailure()) {
279 throw std::runtime_error(
280 "MutableTrackContainerHandle::build, can't record "
281 "TrackSummary");
282 }
283
284 auto constTrack = std::make_unique<ActsTrk::PersistentTrackContainer>(
285 DataLink<ActsTrk::TrackSummaryContainer>(m_trackSummaryKey.key(),
286 evtContext),
287 DataLink<ActsTrk::MultiTrajectory>(m_mtjKey.key(), evtContext));
288
289 return constTrack;
290
291}
SG::WriteHandleKey< ActsTrk::MultiTrajectory > m_mtjKey
SG::WriteHandleKey< ActsTrk::TrackSummaryContainer > m_trackSummaryKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainer > m_trackSurfacesKey
SG::ReadHandleKey< xAOD::TrackSummaryContainer > m_xAODTrackSummaryKey
std::unique_ptr< ActsTrk::MultiTrajectory > buildMtj(const Acts::TrackingGeometry *geo, const EventContext &context) const
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ buildMtj()

std::unique_ptr< ActsTrk::MultiTrajectory > ActsTrk::ConstTrackContainerHandlesHelper::buildMtj ( const Acts::TrackingGeometry * geo,
const EventContext & context ) const
private

Definition at line 200 of file TrackContainerHandlesHelper.cxx.

201 {
202 // we need to build it from backends
203 DataLink<xAOD::TrackStateAuxContainer> statesLink(m_statesKey.key() + "Aux.",
204 evtContext);
205 if (not statesLink.isValid()) {
206 throw std::runtime_error(
207 "ConstMultiTrajectoryHandle::build, StatesLink is invalid");
208 }
209 // The restoration of the pointers to uncalibrated measurements should only
210 // be done once, if it is done in parallel by multiple callers all callers should
211 // write exactly the same value to exactly the same memory location
212 xAOD::TrackStateAuxContainer *nonConstStatesLink ATLAS_THREAD_SAFE = const_cast<xAOD::TrackStateAuxContainer *>(statesLink.getDataPtr());
213 restoreUncalibMeasurementPtr(*nonConstStatesLink);
214
215 DataLink<xAOD::TrackParametersAuxContainer> parametersLink(
216 m_parametersKey.key() + "Aux.", evtContext);
217 if (not parametersLink.isValid()) {
218 throw std::runtime_error(
219 "ConstMultiTrajectoryHandle::build, ParametersLink is invalid");
220 }
221
222 DataLink<xAOD::TrackJacobianAuxContainer> jacobiansLink(
223 m_jacobiansKey.key() + "Aux.", evtContext);
224 if (not jacobiansLink.isValid()) {
225 throw std::runtime_error(
226 "ConstMultiTrajectoryHandle::build, JacobiansLink is invalid");
227 }
228
229 DataLink<xAOD::TrackMeasurementAuxContainer> measurementsLink(
230 m_measurementsKey.key() + "Aux.", evtContext);
231 if (not measurementsLink.isValid()) {
232 throw std::runtime_error(
233 "ConstMultiTrajectoryHandle::build, MeasurementsLink is invalid");
234 }
235
236 DataLink<xAOD::TrackSurfaceAuxContainer> surfacesLink(
237 m_surfacesKey.key() + "Aux.", evtContext);
238 if (not surfacesLink.isValid()) {
239 throw std::runtime_error(
240 "ConstMultiTrajectoryHandle::build, SurfacesLink is invalid");
241 }
242
243
244 auto cmtj = std::make_unique<ActsTrk::MultiTrajectory>(
245 statesLink, parametersLink, jacobiansLink, measurementsLink, surfacesLink);
246 cmtj->fillSurfaces(geo);
247 return cmtj;
248}
#define ATLAS_THREAD_SAFE
SG::ReadHandleKey< xAOD::TrackMeasurementContainer > m_measurementsKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainer > m_surfacesKey
SG::ReadHandleKey< xAOD::TrackStateContainer > m_statesKey
void restoreUncalibMeasurementPtr(xAOD::TrackStateAuxContainer &statesLink) const
SG::ReadHandleKey< xAOD::TrackJacobianContainer > m_jacobiansKey
SG::ReadHandleKey< xAOD::TrackParametersContainer > m_parametersKey
TrackStateAuxContainer_v1 TrackStateAuxContainer

◆ initialize()

StatusCode ActsTrk::ConstTrackContainerHandlesHelper::initialize ( const std::string & prefix)

Sets up the handles.

  • prefix - common prefix for all the names the value would typically be taken from configurable string property

Definition at line 172 of file TrackContainerHandlesHelper.cxx.

173 {
174 m_statesKey = prefix + "TrackStates";
175 m_parametersKey = prefix + "TrackParameters";
176 m_jacobiansKey = prefix + "TrackJacobians";
177 m_measurementsKey = prefix + "TrackMeasurements";
178 m_surfacesKey = prefix + "TrackSurfaces";
179 m_mtjKey = prefix + "MultiTrajectory";
180
187
188 m_xAODTrackSummaryKey = prefix + "TrackSummary";
189 m_trackSurfacesKey = prefix + "TrackSurfaces";
190 m_trackSummaryKey = prefix + "TrackSummary";
191
195
196 return StatusCode::SUCCESS;
197}
#define INIT_CHECK(key)

◆ restoreUncalibMeasurementPtr()

void ActsTrk::ConstTrackContainerHandlesHelper::restoreUncalibMeasurementPtr ( xAOD::TrackStateAuxContainer & statesLink) const
private

Definition at line 322 of file TrackContainerHandlesHelper.cxx.

322 {
323 using link_t = ElementLink< xAOD::UncalibratedMeasurementContainer >;
324 static const SG::ConstAccessor< link_t > link_accessor("uncalibratedMeasurementLink");
325
326 if (statesLink.getAuxIDs().test(link_accessor.auxid())){
327 const_span<link_t> elementLinks = getElementVector(statesLink, link_accessor);
328
330 decor("uncalibratedMeasurement");
331
332 std::span<const xAOD::UncalibratedMeasurement *> uncalibratedMeasurements
333 = createDecoration( statesLink, decor);
334
335 for (unsigned int index = 0; index < elementLinks.size(); ++index) {
336 const link_t &el = elementLinks[index];
337 const xAOD::UncalibratedMeasurement *a_measurement = (el.isValid() ? *el : nullptr);
338 // @TODO is this check necessary ?
339 if (uncalibratedMeasurements[index] != nullptr && a_measurement != uncalibratedMeasurements[index]) {
340 throwConflictingUncalibratedMeasurementPointerValue(uncalibratedMeasurements[index], a_measurement);
341 }
342 uncalibratedMeasurements[index]=a_measurement;
343 }
344 }
345 else {
346 std::cerr << "WARNING no uncalibratedMeasurementLink aux data " << std::endl;
347 }
348}
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
str index
Definition DeMoScan.py:362
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.

Member Data Documentation

◆ m_jacobiansKey

SG::ReadHandleKey<xAOD::TrackJacobianContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_jacobiansKey
private

Definition at line 113 of file TrackContainerHandlesHelper.h.

◆ m_measurementsKey

SG::ReadHandleKey<xAOD::TrackMeasurementContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_measurementsKey
private

Definition at line 114 of file TrackContainerHandlesHelper.h.

◆ m_mtjKey

SG::WriteHandleKey<ActsTrk::MultiTrajectory> ActsTrk::ConstTrackContainerHandlesHelper::m_mtjKey
private

Definition at line 117 of file TrackContainerHandlesHelper.h.

◆ m_parametersKey

SG::ReadHandleKey<xAOD::TrackParametersContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_parametersKey
private

Definition at line 112 of file TrackContainerHandlesHelper.h.

◆ m_statesKey

SG::ReadHandleKey<xAOD::TrackStateContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_statesKey
private

Definition at line 111 of file TrackContainerHandlesHelper.h.

◆ m_surfacesKey

SG::ReadHandleKey<xAOD::TrackSurfaceContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_surfacesKey
private

Definition at line 115 of file TrackContainerHandlesHelper.h.

◆ m_trackSummaryKey

SG::WriteHandleKey<ActsTrk::TrackSummaryContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_trackSummaryKey
private

Definition at line 127 of file TrackContainerHandlesHelper.h.

◆ m_trackSurfacesKey

SG::ReadHandleKey<xAOD::TrackSurfaceContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_trackSurfacesKey
private

Definition at line 126 of file TrackContainerHandlesHelper.h.

◆ m_xAODTrackSummaryKey

SG::ReadHandleKey<xAOD::TrackSummaryContainer> ActsTrk::ConstTrackContainerHandlesHelper::m_xAODTrackSummaryKey
private

Definition at line 125 of file TrackContainerHandlesHelper.h.


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