Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
TransformationFreeToBound.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TransformationFreeToBound.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2020 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include "
Acts/EventData/detail/TransformationFreeToBound.hpp
"
10
11
#include "
Acts/Definitions/Common.hpp
"
12
#include "
Acts/Surfaces/Surface.hpp
"
13
#include "
Acts/Utilities/Result.hpp
"
14
15
#include <algorithm>
16
17
Acts::Result<Acts::BoundVector>
Acts::detail::transformFreeToBoundParameters
(
18
const
FreeVector
& freeParams,
const
Surface
&
surface
,
19
const
GeometryContext
&
geoCtx
,
ActsScalar
tolerance
) {
20
// initialize the bound vector
21
BoundVector
bp = BoundVector::Zero();
22
// convert global to local position on the surface
23
auto
position
= freeParams.segment<3>(
eFreePos0
);
24
auto
direction = freeParams.segment<3>(
eFreeDir0
);
25
auto
result = surface.
globalToLocal
(geoCtx,
position
, direction, tolerance);
26
if
(!result.ok()) {
27
return
Result<Acts::BoundVector>::failure
(result.error());
28
}
29
30
auto
localPosition = result.value();
31
bp[
eBoundLoc0
] = localPosition[
ePos0
];
32
bp[
eBoundLoc1
] = localPosition[
ePos1
];
33
34
bp[
eBoundTime
] = freeParams[
eFreeTime
];
35
bp[
eBoundPhi
] =
VectorHelpers::phi
(direction);
36
bp[
eBoundTheta
] =
VectorHelpers::theta
(direction);
37
bp[
eBoundQOverP
] = freeParams[
eFreeQOverP
];
38
return
Result<Acts::BoundVector>::success
(bp);
39
}
40
41
Acts::Result<Acts::BoundVector>
Acts::detail::transformFreeToBoundParameters
(
42
const
Acts::Vector3
&
position
,
ActsScalar
time
,
43
const
Acts::Vector3
& direction,
ActsScalar
qOverP,
44
const
Acts::Surface
&
surface
,
const
Acts::GeometryContext
&
geoCtx
,
45
ActsScalar
tolerance
) {
46
// initialize the bound vector
47
BoundVector
bp = BoundVector::Zero();
48
// convert global to local position on the surface
49
auto
result = surface.
globalToLocal
(geoCtx, position, direction, tolerance);
50
if
(!result.ok()) {
51
return
Result<Acts::BoundVector>::failure
(result.error());
52
}
53
54
auto
localPosition = result.value();
55
bp[
eBoundLoc0
] = localPosition[
ePos0
];
56
bp[
eBoundLoc1
] = localPosition[
ePos1
];
57
58
bp[
eBoundTime
] =
time
;
59
bp[
eBoundPhi
] =
VectorHelpers::phi
(direction);
60
bp[
eBoundTheta
] =
VectorHelpers::theta
(direction);
61
bp[
eBoundQOverP
] = qOverP;
62
return
Result<Acts::BoundVector>::success
(bp);
63
}
64
65
Acts::BoundVector
Acts::detail::transformFreeToCurvilinearParameters
(
66
ActsScalar
time
,
ActsScalar
phi
,
ActsScalar
theta
,
ActsScalar
qOverP) {
67
BoundVector
bp = BoundVector::Zero();
68
// local coordinates are zero by construction
69
bp[
eBoundTime
] =
time
;
70
bp[
eBoundPhi
] =
phi
;
71
bp[
eBoundTheta
] =
theta
;
72
bp[
eBoundQOverP
] = qOverP;
73
return
bp;
74
}
75
76
Acts::BoundVector
Acts::detail::transformFreeToCurvilinearParameters
(
77
ActsScalar
time
,
const
Vector3
& direction,
ActsScalar
qOverP) {
78
BoundVector
bp = BoundVector::Zero();
79
// local coordinates are zero by construction
80
bp[
eBoundTime
] =
time
;
81
bp[
eBoundPhi
] =
VectorHelpers::phi
(direction);
82
bp[
eBoundTheta
] =
VectorHelpers::theta
(direction);
83
bp[
eBoundQOverP
] = qOverP;
84
return
bp;
85
}
acts
blob
sPHENIX
Core
src
EventData
TransformationFreeToBound.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:35
using
1.8.2 with
sPHENIX GitHub integration