ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_Tracking
ISF_TrackingTools
src
TrkExtrapolator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// class header include
6
#include "
TrkExtrapolator.h
"
7
8
9
#include "
TrkExInterfaces/IExtrapolator.h
"
10
11
#include "
TrkGeometry/TrackingGeometry.h
"
12
#include "
TrkParameters/TrackParameters.h
"
13
#include "
TrkEventPrimitives/PdgToParticleHypothesis.h
"
14
15
17
ISF::TrkExtrapolator::TrkExtrapolator
(
const
std::string& t,
const
std::string& n,
const
IInterface* p)
18
: base_class(t,n,p),
19
m_extrapolator
(
"Trk::Extrapolator/AtlasExtrapolator"
),
20
m_trackingVolumeName
(
""
),
21
m_trackingVolume(0),
22
m_pdgToParticleHypothesis
(new
Trk
::PdgToParticleHypothesis())
23
{
24
declareProperty(
"TrackingVolumeName"
,
25
m_trackingVolumeName
,
26
"Name of the TrackingVolume within which the extrapolation is to be carried out"
);
27
declareProperty(
"Extrapolator"
,
28
m_extrapolator
,
29
"Extrapolator used for track extrapolation"
);
30
}
31
33
ISF::TrkExtrapolator::~TrkExtrapolator
()
34
{
35
delete
m_pdgToParticleHypothesis
;
36
}
37
38
40
StatusCode
ISF::TrkExtrapolator::initialize
()
41
{
42
ATH_MSG_VERBOSE
(
"initialize() begin"
);
43
44
StatusCode
sc
=
m_extrapolator
.retrieve();
45
if
(
sc
.isFailure()){
46
ATH_MSG_FATAL
(
"Could not retrieve "
<<
m_extrapolator
);
47
return
StatusCode::FAILURE;
48
}
49
// initialize the TrackingGeometryReadKey
50
ATH_CHECK
(
m_trackingGeometryReadKey
.initialize());
51
52
ATH_MSG_VERBOSE
(
"initialize() successful"
);
53
return
StatusCode::SUCCESS;
54
}
55
57
StatusCode
ISF::TrkExtrapolator::finalize
()
58
{
59
ATH_MSG_VERBOSE
(
"finalize() begin"
);
60
61
ATH_MSG_VERBOSE
(
"finalize() successful"
);
62
return
StatusCode::SUCCESS;
63
}
64
66
ISF::ISFParticle
*
ISF::TrkExtrapolator::extrapolate
(
const
ISF::ISFParticle
&particle )
const
{
67
68
const
EventContext& ctx = Gaudi::Hive::currentContext();
69
if
(
m_extrapolator
.empty() ) {
70
ATH_MSG_ERROR
(
"Problem with extrapolator!"
);
71
return
0;
72
}
73
74
if
( !m_trackingVolume.get() ) {
75
// ------------------------------- get the trackingGeometry at first place
76
SG::ReadCondHandle<Trk::TrackingGeometry>
readHandle{
m_trackingGeometryReadKey
};
77
if
(!readHandle.
isValid
() || *readHandle ==
nullptr
) {
78
ATH_MSG_ERROR
(
"Problem with TrackingGeometry '"
<<
m_trackingGeometryReadKey
.fullKey() <<
"' from CondStore."
);
79
return
0;
80
}
81
82
const
Trk::TrackingGeometry
* trackingGeometry = *readHandle;
83
const
Trk::TrackingVolume
* trackingVolume = trackingGeometry->
trackingVolume
(
m_trackingVolumeName
);
84
if
(!trackingVolume) {
85
ATH_MSG_FATAL
(
"Failed to retrieve TrackingVolume: "
<<
m_trackingVolumeName
);
86
return
0;
87
}
88
m_trackingVolume.set(trackingVolume);
89
}
90
91
// create objects from ISFParticle needed for extrapolation
92
Trk::CurvilinearParameters
par(particle.position(),particle.momentum(),particle.charge());
93
94
int
absPdg = abs(particle.pdgCode());
95
//bool photon = (absPdg == 22);
96
//bool geantino = (absPdg == 999);
97
//bool charged = photon || geantino ? false : (particle.charge()*particle.charge() > 0) ;
98
99
Trk::ParticleHypothesis
particleHypo =
100
m_pdgToParticleHypothesis
->convert(particle.pdgCode(),particle.charge());
101
if
( absPdg == 999 ) particleHypo =
Trk::geantino
;
102
103
// extrapolate to calorimeter entry
104
const
Trk::TrackParameters
* extrapolatedPars =
m_extrapolator
->extrapolateToVolume(ctx,
105
par,
106
*m_trackingVolume.get(),
107
Trk::alongMomentum
,
108
particleHypo).release();
109
110
// create a new ISF particle representing the given particle at the extrapolated position
111
ISFParticle
*extrapolatedParticle =
new
ISFParticle
( extrapolatedPars->
position
(),
112
extrapolatedPars->
momentum
(),
113
particle.mass(),
114
particle.charge(),
115
particle.pdgCode(),
116
particle.status(),
117
particle.timeStamp(),
118
particle,
119
particle.id()
// FIXME should this be undefined instead?
120
);
121
122
// cleanup
123
delete
extrapolatedPars;
124
125
return
extrapolatedParticle;
126
}
127
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_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
IExtrapolator.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
PdgToParticleHypothesis.h
TrackingGeometry.h
TrackParameters.h
TrkExtrapolator.h
ISF::ISFParticle
The generic ISF particle definition,.
Definition
ISFParticle.h:42
ISF::TrkExtrapolator::initialize
virtual StatusCode initialize() override
Athena AlgTool initialization.
Definition
TrkExtrapolator.cxx:40
ISF::TrkExtrapolator::m_extrapolator
ToolHandle< Trk::IExtrapolator > m_extrapolator
extrapolation to calo entry
Definition
TrkExtrapolator.h:69
ISF::TrkExtrapolator::m_pdgToParticleHypothesis
Trk::PdgToParticleHypothesis * m_pdgToParticleHypothesis
converts PDG ID to hypothesis for TrackParameters
Definition
TrkExtrapolator.h:74
ISF::TrkExtrapolator::~TrkExtrapolator
~TrkExtrapolator()
Destructor.
Definition
TrkExtrapolator.cxx:33
ISF::TrkExtrapolator::finalize
virtual StatusCode finalize() override
Athena AlgTool finalization.
Definition
TrkExtrapolator.cxx:57
ISF::TrkExtrapolator::TrkExtrapolator
TrkExtrapolator(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition
TrkExtrapolator.cxx:17
ISF::TrkExtrapolator::m_trackingVolumeName
std::string m_trackingVolumeName
name of the volume within the extrapolation is carried out
Definition
TrkExtrapolator.h:71
ISF::TrkExtrapolator::extrapolate
virtual ISF::ISFParticle * extrapolate(const ISF::ISFParticle &particle) const override
Extrapolate the given ISFParticle.
Definition
TrkExtrapolator.cxx:66
ISF::TrkExtrapolator::m_trackingGeometryReadKey
SG::ReadCondHandleKey< Trk::TrackingGeometry > m_trackingGeometryReadKey
tracking geometry for geometry signature
Definition
TrkExtrapolator.h:66
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Trk::TrackingGeometry
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
Definition
TrackingGeometry.h:68
Trk::TrackingGeometry::trackingVolume
const TrackingVolume * trackingVolume(const std::string &name) const
return the tracking Volume by name, 0 if it doesn't exist
Trk::TrackingVolume
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Definition
TrackingVolume.h:119
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::alongMomentum
@ alongMomentum
Definition
PropDirection.h:20
Trk::CurvilinearParameters
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
Definition
Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:29
Trk::ParticleHypothesis
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
Definition
ParticleHypothesis.h:28
Trk::geantino
@ geantino
Definition
ParticleHypothesis.h:29
Trk::TrackParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition
Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:27
Generated on
for ATLAS Offline Software by
1.17.0