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::PersistentTrackContainerbuild (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::MultiTrajectorybuildMtj (const Acts::TrackingGeometry *geo, const EventContext &context) const

Private Attributes

SG::ReadHandleKey< xAOD::TrackStateContainerm_statesKey
SG::ReadHandleKey< xAOD::TrackParametersContainerm_parametersKey
SG::ReadHandleKey< xAOD::TrackJacobianContainerm_jacobiansKey
SG::ReadHandleKey< xAOD::TrackMeasurementContainerm_measurementsKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainerm_surfacesKey
SG::WriteHandleKey< ActsTrk::MultiTrajectorym_mtjKey
SG::ReadHandleKey< xAOD::TrackSummaryContainerm_xAODTrackSummaryKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainerm_trackSurfacesKey
SG::WriteHandleKey< ActsTrk::TrackSummaryContainerm_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 252 of file TrackContainerHandlesHelper.cxx.

254 {
255
256 std::unique_ptr<ActsTrk::MultiTrajectory> mtj = buildMtj(geo,evtContext);
257 auto mtjHandle = SG::makeHandle(m_mtjKey, evtContext);
258 if (mtjHandle.record(std::move(mtj)).isFailure()) {
259 throw std::runtime_error(
260 "ConstTrackContainerHandle<C>::build failed recording MTJ");
261 }
262 DataLink<xAOD::TrackSummaryContainer> summaryLink(m_xAODTrackSummaryKey.key(),
263 evtContext);
264 if (not summaryLink.isValid()) {
265 throw std::runtime_error(
266 "ConstTrackContainerHandle::build, SummaryLink is invalid");
267 }
268
269 auto surfacesHandle = SG::makeHandle(m_trackSurfacesKey, evtContext);
270 if (not surfacesHandle.isValid()) {
271 throw std::runtime_error(
272 "ConstTrackContainerHandle::build, SurfaceHandle is invalid");
273 }
274
275 auto constTrackSummary = std::make_unique<ActsTrk::TrackSummaryContainer>(summaryLink);
276 constTrackSummary->decodeSurfaces( surfacesHandle.cptr());
277
278 auto summaryHandle = SG::makeHandle(m_trackSummaryKey, evtContext);
279 if (summaryHandle.record(std::move(constTrackSummary)).isFailure()) {
280 throw std::runtime_error(
281 "MutableTrackContainerHandle::build, can't record "
282 "TrackSummary");
283 }
284
285 auto constTrack = std::make_unique<ActsTrk::PersistentTrackContainer>(
286 DataLink<ActsTrk::TrackSummaryContainer>(m_trackSummaryKey.key(),
287 evtContext),
288 DataLink<ActsTrk::MultiTrajectory>(m_mtjKey.key(), evtContext));
289
290 return constTrack;
291
292}
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 201 of file TrackContainerHandlesHelper.cxx.

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

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

◆ restoreUncalibMeasurementPtr()

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

Definition at line 323 of file TrackContainerHandlesHelper.cxx.

323 {
324 using link_t = ElementLink< xAOD::UncalibratedMeasurementContainer >;
325 static const SG::ConstAccessor< link_t > link_accessor("uncalibratedMeasurementLink");
326
327 if (statesLink.getAuxIDs().test(link_accessor.auxid())){
328 const_span<link_t> elementLinks = getElementVector(statesLink, link_accessor);
329
331 decor("uncalibratedMeasurement");
332
333 std::span<const xAOD::UncalibratedMeasurement *> uncalibratedMeasurements
334 = createDecoration( statesLink, decor);
335
336 for (unsigned int index = 0; index < elementLinks.size(); ++index) {
337 const link_t &el = elementLinks[index];
338 const xAOD::UncalibratedMeasurement *a_measurement = (el.isValid() ? *el : nullptr);
339 // @TODO is this check necessary ?
340 if (uncalibratedMeasurements[index] != nullptr && a_measurement != uncalibratedMeasurements[index]) {
341 throwConflictingUncalibratedMeasurementPointerValue(uncalibratedMeasurements[index], a_measurement);
342 }
343 uncalibratedMeasurements[index]=a_measurement;
344 }
345 }
346 else {
347 std::cerr << "WARNING no uncalibratedMeasurementLink aux data " << std::endl;
348 }
349}
bool test(bit_t bit) const
Test to see if a bit is set.
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:575
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
str index
Definition DeMoScan.py:362
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: