ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 
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. More...
 
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  }
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>(
287  evtContext),
289 
290  return constTrack;
291 
292 }

◆ 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 
217  m_parametersKey.key() + "Aux.", evtContext);
218  if (not parametersLink.isValid()) {
219  throw std::runtime_error(
220  "ConstMultiTrajectoryHandle::build, ParametersLink is invalid");
221  }
222 
224  m_jacobiansKey.key() + "Aux.", evtContext);
225  if (not jacobiansLink.isValid()) {
226  throw std::runtime_error(
227  "ConstMultiTrajectoryHandle::build, JacobiansLink is invalid");
228  }
229 
231  m_measurementsKey.key() + "Aux.", evtContext);
232  if (not measurementsLink.isValid()) {
233  throw std::runtime_error(
234  "ConstMultiTrajectoryHandle::build, MeasurementsLink is invalid");
235  }
236 
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 }

◆ 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 }

◆ restoreUncalibMeasurementPtr()

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

Definition at line 323 of file TrackContainerHandlesHelper.cxx.

323  {
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 }

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:
ActsTrk::ConstTrackContainerHandlesHelper::m_jacobiansKey
SG::ReadHandleKey< xAOD::TrackJacobianContainer > m_jacobiansKey
Definition: TrackContainerHandlesHelper.h:113
ActsTrk::ConstTrackContainerHandlesHelper::m_trackSummaryKey
SG::WriteHandleKey< ActsTrk::TrackSummaryContainer > m_trackSummaryKey
Definition: TrackContainerHandlesHelper.h:127
index
Definition: index.py:1
xAOD::AuxContainerBase::getAuxIDs
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Definition: AuxContainerBase.cxx:277
ActsTrk::ConstTrackContainerHandlesHelper::restoreUncalibMeasurementPtr
void restoreUncalibMeasurementPtr(xAOD::TrackStateAuxContainer &statesLink) const
Definition: TrackContainerHandlesHelper.cxx:323
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
ActsTrk::ConstTrackContainerHandlesHelper::m_trackSurfacesKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainer > m_trackSurfacesKey
Definition: TrackContainerHandlesHelper.h:126
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
INIT_CHECK
#define INIT_CHECK(key)
Definition: TrackContainerHandlesHelper.cxx:42
ActsTrk::ConstTrackContainerHandlesHelper::buildMtj
std::unique_ptr< ActsTrk::MultiTrajectory > buildMtj(const Acts::TrackingGeometry *geo, const EventContext &context) const
Definition: TrackContainerHandlesHelper.cxx:201
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
ActsTrk::ConstTrackContainerHandlesHelper::m_mtjKey
SG::WriteHandleKey< ActsTrk::MultiTrajectory > m_mtjKey
Definition: TrackContainerHandlesHelper.h:117
ActsTrk::ConstTrackContainerHandlesHelper::m_xAODTrackSummaryKey
SG::ReadHandleKey< xAOD::TrackSummaryContainer > m_xAODTrackSummaryKey
Definition: TrackContainerHandlesHelper.h:125
ActsTrk::ConstTrackContainerHandlesHelper::m_measurementsKey
SG::ReadHandleKey< xAOD::TrackMeasurementContainer > m_measurementsKey
Definition: TrackContainerHandlesHelper.h:114
DeMoScan.index
string index
Definition: DeMoScan.py:362
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
ActsTrk::ConstTrackContainerHandlesHelper::m_statesKey
SG::ReadHandleKey< xAOD::TrackStateContainer > m_statesKey
Definition: TrackContainerHandlesHelper.h:111
xAOD::TrackStateAuxContainer_v1
Definition: TrackStateAuxContainer_v1.h:18
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
ActsTrk::ConstTrackContainerHandlesHelper::m_parametersKey
SG::ReadHandleKey< xAOD::TrackParametersContainer > m_parametersKey
Definition: TrackContainerHandlesHelper.h:112
ActsTrk::ConstTrackContainerHandlesHelper::m_surfacesKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainer > m_surfacesKey
Definition: TrackContainerHandlesHelper.h:115
CxxUtils::ConcurrentBitset::test
bool test(bit_t bit) const
Test to see if a bit is set.