]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mchview.cxx
Added two missing includes to allow macro compilation (thanks to Laurent for remarkin...
[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"
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"
3f979838 42
90037e4e 43//______________________________________________________________________________
44Int_t Usage()
0145e89a 45{
90037e4e 46 /// Printout available options of the program
47 cout << "mchview " << endl;
48 cout << " --version : shows the current version of the program" << endl;
49419555 49 cout << " --use filename.root : reuse a previously saved (from this program) root file. Several --use can be used ;-)" << endl;
1ffbeb9d 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;
3f979838 52 cout << " --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
fef32488 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;
90037e4e 55 return -1;
56}
0145e89a 57
90037e4e 58//______________________________________________________________________________
59int main(int argc, char** argv)
60{
61 /// Main function for the program
62 TObjArray args;
0145e89a 63
90037e4e 64 for ( int i = 1; i < argc; ++i )
65 {
66 args.Add(new TObjString(argv[i]));
67 }
0145e89a 68
90037e4e 69 Int_t nok(0);
0145e89a 70
49419555 71 TObjArray filesToOpen;
1ffbeb9d 72 Bool_t isGeometryFixed(kFALSE);
73 Int_t gix, giy;
74 Int_t gox,goy;
3f979838 75 Bool_t ASCIImapping(kFALSE);
76
90037e4e 77 for ( Int_t i = 0; i <= args.GetLast(); ++i )
78 {
79 TString a(static_cast<TObjString*>(args.At(i))->String());
80 if ( a == "--version" )
81 {
82 cout << "mchview Version " << AliMUONMchViewApplication::Version() << " ($Id$)" << endl;
83 ++nok;
84 return 0;
85 }
10eb3d17 86 if ( a == "--use" && i < args.GetLast() )
87 {
49419555 88 filesToOpen.Add(args.At(i+1));
10eb3d17 89 ++i;
90 nok += 2;
91 }
1ffbeb9d 92 else if ( a == "--geometry" )
93 {
94 isGeometryFixed = kTRUE;
95 TString g(static_cast<TObjString*>(args.At(i+1))->String());
96 sscanf(g.Data(),"%dx%d+%d+%d",&gix,&giy,&gox,&goy);
97 nok += 2;
98 ++i;
99 }
3f979838 100 else if ( a == "--asciimapping" )
101 {
fef32488 102 ++nok;
3f979838 103 ASCIImapping = kTRUE;
104 }
fef32488 105 else if ( a == "--de" || a == "--chamber" )
106 {
107 // do nothing. Let AliMUONMchViewApplication handle that one. (and the next one as well).
108 nok += 2;
109 ++i;
110 }
10eb3d17 111 else
112 {
113 return Usage();
114 }
90037e4e 115 }
0145e89a 116
90037e4e 117 if ( nok < args.GetLast() )
118 {
119 return Usage();
120 }
0145e89a 121
1ffbeb9d 122 AliWarningGeneral("main","FIXME ? Remove default storage and run number from here...");
0145e89a 123
162637e4 124 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
0145e89a 125 AliCDBManager::Instance()->SetRun(0);
90037e4e 126
3f979838 127 if ( ASCIImapping )
128 {
129 AliMpDataProcessor mp;
fef32488 130 {
131 AliMpDataMap* datamap = mp.CreateDataMap("data");
132 AliMpDataStreams dataStreams(datamap);
133 AliMpDDLStore::ReadData(dataStreams);
134 }
135 {
136 AliMpDataMap* datamap = mp.CreateDataMap("data_run");
137 AliMpDataStreams dataStreams(datamap);
138 AliMpManuStore::ReadData(dataStreams);
139 }
140
141 AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/Neighbours","local://$ALICE_ROOT/OCDB");
142
3f979838 143 }
144
90037e4e 145 gROOT->SetStyle("Plain");
0145e89a 146 gStyle->SetPalette(1);
0145e89a 147 Int_t n = gStyle->GetNumberOfColors();
0145e89a 148 Int_t* colors = new Int_t[n+2];
0145e89a 149 for ( Int_t i = 1; i <= n; ++i )
150 {
151 colors[i] = gStyle->GetColorPalette(i-1);
152 }
0145e89a 153 colors[0] = 0;
154 colors[n+1] = 1;
0145e89a 155 gStyle->SetPalette(n+2,colors);
0145e89a 156 delete[] colors;
1ffbeb9d 157
158 UInt_t w(0);
159 UInt_t h(0);
160 UInt_t ox(0);
161 UInt_t oy(0);
162
163 if ( isGeometryFixed )
164 {
165 w = gix;
166 h = giy;
167 ox = gox;
168 oy = goy;
169 }
0145e89a 170
1ffbeb9d 171 AliMUONMchViewApplication* theApp = new AliMUONMchViewApplication("mchview", &argc, argv, w,h,gox,goy);
90037e4e 172
0145e89a 173 AliCodeTimer::Instance()->Print();
174
49419555 175 TIter next(&filesToOpen);
176 TObjString* s;
177 while ( ( s = static_cast<TObjString*>(next()) ) )
178 {
179 theApp->Open(s->String().Data());
180 }
10eb3d17 181
0145e89a 182 // --- Start the event loop ---
183 theApp->Run(kTRUE);
184
8f0acce4 185 delete AliMUONPainterHelper::Instance(); // important to trigger the saving of the env. file
0145e89a 186}