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
ProtoBinning.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ProtoBinning.hpp
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
#pragma once
10
11
#include "
Acts/Definitions/Algebra.hpp
"
12
#include "
Acts/Definitions/Common.hpp
"
13
#include "
Acts/Utilities/BinningData.hpp
"
14
#include "
Acts/Utilities/detail/AxisFwd.hpp
"
15
16
#include <stdexcept>
17
#include <vector>
18
19
namespace
Acts {
20
21
namespace
Experimental {
22
28
struct
ProtoBinning
{
30
BinningValue
binValue
=
BinningValue::binValues
;
32
Acts::detail::AxisType
axisType
= Acts::detail::AxisType::Equidistant;
34
Acts::detail::AxisBoundaryType
boundaryType
=
35
Acts::detail::AxisBoundaryType::Bound;
37
std::vector<ActsScalar>
edges
= {};
39
std::size_t
expansion
= 0
u
;
40
47
ProtoBinning
(
BinningValue
bValue,
Acts::detail::AxisBoundaryType
bType,
48
const
std::vector<ActsScalar>&
e
, std::size_t exp = 0
u
)
49
:
binValue
(bValue),
50
axisType
(Acts::detail::
AxisType
::Variable),
51
boundaryType
(bType),
52
edges
(e),
53
expansion
(exp) {
54
if
(
edges
.size() < 2
u
) {
55
throw
std::invalid_argument(
56
"ProtoBinning: Invalid binning, at least two edges are needed."
);
57
}
58
}
59
68
ProtoBinning
(
BinningValue
bValue,
Acts::detail::AxisBoundaryType
bType,
69
ActsScalar
minE,
ActsScalar
maxE, std::size_t
nbins
,
70
std::size_t exp = 0
u
)
71
:
binValue
(bValue),
boundaryType
(bType),
expansion
(exp) {
72
if
(minE >= maxE) {
73
throw
std::invalid_argument(
74
"ProtoBinning: Invalid binning, min edge needs to be smaller than "
75
"max edge."
);
76
}
77
if
(nbins < 1
u
) {
78
throw
std::invalid_argument(
79
"ProtoBinning: Invalid binning, at least one bin is needed."
);
80
}
81
82
ActsScalar
stepE = (maxE - minE) / nbins;
83
edges
.reserve(nbins + 1);
84
for
(std::size_t
i
= 0;
i
<=
nbins
;
i
++) {
85
edges
.push_back(minE +
i
* stepE);
86
}
87
}
88
89
std::size_t
bins
()
const
{
return
edges
.size() - 1
u
; }
90
};
91
92
}
// namespace Experimental
93
}
// namespace Acts
acts
blob
sPHENIX
Core
include
Acts
Detector
ProtoBinning.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:32
using
1.8.2 with
sPHENIX GitHub integration