]>
Commit | Line | Data |
---|---|---|
0145e89a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | ||
18 | /// \ingroup graphics | |
19 | /// \file mchview.cxx | |
20 | /// \brief Tracker visualization program | |
21 | /// | |
22 | /// \author Laurent Aphecetche, Subatech | |
23 | ||
24 | ||
90037e4e | 25 | #include "AliMUONMchViewApplication.h" |
1ffbeb9d | 26 | |
0145e89a | 27 | #include "AliCDBManager.h" |
28 | #include "AliCodeTimer.h" | |
29 | #include "AliLog.h" | |
1ffbeb9d | 30 | #include "AliMUONPainterHelper.h" |
31 | #include <Riostream.h> | |
90037e4e | 32 | #include <TObjArray.h> |
33 | #include <TObjString.h> | |
1ffbeb9d | 34 | #include <TROOT.h> |
35 | #include <TStyle.h> | |
0145e89a | 36 | |
90037e4e | 37 | //______________________________________________________________________________ |
38 | Int_t Usage() | |
0145e89a | 39 | { |
90037e4e | 40 | /// Printout available options of the program |
41 | cout << "mchview " << endl; | |
42 | cout << " --version : shows the current version of the program" << endl; | |
49419555 | 43 | cout << " --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl; |
1ffbeb9d | 44 | cout << " --geometry #x#+#+# : manually specify the geometry of the window, ala X11..., e.g. --geometry 1280x900+1600+0 will" << endl; |
45 | cout << " get a window of size 1280x900, located at (1600,0) from the top-left of the (multihead) display " << endl; | |
90037e4e | 46 | return -1; |
47 | } | |
0145e89a | 48 | |
90037e4e | 49 | //______________________________________________________________________________ |
50 | int main(int argc, char** argv) | |
51 | { | |
52 | /// Main function for the program | |
53 | TObjArray args; | |
0145e89a | 54 | |
90037e4e | 55 | for ( int i = 1; i < argc; ++i ) |
56 | { | |
57 | args.Add(new TObjString(argv[i])); | |
58 | } | |
0145e89a | 59 | |
90037e4e | 60 | Int_t nok(0); |
0145e89a | 61 | |
49419555 | 62 | TObjArray filesToOpen; |
1ffbeb9d | 63 | Bool_t isGeometryFixed(kFALSE); |
64 | Int_t gix, giy; | |
65 | Int_t gox,goy; | |
66 | ||
90037e4e | 67 | for ( Int_t i = 0; i <= args.GetLast(); ++i ) |
68 | { | |
69 | TString a(static_cast<TObjString*>(args.At(i))->String()); | |
70 | if ( a == "--version" ) | |
71 | { | |
72 | cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl; | |
73 | ++nok; | |
74 | return 0; | |
75 | } | |
10eb3d17 | 76 | if ( a == "--use" && i < args.GetLast() ) |
77 | { | |
49419555 | 78 | filesToOpen.Add(args.At(i+1)); |
10eb3d17 | 79 | ++i; |
80 | nok += 2; | |
81 | } | |
1ffbeb9d | 82 | else if ( a == "--geometry" ) |
83 | { | |
84 | isGeometryFixed = kTRUE; | |
85 | TString g(static_cast<TObjString*>(args.At(i+1))->String()); | |
86 | sscanf(g.Data(),"%dx%d+%d+%d",&gix,&giy,&gox,&goy); | |
87 | nok += 2; | |
88 | ++i; | |
89 | } | |
90 | ||
10eb3d17 | 91 | else |
92 | { | |
93 | return Usage(); | |
94 | } | |
90037e4e | 95 | } |
0145e89a | 96 | |
90037e4e | 97 | if ( nok < args.GetLast() ) |
98 | { | |
99 | return Usage(); | |
100 | } | |
0145e89a | 101 | |
1ffbeb9d | 102 | AliWarningGeneral("main","FIXME ? Remove default storage and run number from here..."); |
0145e89a | 103 | |
162637e4 | 104 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
0145e89a | 105 | AliCDBManager::Instance()->SetRun(0); |
90037e4e | 106 | |
107 | gROOT->SetStyle("Plain"); | |
0145e89a | 108 | gStyle->SetPalette(1); |
0145e89a | 109 | Int_t n = gStyle->GetNumberOfColors(); |
0145e89a | 110 | Int_t* colors = new Int_t[n+2]; |
0145e89a | 111 | for ( Int_t i = 1; i <= n; ++i ) |
112 | { | |
113 | colors[i] = gStyle->GetColorPalette(i-1); | |
114 | } | |
0145e89a | 115 | colors[0] = 0; |
116 | colors[n+1] = 1; | |
0145e89a | 117 | gStyle->SetPalette(n+2,colors); |
0145e89a | 118 | delete[] colors; |
1ffbeb9d | 119 | |
120 | UInt_t w(0); | |
121 | UInt_t h(0); | |
122 | UInt_t ox(0); | |
123 | UInt_t oy(0); | |
124 | ||
125 | if ( isGeometryFixed ) | |
126 | { | |
127 | w = gix; | |
128 | h = giy; | |
129 | ox = gox; | |
130 | oy = goy; | |
131 | } | |
0145e89a | 132 | |
1ffbeb9d | 133 | AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, w,h,gox,goy); |
90037e4e | 134 | |
0145e89a | 135 | AliCodeTimer::Instance()->Print(); |
136 | ||
49419555 | 137 | TIter next(&filesToOpen); |
138 | TObjString* s; | |
139 | while ( ( s = static_cast<TObjString*>(next()) ) ) | |
140 | { | |
141 | theApp->Open(s->String().Data()); | |
142 | } | |
10eb3d17 | 143 | |
0145e89a | 144 | // --- Start the event loop --- |
145 | theApp->Run(kTRUE); | |
146 | ||
147 | AliMUONPainterHelper::Instance()->Save(); | |
148 | } |