ATLAS Offline Software
AthROOTErrorHandlerSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef __ATHROOTERRORHANDLERSVC__
6 #define __ATHROOTERRORHANDLERSVC__
7 
10 
17 
18 /*Here's an example of how to include in an athena job options:
19 
20 theApp.CreateSvc += ["AthROOTErrorHandlerSvc"]
21 
22 */
23 
24 /*Here's an example test for the ROOT prompt:
25 
26 AAH::initGaudi();
27 ServiceHandle<IService> s("AthROOTErrorHandlerSvc","");
28 std::map<std::string, int> sources; sources["test1"] = kError;
29 AAH::setProperty( s , "ThrowSources", sources )
30 s->initialize();
31 Error("aaa","bbb"); //should be ok
32 Error("test1","hello"); //should throw exception
33 
34 */
35 
36 #include "TError.h"
37 
38 namespace Handler {
39  void ErrorHandler ATLAS_NOT_THREAD_SAFE ( Int_t level, Bool_t abort, const char* location, const char* message );
40 }
41 
43 
44 public:
45  friend void Handler::ErrorHandler( Int_t level, Bool_t abort, const char* location, const char* message );
46 
47  AthROOTErrorHandlerSvc(const std::string& name, ISvcLocator *svcLoc);
48  virtual ~AthROOTErrorHandlerSvc();
49 
52 
53 private:
54 
55  Gaudi::Property<int> m_catchLevel{
56  this, "CatchLevel", kFatal+1,
57  "Throw runtime error for all messages at this level or HIGHER"};
58 
59  Gaudi::Property<std::map<std::string,int>> m_throwSources{
60  this, "ThrowSources", {{"TBranch::GetBasket", kError},
61  {"TFile::ReadBuffer", kError}},
62  "Map from source to error level. Any message at level or HIGHER will trigger runtime error"};
63 };
64 
65 
66 #endif
67 
Handler
AthROOTErrorHandlerSvc: Replaces ROOT's standard error handler in order to detect Problematic ROOT is...
Definition: AthROOTErrorHandlerSvc.cxx:9
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
initialize
void initialize()
Definition: run_EoverP.cxx:894
AthROOTErrorHandlerSvc::AthROOTErrorHandlerSvc
AthROOTErrorHandlerSvc(const std::string &name, ISvcLocator *svcLoc)
Definition: AthROOTErrorHandlerSvc.cxx:36
AthROOTErrorHandlerSvc
Definition: AthROOTErrorHandlerSvc.h:42
AthROOTErrorHandlerSvc::m_throwSources
Gaudi::Property< std::map< std::string, int > > m_throwSources
Definition: AthROOTErrorHandlerSvc.h:59
ReweightUtils.message
message
Definition: ReweightUtils.py:15
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
AthROOTErrorHandlerSvc::ATLAS_NOT_THREAD_SAFE
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE() override
Handler::ATLAS_NOT_THREAD_SAFE
void ErrorHandler ATLAS_NOT_THREAD_SAFE(Int_t level, Bool_t abort, const char *location, const char *message)
Definition: AthROOTErrorHandlerSvc.cxx:13
AthROOTErrorHandlerSvc::~AthROOTErrorHandlerSvc
virtual ~AthROOTErrorHandlerSvc()
Definition: AthROOTErrorHandlerSvc.cxx:40
Analysis::kError
@ kError
Definition: CalibrationDataVariables.h:60
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthService
Definition: AthService.h:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AthROOTErrorHandlerSvc::m_catchLevel
Gaudi::Property< int > m_catchLevel
Definition: AthROOTErrorHandlerSvc.h:55
AthService.h
AthROOTErrorHandlerSvc::ErrorHandler
friend void Handler::ErrorHandler(Int_t level, Bool_t abort, const char *location, const char *message)
AthROOTErrorHandlerSvc::ATLAS_NOT_THREAD_SAFE
virtual StatusCode finalize ATLAS_NOT_THREAD_SAFE() override
checker_macros.h
Define macros for attributes used to control the static checker.