]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/mchview.cxx
Update from Alberica. Addition of VZERO equalized signals and ZNC.
[u/mrichter/AliRoot.git] / MUON / mchview.cxx
... / ...
CommitLineData
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
27#include "AliCDBManager.h"
28#include "AliCodeTimer.h"
29#include "AliLog.h"
30#include "AliMUONPainterHelper.h"
31#include <Riostream.h>
32#include <TObjArray.h>
33#include <TObjString.h>
34#include <TROOT.h>
35#include <TStyle.h>
36
37#include "AliMpDataProcessor.h"
38#include "AliMpDataMap.h"
39#include "AliMpDataStreams.h"
40#include "AliMpDDLStore.h"
41#include "AliMpManuStore.h"
42
43//______________________________________________________________________________
44Int_t Usage()
45{
46 /// Printout available options of the program
47 cout << "mchview " << endl;
48 cout << " --version : shows the current version of the program" << endl;
49 cout << " --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl;
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;
52 cout << " --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
53 cout << " --de detElemId : start by displaying the given detection element instead of the default view (which is all the chambers)" << endl;
54 cout << " --chamber chamberId (from 1 to 10) : start by displaying the given chamber instead of the default view (which is all the chambers)" << endl;
55 cout << " --ocdb ocdbPath : read the mapping from the given OCDB" << endl;
56 return -1;
57}
58
59//______________________________________________________________________________
60int main(int argc, char** argv)
61{
62 /// Main function for the program
63 TObjArray args;
64
65 for ( int i = 1; i < argc; ++i )
66 {
67 args.Add(new TObjString(argv[i]));
68 }
69
70 Int_t nok(0);
71
72 TObjArray filesToOpen;
73 Bool_t isGeometryFixed(kFALSE);
74 Int_t gix(0),giy(0);
75 Int_t gox(0),goy(0);
76 Bool_t ASCIImapping(kFALSE);
77 TString defaultOCDB("local://$ALICE_ROOT/OCDB");
78
79 for ( Int_t i = 0; i <= args.GetLast(); ++i )
80 {
81 TString a(static_cast<TObjString*>(args.At(i))->String());
82 if ( a == "--version" )
83 {
84 cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl;
85 ++nok;
86 return 0;
87 }
88 if ( a == "--use" && i < args.GetLast() )
89 {
90 filesToOpen.Add(args.At(i+1));
91 ++i;
92 nok += 2;
93 }
94 else if ( a == "--geometry" )
95 {
96 isGeometryFixed = kTRUE;
97 TString g(static_cast<TObjString*>(args.At(i+1))->String());
98 sscanf(g.Data(),"%10dx%10d+%10d+%10d",&gix,&giy,&gox,&goy);
99 nok += 2;
100 ++i;
101 }
102 else if ( a == "--asciimapping" )
103 {
104 ++nok;
105 ASCIImapping = kTRUE;
106 }
107 else if ( a == "--de" || a == "--chamber" )
108 {
109 // do nothing. Let AliMUONMchViewApplication handle that one. (and the next one as well).
110 nok += 2;
111 ++i;
112 }
113 else if ( a == "--ocdb" )
114 {
115 defaultOCDB = static_cast<TObjString*>(args.At(i+1))->String();
116 cout << "Using default storage = " << defaultOCDB.Data() << endl;
117 nok += 2;
118 ++i;
119 }
120 else
121 {
122 return Usage();
123 }
124 }
125
126 if ( nok < args.GetLast() )
127 {
128 return Usage();
129 }
130
131 AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data());
132 AliCDBManager::Instance()->SetRun(0);
133
134 if ( ASCIImapping )
135 {
136 AliMpDataProcessor mp;
137 {
138 AliMpDataMap* datamap = mp.CreateDataMap("data");
139 AliMpDataStreams dataStreams(datamap);
140 AliMpDDLStore::ReadData(dataStreams);
141 }
142 {
143 AliMpDataMap* datamap = mp.CreateDataMap("data_run");
144 AliMpDataStreams dataStreams(datamap);
145 AliMpManuStore::ReadData(dataStreams);
146 }
147
148 AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/Neighbours","local://$ALICE_ROOT/OCDB");
149
150 }
151
152 gROOT->SetStyle("Plain");
153 gStyle->SetPalette(1);
154 Int_t n = gStyle->GetNumberOfColors();
155 Int_t* colors = new Int_t[n+2];
156 for ( Int_t i = 1; i <= n; ++i )
157 {
158 colors[i] = gStyle->GetColorPalette(i-1);
159 }
160 colors[0] = 0;
161 colors[n+1] = 1;
162 gStyle->SetPalette(n+2,colors);
163 delete[] colors;
164
165 AliMUONMchViewApplication* theApp(0x0);
166
167 if ( isGeometryFixed )
168 {
169 theApp = new AliMUONMchViewApplication("mchview", &argc, argv,gix,giy,gox,goy);
170 }
171 else
172 {
173 theApp = new AliMUONMchViewApplication("mchview",&argc,argv);
174 }
175
176 TIter next(&filesToOpen);
177 TObjString* s;
178 while ( ( s = static_cast<TObjString*>(next()) ) )
179 {
180 theApp->Open(s->String().Data());
181 }
182
183 // --- Start the event loop ---
184 theApp->Run(kTRUE);
185
186 delete AliMUONPainterHelper::Instance(); // important to trigger the saving of the env. file
187}