Project
Loading...
Searching...
No Matches
Helper.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef O2_MCH_CONTOUR_HELPER_H
16#define O2_MCH_CONTOUR_HELPER_H
17
18#include <cmath>
19#include <limits>
20#include <cstdint>
21
22namespace o2
23{
24namespace mch
25{
26namespace contour
27{
28namespace impl
29{
30
31template <typename T, typename U>
33{
34 const intmax_t botT = intmax_t(std::numeric_limits<T>::lowest());
35 const intmax_t botU = intmax_t(std::numeric_limits<U>::lowest());
36 const uintmax_t topT = uintmax_t(std::numeric_limits<T>::max());
37 const uintmax_t topU = uintmax_t(std::numeric_limits<U>::max());
38 return !((botT > botU && value < static_cast<U>(botT)) || (topT < topU && value > static_cast<U>(topT)));
39}
40
41inline bool areEqual(double a, double b)
42{
43 return std::fabs(b - a) < 1E-4; // 1E-4 cm = 1 micron
44}
45
46inline bool areEqual(int a, int b) { return a == b; }
47
48inline bool isStrictlyBelow(double a, double b) { return (a < b) && !areEqual(a, b); }
49
50inline bool isStrictlyBelow(int a, int b) { return a < b; }
51
52} // namespace impl
53} // namespace contour
54} // namespace mch
55} // namespace o2
56
57#endif // ALO_HELPER_H
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
bool isStrictlyBelow(double a, double b)
Definition Helper.h:48
bool areEqual(double a, double b)
Definition Helper.h:41
bool CanTypeFitValue(const U value)
Definition Helper.h:32
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...