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
TrackContainerComplianceTests.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TrackContainerComplianceTests.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2023 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/MultiTrajectory.hpp
"
10
#include "
Acts/EventData/TrackContainer.hpp
"
11
#include "
Acts/EventData/VectorMultiTrajectory.hpp
"
12
#include "
Acts/EventData/VectorTrackContainer.hpp
"
13
#include "
Acts/Tests/CommonHelpers/NonCompileTestHelpers.hpp
"
14
#include "
Acts/Utilities/ThrowAssert.hpp
"
15
16
using namespace
Acts;
17
18
ACTS_DOES_NOT_COMPILE_SUITE_BEGIN
(BuildFromConstRef)
19
20
{
21
VectorTrackContainer
mutVtc;
22
VectorMultiTrajectory
mutMtj;
23
24
TrackContainer
mutTc{mutVtc, mutMtj};
25
static_assert(!mutTc.ReadOnly,
"Unexpectedly read only"
);
26
27
auto
t
= mutTc.getTrack(mutTc.addTrack());
28
t
.appendTrackState();
29
t
.appendTrackState();
30
t
.appendTrackState();
31
t
= mutTc.getTrack(mutTc.addTrack());
32
t
.appendTrackState();
33
34
ConstVectorTrackContainer
vtc{
std::move
(mutVtc)};
35
ConstVectorMultiTrajectory
mtj
{
std::move
(mutMtj)};
36
37
TrackContainer
ctc
{vtc,
mtj
};
38
ACTS_DOES_NOT_COMPILE_BEGIN
(AddTrackToConstTrackContainer)
39
ctc
.addTrack();
40
ACTS_DOES_NOT_COMPILE_END
()
41
}
42
43
{
// const correctness
44
VectorTrackContainer
vtc;
45
VectorMultiTrajectory
mtj
;
46
{
47
TrackContainer
tc
{vtc, mtj};
48
49
ACTS_DOES_NOT_COMPILE_BEGIN
(TrackMutateConstProxyRef)
50
for
(const
auto
track :
tc
) {
51
track.parameters().setRandom();
52
}
53
ACTS_DOES_NOT_COMPILE_END
()
54
}
55
56
ConstVectorTrackContainer
cvtc
{
std::move
(vtc)};
57
ConstVectorMultiTrajectory
cmtj
{
std::move
(
mtj
)};
58
{
59
TrackContainer
tc
{
cvtc
,
cmtj
};
60
61
ACTS_DOES_NOT_COMPILE_BEGIN
(TrackMutateConstProxy)
62
for
(
auto
track :
tc
) {
63
track.parameters().setRandom();
64
}
65
ACTS_DOES_NOT_COMPILE_END
()
66
}
67
}
68
69
{
70
VectorTrackContainer
vtc;
71
VectorMultiTrajectory
mtj
;
72
TrackContainer
tc
{vtc, mtj};
73
auto
t
=
tc
.getTrack(
tc
.addTrack());
74
(void)
t
;
75
76
ConstTrackAccessor<unsigned int>
caccNMeasuements
(
"nMeasurements"
);
77
ACTS_DOES_NOT_COMPILE_BEGIN
(ConstAccessorMutate)
78
caccNMeasuements
(
t
) = 66;
79
ACTS_DOES_NOT_COMPILE_END
()
80
81
ACTS_DOES_NOT_COMPILE_BEGIN
(MutationThroughContainerConstRef)
82
const
auto
&
ctc
=
tc
;
83
ctc
.
getTrack
(
idx
).
covariance
().setRandom();
84
ACTS_DOES_NOT_COMPILE_END
()
85
86
ACTS_DOES_NOT_COMPILE_BEGIN
(MutationThroughProxyConstRef)
87
const
auto
&
ctp
= t;
88
ctp
.
covariance
().setRandom();
89
ACTS_DOES_NOT_COMPILE_END
()
90
}
91
92
ACTS_DOES_NOT_COMPILE_SUITE_END
()
acts
blob
sPHENIX
Tests
UnitTests
Core
EventData
TrackContainerComplianceTests.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:43
using
1.8.2 with
sPHENIX GitHub integration