Skip to content
Snippets Groups Projects

Improve FunTuple diagnostic when a Thor functor throws an exception

Merged Gerhard Raven requested to merge improve-filltuple-diagnostic into master
@@ -874,23 +874,30 @@ void FunTupleBase<T>::fill_thor_func_output( const typename LHCb::InputTypeSigna
for ( unsigned int nfunctor = 0; nfunctor < ( ptp.FunctorProps_thor() ).size(); nfunctor++ ) {
ParticleProp::FunctorProp_thor functup = ( ptp.FunctorProps_thor() )[nfunctor];
std::string fieldname = ptp.FieldName() + "_" + functup.Func_fieldname_thor;
if ( this->msgLevel( MSG::DEBUG ) ) {
debug << "fill_thor_func_output: Getting ThOr output for fieldname " << fieldname << endmsg;
}
auto val = get_thor_output( cand, nfield, nfunctor );
if ( this->msgLevel( MSG::DEBUG ) ) {
debug << "fill_thor_func_output: Booking ThOr output for fieldname " << fieldname << endmsg;
}
StatusCode sc_book = LHCb::FTuple::fill_( ntuple, fieldname, val );
if ( sc_book.isFailure() ) {
StatusCode sc = [&] {
try {
if ( this->msgLevel( MSG::DEBUG ) ) {
debug << "fill_thor_func_output: Getting ThOr output for fieldname " << fieldname << endmsg;
}
auto val = get_thor_output( cand, nfield, nfunctor );
if ( this->msgLevel( MSG::DEBUG ) ) {
debug << "fill_thor_func_output: Booking ThOr output for fieldname " << fieldname << endmsg;
}
return LHCb::FTuple::fill_( ntuple, fieldname, val );
} catch ( const GaudiException& ex ) {
err << "Encountered exception while processing field " << fieldname << ": " << ex << endmsg;
return ex.code();
}
}();
if ( sc.isFailure() ) {
using LHCb::FTuple::EC::ErrorCode;
if ( sc_book.getCode() == static_cast<StatusCode::code_t>( ErrorCode::TypeNotSupported ) ) {
if ( sc.getCode() == static_cast<StatusCode::code_t>( ErrorCode::TypeNotSupported ) ) {
err << "Value type returned by functor not supported. Problematic ThOr functor : "
<< ( *( functup.Func_thor ) ).code << " with field name: " << fieldname << endmsg;
} else {
err << "fill_thor_func_output: Unable to fill with ThOr functor: " << ( *( functup.Func_thor ) ).code
<< " with field name: " << fieldname << endmsg;
err << "The reason could be: " << sc_book.message() << endmsg;
err << "The reason could be: " << sc.message() << endmsg;
}
}
}
Loading