ATLAS Offline Software
TrackToTruthParticleAssociation.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 #ifndef TRACKTOGENPARTICLEASSOCIATION_H
5 #define TRACKTOGENPARTICLEASSOCIATION_H
6 #include "boost/container/small_vector.hpp"
10 #include "AthLinks/DataLink.h"
11 #include <vector>
12 #include <array>
13 #include <cstdint>
14 #include <utility>
15 
16 namespace ActsTrk
17 {
18  // NHitCounter is the number of types, without the Other (i.e. unknown) type
20  constexpr unsigned int NTruthParticlesPerTrack = 5; // a tiny fraction of measurements will have more than
21  // 5 associated GenParticles
22 
23  // Wrapper around std::array to ensure that by default elements are initialised to zero
24  class HitCounterArray : public std::array<uint8_t, NHitCounter>
25  {
26  public:
28  };
29 
38  public:
39  using container = boost::container::small_vector<std::pair<const xAOD::TruthParticle *, HitCounterArray >, NTruthParticlesPerTrack>;
40 
43  const container &countsPerTruthParticle() const { return m_counts; }
44 
48 
52 
55  const HitCounterArray &totalCounts() const { return m_recoCounts[kTotal]; }
56 
60 
63  const HitCounterArray &noiseCounts() const { return m_recoCounts[kNoise]; }
64 
65  private:
68  std::array<HitCounterArray,kNRecoCounts> m_recoCounts;
69  };
70 
71  class TrackToTruthParticleAssociation : public std::vector<HitCountsPerTrack> {
72  public:
73  using std::vector<HitCountsPerTrack>::vector ;
74 
76  m_sourceTracks = std::move(source);
77  }
79  return m_sourceTracks.getDataPtr();
80  }
81 
82  private:
84  };
85 }
86 
87 #include "AthenaKernel/CLASS_DEF.h"
89 
90 #endif
ActsTrk::TrackContainer
Definition: TrackContainer.h:31
ActsTrk::HitCountsPerTrack::kNRecoCounts
@ kNRecoCounts
Definition: TrackToTruthParticleAssociation.h:67
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
ActsTrk::HitCountsPerTrack
Container for hit counts per track Contains hit counts per associated truth particle and the total hi...
Definition: TrackToTruthParticleAssociation.h:37
ActsTrk::TrackToTruthParticleAssociation::sourceContainer
const ActsTrk::TrackContainer * sourceContainer() const
Definition: TrackToTruthParticleAssociation.h:78
ActsTrk::HitCountsPerTrack::ECounts
ECounts
Definition: TrackToTruthParticleAssociation.h:67
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
ActsTrk::HitCounterArray
Definition: TrackToTruthParticleAssociation.h:25
ActsTrk::HitCountsPerTrack::kTotal
@ kTotal
Definition: TrackToTruthParticleAssociation.h:67
ActsTrk::HitCountsPerTrack::container
boost::container::small_vector< std::pair< const xAOD::TruthParticle *, HitCounterArray >, NTruthParticlesPerTrack > container
Definition: TrackToTruthParticleAssociation.h:39
ActsTrk::HitCountsPerTrack::kNoise
@ kNoise
Definition: TrackToTruthParticleAssociation.h:67
ActsTrk::NTruthParticlesPerTrack
constexpr unsigned int NTruthParticlesPerTrack
Definition: TrackToTruthParticleAssociation.h:20
ActsTrk::HitCountsPerTrack::totalCounts
const HitCounterArray & totalCounts() const
Total hit counts per track (read only).
Definition: TrackToTruthParticleAssociation.h:55
MeasurementDefs.h
ActsTrk::HitCountsPerTrack::noiseCounts
HitCounterArray & noiseCounts()
Noise hit counts per track.
Definition: TrackToTruthParticleAssociation.h:59
ActsTrk::TrackToTruthParticleAssociation
Definition: TrackToTruthParticleAssociation.h:71
lumiFormat.array
array
Definition: lumiFormat.py:91
xAOD::UncalibMeasType::nTypes
@ nTypes
ActsTrk::TrackToTruthParticleAssociation::setSourceContainer
void setSourceContainer(DataLink< ActsTrk::TrackContainer > &&source)
Definition: TrackToTruthParticleAssociation.h:75
ActsTrk::HitCountsPerTrack::totalCounts
HitCounterArray & totalCounts()
Total hit counts per track.
Definition: TrackToTruthParticleAssociation.h:51
ActsTrk::TrackToTruthParticleAssociation::m_sourceTracks
DataLink< ActsTrk::TrackContainer > m_sourceTracks
Definition: TrackToTruthParticleAssociation.h:83
ActsTrk::HitCountsPerTrack::countsPerTruthParticle
container & countsPerTruthParticle()
vector with counts per associated truth particle (read only)
Definition: TrackToTruthParticleAssociation.h:47
ActsTrk::HitCountsPerTrack::m_recoCounts
std::array< HitCounterArray, kNRecoCounts > m_recoCounts
Definition: TrackToTruthParticleAssociation.h:68
ActsTrk::HitCountsPerTrack::countsPerTruthParticle
const container & countsPerTruthParticle() const
vector with counts per associated truth particle
Definition: TrackToTruthParticleAssociation.h:43
ActsTrk::HitCounterArray::HitCounterArray
HitCounterArray()
Definition: TrackToTruthParticleAssociation.h:27
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:49
copySelective.source
string source
Definition: copySelective.py:32
ActsTrk::HitCountsPerTrack::m_counts
container m_counts
Definition: TrackToTruthParticleAssociation.h:66
ActsTrk::NHitCounter
constexpr unsigned int NHitCounter
Definition: TrackToTruthParticleAssociation.h:19
TruthParticle.h
CLASS_DEF.h
macros to associate a CLID to a type
TrackContainer.h
ActsTrk::HitCountsPerTrack::noiseCounts
const HitCounterArray & noiseCounts() const
Noise hit counts per track (read only).
Definition: TrackToTruthParticleAssociation.h:63