1 |
loizides |
1.3 |
// $Id: Debug.h,v 1.2 2008/05/27 19:59:54 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#ifndef DATAUTIL_DEBUG_H
|
4 |
|
|
#define DATAUTIL_DEBUG_H
|
5 |
|
|
|
6 |
|
|
#include <Rtypes.h>
|
7 |
|
|
#include <TError.h>
|
8 |
|
|
|
9 |
|
|
//--------------------------------------------------------------------------------------------------
|
10 |
|
|
//
|
11 |
|
|
// Debug
|
12 |
|
|
//
|
13 |
|
|
// Detailed logging / debug scheme:
|
14 |
|
|
// This class defines the debuging masks (EDebugMask), which
|
15 |
|
|
// are used with the MDB (MIT DeBug) macro together with
|
16 |
|
|
// the log levels to control the verbosity.
|
17 |
|
|
// As a rule of thumb:
|
18 |
|
|
// level 1 and 2 should not be used in (event) loops,
|
19 |
|
|
// level 3 and 4 might be used in loops.
|
20 |
|
|
// Please, do not introduce more levels!
|
21 |
|
|
//
|
22 |
|
|
// Authors: C.Loizides
|
23 |
|
|
//
|
24 |
|
|
//--------------------------------------------------------------------------------------------------
|
25 |
|
|
|
26 |
loizides |
1.2 |
namespace mithep
|
27 |
|
|
{
|
28 |
loizides |
1.1 |
class Debug
|
29 |
|
|
{
|
30 |
|
|
public:
|
31 |
|
|
enum EDebugMask {
|
32 |
|
|
kNone = 0,
|
33 |
|
|
kGeneral = 1,
|
34 |
|
|
kTreeIO = 2,
|
35 |
|
|
kAnalysis = 4,
|
36 |
|
|
kModules = 8,
|
37 |
|
|
kAll = 0xFFFFFFFF
|
38 |
|
|
};
|
39 |
|
|
private:
|
40 |
|
|
Debug();
|
41 |
|
|
virtual ~Debug() {}
|
42 |
|
|
Debug(const Debug &cpy);
|
43 |
|
|
|
44 |
|
|
ClassDef(Debug, 0) // Defines different debug masks
|
45 |
loizides |
1.2 |
|
46 |
|
|
};
|
47 |
|
|
|
48 |
loizides |
1.3 |
}
|
49 |
loizides |
1.1 |
|
50 |
|
|
R__EXTERN mithep::Debug::EDebugMask gDebugMask;
|
51 |
|
|
R__EXTERN Int_t gDebugLevel;
|
52 |
|
|
|
53 |
|
|
#define MDB(mask,level) \
|
54 |
|
|
if ((mithep::Debug::mask & gDebugMask) && gDebugLevel >= (level))
|
55 |
|
|
|
56 |
|
|
#define MitAssert(f,e) \
|
57 |
|
|
if (!(e)) Fatal(f, kAssertMsg, _QUOTE_(e), __LINE__, __FILE__)
|
58 |
|
|
|
59 |
|
|
#define MitAssertStatic(f,e) \
|
60 |
|
|
if (!(e)) ::Fatal(f, kAssertMsg, _QUOTE_(e), __LINE__, __FILE__)
|
61 |
|
|
|
62 |
loizides |
1.3 |
#endif
|