ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloExtensionHelpers.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ExtendTrackToLayerTool.h
CaloSampling::getSamplingName
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
Definition
Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:18
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloSampling::getNumberOfSamplings
static constexpr unsigned int getNumberOfSamplings()
Get number of available samplings.
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:30
ExtendTrackToLayerTool::m_extensionTool
ToolHandle< Trk::IParticleCaloExtensionTool > m_extensionTool
Definition
ExtendTrackToLayerTool.h:33
ExtendTrackToLayerTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
ExtendTrackToLayerTool.cxx:12
ExtendTrackToLayerTool::m_caloLayers
std::vector< CaloSampling::CaloSample > m_caloLayers
The calo layer enums.
Definition
ExtendTrackToLayerTool.h:40
ExtendTrackToLayerTool::m_caloLayerNames
Gaudi::Property< std::vector< std::string > > m_caloLayerNames
Definition
ExtendTrackToLayerTool.h:35
ExtendTrackToLayerTool::ExtendTrackToLayerTool
ExtendTrackToLayerTool(const std::string &name)
Definition
ExtendTrackToLayerTool.cxx:8
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
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
CaloExtensionHelpers::entryEtaPhiHashLookupVector
void entryEtaPhiHashLookupVector(const Trk::CaloExtension &extension, EtaPhiHashLookupVector &result)
Definition
CaloExtensionHelpers.h:227
CaloExtensionHelpers::EtaPhiHashLookupVector
std::vector< std::tuple< bool, double, double > > EtaPhiHashLookupVector
Definition
CaloExtensionHelpers.h:24
asg
Definition
DataHandleTestTool.h:28
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
IExtendTrackToLayerTool::TrackExtension
Helper struct to hold track extrapolation information.
Definition
IExtendTrackToLayerTool.h:27
Generated on
for ATLAS Offline Software by
1.17.0