Fixes in the HV-sector to manu mapping
[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"
0145e89a 26#include "AliMUONPainterHelper.h"
0145e89a 27#include "AliCDBManager.h"
28#include "AliCodeTimer.h"
29#include "AliLog.h"
0145e89a 30#include <TROOT.h>
0145e89a 31#include <TStyle.h>
90037e4e 32#include <TObjArray.h>
33#include <TObjString.h>
34#include <Riostream.h>
0145e89a 35
90037e4e 36//______________________________________________________________________________
37Int_t Usage()
0145e89a 38{
90037e4e 39 /// Printout available options of the program
40 cout << "mchview " << endl;
41 cout << " --version : shows the current version of the program" << endl;
49419555 42 cout << " --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl;
90037e4e 43 return -1;
44}
0145e89a 45
90037e4e 46//______________________________________________________________________________
47int main(int argc, char** argv)
48{
49 /// Main function for the program
50 TObjArray args;
0145e89a 51
90037e4e 52 for ( int i = 1; i < argc; ++i )
53 {
54 args.Add(new TObjString(argv[i]));
55 }
0145e89a 56
90037e4e 57 Int_t nok(0);
0145e89a 58
49419555 59 TObjArray filesToOpen;
10eb3d17 60
90037e4e 61 for ( Int_t i = 0; i <= args.GetLast(); ++i )
62 {
63 TString a(static_cast<TObjString*>(args.At(i))->String());
64 if ( a == "--version" )
65 {
66 cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl;
67 ++nok;
68 return 0;
69 }
10eb3d17 70 if ( a == "--use" && i < args.GetLast() )
71 {
49419555 72 filesToOpen.Add(args.At(i+1));
10eb3d17 73 ++i;
74 nok += 2;
75 }
76 else
77 {
78 return Usage();
79 }
90037e4e 80 }
0145e89a 81
90037e4e 82 if ( nok < args.GetLast() )
83 {
84 return Usage();
85 }
0145e89a 86
0145e89a 87 AliWarningGeneral("main","Remove default storage and run number from here...");
88
89 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
90 AliCDBManager::Instance()->SetRun(0);
90037e4e 91
92 gROOT->SetStyle("Plain");
0145e89a 93 gStyle->SetPalette(1);
0145e89a 94 Int_t n = gStyle->GetNumberOfColors();
0145e89a 95 Int_t* colors = new Int_t[n+2];
0145e89a 96 for ( Int_t i = 1; i <= n; ++i )
97 {
98 colors[i] = gStyle->GetColorPalette(i-1);
99 }
0145e89a 100 colors[0] = 0;
101 colors[n+1] = 1;
0145e89a 102 gStyle->SetPalette(n+2,colors);
0145e89a 103 delete[] colors;
104
10eb3d17 105 AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, 0.7, 0.9);
90037e4e 106
0145e89a 107 AliCodeTimer::Instance()->Print();
108
49419555 109 TIter next(&filesToOpen);
110 TObjString* s;
111 while ( ( s = static_cast<TObjString*>(next()) ) )
112 {
113 theApp->Open(s->String().Data());
114 }
10eb3d17 115
0145e89a 116 // --- Start the event loop ---
117 theApp->Run(kTRUE);
118
119 AliMUONPainterHelper::Instance()->Save();
120}