source: trunk/MagicSoft/Mars/mars.cc@ 2447

Last change on this file since 2447 was 2447, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.1 KB
Line 
1#include <TROOT.h>
2#include <TApplication.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
17using 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
27static 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
42static 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
52int main(int argc, char **argv)
53{
54#ifdef HAVE_XPM
55 MLogo logo;
56 logo.Popup();
57#endif
58
59 StartUpMessage();
60
61 TApplication app("MarsApp", &argc, argv);
62 if (gROOT->IsBatch() || !gClient)
63 {
64 gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
65 return 1;
66 }
67 /*
68 TGApplication app("MarsApp", &argc, argv);
69 if (gROOT->IsBatch())
70 gROOT->SetBatch(kFALSE);
71 */
72
73 //
74 // check for the right usage of the program
75 //
76 if (argc<1 || argc>2)
77 {
78 Usage();
79 return -1;
80 }
81
82 if (argc==2)
83 {
84 if (argv[1][0]!='-' || argv[1][1]!='v')
85 {
86 Usage();
87 return -1;
88 }
89
90 switch (argv[1][2])
91 {
92 case '0':
93 gLog.SetDebugLevel(0);
94 break;
95 case '1':
96 gLog.SetDebugLevel(1);
97 break;
98 case '2':
99 gLog.SetDebugLevel(2);
100 break;
101 case '3':
102 gLog.SetDebugLevel(3);
103 break;
104 default:
105 Usage();
106 return -1;
107 }
108 }
109 else
110 gLog.SetDebugLevel(2);
111
112 //
113 // Swtich of TObjectStreamer in our base classes derived from TObject
114 //
115 MArray::Class()->IgnoreTObjectStreamer();
116 MParContainer::Class()->IgnoreTObjectStreamer();
117
118#ifdef HAVE_XPM
119 logo.Popdown();
120#endif
121
122 //
123 // start the main window
124 //
125 new MMars;
126
127 //
128 // run the application
129 //
130 app.Run();
131
132 gLog << all << endl;
133
134 return 0;
135}
136
137
Note: See TracBrowser for help on using the repository browser.