]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mchview.cxx
Updated error definitions.
[u/mrichter/AliRoot.git] / MUON / mchview.cxx
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
25 #include "AliMUONMchViewApplication.h"
26 #include "AliMUONPainterHelper.h"
27 #include "AliCDBManager.h"
28 #include "AliCodeTimer.h"
29 #include "AliLog.h"
30 #include <TROOT.h>
31 #include <TStyle.h>
32 #include <TObjArray.h>
33 #include <TObjString.h>
34 #include <Riostream.h>
35
36 //______________________________________________________________________________
37 Int_t Usage()
38 {
39   /// Printout available options of the program
40   cout << "mchview " << endl;
41   cout << "  --version : shows the current version of the program" << endl;
42   return -1;
43 }
44
45 //______________________________________________________________________________
46 int main(int argc, char** argv)
47 {
48   /// Main function for the program
49   TObjArray args;
50   
51   for ( int i = 1; i < argc; ++i ) 
52   {
53     args.Add(new TObjString(argv[i]));
54   }
55   
56   Int_t nok(0);
57   
58   for ( Int_t i = 0; i <= args.GetLast(); ++i ) 
59   {
60     TString a(static_cast<TObjString*>(args.At(i))->String());
61     if ( a == "--version" ) 
62     {
63       cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl;
64       ++nok;
65       return 0;
66     }
67   }
68   
69   if ( nok < args.GetLast() )
70   {
71     return Usage();
72   }
73   
74   AliWarningGeneral("main","Remove default storage and run number from here...");
75   
76   AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
77   AliCDBManager::Instance()->SetRun(0);
78  
79   gROOT->SetStyle("Plain");  
80   gStyle->SetPalette(1);
81   Int_t n = gStyle->GetNumberOfColors();
82   Int_t* colors = new Int_t[n+2];
83   for ( Int_t i = 1; i <= n; ++i )
84   {
85     colors[i] = gStyle->GetColorPalette(i-1);
86   }
87   colors[0] = 0;
88   colors[n+1] = 1;
89   gStyle->SetPalette(n+2,colors);
90   delete[] colors;
91   
92   TRint* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, 0.7, 0.9);
93    
94   AliCodeTimer::Instance()->Print();
95
96   // --- Start the event loop ---
97   theApp->Run(kTRUE);
98
99   AliMUONPainterHelper::Instance()->Save();
100 }