ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
HyPERAnalysisAlgorithms
src
HyPERUtils.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "TMath.h"
5
#include "
HyPERAnalysisAlgorithms/HyPERUtils.h
"
6
7
namespace
EventReco
{
8
9
// Definition of the standalone HyPER message level (default: INFO)
10
thread_local
MSG::Level
g_hyper_msg_level
= MSG::INFO;
11
12
std::vector<std::vector<int64_t>>
transpose
(
13
const
std::vector<std::vector<int64_t>>& vecs) {
14
if
(vecs.empty() || vecs[0].empty())
15
return
{};
16
17
std::size_t rows = vecs.size();
18
std::size_t cols = vecs[0].size();
19
std::vector<std::vector<int64_t>> transposed(cols,
20
std::vector<int64_t>(rows));
21
for
(std::size_t i = 0; i < rows; ++i) {
22
for
(std::size_t j = 0; j < cols; ++j) {
23
transposed[j][i] = vecs[i][j];
24
}
25
}
26
return
transposed;
27
}
28
29
std::vector<int64_t>
range
(int64_t n) {
30
std::vector<int64_t> result;
31
for
(int64_t i{0}; i < n; ++i)
32
result.push_back(i);
33
return
result;
34
}
35
36
// @enum HyPERTopology
37
HyPERTopology
strToHyPERTopology
(
const
std::string&
str
) {
38
if
(
str
==
"TtbarLJets"
)
39
return
HyPERTopology::TtbarLJets
;
40
if
(
str
==
"TtbarLJetsNoBTag"
)
41
return
HyPERTopology::TtbarLJets
;
42
if
(
str
==
"TtbarAllHadronic"
)
43
return
HyPERTopology::TtbarAllHadronic
;
44
if
(
str
==
"TtbarDiLepton"
)
45
return
HyPERTopology::TtbarDiLepton
;
46
return
HyPERTopology::NotSelected
;
47
}
48
49
std::size_t
getIndexFromLabel
(
const
std::vector<std::string>&
vec
,
50
const
std::string&
label
) {
51
auto
it = std::find(
vec
.begin(),
vec
.end(),
label
);
52
if
(it ==
vec
.end()) {
53
throw
std::runtime_error(
54
"HyPERAlg or VyPERAlg:: Could not find the label: "
+
label
);
55
}
else
{
56
return
std::distance(
vec
.begin(), it);
57
}
58
}
59
60
// Calculate delta phi between two angles in radians from -pi/2 to pi/2
61
float
deltaPhi
(
float
phi1,
float
phi2) {
62
float
PI
=
static_cast<
float
>
(TMath::Pi());
63
64
float
dphi = phi1 - phi2;
65
while
(dphi >
PI
)
66
dphi -= 2 *
PI
;
67
while
(dphi <= -
PI
)
68
dphi += 2 *
PI
;
69
70
return
dphi;
71
}
72
73
}
// namespace EventReco
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
HyPERUtils.h
label
std::string label(const std::string &format, int i)
Definition
label.h:19
EventReco
Definition
GraphBase.h:14
EventReco::HyPERTopology
HyPERTopology
Definition
HyPERModel.h:25
EventReco::HyPERTopology::TtbarLJets
@ TtbarLJets
Definition
HyPERModel.h:27
EventReco::HyPERTopology::TtbarDiLepton
@ TtbarDiLepton
Definition
HyPERModel.h:29
EventReco::HyPERTopology::NotSelected
@ NotSelected
Definition
HyPERModel.h:26
EventReco::HyPERTopology::TtbarAllHadronic
@ TtbarAllHadronic
Definition
HyPERModel.h:28
EventReco::strToHyPERTopology
HyPERTopology strToHyPERTopology(const std::string &str)
Definition
HyPERUtils.cxx:37
EventReco::getIndexFromLabel
std::size_t getIndexFromLabel(const std::vector< std::string > &vec, const std::string &label)
Definition
HyPERUtils.cxx:49
EventReco::g_hyper_msg_level
MSG::Level g_hyper_msg_level
Definition
HyPERUtils.cxx:10
EventReco::range
std::vector< int64_t > range(int64_t n)
Definition
HyPERUtils.cxx:29
EventReco::deltaPhi
float deltaPhi(float phi1, float phi2)
Definition
HyPERUtils.cxx:61
EventReco::transpose
std::vector< std::vector< int64_t > > transpose(const std::vector< std::vector< int64_t > > &vecs)
Definition
HyPERUtils.cxx:12
str
Definition
BTagTrackIpAccessor.cxx:11
PI
const float PI
Definition
test_isolaitonTool.cxx:61
Generated on
for ATLAS Offline Software by
1.17.0