Skip to content

Commit 7693d30

Browse files
committed
Protect against invalid trajectory state on surface in STA muon reco
1 parent 1234e95 commit 7693d30

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

RecoMuon/StandAloneTrackFinder/src/StandAloneMuonFilter.cc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,12 @@ void StandAloneMuonFilter::refit(const TrajectoryStateOnSurface& initialTSOS,
233233
LogTrace(metname) << "search Trajectory Measurement from: " << lastTSOS.globalPosition();
234234

235235
// pick the best measurement from each group
236-
std::vector<TrajectoryMeasurement> bestMeasurements = findBestMeasurements(*layer, lastTSOS);
236+
std::vector<TrajectoryMeasurement> bestMeasurements{};
237+
238+
if (lastTSOS.isValid())
239+
bestMeasurements = findBestMeasurements(*layer, lastTSOS);
240+
else
241+
edm::LogInfo(metname) << "Invalid last TSOS, will not find best measurements ";
237242

238243
// RB: Different ways can be choosen if no bestMeasurement is available:
239244
// 1- check on lastTSOS-initialTSOS eta difference
@@ -251,15 +256,23 @@ void StandAloneMuonFilter::refit(const TrajectoryStateOnSurface& initialTSOS,
251256
if (bestMeasurements.empty() && lastdEta > 0.1) {
252257
LogTrace(metname) << "No measurement and big eta variation wrt seed" << endl
253258
<< "trying with lastButOneUpdatedTSOS";
254-
bestMeasurements = findBestMeasurements(*layer, theLastButOneUpdatedTSOS);
259+
260+
if (theLastButOneUpdatedTSOS.isValid())
261+
bestMeasurements = findBestMeasurements(*layer, theLastButOneUpdatedTSOS);
262+
else
263+
edm::LogInfo(metname) << "Invalid last but one updated TSOS, will not find best measurements ";
255264
}
256265

257266
//if no measurement found and the current FTS has an eta very different
258267
//wrt the initial one (i.e. seed), then try to find the measurements
259268
//according to the initial FTS. (1A)
260269
if (bestMeasurements.empty() && lastdEta > 0.1) {
261270
LogTrace(metname) << "No measurement and big eta variation wrt seed" << endl << "tryng with seed TSOS";
262-
bestMeasurements = findBestMeasurements(*layer, initialTSOS);
271+
272+
if (initialTSOS.isValid())
273+
bestMeasurements = findBestMeasurements(*layer, initialTSOS);
274+
else
275+
edm::LogInfo(metname) << "Invalid initial TSOS, will not find best measurements ";
263276
}
264277

265278
// FIXME: uncomment this line!!

0 commit comments

Comments
 (0)