ATLAS Offline Software
Loading...
Searching...
No Matches
MeasurementIndex.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ACTSTRACKRECONSTRUCTION_MEASUREMENTINDEX_H
6#define ACTSTRACKRECONSTRUCTION_MEASUREMENTINDEX_H
7
9
10#include <utility>
11#include <vector>
12
13namespace ActsTrk::detail {
14
15 // Helper class to keep track of measurement indices, used for shared hits and debug printing
17 public:
18 inline MeasurementIndex(std::size_t nMeasurementContainerMax = 0ul); // nMeasurementContainerMax is only a hint
21 MeasurementIndex(MeasurementIndex &&) noexcept = default;
22 MeasurementIndex &operator=(MeasurementIndex &&) noexcept = default;
23 ~MeasurementIndex() = default;
24
25 // addMeasurement(s)/newMeasurementIndex can include previously added hits, as long as they are in the same owning container.
26 inline bool addMeasurement(const xAOD::UncalibratedMeasurement &hit);
27 inline void addMeasurements(const xAOD::UncalibratedMeasurementContainer &clusterContainer);
28 inline std::size_t nMeasurements() const;
29
30 inline std::size_t index(const xAOD::UncalibratedMeasurement &hit) const;
31 inline std::pair<std::size_t,bool> newMeasurementIndex(const xAOD::UncalibratedMeasurement &hit);
32 inline std::size_t size() const;
33
34 private:
35 using ContainerPtr = const SG::AuxVectorData *;
37 std::size_t m_size{};
38 std::size_t m_nMeasurements{};
39 // MeasurementIndex is only ever used as a local stack variable, so doesn't need to be thread safe.
40 // Is there a way to confirm this but still disable "non-thread-safe" warnings?
41 // We could make index() non-const, but it is only needed for these cached values.
42 mutable ContainerPtr m_lastContainer ATLAS_THREAD_SAFE{nullptr};
43 mutable std::size_t m_lastContainerOffset ATLAS_THREAD_SAFE{};
44 mutable std::size_t m_lastContainerSize ATLAS_THREAD_SAFE{};
45 };
46
47} // namespace ActsTrk::detail
48
50
51#endif
bool addMeasurement(const xAOD::UncalibratedMeasurement &hit)
ContainerPtr m_lastContainer ATLAS_THREAD_SAFE
MeasurementIndex(std::size_t nMeasurementContainerMax=0ul)
MeasurementIndex(MeasurementIndex &&) noexcept=default
std::pair< std::size_t, bool > newMeasurementIndex(const xAOD::UncalibratedMeasurement &hit)
const SG::AuxVectorData * ContainerPtr
std::vector< std::pair< ContainerPtr, std::size_t > > m_measurementContainerOffsets
std::size_t nMeasurements() const
MeasurementIndex & operator=(const MeasurementIndex &)=default
MeasurementIndex(const MeasurementIndex &)=default
void addMeasurements(const xAOD::UncalibratedMeasurementContainer &clusterContainer)
STL class.
Athena definition of the Eigen plugin.
Forward declaration.
Definition index.py:1
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
#define private