ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsTruth
src
ClusterToTruthAssociation.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef ACTSTRK_CLUSTERTOTRUTHASSOCIATION_H
5
#define ACTSTRK_CLUSTERTOTRUTHASSOCIATION_H 1
6
7
#include "
InDetSimData/InDetSimDataCollection.h
"
8
#include "
xAODInDetMeasurement/PixelClusterContainer.h
"
9
#include "
xAODInDetMeasurement/StripClusterContainer.h
"
10
#include "
xAODInDetMeasurement/HGTDClusterContainer.h
"
11
12
#include "
GeneratorObjects/xAODTruthParticleLink.h
"
13
#include "
GeneratorObjects/HepMcParticleLink.h
"
14
#include <unordered_map>
15
16
#include "
MeasurementToTruthAssociationAlg.h
"
17
18
// Adapter to use MeasurementToTruthAssociation algorithm to
19
// xAOD::PixelClusterContainer and xAOD::StripClusterContainer to
20
// xAOD::TruthParticles using the InDetSimDataCollection and
21
// the xAODTruthParticleLink which pairs HepMcParticleLinks with the
22
// corresponding xAOD::TruthParticle.
23
24
#include <stdexcept>
25
26
class
HepMcLinkToTruthParticleMap
27
{
28
private
:
29
const
xAODTruthParticleLinkVector
*
m_truthParticleLinks
;
30
public
:
31
HepMcLinkToTruthParticleMap
(
const
xAODTruthParticleLinkVector
&truth_particle_links)
32
:
m_truthParticleLinks
(&truth_particle_links)
33
{}
34
operator
bool()
const
{
35
return
true
;
36
}
37
inline
const
xAOD::TruthParticle
*
getTruthParticle
(
const
InDetSimData::Deposit
&deposit) {
38
if
(deposit.first.isValid()) {
39
ElementLink<xAOD::TruthParticleContainer>
truth_particle_link =
m_truthParticleLinks
->find(deposit.first);
40
if
(truth_particle_link) {
41
return
*truth_particle_link;
42
}
43
}
44
return
nullptr
;
45
}
46
inline
bool
isHardScatter
(
const
InDetSimData::Deposit
&deposit) {
47
return
deposit.first.eventIndex()==0;
48
}
49
};
50
51
// specialisation for the MeasurementToTruthAssociationAlg
52
template
<>
53
inline
auto
ActsTrk::makeDepositToTruthParticleMap
(
const
xAODTruthParticleLinkVector
*truth_particle_links) {
54
if
(!truth_particle_links) {
55
throw
std::runtime_error(
"Invalid xAODTruthParticleLinkVector."
);
56
}
57
58
return
HepMcLinkToTruthParticleMap
(*truth_particle_links);
59
}
60
61
// property name for the input xAODTruthParticleLinkVector
62
template
<>
63
inline
const
char
*
ActsTrk::getInTruthPropertyName<xAODTruthParticleLinkVector>
() {
64
return
"InputTruthParticleLinks"
;
65
}
66
67
// specialisation for the MeasurementToTruthAssociationAlg
68
template
<>
69
//coverity[AUTO_CAUSES_COPY]
70
inline
auto
ActsTrk::getSimDataDeposits
([[maybe_unused]]
const
InDetSimDataCollection
&sim_data_collection,
71
InDetSimDataCollection::const_iterator sim_data_iter_for_identifier) {
72
return
sim_data_iter_for_identifier->second.getdeposits();
73
}
74
75
template
<>
76
inline
float
ActsTrk::getDepositedEnergy
(
const
std::pair<HepMcParticleLink, float> &deposit) {
77
return
deposit.second;
78
}
79
80
constexpr
bool
MeasurementToTruthAssociationDebugHistograms
=
false
;
81
82
83
namespace
ActsTrk
{
84
85
// name the specialistion to get a nicer name in python
86
class
PixelClusterToTruthAssociationAlg
87
:
public
MeasurementToTruthAssociationAlg
<xAOD::PixelClusterContainer,
88
InDetSimDataCollection,
89
xAODTruthParticleLinkVector,
90
MeasurementToTruthAssociationDebugHistograms>
91
{
92
public
:
93
using
MeasurementToTruthAssociationAlg
<
xAOD::PixelClusterContainer
,
94
InDetSimDataCollection
,
95
xAODTruthParticleLinkVector
,
96
MeasurementToTruthAssociationDebugHistograms
>
::MeasurementToTruthAssociationAlg
;
97
};
98
99
// name the specialistion to get a nicer name in python
100
class
StripClusterToTruthAssociationAlg
101
:
public
MeasurementToTruthAssociationAlg
<xAOD::StripClusterContainer,
102
InDetSimDataCollection,
103
xAODTruthParticleLinkVector,
104
MeasurementToTruthAssociationDebugHistograms>
105
{
106
public
:
107
using
MeasurementToTruthAssociationAlg
<
xAOD::StripClusterContainer
,
108
InDetSimDataCollection
,
109
xAODTruthParticleLinkVector
,
110
MeasurementToTruthAssociationDebugHistograms
>
::MeasurementToTruthAssociationAlg
;
111
};
112
// name the specialistion to get a nicer name in python
113
class
HgtdClusterToTruthAssociationAlg
114
:
public
MeasurementToTruthAssociationAlg
<xAOD::HGTDClusterContainer,
115
InDetSimDataCollection,
116
xAODTruthParticleLinkVector,
117
MeasurementToTruthAssociationDebugHistograms>
118
{
119
public
:
120
using
MeasurementToTruthAssociationAlg
<
xAOD::HGTDClusterContainer
,
121
InDetSimDataCollection
,
122
xAODTruthParticleLinkVector
,
123
MeasurementToTruthAssociationDebugHistograms
>
::MeasurementToTruthAssociationAlg
;
124
};
125
126
}
127
#endif
MeasurementToTruthAssociationDebugHistograms
constexpr bool MeasurementToTruthAssociationDebugHistograms
Definition
ClusterToTruthAssociation.h:80
PixelClusterContainer.h
HGTDClusterContainer.h
HepMcParticleLink.h
InDetSimDataCollection.h
MeasurementToTruthAssociationAlg.h
StripClusterContainer.h
ActsTrk::HgtdClusterToTruthAssociationAlg
Definition
ClusterToTruthAssociation.h:118
ActsTrk::MeasurementToTruthAssociationAlg< xAOD::PixelClusterContainer, InDetSimDataCollection, xAODTruthParticleLinkVector, MeasurementToTruthAssociationDebugHistograms >::MeasurementToTruthAssociationAlg
MeasurementToTruthAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator)
ActsTrk::PixelClusterToTruthAssociationAlg
Definition
ClusterToTruthAssociation.h:91
ActsTrk::StripClusterToTruthAssociationAlg
Definition
ClusterToTruthAssociation.h:105
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
HepMcLinkToTruthParticleMap
Definition
ClusterToTruthAssociation.h:27
HepMcLinkToTruthParticleMap::HepMcLinkToTruthParticleMap
HepMcLinkToTruthParticleMap(const xAODTruthParticleLinkVector &truth_particle_links)
Definition
ClusterToTruthAssociation.h:31
HepMcLinkToTruthParticleMap::isHardScatter
bool isHardScatter(const InDetSimData::Deposit &deposit)
Definition
ClusterToTruthAssociation.h:46
HepMcLinkToTruthParticleMap::getTruthParticle
const xAOD::TruthParticle * getTruthParticle(const InDetSimData::Deposit &deposit)
Definition
ClusterToTruthAssociation.h:37
HepMcLinkToTruthParticleMap::m_truthParticleLinks
const xAODTruthParticleLinkVector * m_truthParticleLinks
Definition
ClusterToTruthAssociation.h:29
InDetSimDataCollection
Definition
InDetSimDataCollection.h:25
InDetSimData::Deposit
std::pair< HepMcParticleLink, float > Deposit
Definition
InDetSimData.h:48
xAODTruthParticleLinkVector
Definition
xAODTruthParticleLink.h:26
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ActsTrk::getDepositedEnergy
float getDepositedEnergy(const T_Deposit &)
ActsTrk::getSimDataDeposits
auto getSimDataDeposits(const T_SimDataCollection &sim_data_collection, T_SimDataIterator sim_data_iter_for_identifier)
ActsTrk::getInTruthPropertyName
const char * getInTruthPropertyName()
ActsTrk::makeDepositToTruthParticleMap
auto makeDepositToTruthParticleMap(const T_TruthEventCollection *truth_particle_links)
xAOD::PixelClusterContainer
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
Definition
Event/xAOD/xAODInDetMeasurement/xAODInDetMeasurement/PixelClusterContainer.h:14
xAOD::HGTDClusterContainer
HGTDClusterContainer_v1 HGTDClusterContainer
Define the version of the HGTD cluster container.
Definition
HGTDClusterContainer.h:14
xAOD::StripClusterContainer
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
Definition
StripClusterContainer.h:14
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAODTruthParticleLink.h
Generated on
for ATLAS Offline Software by
1.17.0