Skip to content

Commit

Permalink
Merge pull request cms-sw#23 from tstreble/NanoAOD_BPH_SeqVertFit_Nan…
Browse files Browse the repository at this point in the history
…Check

Vertex fitting NaN check (aka the never-ending story)
  • Loading branch information
tstreble committed Aug 28, 2018
2 parents 8ed724e + 41bd018 commit 0906961
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions RecoVertex/VertexTools/src/SequentialVertexFitter.cc
Expand Up @@ -281,14 +281,29 @@ SequentialVertexFitter<N>::fit(const std::vector<RefCountedVertexTrack> & tracks
if(step != 0) globalVTracks = reLinearizeTracks(tracks,
returnVertex.vertexState());

bool validTracks = true;

// update sequentially the vertex estimate
for (typename std::vector<RefCountedVertexTrack>::const_iterator i
= globalVTracks.begin(); i != globalVTracks.end(); i++) {

//Check if relinearized tracks have well-defined parameters
for(auto f : (*i)->linearizedTrack()->momentumJacobian()) validTracks &= !std::isnan(f);
for(auto f : (*i)->linearizedTrack()->constantTerm()) validTracks &= !std::isnan(f);
if(!validTracks) break;

fVertex = theUpdator->add(fVertex,*i);
if (!fVertex.isValid()) break;
}

validVertex = fVertex.isValid();

if (validVertex && !validTracks) {
LogDebug("RecoVertex/SequentialVertexFitter")
<< "Relinearized tracks have Nan in momentumJacobian or constantTerm.\n";
validVertex = false;
}

// check tracker bounds and NaN in position
if (validVertex && hasNan(fVertex.position())) {
LogDebug("RecoVertex/SequentialVertexFitter")
Expand Down

0 comments on commit 0906961

Please sign in to comment.