1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 /// \brief Tracker visualization program
22 /// \author Laurent Aphecetche, Subatech
25 #include "AliMUONMchViewApplication.h"
27 #include "AliCDBManager.h"
28 #include "AliCodeTimer.h"
30 #include "AliMUONPainterHelper.h"
31 #include <Riostream.h>
32 #include <TObjArray.h>
33 #include <TObjString.h>
37 #include "AliMpDataProcessor.h"
38 #include "AliMpDataMap.h"
39 #include "AliMpDataStreams.h"
40 #include "AliMpDDLStore.h"
41 #include "AliMpManuStore.h"
44 //______________________________________________________________________________
47 /// Printout available options of the program
48 cout << "mchview " << endl;
49 cout << " --version : shows the current version of the program" << endl;
50 cout << " --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl;
51 cout << " --geometry #x#+#+# : manually specify the geometry of the window, ala X11..., e.g. --geometry 1280x900+1600+0 will" << endl;
52 cout << " get a window of size 1280x900, located at (1600,0) from the top-left of the (multihead) display " << endl;
53 cout << " --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
54 cout << " --de detElemId : start by displaying the given detection element instead of the default view (which is all the chambers)" << endl;
55 cout << " --chamber chamberId (from 1 to 10) : start by displaying the given chamber instead of the default view (which is all the chambers)" << endl;
56 cout << " --ocdb ocdbPath : read the mapping from the given OCDB" << endl;
60 //______________________________________________________________________________
61 int main(int argc, char** argv)
63 /// Main function for the program
65 gEnv->SetValue("Cocoa.EnableAntiAliasing","auto");
69 for ( int i = 1; i < argc; ++i )
71 args.Add(new TObjString(argv[i]));
76 TObjArray filesToOpen;
77 Bool_t isGeometryFixed(kFALSE);
80 Bool_t ASCIImapping(kFALSE);
81 TString defaultOCDB("local://$ALICE_ROOT/OCDB");
83 for ( Int_t i = 0; i <= args.GetLast(); ++i )
85 TString a(static_cast<TObjString*>(args.At(i))->String());
86 if ( a == "--version" )
88 cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl;
92 if ( a == "--use" && i < args.GetLast() )
94 filesToOpen.Add(args.At(i+1));
98 else if ( a == "--geometry" )
100 isGeometryFixed = kTRUE;
101 TString g(static_cast<TObjString*>(args.At(i+1))->String());
102 sscanf(g.Data(),"%10dx%10d+%10d+%10d",&gix,&giy,&gox,&goy);
106 else if ( a == "--asciimapping" )
109 ASCIImapping = kTRUE;
111 else if ( a == "--de" || a == "--chamber" )
113 // do nothing. Let AliMUONMchViewApplication handle that one. (and the next one as well).
117 else if ( a == "--ocdb" )
119 defaultOCDB = static_cast<TObjString*>(args.At(i+1))->String();
120 cout << "Using default storage = " << defaultOCDB.Data() << endl;
130 if ( nok < args.GetLast() )
135 AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data());
136 AliCDBManager::Instance()->SetRun(0);
140 AliMpDataProcessor mp;
142 AliMpDataMap* datamap = mp.CreateDataMap("data");
143 AliMpDataStreams dataStreams(datamap);
144 AliMpDDLStore::ReadData(dataStreams);
147 AliMpDataMap* datamap = mp.CreateDataMap("data_run");
148 AliMpDataStreams dataStreams(datamap);
149 AliMpManuStore::ReadData(dataStreams);
152 AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/Neighbours","local://$ALICE_ROOT/OCDB");
156 gROOT->SetStyle("Plain");
157 gStyle->SetPalette(1);
158 Int_t n = gStyle->GetNumberOfColors();
159 Int_t* colors = new Int_t[n+2];
160 for ( Int_t i = 1; i <= n; ++i )
162 colors[i] = gStyle->GetColorPalette(i-1);
166 gStyle->SetPalette(n+2,colors);
169 AliMUONMchViewApplication* theApp(0x0);
171 if ( isGeometryFixed )
173 theApp = new AliMUONMchViewApplication("mchview", &argc, argv,gix,giy,gox,goy);
177 theApp = new AliMUONMchViewApplication("mchview",&argc,argv);
180 TIter next(&filesToOpen);
182 while ( ( s = static_cast<TObjString*>(next()) ) )
184 theApp->Open(s->String().Data());
187 // --- Start the event loop ---
190 delete AliMUONPainterHelper::Instance(); // important to trigger the saving of the env. file