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
EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
sPHENIX
CI
Core
include
Acts
EventData
Geometry
MagneticField
Material
Propagator
detail
AbortList.hpp
ActionList.hpp
AtlasStepper.hpp
ConstrainedStep.hpp
DefaultExtension.hpp
DenseEnvironmentExtension.hpp
DirectNavigator.hpp
EigenStepper.hpp
EigenStepper.ipp
EigenStepperError.hpp
MaterialInteractor.hpp
Navigator.hpp
Propagator.hpp
Propagator.ipp
PropagatorError.hpp
RiddersPropagator.hpp
RiddersPropagator.ipp
StandardAborters.hpp
StepperConcept.hpp
StepperExtensionList.hpp
StraightLineStepper.hpp
SurfaceCollector.hpp
VolumeCollector.hpp
Seeding
Surfaces
TrackFinding
TrackFitting
Utilities
Vertexing
Visualization
src
docs
Examples
Fatras
Plugins
Tests
thirdparty
BeastMagneticField
delphes_EIC
Doxygen_Assist
east
eic-smear
EicRoot
eicsmear-jetexample
eicsmeardetectors
EicToyModel
estarlight
Fun4All-lmon
fun4all_coresoftware
fun4all_eic_qa
fun4all_eic_tutorials
fun4all_eicdetectors
fun4all_eicmacros
fun4all_g4jleic
fun4all_GenFit
fun4all_macros
fun4all_tutorials
g4exampledetector
g4lblvtx
online_distribution
PEPSI
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ConstrainedStep.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ConstrainedStep.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2018 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/Utilities/Definitions.hpp
"
12
13
#include <algorithm>
14
#include <array>
15
#include <iomanip>
16
#include <limits>
17
#include <sstream>
18
19
namespace
Acts {
20
22
struct
ConstrainedStep
{
28
enum
Type
:
int
{
accuracy
= 0,
actor
= 1,
aborter
= 2,
user
= 3 };
29
31
std::array<double, 4>
values
= {
32
{
std::numeric_limits<double>::max
(),
std::numeric_limits<double>::max
(),
33
std::numeric_limits<double>::max
(),
std::numeric_limits<double>::max
()}};
34
36
NavigationDirection
direction
=
forward
;
37
45
void
update
(
const
double
&
value
,
Type
type,
bool
releaseStep =
false
) {
46
if
(releaseStep) {
47
release
(type);
48
}
49
// The check the current value and set it if appropriate
50
double
cValue =
values
[type];
51
values
[type] = cValue * cValue < value * value ? cValue :
value
;
52
}
53
59
void
release
(
Type
type) {
60
double
mvalue = (
direction
==
forward
)
61
? (*std::max_element(
values
.begin(),
values
.end()))
62
: (*std::min_element(
values
.begin(),
values
.end()));
63
values
[type] = mvalue;
64
}
65
68
ConstrainedStep
(
double
value
) :
direction
(value > 0. ?
forward
:
backward
) {
69
values
[
accuracy
] *=
direction
;
70
values
[
actor
] *=
direction
;
71
values
[
aborter
] *=
direction
;
72
values
[
user
] =
value
;
73
}
74
80
ConstrainedStep
&
operator=
(
const
double
&
value
) {
82
values
[
accuracy
] =
value
;
83
// set/update the direction
84
direction
= value > 0. ?
forward
:
backward
;
85
return
(*
this
);
86
}
87
90
operator
double()
const
{
91
if
(
direction
==
forward
) {
92
return
(*std::min_element(
values
.begin(),
values
.end()));
93
}
94
return
(*std::max_element(
values
.begin(),
values
.end()));
95
}
96
100
double
value
(
Type
type)
const
{
return
values
[type]; }
101
104
double
max
()
const
{
105
return
(*std::max_element(
values
.begin(),
values
.end()));
106
}
107
110
double
min
()
const
{
111
return
(*std::min_element(
values
.begin(),
values
.end()));
112
}
113
116
Type
currentType
()
const
{
117
if
(
direction
==
forward
) {
118
return
Type
(std::min_element(
values
.begin(),
values
.end()) -
119
values
.begin());
120
}
121
return
Type
(std::max_element(
values
.begin(),
values
.end()) -
122
values
.begin());
123
}
124
126
std::string
toString
()
const
;
127
};
128
129
inline
std::string
ConstrainedStep::toString
()
const
{
130
std::stringstream dstream;
131
132
// Helper method to avoid unreadable screen output
133
auto
streamValue = [&](
ConstrainedStep
cstep) ->
void
{
134
double
val =
values
[cstep];
135
dstream << std::setw(5);
136
if
(
std::abs
(val) ==
std::numeric_limits<double>::max
()) {
137
dstream << (val > 0 ?
"+∞"
:
"-∞"
);
138
}
else
{
139
dstream << val;
140
}
141
};
142
143
dstream <<
"("
;
144
streamValue(
accuracy
);
145
dstream <<
", "
;
146
streamValue(
actor
);
147
dstream <<
", "
;
148
streamValue(
aborter
);
149
dstream <<
", "
;
150
streamValue(
user
);
151
dstream <<
" )"
;
152
return
dstream.str();
153
}
154
155
}
// namespace Acts
acts
blob
sPHENIX
Core
include
Acts
Propagator
ConstrainedStep.hpp
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:23
using
1.8.2 with
EIC GitHub integration