source: tags/Mars-V0.9.5/mars.cc@ 19146

Last change on this file since 19146 was 7432, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.7 KB
Line 
1#include <TApplication.h>
2
3#include "MAGIC.h"
4
5#include "MLog.h"
6#include "MLogManip.h"
7
8#include "MArgs.h"
9#include "MArray.h"
10#include "MParContainer.h"
11
12#ifdef HAVE_XPM
13#include "MLogo.h"
14#endif
15
16#include "MCameraDisplay.h"
17#include "MEventDisplay.h"
18
19using namespace std;
20
21// **********************************************************************
22//
23// MARS main program
24//
25// The only job of the main program is the initialization of ROOT and
26// the start of the GUI interface for the mars program
27//
28// started by h. kornmayer january, 3rd 2001
29static void StartUpMessage()
30{
31 gLog << all << endl;
32
33 // 1 2 3 4 5
34 // 12345678901234567890123456789012345678901234567890
35 gLog << "==================================================" << endl;
36 gLog << " MARS V" << MARSVER << endl;
37 gLog << " Magic Analysis and Reconstruction Software" << endl;
38 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl;
39 gLog << "==================================================" << endl;
40 gLog << endl;
41}
42
43static void Usage()
44{
45 gLog << all << endl;
46 gLog << "Sorry the usage is:" << endl;
47 gLog << " mars [options] [filename]" << endl << endl;
48 gLog << " Options:" << endl;
49 gLog.Usage();
50 gLog << " -?/-h: This help" << endl << endl;
51}
52
53int main(int argc, char **argv)
54{
55 //
56 // Evaluate arguments
57 //
58 MArgs arg(argc, argv, kTRUE);
59 gLog.Setup(arg);
60
61 StartUpMessage();
62
63 if (arg.HasOption("-?") || arg.HasOption("-h") || arg.GetNumArguments()>1)
64 {
65 Usage();
66 return 2;
67 }
68
69 //
70 // This is to make argv[i] more readable inside the code
71 //
72 const TString kFilename = arg.GetArgumentStr(0);
73
74#ifdef HAVE_XPM
75 MLogo logo;
76 logo.Popup();
77#endif
78
79 //
80 // initialize ROOT
81 //
82 TApplication app("mars", &argc, argv);
83 if (gROOT->IsBatch() || !gClient)
84 {
85 gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
86 return 1;
87 }
88
89 //
90 // Switch of TObject Streamer in our base classes derived from TObject
91 //
92 MArray::Class()->IgnoreTObjectStreamer();
93 MParContainer::Class()->IgnoreTObjectStreamer();
94
95#ifdef HAVE_XPM
96 logo.Popdown();
97#endif
98
99 //
100 // start the main window
101 //
102 if (kFilename.IsNull())
103 new MCameraDisplay;
104 else
105 {
106 MEventDisplay *d = new MEventDisplay(kFilename);
107 d->SetBit(MStatusDisplay::kExitLoopOnExit);
108 d->SetTitle(kFilename);
109 }
110
111 //
112 // run the application
113 //
114 app.Run();
115
116 gLog << all << endl;
117
118 return 0;
119}
120
121
Note: See TracBrowser for help on using the repository browser.