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...
 
std::unique_ptr< ActsTrk::TrackContainerbuild (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 Acts::GeometryContext &geoContext, 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 76 of file TrackContainerHandlesHelper.h.

Member Function Documentation

◆ build()

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

Definition at line 257 of file TrackContainerHandlesHelper.cxx.

259  {
260 
261  std::unique_ptr<ActsTrk::MultiTrajectory> mtj =
262  buildMtj(geo, geoContext, evtContext);
263  auto mtjHandle = SG::makeHandle(m_mtjKey, evtContext);
264  if (mtjHandle.record(std::move(mtj)).isFailure()) {
265  throw std::runtime_error(
266  "ConstTrackContainerHandle<C>::build failed recording MTJ");
267  }
269  evtContext);
270  if (not summaryLink.isValid()) {
271  throw std::runtime_error(
272  "ConstTrackContainerHandle::build, SummaryLink is invalid");
273  }
274 
275  auto surfacesHandle = SG::makeHandle(m_trackSurfacesKey, evtContext);
276  if (not surfacesHandle.isValid()) {
277  throw std::runtime_error(
278  "ConstTrackContainerHandle::build, SurfaceHandle is invalid");
279  }
280 
281  auto constTrackSummary = std::make_unique<ActsTrk::TrackSummaryContainer>(summaryLink);
282  constTrackSummary->decodeSurfaces( surfacesHandle.cptr(), geoContext);
283 
284  auto summaryHandle = SG::makeHandle(m_trackSummaryKey, evtContext);
285  if (summaryHandle.record(std::move(constTrackSummary)).isFailure()) {
286  throw std::runtime_error(
287  "MutableTrackContainerHandle::build, can't record "
288  "TrackSummary");
289  }
290 
291  auto constTrack = std::make_unique<ActsTrk::TrackContainer>(
293  evtContext),
295 
296  return constTrack;
297 
298 }

◆ buildMtj()

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

Definition at line 205 of file TrackContainerHandlesHelper.cxx.

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

◆ 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 177 of file TrackContainerHandlesHelper.cxx.

178  {
179  m_statesKey = prefix + "TrackStates";
180  m_parametersKey = prefix + "TrackParameters";
181  m_jacobiansKey = prefix + "TrackJacobians";
182  m_measurementsKey = prefix + "TrackMeasurements";
183  m_surfacesKey = prefix + "TrackSurfaces";
184  m_mtjKey = prefix + "MultiTrajectory";
185 
186  INIT_CHECK(m_statesKey);
187  INIT_CHECK(m_parametersKey);
188  INIT_CHECK(m_jacobiansKey);
189  INIT_CHECK(m_measurementsKey);
190  INIT_CHECK(m_surfacesKey);
191  INIT_CHECK(m_mtjKey);
192 
193  m_xAODTrackSummaryKey = prefix + "TrackSummary";
194  m_trackSurfacesKey = prefix + "TrackSurfaces";
195  m_trackSummaryKey = prefix + "TrackSummary";
196 
197  INIT_CHECK(m_xAODTrackSummaryKey);
198  INIT_CHECK(m_trackSurfacesKey);
199  INIT_CHECK(m_trackSummaryKey);
200 
201  return StatusCode::SUCCESS;
202 }

◆ restoreUncalibMeasurementPtr()

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

Definition at line 329 of file TrackContainerHandlesHelper.cxx.

329  {
331  static const SG::ConstAccessor< link_t > link_accessor("uncalibratedMeasurementLink");
332 
333  if (statesLink.getAuxIDs().test(link_accessor.auxid())){
334  const_span<link_t> elementLinks = getElementVector(statesLink, link_accessor);
335 
337  decor("uncalibratedMeasurement");
338 
339  std::span<const xAOD::UncalibratedMeasurement *> uncalibratedMeasurements
340  = createDecoration( statesLink, decor);
341 
342  for (unsigned int index = 0; index < elementLinks.size(); ++index) {
343  const link_t &el = elementLinks[index];
344  const xAOD::UncalibratedMeasurement *a_measurement = (el.isValid() ? *el : nullptr);
345  // @TODO is this check necessary ?
346  if (uncalibratedMeasurements[index] != nullptr && a_measurement != uncalibratedMeasurements[index]) {
347  throwConflictingUncalibratedMeasurementPointerValue(uncalibratedMeasurements[index], a_measurement);
348  }
349  uncalibratedMeasurements[index]=a_measurement;
350  }
351  }
352  else {
353  std::cerr << "WARNING no uncalibratedMeasurementLink aux data " << std::endl;
354  }
355 }

Member Data Documentation

◆ m_jacobiansKey

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

Definition at line 96 of file TrackContainerHandlesHelper.h.

◆ m_measurementsKey

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

Definition at line 97 of file TrackContainerHandlesHelper.h.

◆ m_mtjKey

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

Definition at line 100 of file TrackContainerHandlesHelper.h.

◆ m_parametersKey

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

Definition at line 95 of file TrackContainerHandlesHelper.h.

◆ m_statesKey

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

Definition at line 94 of file TrackContainerHandlesHelper.h.

◆ m_surfacesKey

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

Definition at line 98 of file TrackContainerHandlesHelper.h.

◆ m_trackSummaryKey

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

Definition at line 111 of file TrackContainerHandlesHelper.h.

◆ m_trackSurfacesKey

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

Definition at line 110 of file TrackContainerHandlesHelper.h.

◆ m_xAODTrackSummaryKey

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

Definition at line 109 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:96
ActsTrk::ConstTrackContainerHandlesHelper::m_trackSummaryKey
SG::WriteHandleKey< ActsTrk::TrackSummaryContainer > m_trackSummaryKey
Definition: TrackContainerHandlesHelper.h:111
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:275
ActsTrk::ConstTrackContainerHandlesHelper::restoreUncalibMeasurementPtr
void restoreUncalibMeasurementPtr(xAOD::TrackStateAuxContainer &statesLink) const
Definition: TrackContainerHandlesHelper.cxx:329
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:110
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
xAOD::UncalibratedMeasurement_v1
Definition: UncalibratedMeasurement_v1.h:13
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
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:100
ActsTrk::ConstTrackContainerHandlesHelper::m_xAODTrackSummaryKey
SG::ReadHandleKey< xAOD::TrackSummaryContainer > m_xAODTrackSummaryKey
Definition: TrackContainerHandlesHelper.h:109
ActsTrk::ConstTrackContainerHandlesHelper::m_measurementsKey
SG::ReadHandleKey< xAOD::TrackMeasurementContainer > m_measurementsKey
Definition: TrackContainerHandlesHelper.h:97
DeMoScan.index
string index
Definition: DeMoScan.py:364
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
ActsTrk::ConstTrackContainerHandlesHelper::m_statesKey
SG::ReadHandleKey< xAOD::TrackStateContainer > m_statesKey
Definition: TrackContainerHandlesHelper.h:94
xAOD::TrackStateAuxContainer_v1
Definition: TrackStateAuxContainer_v1.h:18
ActsTrk::ConstTrackContainerHandlesHelper::buildMtj
std::unique_ptr< ActsTrk::MultiTrajectory > buildMtj(const Acts::TrackingGeometry *geo, const Acts::GeometryContext &geoContext, const EventContext &context) const
Definition: TrackContainerHandlesHelper.cxx:205
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:95
ActsTrk::ConstTrackContainerHandlesHelper::m_surfacesKey
SG::ReadHandleKey< xAOD::TrackSurfaceContainer > m_surfacesKey
Definition: TrackContainerHandlesHelper.h:98
CxxUtils::ConcurrentBitset::test
bool test(bit_t bit) const
Test to see if a bit is set.