CMS 3D CMS Logo

RntStructs.cc
Go to the documentation of this file.
1 #include "RntStructs.h"
2 
3 #include <cstdio>
4 
5 namespace {
6  constexpr bool isFinite(float x) {
7  const unsigned int mask = 0x7f800000;
8  union {
9  unsigned int l;
10  float d;
11  } v = {.d = x};
12  return (v.l & mask) != mask;
13  }
14 
15  // nan-guard, in place, return true if nan detected.
16  bool ngr(float &f) {
17  bool is_bad = !isFinite(f);
18  if (is_bad)
19  f = -999.0f;
20  return is_bad;
21  }
22  bool ngr(RVec &v) {
23  bool is_bad = ngr(v.fX);
24  is_bad |= ngr(v.fY);
25  is_bad |= ngr(v.fZ);
26  return is_bad;
27  }
28  bool ngr(State &s) {
29  bool is_bad = ngr(s.pos);
30  is_bad |= ngr(s.mom);
31  return is_bad;
32  }
33 } // namespace
34 
36  has_nans = ngr(phi);
37  has_nans |= ngr(dphi);
38  has_nans |= ngr(q);
39  has_nans |= ngr(dq);
40  return has_nans;
41 }
42 
44  has_nans = ngr(ps_min);
45  has_nans |= ngr(ps_max);
46  has_nans |= bso.nan_check();
47  has_nans |= bsn.nan_check();
48 }
49 
51  has_nans = ngr(s_prev);
52  has_nans |= ngr(s_final);
53 }
float dq
Definition: RntStructs.h:62
PropState ps_min
Definition: RntStructs.h:77
float phi
Definition: RntStructs.h:62
bool has_nans
Definition: RntStructs.h:80
float q
Definition: RntStructs.h:62
ROOT::Experimental::REveVector RVec
Definition: RntStructs.h:22
constexpr bool isFinite(T x)
constexpr uint32_t mask
Definition: gpuClustering.h:26
bool nan_check()
Definition: RntStructs.cc:35
void nan_check()
Definition: RntStructs.cc:50
bool has_nans
Definition: RntStructs.h:66
PropState ps_max
Definition: RntStructs.h:77
double f[11][100]
BinSearch bso
Definition: RntStructs.h:78
d
Definition: ztail.py:151
float dphi
Definition: RntStructs.h:62
float x
BinSearch bsn
Definition: RntStructs.h:79
void nan_check()
Definition: RntStructs.cc:43