ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
TruthHSRoISeedTool.h
InDet::IZWindowRoISeedTool::ZWindow
Definition
IZWindowRoISeedTool.h:46
InDet::IZWindowRoISeedTool::ZWindow::zReference
float zReference
Definition
IZWindowRoISeedTool.h:51
InDet::IZWindowRoISeedTool::ZWindow::zWindow
float zWindow[2]
Definition
IZWindowRoISeedTool.h:49
InDet::TruthHSRoISeedTool::m_inputTruthEventsKey
SG::ReadHandleKey< xAOD::TruthEventContainer > m_inputTruthEventsKey
Definition
TruthHSRoISeedTool.h:56
InDet::TruthHSRoISeedTool::m_z0Window
FloatProperty m_z0Window
Definition
TruthHSRoISeedTool.h:57
InDet::TruthHSRoISeedTool::initialize
virtual StatusCode initialize() override
Definition
TruthHSRoISeedTool.cxx:31
InDet::TruthHSRoISeedTool::getRoIs
virtual std::vector< ZWindow > getRoIs(const EventContext &ctx) const override
Compute RoI.
Definition
TruthHSRoISeedTool.cxx:44
InDet::TruthHSRoISeedTool::TruthHSRoISeedTool
TruthHSRoISeedTool()=delete
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::TruthVertex_v1::z
float z() const
Vertex longitudinal distance along the beam line form the origin.
xAOD::TruthVertex
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition
TruthVertex.h:15
xAOD::TruthEvent
TruthEvent_v1 TruthEvent
Typedef to implementation.
Definition
TruthEvent.h:17
Generated on
for ATLAS Offline Software by
1.17.0