ATLAS Offline Software
Trigger
TrigAlgorithms
TrigEFMissingET
src
ExtendTrackToLayerTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ExtendTrackToLayerTool.h
"
6
#include "
TrkCaloExtension/CaloExtensionHelpers.h
"
7
8
ExtendTrackToLayerTool::ExtendTrackToLayerTool
(
const
std::string &
name
) :
asg
::AsgTool(
name
)
9
{
10
}
11
12
StatusCode
ExtendTrackToLayerTool::initialize
()
13
{
14
ATH_MSG_DEBUG
(
"Initialize "
<<
name
());
15
CHECK
(
m_extensionTool
.retrieve());
16
17
if
(
m_caloLayerNames
.value().size() == 0)
18
{
19
ATH_MSG_ERROR
(
"No layers requested, tool would not do anything!"
);
20
return
StatusCode::FAILURE;
21
}
22
23
std::map<std::string, CaloSampling::CaloSample> samplings;
24
for
(
unsigned
int
ii = 0; ii <
CaloSampling::getNumberOfSamplings
(); ++ii)
25
samplings[
CaloSampling::getSamplingName
(ii)] =
static_cast<
CaloSampling::CaloSample
>
(ii);
26
m_caloLayers
.reserve(
m_caloLayerNames
.value().size());
27
for
(
const
std::string &
name
:
m_caloLayerNames
.value())
28
{
29
auto
itr = samplings.find(
name
);
30
if
(itr == samplings.end())
31
{
32
ATH_MSG_ERROR
(
"Unknown sampling '"
<<
name
<<
"' requested!"
);
33
return
StatusCode::FAILURE;
34
}
35
}
36
return
StatusCode::SUCCESS;
37
}
38
39
IExtendTrackToLayerTool::TrackExtension
ExtendTrackToLayerTool::extendTrack
(
40
const
EventContext &ctx,
41
const
xAOD::TrackParticle
&
track
)
const
42
{
43
std::unique_ptr<Trk::CaloExtension> extension =
m_extensionTool
->caloExtension(
44
ctx,
track
);
45
if
(!extension)
46
// This means that track wasn't extrapolated into the calorimeter
47
return
TrackExtension
{};
48
// Get the eta-phi entry positions of the intersections of this track with the
49
// calorimeter
50
CaloExtensionHelpers::EtaPhiHashLookupVector
result
;
51
CaloExtensionHelpers::entryEtaPhiHashLookupVector
(*extension,
result
);
52
// Go through the layers we requested in order
53
bool
isCrossed;
54
double
eta
;
55
double
phi
;
56
for
(
CaloSampling::CaloSample
layer
:
m_caloLayers
)
57
{
58
std::tie(isCrossed,
eta
,
phi
) =
result
[
layer
];
59
// Return the first that is crossed
60
if
(isCrossed)
61
return
TrackExtension
{
eta
,
phi
};
62
}
63
// If we got here, it crossed no layer that we're interested in, return an
64
// invalid extension
65
return
TrackExtension
{};
66
}
get_generator_info.result
result
Definition:
get_generator_info.py:21
phi
Scalar phi() const
phi method
Definition:
AmgMatrixBasePlugin.h:67
CaloExtensionHelpers.h
ExtendTrackToLayerTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition:
ExtendTrackToLayerTool.cxx:12
eta
Scalar eta() const
pseudorapidity method
Definition:
AmgMatrixBasePlugin.h:83
asg
Definition:
DataHandleTestTool.h:28
ExtendTrackToLayerTool::ExtendTrackToLayerTool
ExtendTrackToLayerTool(const std::string &name)
Definition:
ExtendTrackToLayerTool.cxx:8
ExtendTrackToLayerTool.h
IExtendTrackToLayerTool::TrackExtension
Helper struct to hold track extrapolation information.
Definition:
IExtendTrackToLayerTool.h:27
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
CaloSampling::CaloSample
CaloSample
Definition:
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloExtensionHelpers::EtaPhiHashLookupVector
std::vector< std::tuple< bool, double, double > > EtaPhiHashLookupVector
Definition:
CaloExtensionHelpers.h:24
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
TRT::Hit::layer
@ layer
Definition:
HitInfo.h:79
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition:
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ExtendTrackToLayerTool::extendTrack
virtual TrackExtension extendTrack(const EventContext &ctx, const xAOD::TrackParticle &track) const override
Extend the track to a given layer.
Definition:
ExtendTrackToLayerTool.cxx:39
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
CaloSampling::getNumberOfSamplings
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Definition:
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:30
CaloExtensionHelpers::entryEtaPhiHashLookupVector
void entryEtaPhiHashLookupVector(const Trk::CaloExtension &extension, EtaPhiHashLookupVector &result)
Definition:
CaloExtensionHelpers.h:227
ExtendTrackToLayerTool::m_extensionTool
ToolHandle< Trk::IParticleCaloExtensionTool > m_extensionTool
Definition:
ExtendTrackToLayerTool.h:33
ExtendTrackToLayerTool::m_caloLayerNames
Gaudi::Property< std::vector< std::string > > m_caloLayerNames
Definition:
ExtendTrackToLayerTool.h:35
CaloSampling::getSamplingName
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
Definition:
Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:18
xAOD::track
@ track
Definition:
TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition:
TrackParticle_v1.h:43
ExtendTrackToLayerTool::m_caloLayers
std::vector< CaloSampling::CaloSample > m_caloLayers
The calo layer enums.
Definition:
ExtendTrackToLayerTool.h:40
Generated on Sun Dec 22 2024 21:10:23 for ATLAS Offline Software by
1.8.18