ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkExtrapolation
TrkExAlgs
src
CombinedExtrapolatorTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// CombinedExtrapolatorTest.cxx, (c) ATLAS Detector software
8
9
// Tracking
10
#include "
TrkExAlgs/CombinedExtrapolatorTest.h
"
11
#include "
TrkSurfaces/CylinderSurface.h
"
12
#include "
TrkSurfaces/DiscSurface.h
"
13
#include "
TrkSurfaces/PerigeeSurface.h
"
14
#include "
TrkGeometry/TrackingGeometry.h
"
15
#include "
TrkEventPrimitives/ParticleHypothesis.h
"
16
17
//================ Constructor =================================================
18
Trk::CombinedExtrapolatorTest::CombinedExtrapolatorTest
(
const
std::string& name, ISvcLocator* pSvcLocator)
19
:
20
AthAlgorithm
(name, pSvcLocator) {}
21
22
//================ Destructor =================================================
23
24
Trk::CombinedExtrapolatorTest::~CombinedExtrapolatorTest
() {
25
delete
m_gaussDist
;
26
delete
m_flatDist
;
27
}
28
29
//================ Initialisation =================================================
30
31
StatusCode
Trk::CombinedExtrapolatorTest::initialize
() {
32
// Code entered here will be executed once at program start.
33
msg
(MSG::INFO) <<
" initialize()"
<<
endmsg
;
34
35
// Get Extrapolator from ToolService
36
if
(
m_extrapolator
.retrieve().isFailure()) {
37
msg
(MSG::FATAL) <<
"Could not retrieve Tool "
<<
m_extrapolator
<<
". Exiting."
<<
endmsg
;
38
return
StatusCode::FAILURE;
39
}
40
41
m_gaussDist
=
new
Rndm::Numbers(randSvc(), Rndm::Gauss(0., 1.));
42
m_flatDist
=
new
Rndm::Numbers(randSvc(), Rndm::Flat(0., 1.));
43
44
msg
(MSG::INFO) <<
"initialize() successful in "
<<
endmsg
;
45
return
StatusCode::SUCCESS;
46
}
47
48
//================ Finalisation =================================================
49
50
StatusCode
Trk::CombinedExtrapolatorTest::finalize
() {
51
// Code entered here will be executed once at the end of the program run.
52
return
StatusCode::SUCCESS;
53
}
54
55
//================ Execution ====================================================
56
57
StatusCode
Trk::CombinedExtrapolatorTest::execute
(
const
EventContext& ctx) {
58
msg
(MSG::INFO) <<
" execute()"
<<
endmsg
;
59
// retrieve outer boundary
60
if
(!
m_outerBoundary
) {
61
m_trackingGeometry
=
m_extrapolator
->trackingGeometry();
62
m_outerBoundary
=
m_trackingGeometry
->highestTrackingVolume();
63
if
(!
m_outerBoundary
) {
64
msg
(MSG::FATAL) <<
"Could not retrieve geometry boundary from "
<<
m_extrapolator
<<
". Exiting."
<<
endmsg
;
65
return
StatusCode::FAILURE;
66
}
67
msg
(MSG::INFO) <<
" boundary retrieved "
<<
endmsg
;
68
}
69
70
// generate with random number generator
71
double
d0
=
m_gaussDist
->shoot() *
m_sigmaD0
;
72
double
z0
=
m_minZ0
+
m_flatDist
->shoot() * (
m_maxZ0
-
m_minZ0
);
73
double
phi
= 2. *
M_PI
*
m_flatDist
->shoot() -
M_PI
;
74
double
ctheta = -1. + 2 *
m_flatDist
->shoot();
75
double
theta
= acos(ctheta);
76
double
p =
m_minP
+
m_flatDist
->shoot() * (
m_maxP
-
m_minP
);
77
double
charge
= (
m_flatDist
->shoot() > 0.5) ? -1. : 1.;
78
double
qOverP
=
charge
/ (p);
79
80
// the initial perigee with random numbers
81
const
Trk::PerigeeSurface
perSurface;
82
Trk::Perigee
initialPerigee(
d0
,
z0
,
phi
,
theta
,
qOverP
, perSurface);
83
// input covariance matrix
84
const
Trk::TrackParameters
* seed = initialPerigee.
clone
();
85
86
const
Trk::PerigeeSurface
& pSf = initialPerigee.
associatedSurface
();
87
88
const
Trk::TrackParameters
* destParameters =
m_extrapolator
->extrapolateToVolume(
89
ctx,
90
*seed,
91
*
m_outerBoundary
,
92
Trk::alongMomentum
,
93
static_cast<
Trk::ParticleHypothesis
>
(
m_particleType
.value())).release();
94
95
if
(!destParameters || !
Trk::TrackingGeometry::atVolumeBoundary
(destParameters->
position
(),
m_outerBoundary
, 0.001)) {
96
msg
(MSG::ERROR) <<
" extrapolation to outer boundary failed for input parameters: "
<<
97
initialPerigee.parameters() <<
endmsg
;
98
}
else
{
99
// forward extrapolation ok
100
msg
(MSG::INFO) <<
" outer boundary reached at: "
<< destParameters->
position
().perp() <<
","
<<
101
destParameters->
position
().z() <<
endmsg
;
102
msg
(MSG::INFO) <<
"cov matrix:"
<< destParameters->covariance() <<
endmsg
;
103
104
const
Trk::TrackParameters
* peri =
m_extrapolator
->extrapolate(
105
ctx,
106
*destParameters,
107
pSf,
108
Trk::oppositeMomentum
,
109
false
,
110
static_cast<
Trk::ParticleHypothesis
>
(
m_particleType
.value())).release();
111
if
(peri) {
112
msg
(MSG::INFO) <<
" extrapolation to perigee:input: "
<< initialPerigee.parameters() <<
endmsg
;
113
msg
(MSG::INFO) <<
" extrapolation to perigee:output: "
<< peri->parameters() <<
endmsg
;
114
msg
(MSG::INFO) <<
"cov matrix:"
<< peri->covariance() <<
endmsg
;
115
}
else
{
116
msg
(MSG::ERROR) <<
" extrapolation to perigee failed for input parameters: "
<< destParameters->parameters() <<
117
endmsg
;
118
}
119
delete
peri;
120
}
121
122
delete
destParameters;
123
124
return
StatusCode::SUCCESS;
125
}
126
127
//============================================================================================
M_PI
#define M_PI
Definition
ActiveFraction.h:14
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
charge
double charge(const T &p)
Definition
AtlasPID.h:1003
CombinedExtrapolatorTest.h
CylinderSurface.h
DiscSurface.h
ParticleHypothesis.h
PerigeeSurface.h
TrackingGeometry.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
Trk::CombinedExtrapolatorTest::initialize
StatusCode initialize()
standard Athena-Algorithm method
Definition
CombinedExtrapolatorTest.cxx:31
Trk::CombinedExtrapolatorTest::m_maxZ0
DoubleProperty m_maxZ0
Definition
CombinedExtrapolatorTest.h:64
Trk::CombinedExtrapolatorTest::m_minP
DoubleProperty m_minP
Definition
CombinedExtrapolatorTest.h:65
Trk::CombinedExtrapolatorTest::m_particleType
IntegerProperty m_particleType
Definition
CombinedExtrapolatorTest.h:71
Trk::CombinedExtrapolatorTest::~CombinedExtrapolatorTest
~CombinedExtrapolatorTest()
Default Destructor.
Definition
CombinedExtrapolatorTest.cxx:24
Trk::CombinedExtrapolatorTest::m_outerBoundary
const Trk::TrackingVolume * m_outerBoundary
Definition
CombinedExtrapolatorTest.h:68
Trk::CombinedExtrapolatorTest::m_flatDist
Rndm::Numbers * m_flatDist
Definition
CombinedExtrapolatorTest.h:60
Trk::CombinedExtrapolatorTest::m_maxP
DoubleProperty m_maxP
Definition
CombinedExtrapolatorTest.h:66
Trk::CombinedExtrapolatorTest::finalize
StatusCode finalize()
standard Athena-Algorithm method
Definition
CombinedExtrapolatorTest.cxx:50
Trk::CombinedExtrapolatorTest::execute
StatusCode execute(const EventContext &ctx)
standard Athena-Algorithm method
Definition
CombinedExtrapolatorTest.cxx:57
Trk::CombinedExtrapolatorTest::m_trackingGeometry
const Trk::TrackingGeometry * m_trackingGeometry
Definition
CombinedExtrapolatorTest.h:69
Trk::CombinedExtrapolatorTest::m_gaussDist
Rndm::Numbers * m_gaussDist
Random Number setup.
Definition
CombinedExtrapolatorTest.h:59
Trk::CombinedExtrapolatorTest::m_extrapolator
ToolHandle< IExtrapolator > m_extrapolator
The Extrapolator to be retrieved.
Definition
CombinedExtrapolatorTest.h:56
Trk::CombinedExtrapolatorTest::CombinedExtrapolatorTest
CombinedExtrapolatorTest(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition
CombinedExtrapolatorTest.cxx:18
Trk::CombinedExtrapolatorTest::m_sigmaD0
DoubleProperty m_sigmaD0
Definition
CombinedExtrapolatorTest.h:62
Trk::CombinedExtrapolatorTest::m_minZ0
DoubleProperty m_minZ0
Definition
CombinedExtrapolatorTest.h:63
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Trk::ParametersT::clone
virtual ParametersT< DIM, T, S > * clone() const override final
Virtual clone.
Trk::ParametersT::associatedSurface
virtual const S & associatedSurface() const override final
Access to the Surface method.
Trk::PerigeeSurface
Class describing the Line to which the Perigee refers to.
Definition
PerigeeSurface.h:43
Trk::TrackingGeometry::atVolumeBoundary
static bool atVolumeBoundary(const Amg::Vector3D &gp, const TrackingVolume *vol, double tol)
check position at volume boundary
Definition
TrackingGeometry.cxx:244
Trk::oppositeMomentum
@ oppositeMomentum
Definition
PropDirection.h:21
Trk::alongMomentum
@ alongMomentum
Definition
PropDirection.h:20
Trk::Perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Definition
Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:33
Trk::theta
@ theta
Definition
ParamDefs.h:66
Trk::qOverP
@ qOverP
perigee
Definition
ParamDefs.h:67
Trk::phi
@ phi
Definition
ParamDefs.h:75
Trk::d0
@ d0
Definition
ParamDefs.h:63
Trk::z0
@ z0
Definition
ParamDefs.h:64
Trk::ParticleHypothesis
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
Definition
ParticleHypothesis.h:28
Trk::TrackParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition
Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:27
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0