ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataUtil/interface/Debug.h
Revision: 1.8
Committed: Wed Sep 10 03:33:27 2008 UTC (16 years, 8 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012h, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008, Mit_008pre2, Mit_008pre1, Mit_006b, Mit_006a, Mit_006, Mit_005, Mit_004, HEAD
Branch point for: Mit_025c_branch
Changes since 1.7: +3 -3 lines
Log Message:
Cleanup

File Contents

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