ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
EFTrackingEmulation
src
EFTrackingSmearMonAlg.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 "
EFTrackingSmearMonAlg.h
"
6
#include "
AthContainers/ConstAccessor.h
"
7
8
9
EFTrackingSmearMonAlg::EFTrackingSmearMonAlg
(
const
std::string& name, ISvcLocator* pSvcLocator )
10
:
AthHistogramAlgorithm
( name, pSvcLocator ){}
11
12
13
14
StatusCode
EFTrackingSmearMonAlg::initialize
() {
15
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
16
ATH_CHECK
(
m_inputTrackParticleKey
.initialize() );
17
ATH_CHECK
(
m_inputTruthParticleKey
.initialize() );
18
ATH_CHECK
(
m_smearedTrackParticleKey
.initialize() );
19
ATH_CHECK
(
m_smearedTruthParticleKey
.initialize() );
20
21
22
return
StatusCode::SUCCESS;
23
}
24
25
StatusCode
EFTrackingSmearMonAlg::execute
(
const
EventContext& ctx) {
26
27
SG::ReadHandle<xAOD::TrackParticleContainer>
inputTracks_handle(
m_inputTrackParticleKey
, ctx );
28
const
xAOD::TrackParticleContainer
* inputTracks = inputTracks_handle.
cptr
();
29
if
(not inputTracks) {
30
ATH_MSG_FATAL
(
"Unable to retrieve input ID tacks"
);
31
return
StatusCode::FAILURE;
32
}
33
34
35
ATH_MSG_DEBUG
(
"Found "
<<inputTracks->
size
()<<
" input tracks"
);
36
// trakc particles
37
for
(
const
auto
* trk : *inputTracks )
38
{
39
// get Cov matrix of input track
40
xAOD::ParametersCovMatrix_t trkcov = trk->definingParametersCovMatrix();
41
auto
trkcovvec = trk->definingParametersCovMatrixVec();
42
if
(trk->pt() == 0.)
continue
;
43
ATH_MSG_DEBUG
(
"Track: "
44
<<
" curv="
<< 1./trk->pt()
45
<<
" phi="
<< trk->phi()
46
<<
" eta="
<< trk->eta()
47
<<
" d0="
<< trk->d0()
48
<<
" z0="
<< trk->z0()
49
<<
" pT="
<< trk->pt()
50
<<
" cov_d0="
<< trkcov(
Trk::d0
,
Trk::d0
)
51
<<
" cov_z0="
<< trkcov(
Trk::z0
,
Trk::z0
)
52
<<
" sigma_d0="
<< std::sqrt(std::abs(trkcov(
Trk::d0
,
Trk::d0
)))
53
<<
" sigma_z0="
<< std::sqrt(std::abs(trkcov(
Trk::z0
,
Trk::z0
))) );
54
}
55
57
SG::ReadHandle<xAOD::TrackParticleContainer>
smearedTracks_handle(
m_smearedTrackParticleKey
, ctx );
58
const
xAOD::TrackParticleContainer
* smearedTracks = smearedTracks_handle.
cptr
();
59
if
(not smearedTracks) {
60
ATH_MSG_FATAL
(
"Unable to retrieve smeared ID tacks"
);
61
return
StatusCode::FAILURE;
62
}
63
64
65
ATH_MSG_DEBUG
(
"Found "
<<smearedTracks->
size
()<<
" smeared tracks"
);
66
// trakc particles
67
for
(
const
auto
* trk : *smearedTracks )
68
{
69
// get Cov matrix of input track
70
xAOD::ParametersCovMatrix_t trkcov = trk->definingParametersCovMatrix();
71
auto
trkcovvec = trk->definingParametersCovMatrixVec();
72
if
(trk->pt() == 0.)
continue
;
73
ATH_MSG_DEBUG
(
"Smeared Track: "
74
<<
" curv="
<< 1./trk->pt()
75
<<
" phi="
<< trk->phi()
76
<<
" eta="
<< trk->eta()
77
<<
" d0="
<< trk->d0()
78
<<
" z0="
<< trk->z0()
79
<<
" pT="
<< trk->pt()
80
<<
" cov_d0="
<< trkcov(
Trk::d0
,
Trk::d0
)
81
<<
" cov_z0="
<< trkcov(
Trk::z0
,
Trk::z0
)
82
<<
" sigma_d0="
<< std::sqrt(std::abs(trkcov(
Trk::d0
,
Trk::d0
)))
83
<<
" sigma_z0="
<< std::sqrt(std::abs(trkcov(
Trk::z0
,
Trk::z0
))) );
84
}
85
87
//truth
88
SG::ReadHandle<xAOD::TruthParticleContainer>
inputTruth_handle(
m_inputTruthParticleKey
, ctx );
89
const
xAOD::TruthParticleContainer
* inputTruth = inputTruth_handle.
cptr
();
90
if
(not inputTruth) {
91
ATH_MSG_FATAL
(
"Unable to retrieve input truth particle"
);
92
return
StatusCode::FAILURE;
93
}
94
95
static
const
SG::ConstAccessor<float>
ptAcc(
"pt"
);
96
static
const
SG::ConstAccessor<float>
d0Acc(
"d0"
);
97
static
const
SG::ConstAccessor<float>
z0Acc(
"z0"
);
98
99
ATH_MSG_DEBUG
(
"Found "
<<inputTruth->
size
()<<
" input truth particles"
);
100
for
(
const
auto
* part : *inputTruth )
101
{
102
if
(part->pt() == 0.)
continue
;
103
ATH_MSG_DEBUG
(
"===> Truth : "
104
<<
" curv="
<< 1./part->pt()
105
<<
" phi="
<< part->phi()
106
<<
" eta="
<< part->eta()
107
<<
" d0="
<< d0Acc(*part)
108
<<
" z0="
<< z0Acc(*part)
109
<<
" pT="
<< part->pt()
110
<<
" PDGID="
<< part->pdgId()
111
<<
" status="
<< part->status()
112
);
113
if
(part->parent(0))
ATH_MSG_DEBUG
(
" parent pdgId="
<< part->parent(0)->pdgId());
114
}
115
117
118
SG::ReadHandle<xAOD::TruthParticleContainer>
smearedTruth_handle(
m_smearedTruthParticleKey
, ctx );
119
const
xAOD::TruthParticleContainer
* smearedTruth = smearedTruth_handle.
cptr
();
120
if
(not smearedTruth) {
121
ATH_MSG_FATAL
(
"Unable to retrieve input truth particle"
);
122
return
StatusCode::FAILURE;
123
}
124
125
ATH_MSG_DEBUG
(
"Found "
<<smearedTruth->
size
()<<
" smeared truth particles"
);
126
for
(
const
auto
* part : *smearedTruth )
127
{
128
if
(part->pt() == 0.)
continue
;
129
ATH_MSG_DEBUG
(
"===> Truth : "
130
<<
" curv="
<< 1./ptAcc(*part)
131
<<
" phi="
<< part->phi()
132
<<
" eta="
<< part->eta()
133
<<
" d0="
<< d0Acc(*part)
134
<<
" z0="
<< z0Acc(*part)
135
<<
" pT="
<< ptAcc(*part)
136
<<
" PDGID="
<< part->pdgId()
137
<<
" status="
<< part->status()
138
);
139
if
(part->parent(0))
ATH_MSG_DEBUG
(
" parent pdgId="
<< part->parent(0)->pdgId());
140
}
141
142
return
StatusCode::SUCCESS;
143
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
EFTrackingSmearMonAlg.h
AthHistogramAlgorithm::AthHistogramAlgorithm
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition
AthHistogramAlgorithm.cxx:31
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
EFTrackingSmearMonAlg::EFTrackingSmearMonAlg
EFTrackingSmearMonAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
EFTrackingSmearMonAlg.cxx:9
EFTrackingSmearMonAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
EFTrackingSmearMonAlg.cxx:25
EFTrackingSmearMonAlg::initialize
virtual StatusCode initialize() override
Definition
EFTrackingSmearMonAlg.cxx:14
EFTrackingSmearMonAlg::m_smearedTruthParticleKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_smearedTruthParticleKey
Definition
EFTrackingSmearMonAlg.h:38
EFTrackingSmearMonAlg::m_smearedTrackParticleKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_smearedTrackParticleKey
Definition
EFTrackingSmearMonAlg.h:34
EFTrackingSmearMonAlg::m_inputTruthParticleKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_inputTruthParticleKey
Definition
EFTrackingSmearMonAlg.h:31
EFTrackingSmearMonAlg::m_inputTrackParticleKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inputTrackParticleKey
Definition
EFTrackingSmearMonAlg.h:27
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
Trk::d0
@ d0
Definition
ParamDefs.h:63
Trk::z0
@ z0
Definition
ParamDefs.h:64
xAOD::TrackParticleContainer
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticleContainer.h:14
xAOD::TruthParticleContainer
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Definition
Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0