| 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 "MArgs.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 | #if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02)
|
|---|
| 20 | #include <TRootGuiFactory.h>
|
|---|
| 21 | #include <TPluginManager.h>
|
|---|
| 22 | void InitGuiFactory()
|
|---|
| 23 | {
|
|---|
| 24 | if (gROOT->IsBatch())
|
|---|
| 25 | gROOT->SetBatch(kFALSE);
|
|---|
| 26 |
|
|---|
| 27 | //
|
|---|
| 28 | // Must be loaded by hand, because it is not loaded by TGApplication.
|
|---|
| 29 | // We could also use TApplication instead, but TApplication doesn't
|
|---|
| 30 | // deal with the DISPLAY variable in a convient way.
|
|---|
| 31 | //
|
|---|
| 32 | TPluginHandler *h;
|
|---|
| 33 | if ((h = gROOT->GetPluginManager()->FindHandler("TGuiFactory", "root")))
|
|---|
| 34 | {
|
|---|
| 35 | if (h->LoadPlugin() == -1)
|
|---|
| 36 | return;
|
|---|
| 37 | gGuiFactory = (TGuiFactory*)h->ExecPlugin(0);
|
|---|
| 38 | }
|
|---|
| 39 | }
|
|---|
| 40 | #endif
|
|---|
| 41 | */
|
|---|
| 42 |
|
|---|
| 43 | // **********************************************************************
|
|---|
| 44 | //
|
|---|
| 45 | // MARS main program
|
|---|
| 46 | //
|
|---|
| 47 | // The only job of the main program is the initialisation of ROOT and
|
|---|
| 48 | // the start of the guiinterface for the mars program
|
|---|
| 49 | //
|
|---|
| 50 | // started by h. kornmayer january, 3rd 2001
|
|---|
| 51 | static void StartUpMessage()
|
|---|
| 52 | {
|
|---|
| 53 | gLog << all << endl;
|
|---|
| 54 |
|
|---|
| 55 | // 1 2 3 4 5
|
|---|
| 56 | // 12345678901234567890123456789012345678901234567890
|
|---|
| 57 | gLog << "==================================================" << endl;
|
|---|
| 58 | gLog << " MARS V" << MARSVER << endl;
|
|---|
| 59 | gLog << " Magic Analysis and Reconstruction Software" << endl;
|
|---|
| 60 | gLog << " Compiled on <" << __DATE__ << ">" << endl;
|
|---|
| 61 | gLog << " Using ROOT v" << ROOTVER << endl;
|
|---|
| 62 | gLog << "==================================================" << endl;
|
|---|
| 63 | gLog << endl;
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | static void Usage()
|
|---|
| 67 | {
|
|---|
| 68 | gLog << all << endl;
|
|---|
| 69 | gLog << "Sorry the usage is:" << endl;
|
|---|
| 70 | gLog << " mars [-h] [-?] [-a0] [-vn]" << endl << endl;
|
|---|
| 71 | gLog << " -a0: Do not use Ansii codes." << endl;
|
|---|
| 72 | gLog << " -vn: Verbosity level n [default=2]" << endl;
|
|---|
| 73 | gLog << " -?/-h: This help" << endl << endl;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | int main(int argc, char **argv)
|
|---|
| 77 | {
|
|---|
| 78 | StartUpMessage();
|
|---|
| 79 |
|
|---|
| 80 | //
|
|---|
| 81 | // Evaluate arguments
|
|---|
| 82 | //
|
|---|
| 83 | MArgs arg(argc, argv);
|
|---|
| 84 |
|
|---|
| 85 | if (arg.HasOption("-?") || arg.HasOption("-h"))
|
|---|
| 86 | {
|
|---|
| 87 | Usage();
|
|---|
| 88 | return -1;
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | //
|
|---|
| 92 | // Set verbosity to highest level.
|
|---|
| 93 | //
|
|---|
| 94 | gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
|
|---|
| 95 |
|
|---|
| 96 | if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0)
|
|---|
| 97 | gLog.SetNoColors();
|
|---|
| 98 |
|
|---|
| 99 | #ifdef HAVE_XPM
|
|---|
| 100 | MLogo logo;
|
|---|
| 101 | logo.Popup();
|
|---|
| 102 | #endif
|
|---|
| 103 |
|
|---|
| 104 | //
|
|---|
| 105 | // initialise ROOT
|
|---|
| 106 | //
|
|---|
| 107 | TApplication app("Mars", &argc, argv);
|
|---|
| 108 | if (gROOT->IsBatch() || !gClient)
|
|---|
| 109 | {
|
|---|
| 110 | gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
|
|---|
| 111 | return 1;
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | //
|
|---|
| 115 | // Swtich of TObjectStreamer in our base classes derived from TObject
|
|---|
| 116 | //
|
|---|
| 117 | MArray::Class()->IgnoreTObjectStreamer();
|
|---|
| 118 | MParContainer::Class()->IgnoreTObjectStreamer();
|
|---|
| 119 |
|
|---|
| 120 | /*
|
|---|
| 121 | TGApplication app("Mars", &argc, argv);
|
|---|
| 122 |
|
|---|
| 123 | #if ROOT_VERSION_CODE < ROOT_VERSION(3,10,02)
|
|---|
| 124 | InitGuiFactory();
|
|---|
| 125 | #endif
|
|---|
| 126 | */
|
|---|
| 127 |
|
|---|
| 128 | #ifdef HAVE_XPM
|
|---|
| 129 | logo.Popdown();
|
|---|
| 130 | #endif
|
|---|
| 131 |
|
|---|
| 132 | //
|
|---|
| 133 | // start the main window
|
|---|
| 134 | //
|
|---|
| 135 | new MMars;
|
|---|
| 136 |
|
|---|
| 137 | //
|
|---|
| 138 | // run the application
|
|---|
| 139 | //
|
|---|
| 140 | app.Run();
|
|---|
| 141 |
|
|---|
| 142 | gLog << all << endl;
|
|---|
| 143 |
|
|---|
| 144 | return 0;
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|