| 1 | #include <TROOT.h>
|
|---|
| 2 | #include <TClass.h>
|
|---|
| 3 | #include <TSystem.h>
|
|---|
| 4 | #include <TGClient.h>
|
|---|
| 5 | #include <TApplication.h>
|
|---|
| 6 | #include <TObjectTable.h>
|
|---|
| 7 |
|
|---|
| 8 | #include "MAGIC.h"
|
|---|
| 9 |
|
|---|
| 10 | #include "MLog.h"
|
|---|
| 11 | #include "MLogManip.h"
|
|---|
| 12 |
|
|---|
| 13 | //#include "MEnv.h"
|
|---|
| 14 | #include "MArgs.h"
|
|---|
| 15 | #include "MArray.h"
|
|---|
| 16 | #include "MParContainer.h"
|
|---|
| 17 | //#include "MDirIter.h"
|
|---|
| 18 |
|
|---|
| 19 | #include "TPointGui.h"
|
|---|
| 20 | //#include "MStatusDisplay.h"
|
|---|
| 21 |
|
|---|
| 22 | //#include "MSequence.h"
|
|---|
| 23 | //#include "MJStar.h"
|
|---|
| 24 |
|
|---|
| 25 | using namespace std;
|
|---|
| 26 |
|
|---|
| 27 | static void StartUpMessage()
|
|---|
| 28 | {
|
|---|
| 29 | gLog << all << endl;
|
|---|
| 30 |
|
|---|
| 31 | // 1 2 3 4 5 6
|
|---|
| 32 | // 123456789012345678901234567890123456789012345678901234567890
|
|---|
| 33 | gLog << "========================================================" << endl;
|
|---|
| 34 | gLog << " Telesto - COSY" << endl;
|
|---|
| 35 | gLog << " Telesto - Telescope TPoint organizer" << endl;
|
|---|
| 36 | gLog << " Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
|
|---|
| 37 | gLog << "========================================================" << endl;
|
|---|
| 38 | gLog << endl;
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | static void Usage()
|
|---|
| 42 | {
|
|---|
| 43 | // 1 2 3 4 5 6 7 8
|
|---|
| 44 | // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|---|
| 45 | gLog << all << endl;
|
|---|
| 46 | gLog << "Sorry the usage is:" << endl;
|
|---|
| 47 | gLog << " telestop [file.txt|file.col]" << endl << endl;
|
|---|
| 48 | gLog << " Arguments:" << endl;
|
|---|
| 49 | gLog << " n/a" << endl;
|
|---|
| 50 | gLog << " For more details see MSequence" << endl;
|
|---|
| 51 | gLog << " Root Options:" << endl;
|
|---|
| 52 | gLog << " -b Batch mode (no graphical output to screen)" << endl<<endl;
|
|---|
| 53 | gLog << " Options:" << endl;
|
|---|
| 54 | gLog.Usage();
|
|---|
| 55 | // gLog << " --debug-env=0 Disable debugging setting resources <default>" << endl;
|
|---|
| 56 | // gLog << " --debug-env[=1] Display untouched resources after program execution" << endl;
|
|---|
| 57 | // gLog << " --debug-env=2 Display untouched resources after eventloop setup" << endl;
|
|---|
| 58 | // gLog << " --debug-env=3 Debug setting resources from resource file and command line" << endl;
|
|---|
| 59 | gLog << " --debug-mem Debug memory usage" << endl << endl;
|
|---|
| 60 | // gLog << " --rc=Name:option Set or overwrite a resource of the resource file." << endl;
|
|---|
| 61 | gLog << " (Note, that this option can be used multiple times." << endl;
|
|---|
| 62 | gLog << endl;
|
|---|
| 63 | // gLog << " Input Options:" << endl;
|
|---|
| 64 | // gLog << " -mc You must use this for MC files (PRELIMINARY)" << endl << endl;
|
|---|
| 65 | gLog << " Output options:" << endl;
|
|---|
| 66 | // gLog << " -q Quit when job is finished" << endl;
|
|---|
| 67 | // gLog << " -f Force overwrite of existing files" << endl;
|
|---|
| 68 | // gLog << " -ff Force execution if not all files found" << endl;
|
|---|
| 69 | // gLog << " --ind=path Path where to search for the calibrated data (Y)" << endl;
|
|---|
| 70 | // gLog << " [default=standard path in datacenter]" << endl;
|
|---|
| 71 | // gLog << " --out=path Path to write the all results to [def=local path]" << endl;
|
|---|
| 72 | // gLog << " (overwrites --outc and --outy)" << endl;
|
|---|
| 73 | // gLog << " --no-muons Switch off Muon analysis (for fast tests)" << endl;
|
|---|
| 74 | // gLog << " --print-seq Print Sequence information" << endl;
|
|---|
| 75 | // gLog << " --print-files Print Files taken from Sequence" << endl;
|
|---|
| 76 | // gLog << " --print-found Print Files found from Sequence" << endl;
|
|---|
| 77 | // gLog << " --config=star.rc Resource file [default=star.rc]" << endl;
|
|---|
| 78 | gLog << endl;
|
|---|
| 79 | gLog << " --version, -V Show startup message with version number" << endl;
|
|---|
| 80 | gLog << " -?, -h, --help This help" << endl << endl;
|
|---|
| 81 | gLog << "Background:" << endl;
|
|---|
| 82 | gLog << " Telesto is a moon of Saturn. It was discovered by Smith, Reitsema," << endl;
|
|---|
| 83 | gLog << " Larson and Fountain in 1980 from ground-based observations, and was" << endl;
|
|---|
| 84 | gLog << " provisionally designated S/1980 S 13." << endl;
|
|---|
| 85 | gLog << " In 1983 it was officially named after Telesto of Greek mythology. It" << endl;
|
|---|
| 86 | gLog << " is also designated as Saturn XIII or Tethys B." << endl;
|
|---|
| 87 | gLog << " Telesto is co-orbital with Tethys, residing in Tethys' leading" << endl;
|
|---|
| 88 | gLog << " Lagrangian point (L4). This relationship was first identified by" << endl;
|
|---|
| 89 | gLog << " Seidelmann et al. The moon Calypso also resides in the other" << endl;
|
|---|
| 90 | gLog << " (trailing) lagrangian point of Tethys, 60 deg in the other direction." << endl;
|
|---|
| 91 | gLog << " The Cassini probe performed a distant flyby of Telesto on Oct. 11," << endl;
|
|---|
| 92 | gLog << " 2005. The resulting images show that its surface is surprisingly" << endl;
|
|---|
| 93 | gLog << " smooth, devoid of small impact craters." << endl << endl;
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | int main(int argc, char **argv)
|
|---|
| 97 | {
|
|---|
| 98 | if (!MARS::CheckRootVer())
|
|---|
| 99 | return 0xff;
|
|---|
| 100 |
|
|---|
| 101 | MLog::RedirectErrorHandler(MLog::kColor);
|
|---|
| 102 |
|
|---|
| 103 | //
|
|---|
| 104 | // Evaluate arguments
|
|---|
| 105 | //
|
|---|
| 106 | MArgs arg(argc, argv, kTRUE);
|
|---|
| 107 | gLog.Setup(arg);
|
|---|
| 108 |
|
|---|
| 109 | StartUpMessage();
|
|---|
| 110 |
|
|---|
| 111 | if (arg.HasOnly("-V") || arg.HasOnly("--version"))
|
|---|
| 112 | return 0;
|
|---|
| 113 |
|
|---|
| 114 | if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
|
|---|
| 115 | {
|
|---|
| 116 | Usage();
|
|---|
| 117 | return 2;
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | const Bool_t kDebugMem = arg.HasOnlyAndRemove("--debug-mem");
|
|---|
| 121 |
|
|---|
| 122 | //
|
|---|
| 123 | // check for the right usage of the program (number of arguments)
|
|---|
| 124 | //
|
|---|
| 125 | if (arg.GetNumArguments()>1)
|
|---|
| 126 | {
|
|---|
| 127 | gLog << warn << "WARNING - Wrong number of arguments..." << endl;
|
|---|
| 128 | Usage();
|
|---|
| 129 | return 2;
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | TString fname=arg.GetArgumentStr(0);
|
|---|
| 133 |
|
|---|
| 134 | //
|
|---|
| 135 | // check for the right usage of the program (number of options)
|
|---|
| 136 | //
|
|---|
| 137 | if (arg.GetNumOptions()>0)
|
|---|
| 138 | {
|
|---|
| 139 | gLog << warn << "WARNING - Unknown commandline options..." << endl;
|
|---|
| 140 | arg.Print("options");
|
|---|
| 141 | gLog << endl;
|
|---|
| 142 | return 2;
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | // MArray::Class()->IgnoreTObjectStreamer();
|
|---|
| 146 | // MParContainer::Class()->IgnoreTObjectStreamer();
|
|---|
| 147 |
|
|---|
| 148 | TApplication app("telesto", &argc, argv);
|
|---|
| 149 | if (!gClient || gROOT->IsBatch())
|
|---|
| 150 | {
|
|---|
| 151 | gLog << err << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
|
|---|
| 152 | return 1;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | if (kDebugMem)
|
|---|
| 156 | TObject::SetObjectStat(kTRUE);
|
|---|
| 157 |
|
|---|
| 158 | TPointGui *gui = new TPointGui(fname.IsNull()?0:(const char*)fname);
|
|---|
| 159 | gui->SetExitLoopOnClose();
|
|---|
| 160 |
|
|---|
| 161 | // Wait until the user decides to exit the application
|
|---|
| 162 | app.Run(kFALSE);
|
|---|
| 163 |
|
|---|
| 164 | if (TObject::GetObjectStat())
|
|---|
| 165 | {
|
|---|
| 166 | TObject::SetObjectStat(kFALSE);
|
|---|
| 167 | gObjectTable->Print();
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | return 0;
|
|---|
| 171 | }
|
|---|