source: tags/Mars-V0.8.2/mars.cc@ 13210

Last change on this file since 13210 was 2491, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.7 KB
Line 
1#include <TApplication.h>
2
3#include "MAGIC.h"
4
5#include "MLog.h"
6#include "MLogManip.h"
7
8#include "MMars.h"
9#include "MArray.h"
10#include "MParContainer.h"
11
12#ifdef HAVE_XPM
13#include "MLogo.h"
14#endif
15
16using namespace std;
17/*
18#if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02)
19#include <TRootGuiFactory.h>
20#include <TPluginManager.h>
21void InitGuiFactory()
22{
23 if (gROOT->IsBatch())
24 gROOT->SetBatch(kFALSE);
25
26 //
27 // Must be loaded by hand, because it is not loaded by TGApplication.
28 // We could also use TApplication instead, but TApplication doesn't
29 // deal with the DISPLAY variable in a convient way.
30 //
31 TPluginHandler *h;
32 if ((h = gROOT->GetPluginManager()->FindHandler("TGuiFactory", "root")))
33 {
34 if (h->LoadPlugin() == -1)
35 return;
36 gGuiFactory = (TGuiFactory*)h->ExecPlugin(0);
37 }
38}
39#endif
40*/
41
42// **********************************************************************
43//
44// MARS main program
45//
46// The only job of the main program is the initialisation of ROOT and
47// the start of the guiinterface for the mars program
48//
49// started by h. kornmayer january, 3rd 2001
50static void StartUpMessage()
51{
52 gLog << all << endl;
53
54 // 1 2 3 4 5
55 // 12345678901234567890123456789012345678901234567890
56 gLog << "==================================================" << endl;
57 gLog << " MARS V" << MARSVER << endl;
58 gLog << " Magic Analysis and Reconstruction Software" << endl;
59 gLog << " Compiled on <" << __DATE__ << ">" << endl;
60 gLog << " Using ROOT v" << ROOTVER << endl;
61 gLog << "==================================================" << endl;
62 gLog << endl;
63}
64
65static void Usage()
66{
67 gLog << all << endl;
68 gLog << "Sorry the usage is:" << endl;
69 gLog << " mars [-v#]" << endl << endl;
70 gLog << " -v0: verbosity level: as less as possible" << endl;
71 gLog << " -v1: errors only" << endl;
72 gLog << " -v2: errors and warnings <default>" << endl;
73 gLog << " -v3: errors, warnings and infos" << endl;
74}
75
76int main(int argc, char **argv)
77{
78 StartUpMessage();
79
80 //
81 // check for the right usage of the program
82 //
83 if (argc<1 || argc>2)
84 {
85 Usage();
86 return -1;
87 }
88
89 if (argc==2)
90 {
91 if (argv[1][0]!='-' || argv[1][1]!='v')
92 {
93 Usage();
94 return -1;
95 }
96
97 switch (argv[1][2])
98 {
99 case '0':
100 gLog.SetDebugLevel(0);
101 break;
102 case '1':
103 gLog.SetDebugLevel(1);
104 break;
105 case '2':
106 gLog.SetDebugLevel(2);
107 break;
108 case '3':
109 gLog.SetDebugLevel(3);
110 break;
111 default:
112 Usage();
113 return -1;
114 }
115 }
116 else
117 gLog.SetDebugLevel(2);
118
119#ifdef HAVE_XPM
120 MLogo logo;
121 logo.Popup();
122#endif
123
124 //
125 // initialise ROOT
126 //
127 TApplication app("Mars", &argc, argv);
128 if (gROOT->IsBatch() || !gClient)
129 {
130 gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
131 return 1;
132 }
133
134 //
135 // Swtich of TObjectStreamer in our base classes derived from TObject
136 //
137 MArray::Class()->IgnoreTObjectStreamer();
138 MParContainer::Class()->IgnoreTObjectStreamer();
139
140 /*
141 TGApplication app("Mars", &argc, argv);
142
143#if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02)
144 InitGuiFactory();
145#endif
146 */
147
148#ifdef HAVE_XPM
149 logo.Popdown();
150#endif
151
152 //
153 // start the main window
154 //
155 new MMars;
156
157 //
158 // run the application
159 //
160 app.Run();
161
162 gLog << all << endl;
163
164 return 0;
165}
166
167
Note: See TracBrowser for help on using the repository browser.