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
ExternallyAlignedDetectorElement.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ExternallyAlignedDetectorElement.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 "
Acts/Definitions/Algebra.hpp
"
12
#include "
Acts/Geometry/GeometryContext.hpp
"
13
#include "
Acts/Geometry/GeometryIdentifier.hpp
"
14
#include "
Acts/Plugins/Identification/IdentifiedDetectorElement.hpp
"
15
#include "
Acts/Plugins/Identification/Identifier.hpp
"
16
#include "
Acts/Surfaces/Surface.hpp
"
17
#include "
ActsExamples/GenericDetector/GenericDetectorElement.hpp
"
18
19
#include <map>
20
21
namespace
ActsExamples {
22
23
namespace
Contextual {
24
41
class
ExternallyAlignedDetectorElement
42
:
public
Generic::GenericDetectorElement
{
43
public
:
44
struct
AlignmentStore
{
45
// GenericDetector identifiers are sequential
46
std::vector<Acts::Transform3>
transforms
;
47
size_t
lastAccessed
= 0;
48
};
49
52
struct
ContextType
{
53
// GenericDetector identifiers are an integer sequence, so vector is fine!
54
std::shared_ptr<const AlignmentStore>
alignmentStore
{
nullptr
};
55
};
56
57
using
Generic::GenericDetectorElement::GenericDetectorElement
;
58
64
const
Acts::Transform3
&
transform
(
65
const
Acts::GeometryContext
&
gctx
)
const override
;
66
};
67
68
inline
const
Acts::Transform3
&
ExternallyAlignedDetectorElement::transform
(
69
const
Acts::GeometryContext
&
gctx
)
const
{
70
if
(!gctx.hasValue()) {
// Treating empty context => nominal alignment
71
return
GenericDetectorElement::transform
(gctx);
72
}
73
// cast into the right context object
74
const
auto
& alignContext = gctx.get<
ContextType
>();
75
identifier_type
idValue =
identifier_type
(
identifier
());
76
77
if
(alignContext.alignmentStore ==
nullptr
) {
78
// geometry construction => nominal alignment
79
return
GenericDetectorElement::transform
(gctx);
80
}
81
82
// At this point, the alignment store should be populated
83
assert
(idValue < alignContext.alignmentStore->transforms.size());
84
return
alignContext.alignmentStore->transforms[idValue];
85
}
86
87
}
// end of namespace Contextual
88
}
// end of namespace ActsExamples
acts
blob
sPHENIX
Examples
Detectors
ContextualDetector
include
ActsExamples
ContextualDetector
ExternallyAlignedDetectorElement.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:37
using
1.8.2 with
sPHENIX GitHub integration