| 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 |  | 
|---|
| 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 |  | 
|---|
| 28 | void Usage() | 
|---|
| 29 | { | 
|---|
| 30 | gLog << "Sorry the usage is:" << endl; | 
|---|
| 31 | gLog << "   mars [-v#]" << endl << endl; | 
|---|
| 32 | gLog << "     -v0: verbosity level: as less as possible" << endl; | 
|---|
| 33 | gLog << "     -v1: errors only"                          << endl; | 
|---|
| 34 | gLog << "     -v2: errors and warnings <default>"        << endl; | 
|---|
| 35 | gLog << "     -v3: errors, warnings and infos"           << endl; | 
|---|
| 36 | } | 
|---|
| 37 |  | 
|---|
| 38 | void StartUpMessage() | 
|---|
| 39 | { | 
|---|
| 40 | gLog << all << endl; | 
|---|
| 41 |  | 
|---|
| 42 | //                1         2         3         4         5 | 
|---|
| 43 | //       12345678901234567890123456789012345678901234567890 | 
|---|
| 44 | gLog << "==================================================" << endl; | 
|---|
| 45 | gLog << "                    MARS V" << MARSVER << "                      " << endl; | 
|---|
| 46 | gLog << "    Magic Analysis and Reconstruction Software    " << endl; | 
|---|
| 47 | gLog << "            Compiled on <" << __DATE__ << ">"       << endl; | 
|---|
| 48 | gLog << "               Using ROOT v" << ROOTVER             << endl; | 
|---|
| 49 | gLog << "==================================================" << endl; | 
|---|
| 50 | gLog << endl; | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | int main(int argc, char **argv) | 
|---|
| 54 | { | 
|---|
| 55 | #ifdef HAVE_XPM | 
|---|
| 56 | MLogo logo; | 
|---|
| 57 | logo.Popup(); | 
|---|
| 58 | #endif | 
|---|
| 59 |  | 
|---|
| 60 | StartUpMessage(); | 
|---|
| 61 |  | 
|---|
| 62 | // | 
|---|
| 63 | // check for the right usage of the program | 
|---|
| 64 | // | 
|---|
| 65 | if (argc<1 || argc>2) | 
|---|
| 66 | { | 
|---|
| 67 | Usage(); | 
|---|
| 68 | return -1; | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | if (argc==2) | 
|---|
| 72 | { | 
|---|
| 73 | if (argv[1][0]!='-' || argv[1][1]!='v') | 
|---|
| 74 | { | 
|---|
| 75 | Usage(); | 
|---|
| 76 | return -1; | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | switch (argv[1][2]) | 
|---|
| 80 | { | 
|---|
| 81 | case '0': | 
|---|
| 82 | gLog.SetDebugLevel(0); | 
|---|
| 83 | break; | 
|---|
| 84 | case '1': | 
|---|
| 85 | gLog.SetDebugLevel(1); | 
|---|
| 86 | break; | 
|---|
| 87 | case '2': | 
|---|
| 88 | gLog.SetDebugLevel(2); | 
|---|
| 89 | break; | 
|---|
| 90 | case '3': | 
|---|
| 91 | gLog.SetDebugLevel(3); | 
|---|
| 92 | break; | 
|---|
| 93 | default: | 
|---|
| 94 | Usage(); | 
|---|
| 95 | return -1; | 
|---|
| 96 | } | 
|---|
| 97 | } | 
|---|
| 98 | else | 
|---|
| 99 | gLog.SetDebugLevel(2); | 
|---|
| 100 |  | 
|---|
| 101 | // | 
|---|
| 102 | // Swtich of TObjectStreamer in our base classes derived from TObject | 
|---|
| 103 | // | 
|---|
| 104 | MArray::Class()->IgnoreTObjectStreamer(); | 
|---|
| 105 | MParContainer::Class()->IgnoreTObjectStreamer(); | 
|---|
| 106 |  | 
|---|
| 107 | // | 
|---|
| 108 | // initialise ROOT | 
|---|
| 109 | // | 
|---|
| 110 | TROOT simple("mars", "MARS - Magic Analysis and Reconstruction Software"); | 
|---|
| 111 |  | 
|---|
| 112 | TApplication app("MarsApp", &argc, argv); | 
|---|
| 113 |  | 
|---|
| 114 | #ifdef HAVE_XPM | 
|---|
| 115 | logo.Popdown(); | 
|---|
| 116 | #endif | 
|---|
| 117 |  | 
|---|
| 118 | // | 
|---|
| 119 | // start the main window | 
|---|
| 120 | // | 
|---|
| 121 | new MMars; | 
|---|
| 122 |  | 
|---|
| 123 | // | 
|---|
| 124 | // run the application | 
|---|
| 125 | // | 
|---|
| 126 | app.Run(); | 
|---|
| 127 |  | 
|---|
| 128 | gLog << all << endl; | 
|---|
| 129 |  | 
|---|
| 130 | return 0; | 
|---|
| 131 | } | 
|---|
| 132 |  | 
|---|
| 133 |  | 
|---|