source: tags/Mars-V0.10.3/mars.cc@ 17563

Last change on this file since 17563 was 8011, checked in by tbretz, 18 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" << ROOT_RELEASE << " 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 if (!MARS::CheckRootVer())
56 return 0xff;
57
58 //
59 // Evaluate arguments
60 //
61 MArgs arg(argc, argv, kTRUE);
62 gLog.Setup(arg);
63
64 StartUpMessage();
65
66 if (arg.HasOption("-?") || arg.HasOption("-h") || arg.GetNumArguments()>1)
67 {
68 Usage();
69 return 2;
70 }
71
72 //
73 // This is to make argv[i] more readable inside the code
74 //
75 const TString kFilename = arg.GetArgumentStr(0);
76
77#ifdef HAVE_XPM
78 MLogo logo;
79 logo.Popup();
80#endif
81
82 //
83 // initialize ROOT
84 //
85 TApplication app("mars", &argc, argv);
86 if (gROOT->IsBatch() || !gClient)
87 {
88 gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
89 return 1;
90 }
91
92 //
93 // Switch of TObject Streamer in our base classes derived from TObject
94 //
95 MArray::Class()->IgnoreTObjectStreamer();
96 MParContainer::Class()->IgnoreTObjectStreamer();
97
98#ifdef HAVE_XPM
99 logo.Popdown();
100#endif
101
102 //
103 // start the main window
104 //
105 if (kFilename.IsNull())
106 new MCameraDisplay;
107 else
108 {
109 MEventDisplay *d = new MEventDisplay(kFilename);
110 d->SetBit(MStatusDisplay::kExitLoopOnExit);
111 d->SetTitle(kFilename);
112 }
113
114 //
115 // run the application
116 //
117 app.Run();
118
119 gLog << all << endl;
120
121 return 0;
122}
123
124
Note: See TracBrowser for help on using the repository browser.