EIC Software
Reference for
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
SimSourceLink.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file SimSourceLink.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2016-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/EventData/Measurement.hpp
"
12
#include "
ActsExamples/EventData/GeometryContainers.hpp
"
13
#include "
ActsFatras/EventData/Hit.hpp
"
14
15
#include <stdexcept>
16
#include <string>
17
18
namespace
ActsExamples {
19
26
class
SimSourceLink
{
27
public
:
28
SimSourceLink
(
const
Acts::Surface
&
surface
,
const
ActsFatras::Hit
&
truthHit
,
29
size_t
dim
,
Acts::BoundVector
values
,
Acts::BoundMatrix
cov
)
30
:
m_values
(values),
31
m_cov
(cov),
32
m_dim
(dim),
33
m_geometryId
(truthHit.
geometryId
()),
34
m_surface
(&surface),
35
m_truthHit
(&truthHit) {}
37
SimSourceLink
() =
default
;
38
SimSourceLink
(
SimSourceLink
&&) =
default
;
39
SimSourceLink
(
const
SimSourceLink
&) =
default
;
40
SimSourceLink
&
operator=
(
SimSourceLink
&&) =
default
;
41
SimSourceLink
&
operator=
(
const
SimSourceLink
&) =
default
;
42
43
constexpr
Acts::GeometryIdentifier
geometryId
()
const
{
return
m_geometryId
; }
44
constexpr
const
Acts::Surface
&
referenceSurface
()
const
{
return
*
m_surface
; }
45
constexpr
const
ActsFatras::Hit
&
truthHit
()
const
{
return
*
m_truthHit
; }
46
47
Acts::FittableMeasurement<SimSourceLink>
operator*
()
const
{
48
if
(
m_dim
== 0) {
49
throw
std::runtime_error(
"Cannot create dim 0 measurement"
);
50
}
else
if
(
m_dim
== 1) {
51
return
Acts::Measurement
<
SimSourceLink
,
Acts::BoundIndices
,
52
Acts::eBoundLoc0
>{
53
m_surface
->
getSharedPtr
(), *
this
,
m_cov
.topLeftCorner<1, 1>(),
54
m_values
[0]};
55
}
else
if
(
m_dim
== 2) {
56
return
Acts::Measurement
<
SimSourceLink
,
Acts::BoundIndices
,
57
Acts::eBoundLoc0
,
Acts::eBoundLoc1
>{
58
m_surface
->
getSharedPtr
(), *
this
,
m_cov
.topLeftCorner<2, 2>(),
59
m_values
[0],
m_values
[1]};
60
}
else
{
61
throw
std::runtime_error(
"Dim "
+
std::to_string
(
m_dim
) +
62
" currently not supported."
);
63
}
64
}
65
66
private
:
67
Acts::BoundVector
m_values
;
68
Acts::BoundMatrix
m_cov
;
69
size_t
m_dim
= 0
u
;
70
// store geo id copy to avoid indirection via truth hit
71
Acts::GeometryIdentifier
m_geometryId
;
72
// need to store pointers to make the object copyable
73
const
Acts::Surface
*
m_surface
;
74
const
ActsFatras::Hit
*
m_truthHit
;
75
76
friend
constexpr
bool
operator==
(
const
SimSourceLink& lhs,
77
const
SimSourceLink& rhs) {
78
return
lhs.
m_truthHit
== rhs.
m_truthHit
;
79
}
80
};
81
83
using
SimSourceLinkContainer
=
GeometryIdMultiset<SimSourceLink>
;
84
85
}
// end of namespace ActsExamples
acts
blob
sPHENIX
Examples
Framework
include
ActsExamples
EventData
SimSourceLink.hpp
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:25
using
1.8.2 with
EIC GitHub integration