ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthAnalysisBaseComps
src
AthROOTErrorHandlerSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AthROOTErrorHandlerSvc.h
"
6
7
#include "TROOT.h"
8
9
namespace
Handler
{
10
AthROOTErrorHandlerSvc
*
svc
;
11
ErrorHandlerFunc_t
oldHandler
;
12
13
void
ErrorHandler
ATLAS_NOT_THREAD_SAFE
( Int_t level, Bool_t abort,
const
char
* location,
const
char
* message ) {
14
if
(
svc
) {
// should always be set by now
15
if
(
svc
->m_catchLevel <= level) {
16
std::ostringstream oss;
17
oss <<
"AthROOTErrorHandlerSvc detected ROOT message >= CatchLevel "
18
<<
svc
->m_catchLevel <<
" ("
<< level <<
"): "
<< location <<
" : "
<< message;
19
throw
std::runtime_error(oss.str());
20
}
21
const
auto
itr =
svc
->m_throwSources.find(location);
22
if
(itr!=
svc
->m_throwSources.end() && itr->second <= level) {
23
std::ostringstream oss;
24
oss <<
"AthROOTErrorHandlerSvc detected ROOT message from Throw Sources : "
25
<< location <<
" (level="
<< level <<
") : "
<< message;
26
throw
std::runtime_error(oss.str());
27
}
28
}
29
//now pass on to old handler
30
if
(
oldHandler
)
oldHandler
( level, abort, location, message );
31
}
32
33
}
34
35
36
AthROOTErrorHandlerSvc::AthROOTErrorHandlerSvc
(
const
std::string& name, ISvcLocator *svcLoc) :
37
AthService
(name, svcLoc) {
38
}
39
40
AthROOTErrorHandlerSvc::~AthROOTErrorHandlerSvc
() {
41
}
42
43
44
StatusCode AthROOTErrorHandlerSvc::initialize
ATLAS_NOT_THREAD_SAFE
() {
45
46
ATH_MSG_DEBUG
(
"Replacing ROOT ErrorHandler"
);
47
ErrorHandlerFunc_t
h
= ::SetErrorHandler( Handler::ErrorHandler );
48
Handler::svc
=
this
;
49
50
// if statement protects against double-initialize causing infinite loop in ErrorHandler
51
if
(
h
!= Handler::ErrorHandler) {
52
Handler::oldHandler
=
h
;
53
}
54
return
StatusCode::SUCCESS;
55
}
56
57
StatusCode
AthROOTErrorHandlerSvc::finalize
ATLAS_NOT_THREAD_SAFE
() {
58
59
ATH_MSG_DEBUG
(
"Restoring old ROOT ErrorHandler"
);
60
Handler::svc
=
nullptr
;
61
if
(
Handler::oldHandler
) ::SetErrorHandler(
Handler::oldHandler
);
62
Handler::oldHandler
=
nullptr
;
63
return
StatusCode::SUCCESS;
64
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ATLAS_NOT_THREAD_SAFE
StatusCode AthROOTErrorHandlerSvc::initialize ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
Definition
AthROOTErrorHandlerSvc.cxx:44
AthROOTErrorHandlerSvc.h
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition
checker_macros.h:212
h
Header file for AthHistogramAlgorithm.
AthROOTErrorHandlerSvc
Definition
AthROOTErrorHandlerSvc.h:42
AthROOTErrorHandlerSvc::AthROOTErrorHandlerSvc
AthROOTErrorHandlerSvc(const std::string &name, ISvcLocator *svcLoc)
Definition
AthROOTErrorHandlerSvc.cxx:36
AthROOTErrorHandlerSvc::~AthROOTErrorHandlerSvc
virtual ~AthROOTErrorHandlerSvc()
Definition
AthROOTErrorHandlerSvc.cxx:40
AthService::AthService
AthService()
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Handler
AthROOTErrorHandlerSvc: Replaces ROOT's standard error handler in order to detect Problematic ROOT is...
Definition
AthROOTErrorHandlerSvc.cxx:9
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition
AthROOTErrorHandlerSvc.cxx:10
Handler::oldHandler
ErrorHandlerFunc_t oldHandler
Definition
AthROOTErrorHandlerSvc.cxx:11
Generated on
for ATLAS Offline Software by
1.17.0