ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigIDR4Monitoring
src
find_bin.h
Go to the documentation of this file.
1
12
13
14
#ifndef IDTPM2_BINS_FIND_BIN
15
#define IDTPM2_BINS_FIND_BIN
16
17
#include <vector>
18
#include <stdexcept>
19
20
21
namespace
IDTPM2::bins
{
22
23
template
<
typename
T,
typename
U=T>
24
size_t
find_bin
(
const
std::vector<T>& v,
const
U&
x
) {
25
if
( v.size()<2)
throw
std::runtime_error(
"cannot define a bin range with fewer than two limits"
);
26
if
(
x
>=v.back() )
return
v.size()-2;
27
if
(
x
<v.front() )
return
0;
28
typename
std::vector<T>::const_iterator itr = std::lower_bound( v.begin(), v.end(),
x
);
29
return
(itr-v.begin())-1;
30
}
31
32
}
33
34
#endif
// IDTPM2_BINS_FIND_BIN
35
x
#define x
IDTPM2::bins
Definition
find_bin.h:21
IDTPM2::bins::find_bin
size_t find_bin(const std::vector< T > &v, const U &x)
Definition
find_bin.h:24
Generated on
for ATLAS Offline Software by
1.17.0