Skip to content

Commit

Permalink
Merge pull request #14846 from arizzi/nanProtectionPVSorter
Browse files Browse the repository at this point in the history
add a nan protection to avoid crash in fastjet call from pvsorter
  • Loading branch information
cmsbuild committed Jun 24, 2016
2 parents ec049f5 + 365c976 commit d1e666c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CommonTools/RecoAlgos/src/PrimaryVertexSorting.cc
Expand Up @@ -9,6 +9,7 @@
#include "fastjet/ClusterSequence.hh"
#include "fastjet/Selector.hh"
#include "fastjet/PseudoJet.hh"
#include "FWCore/Utilities/interface/isFinite.h"

using namespace fastjet;
using namespace std;
Expand All @@ -27,7 +28,13 @@ float PrimaryVertexSorting::score(const reco::Vertex & pv,const std::vector<con
float scale=1.;
if(c->bestTrack() != 0)
{
scale=(c->pt()-c->bestTrack()->ptError())/c->pt();
if(c->pt()!=0) {
scale=(c->pt()-c->bestTrack()->ptError())/c->pt();
}
if(edm::isNotFinite(scale)) {
edm::LogWarning("PrimaryVertexSorting") << "Scaling is NAN ignoring this candidate/track" << std::endl;
scale=0;
}
if(scale<0){
scale=0;
countScale0++;
Expand Down

0 comments on commit d1e666c

Please sign in to comment.