ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
eflowRec
src
eflowTrackCaloExtensionTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
NAME: eflowTrackCaloExtensionTool.cxx
8
PACKAGE: offline/Reconstruction/eflowRec
9
10
AUTHORS: T.Guttenberger
11
CREATED: 19th September, 2014
12
13
********************************************************************/
14
15
#include "
eflowTrackCaloExtensionTool.h
"
16
17
#include "
eflowTrackCaloPoints.h
"
18
#include "
eflowDepthCalculator.h
"
19
20
#include "
TrkParameters/TrackParameters.h
"
// typedef
21
#include "
TrkCaloExtension/CaloExtension.h
"
22
#include "
TrkParametersIdentificationHelpers/TrackParametersIdHelper.h
"
23
24
#include "
CaloDetDescr/CaloDepthTool.h
"
25
26
#include "GaudiKernel/TypeNameString.h"
27
28
#include <map>
29
#include <vector>
30
#include <utility>
31
32
eflowTrackCaloExtensionTool::eflowTrackCaloExtensionTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent) :
33
AthAlgTool
(
type
, name, parent),
34
m_trackParametersIdHelper
(
std
::make_unique<
Trk
::TrackParametersIdHelper>())
35
{
36
declareInterface<eflowTrackExtrapolatorBaseAlgTool>(
this
);
37
}
38
39
eflowTrackCaloExtensionTool::~eflowTrackCaloExtensionTool
() =
default
;
40
41
StatusCode
eflowTrackCaloExtensionTool::initialize
() {
42
43
if
(
m_theTrackExtrapolatorTool
.retrieve().isFailure()) {
44
ATH_MSG_WARNING
(
"Cannot find Extrapolation tool "
45
<<
m_theTrackExtrapolatorTool
.typeAndName());
46
return
StatusCode::SUCCESS;
47
}
else
{
48
ATH_MSG_VERBOSE
(
"Successfully retrieved Extrapolation tool "
49
<<
m_theTrackExtrapolatorTool
.typeAndName());
50
}
51
52
if
(!
m_ParticleCacheKey
.key().empty())
ATH_CHECK
(
m_ParticleCacheKey
.initialize());
53
else
m_useOldCalo
=
true
;
54
55
if
(!
m_monTool
.empty())
ATH_CHECK
(
m_monTool
.retrieve());
56
57
return
StatusCode::SUCCESS;
58
}
59
60
std::unique_ptr<eflowTrackCaloPoints>
eflowTrackCaloExtensionTool::execute
(
const
EventContext& ctx,
const
xAOD::TrackParticle
* track)
const
{
61
62
ATH_MSG_VERBOSE
(
" Now running eflowTrackCaloExtensionTool"
);
63
64
auto
execution_timer =
Monitored::Timer<std::chrono::microseconds>
(
"TIME_execute"
);
65
Monitored::ScopedTimer
execution_time(execution_timer);
66
auto
extrapolation_timer =
Monitored::Timer<std::chrono::microseconds>
(
"TIME_extrapolation"
);
67
auto
track_pt =
Monitored::Scalar<float>
(
"track_pt"
);
68
auto
group =
Monitored::Group
(
m_monTool
, execution_timer, extrapolation_timer, track_pt);
69
70
track_pt = track->pt() *
m_invGeV
;
71
72
/*Create a map to index the TrackParameters at calo (owned by the extension) wrt to layers*/
73
std::map<eflowCalo::LAYER, const Trk::TrackParameters*> parametersMap;
74
std::map<CaloCell_ID::CaloSample,const Trk::TrackParameters*> tileParametersMap;
75
76
/*get the CaloExtension object*/
77
const
Trk::CaloExtension
* extension =
nullptr
;
78
std::unique_ptr<Trk::CaloExtension> uniqueExtension;
79
const
int
index
= track->index();
80
ATH_MSG_VERBOSE
(
"Getting element "
<<
index
<<
" from the particleCache"
);
81
82
extrapolation_timer.start();
83
if
(
m_useOldCalo
) {
84
/* If CaloExtensionBuilder is unavailable, use the calo extension tool */
85
ATH_MSG_VERBOSE
(
"Using the CaloExtensionTool"
);
86
uniqueExtension =
m_theTrackExtrapolatorTool
->caloExtension(ctx, *track);
87
extension = uniqueExtension.get();
88
}
else
{
89
/*get the CaloExtension object*/
90
SG::ReadHandle<CaloExtensionCollection>
particleCache {
m_ParticleCacheKey
, ctx};
91
ATH_MSG_VERBOSE
(
"Using the CaloExtensionBuilder Cache"
);
92
extension = (*particleCache)[
index
];
93
ATH_MSG_VERBOSE
(
"Getting element "
<<
index
<<
" from the particleCache"
);
94
if
( not extension ){
95
ATH_MSG_VERBOSE
(
"Cache does not contain a calo extension -> Calculating with the a CaloExtensionTool"
);
96
uniqueExtension =
m_theTrackExtrapolatorTool
->caloExtension(ctx, *track);
97
extension = uniqueExtension.get();
98
}
99
}
100
extrapolation_timer.stop();
101
102
if
(extension !=
nullptr
) {
103
104
/*extract the CurvilinearParameters*/
105
const
std::vector<Trk::CurvilinearParameters>& clParametersVector = extension->
caloLayerIntersections
();
106
107
/*The parameters are owned by the CaloExtension so are handled by it the eflowTrackCaloPoints does
108
* not take ownership */
109
for
(
const
Trk::CurvilinearParameters
& clParameter : clParametersVector) {
110
if
(parametersMap[
getLayer
(&clParameter)] ==
nullptr
) {
111
parametersMap[
getLayer
(&clParameter)] = &clParameter;
112
}
else
if
(
m_trackParametersIdHelper
->isEntryToVolume(clParameter.cIdentifier())) {
113
parametersMap[
getLayer
(&clParameter)] = &clParameter;
114
}
115
116
CaloCell_ID::CaloSample
caloSample =
m_trackParametersIdHelper
->caloSample(clParameter.cIdentifier());
117
118
if
(tileParametersMap[caloSample] ==
nullptr
){
119
tileParametersMap[caloSample] = &clParameter;
120
}
else
if
(
m_trackParametersIdHelper
->isEntryToVolume(clParameter.cIdentifier())){
121
tileParametersMap[caloSample] = &clParameter;
122
}
123
124
}
125
126
127
/*
128
parametersMap may have several entries for Tile1,2,3.
129
The impact is negligible as the eta/phi of these entries are very similar
130
https://its.cern.ch/jira/browse/ATLJETMET-242
131
*/
132
133
return
std::make_unique<eflowTrackCaloPoints>(parametersMap,tileParametersMap);
134
135
}
136
else
{
137
if
(track->pt() > 3*Gaudi::Units::GeV)
ATH_MSG_WARNING
(
"TrackExtension failed for track with pt and eta "
<< track->pt() <<
" and "
<< track->eta());
138
parametersMap[
eflowCalo::LAYER::Unknown
] =
nullptr
;
139
return
std::make_unique<eflowTrackCaloPoints>(parametersMap);
140
}
141
}
142
143
StatusCode
eflowTrackCaloExtensionTool::finalize
() {
144
return
StatusCode::SUCCESS;
145
}
146
147
/*This function translates the information embedded within the CurvilinearParameters of the CaloExtension object into an eflowCaloLayer*/
148
eflowCalo::LAYER
eflowTrackCaloExtensionTool::getLayer
(
const
Trk::CurvilinearParameters
* clParameter)
const
{
149
unsigned
int
parametersIdentifier = clParameter->
cIdentifier
();
150
151
/*Return unknown when the identifier is invalid */
152
if
(!
m_trackParametersIdHelper
->isValid(parametersIdentifier)) {
153
ATH_MSG_ERROR
(
"invalid Track Identifier"
);
154
return
eflowCalo::LAYER::Unknown
;
155
};
156
157
if
(
m_trackParametersIdHelper
->isEntryToVolume(parametersIdentifier)) {
158
ATH_MSG_VERBOSE
(
"is Volume Entry"
);
159
}
else
{
160
ATH_MSG_VERBOSE
(
"is Volume Exit"
);
161
}
162
163
return
eflowCalo::translateSampl
(
m_trackParametersIdHelper
->caloSample(parametersIdentifier));
164
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
CaloDepthTool.h
Declaration of CaloDepthTool.
TrackParametersIdHelper.h
TrackParameters.h
CaloExtension.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
CaloCell_ID::CaloSample
CaloSampling::CaloSample CaloSample
Definition
CaloCell_ID.h:53
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
Monitored::ScopedTimer
Helper class to create a scoped timer.
Definition
MonitoredTimer.h:95
Monitored::Timer
A monitored timer.
Definition
MonitoredTimer.h:32
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
Trk::CaloExtension
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
Definition
TrkEvent/TrkCaloExtension/TrkCaloExtension/CaloExtension.h:19
Trk::CaloExtension::caloLayerIntersections
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
Definition
TrkEvent/TrkCaloExtension/TrkCaloExtension/CaloExtension.h:59
Trk::CurvilinearParametersT::cIdentifier
unsigned int cIdentifier() const
the curvilinear parameters identifier
eflowCalo::translateSampl
static LAYER translateSampl(CaloCell_ID::CaloSample sampl)
Definition
eflowCaloRegions.cxx:45
eflowCalo::LAYER
LAYER
Definition
eflowCaloRegions.h:28
eflowCalo::Unknown
@ Unknown
Definition
eflowCaloRegions.h:34
eflowTrackCaloExtensionTool::m_useOldCalo
Gaudi::Property< bool > m_useOldCalo
Definition
eflowTrackCaloExtensionTool.h:64
eflowTrackCaloExtensionTool::execute
virtual std::unique_ptr< eflowTrackCaloPoints > execute(const EventContext &ctx, const xAOD::TrackParticle *track) const override
Definition
eflowTrackCaloExtensionTool.cxx:60
eflowTrackCaloExtensionTool::m_theTrackExtrapolatorTool
ToolHandle< Trk::IParticleCaloExtensionTool > m_theTrackExtrapolatorTool
Definition
eflowTrackCaloExtensionTool.h:56
eflowTrackCaloExtensionTool::~eflowTrackCaloExtensionTool
~eflowTrackCaloExtensionTool()
eflowTrackCaloExtensionTool::finalize
virtual StatusCode finalize() override
Definition
eflowTrackCaloExtensionTool.cxx:143
eflowTrackCaloExtensionTool::getLayer
eflowCalo::LAYER getLayer(const Trk::CurvilinearParameters *clParameters) const
Definition
eflowTrackCaloExtensionTool.cxx:148
eflowTrackCaloExtensionTool::m_trackParametersIdHelper
std::unique_ptr< Trk::TrackParametersIdHelper > m_trackParametersIdHelper
Definition
eflowTrackCaloExtensionTool.h:58
eflowTrackCaloExtensionTool::initialize
virtual StatusCode initialize() override
Definition
eflowTrackCaloExtensionTool.cxx:41
eflowTrackCaloExtensionTool::m_ParticleCacheKey
SG::ReadHandleKey< CaloExtensionCollection > m_ParticleCacheKey
Definition
eflowTrackCaloExtensionTool.h:61
eflowTrackCaloExtensionTool::eflowTrackCaloExtensionTool
eflowTrackCaloExtensionTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
eflowTrackCaloExtensionTool.cxx:32
eflowTrackCaloExtensionTool::m_invGeV
const float m_invGeV
Definition
eflowTrackCaloExtensionTool.h:52
eflowTrackCaloExtensionTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Online monitoring tool for recording histograms of the alg in action.
Definition
eflowTrackCaloExtensionTool.h:67
eflowDepthCalculator.h
eflowTrackCaloExtensionTool.h
eflowTrackCaloPoints.h
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::CurvilinearParameters
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
Definition
Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:29
index
Definition
index.py:1
std
STL namespace.
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
type
Generated on
for ATLAS Offline Software by
1.17.0