ATLAS Offline Software
Loading...
Searching...
No Matches
ClusterToTruthAssociation.h
Go to the documentation of this file.
1#ifndef ACTSTRK_CLUSTERTOTRUTHASSOCIATION_H
2#define ACTSTRK_CLUSTERTOTRUTHASSOCIATION_H 1
3
8
11#include <unordered_map>
12
14
15// Adapter to use MeasurementToTruthAssociation algorithm to
16// xAOD::PixelClusterContainer and xAOD::StripClusterContainer to
17// xAOD::TruthParticles using the InDetSimDataCollection and
18// the xAODTruthParticleLink which pairs HepMcParticleLinks with the
19// corresponding xAOD::TruthParticle.
20
21#include <iostream>
22
24{
25private:
27public:
29 : m_truthParticleLinks(&truth_particle_links)
30 {}
31 operator bool() const {
32 return true;
33 }
35 if (deposit.first.isValid()) {
36 ElementLink<xAOD::TruthParticleContainer> truth_particle_link = m_truthParticleLinks->find(deposit.first);
37 if (truth_particle_link) {
38 return *truth_particle_link;
39 }
40 }
41 return nullptr;
42 }
43 inline bool isHardScatter(const InDetSimData::Deposit &deposit) {
44 return deposit.first.eventIndex()==0;
45 }
46};
47
48// specialisation for the MeasurementToTruthAssociationAlg
49template <>
50inline auto ActsTrk::makeDepositToTruthParticleMap(const xAODTruthParticleLinkVector *truth_particle_links) {
51 if (!truth_particle_links) {
52 throw std::runtime_error("Invalid xAODTruthParticleLinkVector.");
53 }
54
55 return HepMcLinkToTruthParticleMap(*truth_particle_links);
56}
57
58// property name for the input xAODTruthParticleLinkVector
59template <>
61 return "InputTruthParticleLinks";
62}
63
64// specialisation for the MeasurementToTruthAssociationAlg
65template <>
66inline auto ActsTrk::getSimDataDeposits([[maybe_unused]] const InDetSimDataCollection &sim_data_collection,
67 InDetSimDataCollection::const_iterator sim_data_iter_for_identifier) {
68 return sim_data_iter_for_identifier->second.getdeposits();
69}
70
71template <>
72inline float ActsTrk::getDepositedEnergy(const std::pair<HepMcParticleLink, float> &deposit) {
73 return deposit.second;
74}
75
77
78
79namespace ActsTrk {
80
81 // name the specialistion to get a nicer name in python
83 : public MeasurementToTruthAssociationAlg<xAOD::PixelClusterContainer,
84 InDetSimDataCollection,
85 xAODTruthParticleLinkVector,
86 MeasurementToTruthAssociationDebugHistograms>
87 {
88 public:
93 };
94
95 // name the specialistion to get a nicer name in python
97 : public MeasurementToTruthAssociationAlg<xAOD::StripClusterContainer,
98 InDetSimDataCollection,
99 xAODTruthParticleLinkVector,
100 MeasurementToTruthAssociationDebugHistograms>
101 {
102 public:
107 };
108 // name the specialistion to get a nicer name in python
110 : public MeasurementToTruthAssociationAlg<xAOD::HGTDClusterContainer,
111 InDetSimDataCollection,
112 xAODTruthParticleLinkVector,
113 MeasurementToTruthAssociationDebugHistograms>
114 {
115 public:
120 };
121
122}
123#endif
constexpr bool MeasurementToTruthAssociationDebugHistograms
HepMcLinkToTruthParticleMap(const xAODTruthParticleLinkVector &truth_particle_links)
bool isHardScatter(const InDetSimData::Deposit &deposit)
const xAOD::TruthParticle * getTruthParticle(const InDetSimData::Deposit &deposit)
const xAODTruthParticleLinkVector * m_truthParticleLinks
std::pair< HepMcParticleLink, float > Deposit
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
float getDepositedEnergy(const T_Deposit &)
auto getSimDataDeposits(const T_SimDataCollection &sim_data_collection, T_SimDataIterator sim_data_iter_for_identifier)
const char * getInTruthPropertyName()
auto makeDepositToTruthParticleMap(const T_TruthEventCollection *truth_particle_links)
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
HGTDClusterContainer_v1 HGTDClusterContainer
Define the version of the HGTD cluster container.
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
TruthParticle_v1 TruthParticle
Typedef to implementation.