Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:24

0001 #include "RntStructs.h"
0002 
0003 #include <cstdio>
0004 
0005 namespace {
0006   constexpr bool isFinite(float x) {
0007     const unsigned int mask = 0x7f800000;
0008     union {
0009       unsigned int l;
0010       float d;
0011     } v = {.d = x};
0012     return (v.l & mask) != mask;
0013   }
0014 
0015   // nan-guard, in place, return true if nan detected.
0016   bool ngr(float &f) {
0017     bool is_bad = !isFinite(f);
0018     if (is_bad)
0019       f = -999.0f;
0020     return is_bad;
0021   }
0022   bool ngr(RVec &v) {
0023     bool is_bad = ngr(v.fX);
0024     is_bad |= ngr(v.fY);
0025     is_bad |= ngr(v.fZ);
0026     return is_bad;
0027   }
0028   bool ngr(State &s) {
0029     bool is_bad = ngr(s.pos);
0030     is_bad |= ngr(s.mom);
0031     return is_bad;
0032   }
0033 }  // namespace
0034 
0035 bool BinSearch::nan_check() {
0036   has_nans = ngr(phi);
0037   has_nans |= ngr(dphi);
0038   has_nans |= ngr(q);
0039   has_nans |= ngr(dq);
0040   return has_nans;
0041 }
0042 
0043 void CandInfo::nan_check() {
0044   has_nans = ngr(ps_min);
0045   has_nans |= ngr(ps_max);
0046   has_nans |= bso.nan_check();
0047   has_nans |= bsn.nan_check();
0048 }
0049 
0050 void FailedPropInfo::nan_check() {
0051   has_nans = ngr(s_prev);
0052   has_nans |= ngr(s_final);
0053 }