From 8bb9eb0139bb8089a23f4f215bf7e16f9e7e0606 Mon Sep 17 00:00:00 2001 From: Tamas Date: Thu, 28 Jul 2022 14:34:07 +0200 Subject: [PATCH] check for nans earlier in the template reco --- CondFormats/SiPixelTransient/src/SiPixelTemplate.cc | 12 ++++++------ .../SiPixelTransient/src/SiPixelTemplate2D.cc | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc b/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc index 57e7806db0326..a409f97615ad4 100644 --- a/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc +++ b/CondFormats/SiPixelTransient/src/SiPixelTemplate.cc @@ -1328,6 +1328,12 @@ void SiPixelTemplate::postInit(std::vector& thePixelTemp_) bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx) { // Interpolate for a new set of track angles + //check for nan's + if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) { + success_ = false; + return success_; + } + // Local variables int i, j; int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx; @@ -1393,12 +1399,6 @@ bool SiPixelTemplate::interpolate(int id, float cotalpha, float cotbeta, float l throw cms::Exception("DataCorrupt") << "SiPixelTemplate::interpolate can't find needed template ID = " << id << std::endl; } - - //check for nan's - if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) { - success_ = false; - return success_; - } #else assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size()); #endif diff --git a/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc b/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc index d9e3441e357d0..9380f61f63e1a 100644 --- a/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc +++ b/CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc @@ -626,6 +626,12 @@ bool SiPixelTemplate2D::getid(int id) { bool SiPixelTemplate2D::interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx) { // Interpolate for a new set of track angles + //check for nan's + if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) { + success_ = false; + return success_; + } + // Local variables float acotb, dcota, dcotb; @@ -680,12 +686,6 @@ bool SiPixelTemplate2D::interpolate(int id, float cotalpha, float cotbeta, float #ifndef SI_PIXEL_TEMPLATE_STANDALONE throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; - - //check for nan's - if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) { - success_ = false; - return success_; - } #else std::cout << "SiPixelTemplate:2D:illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; #endif