]>
Commit | Line | Data |
---|---|---|
676fb573 | 1 | // $Id$ |
2 | // Category: global | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "AliGlobals.h" | |
c3f6816b | 7 | #include "TG4Globals.h" |
676fb573 | 8 | |
9 | #include <stdlib.h> | |
10 | ||
11 | // static data members | |
c63f260d | 12 | const G4double AliGlobals::fgkDefaultCut = 2.0*mm; |
676fb573 | 13 | |
14 | AliGlobals::AliGlobals() { | |
15 | // | |
16 | } | |
17 | ||
18 | AliGlobals::~AliGlobals() { | |
19 | // | |
20 | } | |
21 | ||
22 | // static methods | |
23 | ||
24 | void AliGlobals::Exception(const char* s) | |
25 | { | |
26 | // Prints error message end exits the program. | |
27 | // --- | |
28 | ||
29 | if (s) | |
5f1d09c5 | 30 | { G4cerr << G4endl << " " << s << G4endl; } |
31 | G4cerr << "*** AliceException: Aborting execution ***" << G4endl; | |
676fb573 | 32 | exit(1); |
33 | } | |
34 | ||
35 | void AliGlobals::Warning(const char* s) | |
36 | { | |
37 | // Prints warning message. | |
38 | // --- | |
39 | ||
5f1d09c5 | 40 | G4cerr << "+++ Alice Warning: +++" << G4endl; |
676fb573 | 41 | if (s) |
5f1d09c5 | 42 | { G4cerr << " " << s << G4endl; } |
43 | G4cerr << "++++++++++++++++++++++" << G4endl; | |
676fb573 | 44 | } |
45 | ||
46 | #ifdef G4USE_STL | |
47 | void AliGlobals::Exception(G4std::string s) { | |
48 | // | |
49 | AliGlobals::Exception(s.c_str()); | |
50 | } | |
51 | ||
52 | void AliGlobals::Exception(G4String s) { | |
53 | // | |
54 | AliGlobals::Exception(s.c_str()); | |
55 | } | |
56 | ||
57 | void AliGlobals::Warning(G4std::string s) { | |
58 | // | |
59 | AliGlobals::Warning(s.c_str()); | |
60 | } | |
61 | ||
62 | void AliGlobals::Warning(G4String s) { | |
63 | // | |
64 | AliGlobals::Warning(s.c_str()); | |
65 | } | |
66 | #endif | |
67 | ||
68 | void AliGlobals::AppendNumberToString(G4String& s, G4int a) | |
69 | { | |
70 | // Appends number to string. | |
71 | // --- | |
c3f6816b | 72 | TG4Globals::AppendNumberToString(s, a); |
5f1d09c5 | 73 | } |
676fb573 | 74 | |
75 | G4int AliGlobals::StringToInt(G4String s) | |
76 | { | |
77 | // Converts one char string to integer number. | |
78 | // --- | |
79 | ||
80 | // make better | |
81 | if (s=="0") return 0; | |
82 | if (s=="1") return 1; | |
83 | if (s=="2") return 2; | |
84 | if (s=="3") return 3; | |
85 | if (s=="4") return 4; | |
86 | if (s=="5") return 5; | |
87 | if (s=="6") return 6; | |
88 | if (s=="7") return 7; | |
89 | if (s=="8") return 8; | |
90 | if (s=="9") return 9; | |
91 | return -1; | |
92 | } | |
93 |