Skip to content

Commit

Permalink
protect vertex tool compatibility failures with try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed Aug 23, 2022
1 parent 6340733 commit 2456648
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions DQMOffline/Alignment/src/DiMuonVertexMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
VertexDistanceXY vertTool;
double distance = vertTool.distance(mumuTransientVtx, theMainVtx).value();
double dist_err = vertTool.distance(mumuTransientVtx, theMainVtx).error();
float compatibility = vertTool.compatibility(mumuTransientVtx, theMainVtx);
float compatibility = 0.;

try {
compatibility = vertTool.compatibility(mumuTransientVtx, theMainVtx);
} catch (cms::Exception& er) {
LogTrace("DiMuonVertexMonitor") << "caught std::exception " << er.what() << std::endl;
}

hSVCompatibility_->Fill(compatibility);
hSVDist_->Fill(distance * cmToum);
Expand All @@ -182,7 +188,13 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu
VertexDistance3D vertTool3D;
double distance3D = vertTool3D.distance(mumuTransientVtx, theMainVtx).value();
double dist3D_err = vertTool3D.distance(mumuTransientVtx, theMainVtx).error();
float compatibility3D = vertTool3D.compatibility(mumuTransientVtx, theMainVtx);
float compatibility3D = 0.;

try {
compatibility3D = vertTool3D.compatibility(mumuTransientVtx, theMainVtx);
} catch (cms::Exception& er) {
LogTrace("DiMuonVertexMonitor") << "caught std::exception " << er.what() << std::endl;
}

hSVCompatibility3D_->Fill(compatibility3D);
hSVDist3D_->Fill(distance3D * cmToum);
Expand Down

0 comments on commit 2456648

Please sign in to comment.