GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Usage of exceptions in CINT (Catching GFException seems to not work)
icon5.gif  Usage of exceptions in CINT [message #19039] Wed, 17 February 2016 12:41 Go to previous message
Philipp Bielefeldt is currently offline  Philipp Bielefeldt
Messages: 5
Registered: August 2015
Location: Universität Bonn
occasional visitor

From: *
Hi forum!
I am working on a CINT macro with FopiRoot, but I seem unable to get the exception handling done correctly. I set up a Kalman fitter kFitter and create a track that I want to process. As long as the fitter doesn't throw and exception, it seems to work -- however, in case the GFKalman fails, the following happens:

        std::cout << "Entries in Track: " << NHitsInRecoTrack << std::endl;
        catch(const GFException& e){
            std::cerr << e.what() << std::endl;
            std::cout << "[WARN    ] Exception in track procession, next track" << std::endl;
        std::cout << "[INFO    ] Processed track!" << std::endl;

This is my code -- I put an cli output just before and after the try/catch-block.
The result (in a case an exception is thrown) is:

Entries in Track: 7
GFException thrown with excString:
RKTrackRep::RKutta ==> momentum too low: 1.08513 MeV
in line: 1215 in file: /home/bielefeldt/g2fopiroot/GenfitTools/trackrep/RKTrackRep/RKTrackRep.cxx
with fatal flag 0
[INFO    ] Processed track!

Apparently, the exception is printed. But this also happens if I comment out the e.what-line; The "[WARN ]..." and the "continue" seem to be ignored. However, even if I do not ask for the exception to be printed, it will be written to console.

The CINT documentation is a bit vague, but states

Exception handling is implemented but with limitations. Object destruction may not be done properly in complex case. It is recommended not to use Exception Handling in interpreted code.

which is why I use interpreted code (loading with .L XYZ.C++).

I am quite puzzled -- maybe I am doing truly awful, but I do not understand how I am supposed to work properly with exception handling on the fitter. If anyone here can give me a little more understanding (or any useful reference), I'd be very thankful!

Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Previous Topic: GSI Annual Report
Next Topic: CHEP2016 abstract submission open!
Goto Forum:

Current Time: Wed Jan 26 06:56:19 CET 2022

Total time taken to generate the page: 0.01051 seconds