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
Tracking
TrkAlgorithms
TrkTruthAlgs
src
TrackTruthSelector.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrkTruthAlgs/TrackTruthSelector.h
"
6
7
TrackTruthSelector::TrackTruthSelector
(
const
std::string &
name
,ISvcLocator *pSvcLocator) :
AthAlgorithm
(
name
,pSvcLocator) {}
8
9
// -----------------------------------------------------------------------------------------------------
10
StatusCode
TrackTruthSelector::initialize
()
11
{
12
m_subDetWeights
[
SubDetHitStatistics::Pixel
] =
m_weightPixel
;
13
m_subDetWeights
[
SubDetHitStatistics::SCT
] =
m_weightSCT
;
14
m_subDetWeights
[
SubDetHitStatistics::TRT
] =
m_weightTRT
;
15
m_subDetWeights
[
SubDetHitStatistics::MDT
] =
m_weightMDT
;
16
m_subDetWeights
[
SubDetHitStatistics::RPC
] =
m_weightRPC
;
17
m_subDetWeights
[
SubDetHitStatistics::TGC
] =
m_weightTGC
;
18
m_subDetWeights
[
SubDetHitStatistics::CSC
] =
m_weightCSC
;
19
m_subDetWeights
[
SubDetHitStatistics::STGC
] =
m_weightsTGC
;
20
m_subDetWeights
[
SubDetHitStatistics::MM
] =
m_weightMM
;
21
22
ATH_CHECK
(
m_detailedTrackTruthName
.
initialize
() );
23
ATH_CHECK
(
m_outputName
.
initialize
() );
24
return
StatusCode::SUCCESS;
25
}
26
27
// -----------------------------------------------------------------------------------------------------
28
StatusCode
TrackTruthSelector::execute
() {
29
ATH_MSG_DEBUG
(
"TrackTruthSelector::execute()"
);
30
31
//----------------------------------------------------------------
32
// Retrieve the input
33
const
DetailedTrackTruthCollection
*detailed =
nullptr
;
34
SG::ReadHandle<DetailedTrackTruthCollection>
rh_detailed(
m_detailedTrackTruthName
);
35
SG::WriteHandle<TrackTruthCollection>
wh_output(
m_outputName
);
36
if
(!rh_detailed.
isValid
()){
37
ATH_MSG_WARNING
(
"DetailedTrackTruthCollection "
<<
m_detailedTrackTruthName
.
key
()<<
" NOT found"
);
38
return
StatusCode::SUCCESS;
39
}
else
{
40
detailed = rh_detailed.
cptr
();
41
ATH_MSG_DEBUG
(
"Got DetailedTrackTruthCollection "
<<
m_detailedTrackTruthName
.
key
());
42
}
43
44
45
//----------------------------------------------------------------
46
// Produce and store the output.
47
48
TrackTruthCollection
*
out
=
new
TrackTruthCollection
(detailed->
trackCollectionLink
());
49
50
fillOutput
(
out
,detailed);
51
52
ATH_CHECK
(wh_output.
record
(std::unique_ptr<TrackTruthCollection>(
out
)));
53
54
return
StatusCode::SUCCESS;
55
56
}
57
//================================================================
58
59
void
TrackTruthSelector::fillOutput
(
TrackTruthCollection
*
out
,
60
const
DetailedTrackTruthCollection
*in)
61
{
62
using
Iter = DetailedTrackTruthCollection::const_iterator;
63
Iter itrackData=in->begin();
64
while
(itrackData!=in->end()) {
65
std::pair<Iter,Iter>
range
= in->equal_range(itrackData->first);
66
67
// We KNOW that the range is not empty - no need to check that.
68
Iter selected =
range
.first;
69
double
bestProb =
getProbability
(selected->second);
70
ATH_MSG_VERBOSE
(
"track="
<< selected->first.index() <<
" prob="
<< bestProb <<
" link: "
<< *(selected->second.trajectory().rbegin()));
71
for
(Iter imatch = ++
range
.first; imatch !=
range
.second; ++imatch) {
72
double
prob
=
getProbability
(imatch->second);
73
ATH_MSG_VERBOSE
(
"track="
<< imatch->first.index() <<
" prob="
<<
prob
<<
" link: "
<< *(imatch->second.trajectory().rbegin()));
74
if
(
prob
>bestProb) {
75
bestProb =
prob
;
76
selected = imatch;
77
}
78
}
79
80
// trajectory[0] is the LAST particle on the trajectory. The first
81
// is at trajectory.rbegin(), but different trajectories can have
82
// the same first particle.
83
// const HepMcParticleLink& particleLink = selected->second.trajectory()[0];
84
const
HepMcParticleLink
& particleLink = *(selected->second.trajectory().rbegin());
85
86
ATH_MSG_DEBUG
(
"Truth selected for track="
<< selected->first.index() <<
" prob="
<< bestProb <<
" link: "
<< particleLink);
87
out
->insert(std::make_pair(selected->first,
TrackTruth
(particleLink, bestProb, 0) ));
88
itrackData=
range
.second;
89
}
90
91
}
92
93
//================================================================
94
double
TrackTruthSelector::getProbability
(
const
DetailedTrackTruth
&
dt
)
const
95
{
96
double
prd_track=0, prd_common=0;
97
for
(
unsigned
i
=0;
i
<
SubDetHitStatistics::NUM_SUBDETECTORS
;
i
++) {
98
prd_common +=
m_subDetWeights
[
i
] *
dt
.statsCommon()[
SubDetHitStatistics::SubDetType
(
i
)];
99
prd_track +=
m_subDetWeights
[
i
] *
dt
.statsTrack()[
SubDetHitStatistics::SubDetType
(
i
)];
100
}
101
return
(prd_track>0)? prd_common/prd_track : -1.;
102
}
103
104
//================================================================
TrackTruthSelector::m_weightTGC
DoubleProperty m_weightTGC
Definition:
TrackTruthSelector.h:41
SubDetHitStatistics::SubDetType
SubDetType
Definition:
SubDetHitStatistics.h:74
TrackTruthSelector::execute
virtual StatusCode execute() override
Definition:
TrackTruthSelector.cxx:28
TrackTruthSelector::m_weightCSC
DoubleProperty m_weightCSC
Definition:
TrackTruthSelector.h:42
SubDetHitStatistics::SCT
@ SCT
Definition:
SubDetHitStatistics.h:74
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
TrackTruthSelector::m_detailedTrackTruthName
SG::ReadHandleKey< DetailedTrackTruthCollection > m_detailedTrackTruthName
Definition:
TrackTruthSelector.h:27
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:67
SubDetHitStatistics::NUM_SUBDETECTORS
@ NUM_SUBDETECTORS
Definition:
SubDetHitStatistics.h:74
TrackTruthSelector::TrackTruthSelector
TrackTruthSelector(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
TrackTruthSelector.cxx:7
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
TrackTruthSelector::m_subDetWeights
std::vector< double > m_subDetWeights
Definition:
TrackTruthSelector.h:34
SubDetHitStatistics::MM
@ MM
Definition:
SubDetHitStatistics.h:74
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition:
AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition:
AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
covarianceTool.prob
prob
Definition:
covarianceTool.py:678
SubDetHitStatistics::CSC
@ CSC
Definition:
SubDetHitStatistics.h:74
TrackTruthSelector::m_weightPixel
DoubleProperty m_weightPixel
Definition:
TrackTruthSelector.h:36
TrackTruthSelector::m_weightTRT
DoubleProperty m_weightTRT
Definition:
TrackTruthSelector.h:38
TrackTruthSelector::m_weightsTGC
DoubleProperty m_weightsTGC
Definition:
TrackTruthSelector.h:43
TrackTruthSelector::m_outputName
SG::WriteHandleKey< TrackTruthCollection > m_outputName
Definition:
TrackTruthSelector.h:31
HepMcParticleLink
a link optimized in size for a GenParticle in a McEventCollection
Definition:
HepMcParticleLink.h:72
TrackTruthCollection
Definition:
TrackTruthCollection.h:21
lumiFormat.i
int i
Definition:
lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
CaloNoise_fillDB.dt
dt
Definition:
CaloNoise_fillDB.py:58
SubDetHitStatistics::MDT
@ MDT
Definition:
SubDetHitStatistics.h:74
plotBeamSpotVxVal.range
range
Definition:
plotBeamSpotVxVal.py:195
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
TrackTruthSelector::fillOutput
void fillOutput(TrackTruthCollection *out, const DetailedTrackTruthCollection *in)
Definition:
TrackTruthSelector.cxx:59
TrackTruthSelector::getProbability
double getProbability(const DetailedTrackTruth &dt) const
Definition:
TrackTruthSelector.cxx:94
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition:
AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthAlgorithm
Definition:
AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SubDetHitStatistics::TGC
@ TGC
Definition:
SubDetHitStatistics.h:74
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:240
DetailedTrackTruth
Definition:
DetailedTrackTruth.h:16
TrackTruthSelector::initialize
virtual StatusCode initialize() override
Definition:
TrackTruthSelector.cxx:10
SubDetHitStatistics::RPC
@ RPC
Definition:
SubDetHitStatistics.h:74
SG::WriteHandle
Definition:
StoreGate/StoreGate/WriteHandle.h:73
TrackTruthSelector::m_weightMM
DoubleProperty m_weightMM
Definition:
TrackTruthSelector.h:44
TrackTruth
MC particle associated with a reco track + the quality of match.
Definition:
TrackTruth.h:14
SubDetHitStatistics::TRT
@ TRT
Definition:
SubDetHitStatistics.h:74
TrackTruthSelector::m_weightSCT
DoubleProperty m_weightSCT
Definition:
TrackTruthSelector.h:37
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
DetailedTrackTruthCollection::trackCollectionLink
DataLink< TrackCollection > trackCollectionLink() const
Definition:
DetailedTrackTruthCollection.h:25
DetailedTrackTruthCollection
Definition:
DetailedTrackTruthCollection.h:20
SubDetHitStatistics::Pixel
@ Pixel
Definition:
SubDetHitStatistics.h:74
SubDetHitStatistics::STGC
@ STGC
Definition:
SubDetHitStatistics.h:74
TrackTruthSelector::m_weightRPC
DoubleProperty m_weightRPC
Definition:
TrackTruthSelector.h:40
TrackTruthSelector::m_weightMDT
DoubleProperty m_weightMDT
Definition:
TrackTruthSelector.h:39
TrackTruthSelector.h
Generated on Tue Apr 22 2025 21:21:15 for ATLAS Offline Software by
1.8.18