]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mchview.cxx
Some cleanup in the makefiles
[u/mrichter/AliRoot.git] / MUON / mchview.cxx
CommitLineData
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
3f979838 37#include "AliMpDataProcessor.h"
38#include "AliMpDataMap.h"
39#include "AliMpDataStreams.h"
40#include "AliMpDDLStore.h"
41
42
90037e4e 43//______________________________________________________________________________
44Int_t Usage()
0145e89a 45{
90037e4e 46 /// Printout available options of the program
47 cout << "mchview " << endl;
48 cout << " --version : shows the current version of the program" << endl;
49419555 49 cout << " --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl;
1ffbeb9d 50 cout << " --geometry #x#+#+# : manually specify the geometry of the window, ala X11..., e.g. --geometry 1280x900+1600+0 will" << endl;
51 cout << " get a window of size 1280x900, located at (1600,0) from the top-left of the (multihead) display " << endl;
3f979838 52 cout << " --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
90037e4e 53 return -1;
54}
0145e89a 55
90037e4e 56//______________________________________________________________________________
57int main(int argc, char** argv)
58{
59 /// Main function for the program
60 TObjArray args;
0145e89a 61
90037e4e 62 for ( int i = 1; i < argc; ++i )
63 {
64 args.Add(new TObjString(argv[i]));
65 }
0145e89a 66
90037e4e 67 Int_t nok(0);
0145e89a 68
49419555 69 TObjArray filesToOpen;
1ffbeb9d 70 Bool_t isGeometryFixed(kFALSE);
71 Int_t gix, giy;
72 Int_t gox,goy;
3f979838 73 Bool_t ASCIImapping(kFALSE);
74
90037e4e 75 for ( Int_t i = 0; i <= args.GetLast(); ++i )
76 {
77 TString a(static_cast<TObjString*>(args.At(i))->String());
78 if ( a == "--version" )
79 {
80 cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl;
81 ++nok;
82 return 0;
83 }
10eb3d17 84 if ( a == "--use" && i < args.GetLast() )
85 {
49419555 86 filesToOpen.Add(args.At(i+1));
10eb3d17 87 ++i;
88 nok += 2;
89 }
1ffbeb9d 90 else if ( a == "--geometry" )
91 {
92 isGeometryFixed = kTRUE;
93 TString g(static_cast<TObjString*>(args.At(i+1))->String());
94 sscanf(g.Data(),"%dx%d+%d+%d",&gix,&giy,&gox,&goy);
95 nok += 2;
96 ++i;
97 }
3f979838 98 else if ( a == "--asciimapping" )
99 {
100 ASCIImapping = kTRUE;
101 }
1ffbeb9d 102
10eb3d17 103 else
104 {
105 return Usage();
106 }
90037e4e 107 }
0145e89a 108
90037e4e 109 if ( nok < args.GetLast() )
110 {
111 return Usage();
112 }
0145e89a 113
1ffbeb9d 114 AliWarningGeneral("main","FIXME ? Remove default storage and run number from here...");
0145e89a 115
162637e4 116 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
0145e89a 117 AliCDBManager::Instance()->SetRun(0);
90037e4e 118
3f979838 119 if ( ASCIImapping )
120 {
121 AliMpDataProcessor mp;
122 AliMpDataMap* map = mp.CreateDataMap("data");
123 AliMpDataStreams dataStreams(map);
124 AliMpDDLStore::ReadData(dataStreams);
125 }
126
90037e4e 127 gROOT->SetStyle("Plain");
0145e89a 128 gStyle->SetPalette(1);
0145e89a 129 Int_t n = gStyle->GetNumberOfColors();
0145e89a 130 Int_t* colors = new Int_t[n+2];
0145e89a 131 for ( Int_t i = 1; i <= n; ++i )
132 {
133 colors[i] = gStyle->GetColorPalette(i-1);
134 }
0145e89a 135 colors[0] = 0;
136 colors[n+1] = 1;
0145e89a 137 gStyle->SetPalette(n+2,colors);
0145e89a 138 delete[] colors;
1ffbeb9d 139
140 UInt_t w(0);
141 UInt_t h(0);
142 UInt_t ox(0);
143 UInt_t oy(0);
144
145 if ( isGeometryFixed )
146 {
147 w = gix;
148 h = giy;
149 ox = gox;
150 oy = goy;
151 }
0145e89a 152
1ffbeb9d 153 AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, w,h,gox,goy);
90037e4e 154
0145e89a 155 AliCodeTimer::Instance()->Print();
156
49419555 157 TIter next(&filesToOpen);
158 TObjString* s;
159 while ( ( s = static_cast<TObjString*>(next()) ) )
160 {
161 theApp->Open(s->String().Data());
162 }
10eb3d17 163
0145e89a 164 // --- Start the event loop ---
165 theApp->Run(kTRUE);
166
8f0acce4 167 delete AliMUONPainterHelper::Instance(); // important to trigger the saving of the env. file
0145e89a 168}