ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
AlignedDetectorElement.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file AlignedDetectorElement.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2019 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
#pragma once
10
11
#include <memory>
12
13
#include "
ACTFW/GenericDetector/GenericDetectorElement.hpp
"
14
#include "
Acts/Geometry/GeometryContext.hpp
"
15
#include "
Acts/Geometry/GeometryID.hpp
"
16
#include "
Acts/Plugins/Identification/IdentifiedDetectorElement.hpp
"
17
#include "
Acts/Plugins/Identification/Identifier.hpp
"
18
#include "
Acts/Surfaces/Surface.hpp
"
19
#include "
Acts/Utilities/Definitions.hpp
"
20
21
namespace
FW {
22
23
namespace
Contextual {
24
37
class
AlignedDetectorElement
:
public
Generic::GenericDetectorElement
{
38
public
:
41
struct
ContextType
{
43
unsigned
int
iov
= 0;
44
};
45
49
template
<
typename
... Args>
50
AlignedDetectorElement
(Args&&... args)
51
: Generic::
GenericDetectorElement
(std::
forward
<Args>(args)...) {}
52
58
const
Acts::Transform3D
&
transform
(
59
const
Acts::GeometryContext
&
gctx
)
const
final
override
;
60
64
const
Acts::Transform3D
&
nominalTransform
(
65
const
Acts::GeometryContext
&
gctx
)
const
;
66
71
void
addAlignedTransform
(std::unique_ptr<Acts::Transform3D> alignedTransform,
72
unsigned
int
iov);
73
75
const
std::vector<std::unique_ptr<Acts::Transform3D>>&
alignedTransforms
()
76
const
;
77
78
private
:
79
std::vector<std::unique_ptr<Acts::Transform3D>>
m_alignedTransforms
;
80
};
81
82
inline
const
Acts::Transform3D
&
AlignedDetectorElement::transform
(
83
const
Acts::GeometryContext
&
gctx
)
const
{
84
// Check if a different transform than the nominal exists
85
if
(
m_alignedTransforms
.size()) {
86
// cast into the right context object
87
auto
alignContext =
std::any_cast
<
ContextType
>(
gctx
);
88
return
(*
m_alignedTransforms
[alignContext.iov].get());
89
}
90
// Return the standard transform if not found
91
return
nominalTransform
(gctx);
92
}
93
94
inline
const
Acts::Transform3D
&
AlignedDetectorElement::nominalTransform
(
95
const
Acts::GeometryContext
&
gctx
)
const
{
96
return
GenericDetectorElement::transform
(gctx);
97
}
98
99
inline
void
AlignedDetectorElement::addAlignedTransform
(
100
std::unique_ptr<Acts::Transform3D> alignedTransform,
unsigned
int
iov) {
101
// most standard case, it's just a new one:
102
auto
cios =
m_alignedTransforms
.size();
103
for
(
unsigned
int
ic = cios; ic <= iov; ++ic) {
104
m_alignedTransforms
.push_back(
nullptr
);
105
}
106
m_alignedTransforms
[iov] = std::move(alignedTransform);
107
}
108
109
inline
const
std::vector<std::unique_ptr<Acts::Transform3D>>&
110
AlignedDetectorElement::alignedTransforms
()
const
{
111
return
m_alignedTransforms
;
112
}
113
114
}
// end of namespace Contextual
115
}
// end of namespace FW
acts
blob
master
Examples
Detectors
ContextualDetector
include
ACTFW
ContextualDetector
AlignedDetectorElement.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:23
using
1.8.2 with
ECCE GitHub integration