Skip to content

Commit

Permalink
add check on PATLeptonTimeLifeInfoProducer closestState valid state
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobrivio committed Apr 29, 2024
1 parent 43944b8 commit 36effa5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "DataFormats/Common/interface/ValueMap.h"
#include "DataFormats/PatCandidates/interface/Electron.h"
Expand Down Expand Up @@ -169,6 +170,14 @@ void PATLeptonTimeLifeInfoProducer<T>::produceAndFillIPInfo(const T& lepton,
AnalyticalImpactPointExtrapolator extrapolator(transTrack.field());
TrajectoryStateOnSurface closestState =
extrapolator.extrapolate(transTrack.impactPointState(), RecoVertex::convertPos(pv.position()));
if (!closestState.isValid()) {
edm::LogError("PATLeptonTimeLifeInfoProducer")
<< "closestState not valid! From:\n"
<< "transTrack.impactPointState():\n"
<< transTrack.impactPointState() << "RecoVertex::convertPos(pv.position()):\n"
<< RecoVertex::convertPos(pv.position());
return;
}
GlobalPoint pca = closestState.globalPosition();
GlobalError pca_cov = closestState.cartesianError().position();
GlobalVector ip_vec = GlobalVector(pca.x() - pv.x(), pca.y() - pv.y(), pca.z() - pv.z());
Expand Down

0 comments on commit 36effa5

Please sign in to comment.