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
BoundRandomValues.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file BoundRandomValues.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2020 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
13
#include <array>
14
15
namespace
ActsFatras {
16
18
struct
RectangleRandom
{
19
double
xmax
;
20
double
ymax
;
21
26
RectangleRandom
(
double
xmax_,
double
ymax_) :
xmax
(xmax_),
ymax
(ymax_) {}
27
32
Acts::Vector2
operator()
(
double
r0
,
double
r1
)
const
{
33
return
{(2 * r0 - 1) *
xmax
, (2 * r1 - 1) *
ymax
};
34
}
35
};
36
38
struct
TrapezoidRandom
{
39
double
xminy
;
40
double
xmaxy
;
41
double
ymin
;
42
double
ymax
;
43
49
TrapezoidRandom
(
double
xminy_,
double
xmaxy_,
double
ymax_)
50
:
xminy
(xminy_),
xmaxy
(xmaxy_),
ymin
(-ymax_),
ymax
(ymax_) {}
51
58
TrapezoidRandom
(
double
xminy_,
double
xmaxy_,
double
ymin_,
double
ymax_)
59
:
xminy
(xminy_),
xmaxy
(xmaxy_),
ymin
(ymin_),
ymax
(ymax_) {}
60
65
Acts::Vector2
operator()
(
double
r0
,
double
r1
)
const
{
66
double
y
=
ymin
+ (
ymax
-
ymin
) * r1;
67
double
xmax
=
xminy
+ (
xmaxy
-
xminy
) / (
ymax
-
ymin
) * (y -
ymin
);
68
double
x
= (2 * r0 - 1) * xmax;
69
return
{
x
, y};
70
}
71
};
72
74
struct
DiscRandom
{
75
double
rmin
;
76
double
rmax
;
77
double
phimin
;
78
double
phimax
;
79
86
DiscRandom
(
double
rmin_,
double
rmax_
,
double
phimin_,
double
phimax_)
87
:
rmin
(rmin_),
rmax
(rmax_),
phimin
(phimin_),
phimax
(phimax_) {}
88
93
Acts::Vector2
operator()
(
double
r0
,
double
r1
)
const
{
94
double
r
=
rmin
+ (
rmax
-
rmin
) * r0;
95
double
phi
=
phimin
+ (
phimax
-
phimin
) * r1;
96
return
{r * std::cos(phi), r * std::sin(phi)};
97
}
98
};
99
101
struct
AnnulusRandom
{
102
double
rmin
;
103
double
rmax
;
104
double
phimins
;
// strip system
105
double
phimaxs
;
// strip system
106
double
originxs
;
// strip system origin x
107
double
originys
;
// strip system origin y
108
117
AnnulusRandom
(
double
rmin_,
double
rmax_
,
double
phimins_,
double
phimaxs_,
118
double
originxs_,
double
originys_)
119
:
rmin
(rmin_),
120
rmax
(rmax_),
121
phimins
(phimins_),
122
phimaxs
(phimaxs_),
123
originxs
(originxs_),
124
originys
(originys_) {}
125
130
Acts::Vector2
operator()
(
double
r0
,
double
r1
)
const
{
131
double
r
=
rmin
+ (
rmax
-
rmin
) * r0;
132
double
phi
=
phimins
+ (
phimaxs
-
phimins
) * r1;
133
return
{r * std::cos(phi), r * std::sin(phi)};
134
}
135
};
136
137
}
// namespace ActsFatras
acts
blob
sPHENIX
Tests
UnitTests
Fatras
Digitization
BoundRandomValues.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:45
using
1.8.2 with
sPHENIX GitHub integration