Skip to content

Commit

Permalink
check for nans earlier in the template reco
Browse files Browse the repository at this point in the history
  • Loading branch information
tvami committed Jul 28, 2022
1 parent 7178892 commit 8bb9eb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions CondFormats/SiPixelTransient/src/SiPixelTemplate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,12 @@ void SiPixelTemplate::postInit(std::vector<SiPixelTemplateStore>& 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;
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions CondFormats/SiPixelTransient/src/SiPixelTemplate2D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8bb9eb0

Please sign in to comment.