]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mchview/mchview.cxx
remove unused code
[u/mrichter/AliRoot.git] / MUON / mchview / 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"
fef32488 41#include "AliMpManuStore.h"
065e62e4 42#include "TEnv.h"
e4061552 43#include "TGrid.h"
3f979838 44
90037e4e 45//______________________________________________________________________________
46Int_t Usage()
0145e89a 47{
90037e4e 48 /// Printout available options of the program
49 cout << "mchview " << endl;
50 cout << " --version : shows the current version of the program" << endl;
49419555 51 cout << " --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl;
1ffbeb9d 52 cout << " --geometry #x#+#+# : manually specify the geometry of the window, ala X11..., e.g. --geometry 1280x900+1600+0 will" << endl;
53 cout << " get a window of size 1280x900, located at (1600,0) from the top-left of the (multihead) display " << endl;
3f979838 54 cout << " --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
fef32488 55 cout << " --de detElemId : start by displaying the given detection element instead of the default view (which is all the chambers)" << endl;
56 cout << " --chamber chamberId (from 1 to 10) : start by displaying the given chamber instead of the default view (which is all the chambers)" << endl;
ca913045 57 cout << " --ocdb ocdbPath : read the mapping from the given OCDB" << endl;
90037e4e 58 return -1;
59}
0145e89a 60
90037e4e 61//______________________________________________________________________________
62int main(int argc, char** argv)
63{
64 /// Main function for the program
065e62e4 65
66 gEnv->SetValue("Cocoa.EnableAntiAliasing","auto");
67
90037e4e 68 TObjArray args;
0145e89a 69
90037e4e 70 for ( int i = 1; i < argc; ++i )
71 {
72 args.Add(new TObjString(argv[i]));
73 }
0145e89a 74
90037e4e 75 Int_t nok(0);
0145e89a 76
49419555 77 TObjArray filesToOpen;
1ffbeb9d 78 Bool_t isGeometryFixed(kFALSE);
d2b2e698 79 Int_t gix(0),giy(0);
80 Int_t gox(0),goy(0);
3f979838 81 Bool_t ASCIImapping(kFALSE);
e4061552 82 TString defaultOCDB("raw://");
3f979838 83
e4061552 84 if (!gGrid)
85 {
86 TGrid::Connect("alien://");
87 }
88
89 for ( Int_t i = 0; i <= args.GetLast(); ++i )
90037e4e 90 {
91 TString a(static_cast<TObjString*>(args.At(i))->String());
92 if ( a == "--version" )
93 {
94 cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl;
95 ++nok;
96 return 0;
97 }
10eb3d17 98 if ( a == "--use" && i < args.GetLast() )
99 {
49419555 100 filesToOpen.Add(args.At(i+1));
10eb3d17 101 ++i;
102 nok += 2;
103 }
1ffbeb9d 104 else if ( a == "--geometry" )
105 {
106 isGeometryFixed = kTRUE;
107 TString g(static_cast<TObjString*>(args.At(i+1))->String());
2a87e9b1 108 sscanf(g.Data(),"%10dx%10d+%10d+%10d",&gix,&giy,&gox,&goy);
1ffbeb9d 109 nok += 2;
110 ++i;
111 }
3f979838 112 else if ( a == "--asciimapping" )
113 {
fef32488 114 ++nok;
3f979838 115 ASCIImapping = kTRUE;
116 }
fef32488 117 else if ( a == "--de" || a == "--chamber" )
118 {
119 // do nothing. Let AliMUONMchViewApplication handle that one. (and the next one as well).
120 nok += 2;
121 ++i;
122 }
ca913045 123 else if ( a == "--ocdb" )
124 {
125 defaultOCDB = static_cast<TObjString*>(args.At(i+1))->String();
126 cout << "Using default storage = " << defaultOCDB.Data() << endl;
127 nok += 2;
128 ++i;
129 }
10eb3d17 130 else
131 {
132 return Usage();
133 }
90037e4e 134 }
0145e89a 135
90037e4e 136 if ( nok < args.GetLast() )
137 {
138 return Usage();
139 }
0145e89a 140
e4061552 141 std::cout << "Using defaultOCDB=" << defaultOCDB.Data() << std::endl;
142
ca913045 143 AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data());
e4061552 144 AliCDBManager::Instance()->SetRun(196792);
90037e4e 145
3f979838 146 if ( ASCIImapping )
147 {
148 AliMpDataProcessor mp;
fef32488 149 {
150 AliMpDataMap* datamap = mp.CreateDataMap("data");
151 AliMpDataStreams dataStreams(datamap);
152 AliMpDDLStore::ReadData(dataStreams);
153 }
154 {
155 AliMpDataMap* datamap = mp.CreateDataMap("data_run");
156 AliMpDataStreams dataStreams(datamap);
157 AliMpManuStore::ReadData(dataStreams);
158 }
159
e4061552 160// AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/Neighbours","local://$ALICE_ROOT/OCDB");
fef32488 161
3f979838 162 }
163
90037e4e 164 gROOT->SetStyle("Plain");
0145e89a 165 gStyle->SetPalette(1);
0145e89a 166 Int_t n = gStyle->GetNumberOfColors();
0145e89a 167 Int_t* colors = new Int_t[n+2];
0145e89a 168 for ( Int_t i = 1; i <= n; ++i )
169 {
170 colors[i] = gStyle->GetColorPalette(i-1);
171 }
0145e89a 172 colors[0] = 0;
173 colors[n+1] = 1;
0145e89a 174 gStyle->SetPalette(n+2,colors);
0145e89a 175 delete[] colors;
1ffbeb9d 176
d2b2e698 177 AliMUONMchViewApplication* theApp(0x0);
1ffbeb9d 178
179 if ( isGeometryFixed )
180 {
d2b2e698 181 theApp = new AliMUONMchViewApplication("mchview", &argc, argv,gix,giy,gox,goy);
182 }
183 else
184 {
185 theApp = new AliMUONMchViewApplication("mchview",&argc,argv);
1ffbeb9d 186 }
90037e4e 187
49419555 188 TIter next(&filesToOpen);
189 TObjString* s;
190 while ( ( s = static_cast<TObjString*>(next()) ) )
191 {
192 theApp->Open(s->String().Data());
193 }
10eb3d17 194
0145e89a 195 // --- Start the event loop ---
196 theApp->Run(kTRUE);
197
8f0acce4 198 delete AliMUONPainterHelper::Instance(); // important to trigger the saving of the env. file
0145e89a 199}