1 | #include <TROOT.h>
|
---|
2 | #include <TGApplication.h>
|
---|
3 |
|
---|
4 | #include "MAGIC.h"
|
---|
5 |
|
---|
6 | #include "MLog.h"
|
---|
7 | #include "MLogManip.h"
|
---|
8 |
|
---|
9 | #include "MMars.h"
|
---|
10 | #include "MArray.h"
|
---|
11 | #include "MParContainer.h"
|
---|
12 |
|
---|
13 | #ifdef HAVE_XPM
|
---|
14 | #include "MLogo.h"
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | using namespace std;
|
---|
18 |
|
---|
19 | // **********************************************************************
|
---|
20 | //
|
---|
21 | // MARS main program
|
---|
22 | //
|
---|
23 | // The only job of the main program is the initialisation of ROOT and
|
---|
24 | // the start of the guiinterface for the mars program
|
---|
25 | //
|
---|
26 | // started by h. kornmayer january, 3rd 2001
|
---|
27 | static void StartUpMessage()
|
---|
28 | {
|
---|
29 | gLog << all << endl;
|
---|
30 |
|
---|
31 | // 1 2 3 4 5
|
---|
32 | // 12345678901234567890123456789012345678901234567890
|
---|
33 | gLog << "==================================================" << endl;
|
---|
34 | gLog << " MARS V" << MARSVER << endl;
|
---|
35 | gLog << " Magic Analysis and Reconstruction Software" << endl;
|
---|
36 | gLog << " Compiled on <" << __DATE__ << ">" << endl;
|
---|
37 | gLog << " Using ROOT v" << ROOTVER << endl;
|
---|
38 | gLog << "==================================================" << endl;
|
---|
39 | gLog << endl;
|
---|
40 | }
|
---|
41 |
|
---|
42 | static void Usage()
|
---|
43 | {
|
---|
44 | gLog << "Sorry the usage is:" << endl;
|
---|
45 | gLog << " mars [-v#]" << endl << endl;
|
---|
46 | gLog << " -v0: verbosity level: as less as possible" << endl;
|
---|
47 | gLog << " -v1: errors only" << endl;
|
---|
48 | gLog << " -v2: errors and warnings <default>" << endl;
|
---|
49 | gLog << " -v3: errors, warnings and infos" << endl;
|
---|
50 | }
|
---|
51 |
|
---|
52 | int main(int argc, char **argv)
|
---|
53 | {
|
---|
54 | #ifdef HAVE_XPM
|
---|
55 | MLogo logo;
|
---|
56 | logo.Popup();
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | StartUpMessage();
|
---|
60 |
|
---|
61 | TGApplication app("MarsApp", &argc, argv);
|
---|
62 | if (gROOT->IsBatch())
|
---|
63 | gROOT->SetBatch(kFALSE);
|
---|
64 |
|
---|
65 | //
|
---|
66 | // check for the right usage of the program
|
---|
67 | //
|
---|
68 | if (argc<1 || argc>2)
|
---|
69 | {
|
---|
70 | Usage();
|
---|
71 | return -1;
|
---|
72 | }
|
---|
73 |
|
---|
74 | if (argc==2)
|
---|
75 | {
|
---|
76 | if (argv[1][0]!='-' || argv[1][1]!='v')
|
---|
77 | {
|
---|
78 | Usage();
|
---|
79 | return -1;
|
---|
80 | }
|
---|
81 |
|
---|
82 | switch (argv[1][2])
|
---|
83 | {
|
---|
84 | case '0':
|
---|
85 | gLog.SetDebugLevel(0);
|
---|
86 | break;
|
---|
87 | case '1':
|
---|
88 | gLog.SetDebugLevel(1);
|
---|
89 | break;
|
---|
90 | case '2':
|
---|
91 | gLog.SetDebugLevel(2);
|
---|
92 | break;
|
---|
93 | case '3':
|
---|
94 | gLog.SetDebugLevel(3);
|
---|
95 | break;
|
---|
96 | default:
|
---|
97 | Usage();
|
---|
98 | return -1;
|
---|
99 | }
|
---|
100 | }
|
---|
101 | else
|
---|
102 | gLog.SetDebugLevel(2);
|
---|
103 |
|
---|
104 | //
|
---|
105 | // Swtich of TObjectStreamer in our base classes derived from TObject
|
---|
106 | //
|
---|
107 | MArray::Class()->IgnoreTObjectStreamer();
|
---|
108 | MParContainer::Class()->IgnoreTObjectStreamer();
|
---|
109 |
|
---|
110 | #ifdef HAVE_XPM
|
---|
111 | logo.Popdown();
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | //
|
---|
115 | // start the main window
|
---|
116 | //
|
---|
117 | new MMars;
|
---|
118 |
|
---|
119 | //
|
---|
120 | // run the application
|
---|
121 | //
|
---|
122 | app.Run();
|
---|
123 |
|
---|
124 | gLog << all << endl;
|
---|
125 |
|
---|
126 | return 0;
|
---|
127 | }
|
---|
128 |
|
---|
129 |
|
---|