source: trunk/MagicSoft/Mars/showplot.cc@ 4775

Last change on this file since 4775 was 4722, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 2.1 KB
Line 
1#include <TROOT.h>
2#include <TClass.h>
3#include <TGClient.h>
4#include <TApplication.h>
5
6#include "MLog.h"
7#include "MLogManip.h"
8
9#include "MArgs.h"
10
11#include "MStatusDisplay.h"
12
13using namespace std;
14
15static void StartUpMessage()
16{
17 // 1 2 3 4 5
18 // 12345678901234567890123456789012345678901234567890
19 gLog << endl;
20 gLog << "showplot --- Mars V" << MARSVER << " compiled on <" << __DATE__ << "> using ROOT v" << ROOTVER << endl;
21 gLog << endl;
22}
23
24static void Usage()
25{
26 // 1 2 3 4 5 6 7 8
27 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
28 gLog << all << endl;
29 gLog << "Sorry the usage is:" << endl;
30 gLog << " showplot filename" << endl << endl;
31 gLog << "Description:" << endl;
32 gLog << " Use showplot to display a MStatusArray in an MStatusDisplay." << endl;
33 gLog << " MStatusArrays are typically written by programs showing data" << endl;
34 gLog << " check plots, like callisto." << endl;
35 gLog << endl;
36}
37
38int main(int argc, char **argv)
39{
40 StartUpMessage();
41
42 //
43 // Evaluate arguments
44 //
45 MArgs arg(argc, argv);
46
47 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
48 {
49 Usage();
50 return -1;
51 }
52
53 //
54 // check for the right usage of the program
55 //
56 if (arg.GetNumArguments()!=1)
57 {
58 Usage();
59 return -1;
60 }
61
62 const TString kInput = arg.GetArgumentStr(0);
63
64 TApplication app("Callisto", &argc, argv);
65 if (gROOT->IsBatch() || !gClient)
66 {
67 gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
68 return 1;
69 }
70
71 //
72 // Update frequency by default = 1Hz
73 //
74 MStatusDisplay *d = new MStatusDisplay;
75
76 // From now on each 'Exit' means: Terminate the application
77 d->SetTitle(kInput);
78 d->Open(kInput);
79
80 // From now on each 'Close' means: Terminate the application
81 d->SetBit(MStatusDisplay::kExitLoopOnClose);
82
83 // Wait until the user decides to exit the application
84 app.Run(kFALSE);
85 return 0;
86}
Note: See TracBrowser for help on using the repository browser.