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