ATLAS Offline Software
InnerDetector
InDetRecTools
ZWindowRoISeedTool
src
TruthHSRoISeedTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2020-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// Implementation file for class TruthHSRoISeedTool
8
// (c) ATLAS Detector software
10
11
12
#include "
ZWindowRoISeedTool/TruthHSRoISeedTool.h
"
13
#include "TVector2.h"
14
#include <map>
15
16
18
// Constructor
20
21
InDet::TruthHSRoISeedTool::TruthHSRoISeedTool
22
(
const
std::string&
t
,
const
std::string&
n
,
const
IInterface*
p
)
23
: base_class(
t
,
n
,
p
)
24
{
25
}
26
28
// Initialization
30
31
StatusCode
InDet::TruthHSRoISeedTool::initialize
()
32
{
33
StatusCode
sc
=
AlgTool::initialize
();
34
35
ATH_CHECK
(
m_inputTruthEventsKey
.initialize() );
36
37
return
sc
;
38
}
39
41
// Compute RoI
43
44
std::vector<InDet::IZWindowRoISeedTool::ZWindow>
InDet::TruthHSRoISeedTool::getRoIs
(
const
EventContext& ctx)
const
45
{
46
47
// prepare output
48
std::vector<InDet::IZWindowRoISeedTool::ZWindow> listRoIs;
49
listRoIs.clear();
50
51
//retrieve truth collection
52
SG::ReadHandle<xAOD::TruthEventContainer>
truthEvents(
m_inputTruthEventsKey
, ctx);
53
if
(not truthEvents.
isValid
()) {
54
ATH_MSG_ERROR
(
"Cannot retrieve xAOD truth event information. Bailing out with empty RoI list."
);
55
return
listRoIs;
56
}
57
ATH_MSG_DEBUG
(
"xAOD Truth Event available!"
);
58
59
//get HS position
60
for
(
const
xAOD::TruthEvent
*
evt
: *truthEvents) {
61
const
xAOD::TruthVertex
*hsPos =
evt
->signalProcessVertex();
62
if
(hsPos ==
nullptr
) {
63
ATH_MSG_DEBUG
(
"Invalid signal process vertex! Trying next TruthEvent."
);
64
continue
;
65
}
66
InDet::IZWindowRoISeedTool::ZWindow
RoI;
67
RoI.
zReference
= hsPos->
z
();
68
RoI.
zWindow
[0] = RoI.
zReference
-
m_z0Window
;
69
RoI.
zWindow
[1] = RoI.
zReference
+
m_z0Window
;
70
listRoIs.push_back(RoI);
71
ATH_MSG_DEBUG
(
"Found RoI: "
<< RoI.
zReference
<<
" ["
<< RoI.
zWindow
[0] <<
", "
<< RoI.
zWindow
[1] <<
"]"
);
72
//use only the first one
73
break
;
74
}
75
76
return
listRoIs;
77
78
}
79
InDet::TruthHSRoISeedTool::m_inputTruthEventsKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_inputTruthEventsKey
Definition:
TruthHSRoISeedTool.h:56
SG::ReadHandle
Definition:
StoreGate/StoreGate/ReadHandle.h:70
initialize
void initialize()
Definition:
run_EoverP.cxx:894
LArG4FSStartPointFilter.evt
evt
Definition:
LArG4FSStartPointFilter.py:42
read_hist_ntuple.t
t
Definition:
read_hist_ntuple.py:5
InDet::TruthHSRoISeedTool::TruthHSRoISeedTool
TruthHSRoISeedTool()=delete
InDet::TruthHSRoISeedTool::m_z0Window
FloatProperty m_z0Window
Definition:
TruthHSRoISeedTool.h:57
AthenaPoolTestRead.sc
sc
Definition:
AthenaPoolTestRead.py:27
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
InDet::TruthHSRoISeedTool::initialize
virtual StatusCode initialize() override
Definition:
TruthHSRoISeedTool.cxx:31
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
InDet::IZWindowRoISeedTool::ZWindow
Definition:
IZWindowRoISeedTool.h:46
beamspotman.n
n
Definition:
beamspotman.py:731
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
TruthHSRoISeedTool.h
xAOD::TruthEvent_v1
Class describing a signal truth event in the MC record.
Definition:
TruthEvent_v1.h:35
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
InDet::TruthHSRoISeedTool::getRoIs
virtual std::vector< ZWindow > getRoIs(const EventContext &ctx) const override
Compute RoI.
Definition:
TruthHSRoISeedTool.cxx:44
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition:
TruthVertex_v1.h:37
InDet::IZWindowRoISeedTool::ZWindow::zWindow
float zWindow[2]
Definition:
IZWindowRoISeedTool.h:49
xAOD::TruthVertex_v1::z
float z() const
Vertex longitudinal distance along the beam line form the origin.
InDet::IZWindowRoISeedTool::ZWindow::zReference
float zReference
Definition:
IZWindowRoISeedTool.h:51
Generated on Thu Nov 7 2024 21:31:06 for ATLAS Offline Software by
1.8.18