Skip to content

Tracking: Genfit exception guard #85

Open
mahmoudali2 wants to merge 2 commits into
key4hep:mainfrom
mahmoudali2:genfit-fit-exception-guard
Open

Tracking: Genfit exception guard #85
mahmoudali2 wants to merge 2 commits into
key4hep:mainfrom
mahmoudali2:genfit-fit-exception-guard

Conversation

@mahmoudali2

Copy link
Copy Markdown
Member

BEGINRELEASENOTES

Guard the whole per-track fit: a GenFit exception (e.g. an ill-conditioned covariance during the fit or the extrapolation to the IP) should skip just this track, not abort the entire event loop.

ENDRELEASENOTES

// Guard the whole per-track fit: a GenFit exception (e.g. an
// ill-conditioned covariance during the fit or the extrapolation to the
// IP) should skip just this track, not abort the entire event loop.
try {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can your try-except only cover the line that can throw an exception? You probably don't want to catch an unrelated exception, but if it happens in the big block inside the try-except you may.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jmcarcell, it's not only specific one line, but it happens when it calls ProcessTrack, which it happens multiple times through the loop.
But we can change the exception to genfit::Exception instead of std::exception, so it caches narrower and only related exceptions. What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it should probably be handled inside ProcessTrack and not outside of it, as any caller will be in the same situation. Different return codes can be returned, for example, to distinguish different cases. using genfit::Exception is definitely better.

Tagging @andread3vita

@andread3vita

Copy link
Copy Markdown
Contributor

Thank you @mahmoudali2! Do you have a reproducer for the bug you are describing?

@andread3vita

andread3vita commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thank you @mahmoudali2! Do you have a reproducer for the bug you are describing?

While testing the fitter, I checked whether the failure of a single track fit could cause the entire event processing to crash. To prevent this, I wrapped the fitting procedure in a try-catch block so that a failed fit for one track should not interrupt the processing of the rest of the event. See here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants