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