Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DANARootErrorHandler.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DANARootErrorHandler.cc
4 // Created: Mon Nov 9 16:09:14 EST 2009
5 // Creator: davidl (on Darwin Amelia.local 9.8.0 i386)
6 //
7 
8 // This is based on info found here:
9 //
10 // http://root.cern.ch/root/roottalk/roottalk02/0514.html
11 //
12 
13 #include <iostream>
14 using namespace std;
15 
16 #include <TError.h>
17 #include "DANARootErrorHandler.h"
18 
19 
21 
22 //---------------------------------
23 // InitDANARootErrorHandler
24 //---------------------------------
25 void InitDANARootErrorHandler(int my_ROOT_ERROR_LEVEL_SUPRESS)
26 {
27  ROOT_ERROR_LEVEL_SUPRESS = my_ROOT_ERROR_LEVEL_SUPRESS;
28 
29  // Register handler with ROOT
30  SetErrorHandler(DANARootErrorHandler);
31 }
32 
33 //---------------------------------
34 // DANARootErrorHandler
35 //---------------------------------
36 void DANARootErrorHandler(int lvl, bool abt, const char* loc, const char* msg)
37 {
38  // Here is the entry point for the error handler
39  if(lvl>ROOT_ERROR_LEVEL_SUPRESS || abt){
40 
41  // Check for certain messages we wish to ignore no matter what
42  string sloc(loc);
43  string smsg(msg);
44 
45  // The following is an error that occurs on occasion in the
46  // tracking code while inverting a matrix. The condition is
47  // checked for and handled there so printing of an error is
48  // unnecessary (and even a bit misleading since it is not
49  // really an error condition)
50  if(sloc == "TDecompLU::DecomposeLUCrout" && smsg == "matrix is singular") return;
51 
52  // The DRootGeom class generates several "errors" in when
53  // loading the ROOT geometry such as from the following:
54  // TGeoVolumeMulti::CheckShapes
55  // TGeoEltu::GetMakeRuntimeShape
56  // ... etc...
57  // These may real issues with the ROOT geometry, but it is
58  // not used for core reconstruction at this time so the
59  // errors are distracting.
60  if(sloc.find("TGeo") == 0) return;
61 
62  // Use normal ROOT error handler
63  DefaultErrorHandler(lvl, abt, loc, msg);
64  }
65 }
66 
static int ROOT_ERROR_LEVEL_SUPRESS
void DANARootErrorHandler(int lvl, bool abt, const char *loc, const char *msg)
void InitDANARootErrorHandler(int my_ROOT_ERROR_LEVEL_SUPRESS)