Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
v
w
x
z
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
GitLab
LXR
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
InnerDetector
InDetValidation
InDetPhysValMonitoring
src
CachedGetAssocTruth.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
11
#include "
CachedGetAssocTruth.h
"
12
#include "
xAODTruth/TruthParticleContainer.h
"
13
#include "
AthContainers/ConstAccessor.h
"
14
15
namespace
IDPVM
{
16
void
17
CachedGetAssocTruth::clear
() {
18
m_cache
.clear();
19
}
20
21
const
xAOD::TruthParticle
*
22
CachedGetAssocTruth::getTruth
(
const
xAOD::TrackParticle
* trackParticle) {
23
if
(not trackParticle) {
24
return
nullptr
;
25
}
26
auto
pCache =
m_cache
.find(trackParticle);
27
if
(pCache !=
m_cache
.end()) {
28
return
pCache->second;
29
}
30
using
ElementTruthLink_t =
ElementLink<xAOD::TruthParticleContainer>
;
31
const
xAOD::TruthParticle
*
result
(
nullptr
);
32
static
const
SG::ConstAccessor<ElementTruthLink_t>
truthParticleLinkAcc(
"truthParticleLink"
);
33
// 0. is there any truth?
34
if
(truthParticleLinkAcc.
isAvailable
(*trackParticle)) {
35
// 1. ..then get link
36
const
ElementTruthLink_t ptruthContainer = truthParticleLinkAcc(*trackParticle);
37
if
(ptruthContainer.isValid()) {
38
result
= *ptruthContainer;
39
}
40
}
41
m_cache
[trackParticle] =
result
;
42
return
result
;
43
}
44
45
const
xAOD::TruthParticle
*
46
CachedGetAssocTruth::operator ()
(
const
xAOD::TrackParticle
* trackParticle) {
47
return
getTruth
(trackParticle);
48
}
49
50
}
IDPVM
Class to retrieve associated truth from a track, implementing a cached response.
Definition:
InDetPhysValMonitoringTool.h:56
get_generator_info.result
result
Definition:
get_generator_info.py:21
IDPVM::CachedGetAssocTruth::clear
void clear()
clear the cache
Definition:
CachedGetAssocTruth.cxx:17
TruthParticleContainer.h
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition:
ConstAccessor.h:55
CachedGetAssocTruth.h
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition:
TruthParticle_v1.h:37
IDPVM::CachedGetAssocTruth::getTruth
const xAOD::TruthParticle * getTruth(const xAOD::TrackParticle *const trackParticle)
Definition:
CachedGetAssocTruth.cxx:22
ElementLink
ElementLink implementation for ROOT usage.
Definition:
AthLinks/ElementLink.h:123
IDPVM::CachedGetAssocTruth::operator()
const xAOD::TruthParticle * operator()(const xAOD::TrackParticle *trackParticle)
Get the associated truth particle, given a track particle.
Definition:
CachedGetAssocTruth.cxx:46
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition:
TrackParticle_v1.h:43
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
IDPVM::CachedGetAssocTruth::m_cache
std::unordered_map< const xAOD::TrackParticle *, const xAOD::TruthParticle * > m_cache
private cache container; map or unordered_map could be used
Definition:
CachedGetAssocTruth.h:37
Generated on Wed Mar 26 2025 21:07:51 for ATLAS Offline Software by
1.8.18