StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuDebug.h
1 /***********************************************************************
2  *
3  * StMuDebug.h,v 1.0 1999/09/07
4  * Authors: Frank Laue, BNL, laue@bnl.gov
5  *
6  ***********************************************************************/
7 
8 #ifndef StMuDebug_h
9 #define StMuDebug_h
10 
11 #include "TObject.h"
12 
13 #if defined(__GNUC__) && ! defined(__CINT__)
14 # define __PRETTYF__ __PRETTY_FUNCTION__
15 #else
16 # define __PRETTYF__ __FILE__
17 #endif
18 
19 
20 
21 #ifndef FORCEDDEBUGMESSAGE
22 #define FORCEDDEBUGMESSAGE(x) cout << "##### " << __PRETTYF__ << " ##### " << x << endl;
23 #define DEBUGMESSAGE(x) if (StMuDebug::level()> 0) cout << "##### " << __PRETTYF__ << " ##### " << x << endl;
24 #define DEBUGMESSAGE1(x) if (StMuDebug::level()>=1) cout << "##### " << __PRETTYF__ << " ##### " << x << endl;
25 #define DEBUGMESSAGE2(x) if (StMuDebug::level()>=2) cout << "##### " << __PRETTYF__ << " ##### " << x << endl;
26 #define DEBUGMESSAGE3(x) if (StMuDebug::level()>=3) cout << "##### " << __PRETTYF__ << " ##### " << x << endl;
27 #endif
28 
29 #ifndef FORCEDDEBUGVALUE
30 #define FORCEDDEBUGVALUE(x) cout << "##### " << __PRETTYF__ << " ##### " << (#x) << "=" << x << endl;
31 #define DEBUGVALUE(x) if (StMuDebug::level()> 0) cout << "##### " << __PRETTYF__ << " ##### " << (#x) << "=" << x << endl;
32 #define DEBUGVALUE1(x) if (StMuDebug::level()>=1) cout << "##### " << __PRETTYF__ << " ##### " << (#x) << "=" << x << endl;
33 #define DEBUGVALUE2(x) if (StMuDebug::level()>=2) cout << "##### " << __PRETTYF__ << " ##### " << (#x) << "=" << x << endl;
34 #define DEBUGVALUE3(x) if (StMuDebug::level()>=3) cout << "##### " << __PRETTYF__ << " ##### " << (#x) << "=" << x << endl;
35 #endif
36 
37 #ifndef IFDEBUG
38 #define IFDEBUG(x) if (StMuDebug::level()> 0) { DEBUGMESSAGE(""); (x);}
39 #define IFDEBUG1(x) if (StMuDebug::level()>=1) { DEBUGMESSAGE(""); (x);}
40 #define IFDEBUG2(x) if (StMuDebug::level()>=2) { DEBUGMESSAGE(""); (x);}
41 #define IFDEBUG3(x) if (StMuDebug::level()>=3) { DEBUGMESSAGE(""); (x);}
42 #endif
43 
66 class StMuDebug : public TObject{
67  public:
68  StMuDebug() {};
69  ~StMuDebug() {};
70 
72  static void on() { mDebug = absolut(mDebug); }
74  static void setLevel(unsigned int level) { mDebug=level; }
76  static void off() { mDebug = -1*absolut(mDebug); }
78  static int level() { return mDebug;}
79  protected:
81  static int absolut(int i) { return (i>0) ? i : -i; }
83  static int mDebug;
84  ClassDef(StMuDebug,1)
85 };
86 
87 #endif
88 
89 /***********************************************************************
90  *
91  * $Log: StMuDebug.h,v $
92  * Revision 1.8 2021/05/12 00:02:36 perev
93  * WarnOff
94  *
95  * Revision 1.7 2004/05/02 04:10:13 perev
96  * private => protected
97  *
98  * Revision 1.6 2004/02/17 04:56:36 jeromel
99  * Extended help, added crs support, restored __GNUC__ for PRETTY_FUNCTION(checked once
100  * more and yes, it is ONLY defined in GCC and so is __FUCTION__), use of a consistent
101  * internal __PRETTYF__, return NULL if no case selected (+message) and protected against
102  * NULL mChain.
103  *
104  * Revision 1.5 2003/09/19 01:45:18 jeromel
105  * A few problems hopefully fixed i.e. one constructor lacked zeroing
106  * emcArrays were not zeroed, mStMuDst not zeroed.
107  * For maintainability zeroArrays() added.
108  *
109  * Revision 1.4 2002/08/27 19:05:56 laue
110  * Minor updates to make the muDst from simulation work
111  *
112  * Revision 1.3 2002/08/20 19:55:48 laue
113  * Doxygen comments added
114  *
115  * Revision 1.2 2002/04/11 14:19:30 laue
116  * - update for RH 7.2
117  * - decrease default arrays sizes
118  * - add data base readerfor number of events in a file
119  *
120  * Revision 1.1 2002/03/08 17:04:17 laue
121  * initial revision
122  *
123  *
124  ***********************************************************************/
static void off()
switch of debug level, but remember last
Definition: StMuDebug.h:76
static int absolut(int i)
returns the absolute of the debug level
Definition: StMuDebug.h:81
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
static int mDebug
debug level
Definition: StMuDebug.h:83
static int level()
returns debug level
Definition: StMuDebug.h:78
static void on()
switch debug output on ( to last known level)
Definition: StMuDebug.h:72