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 "AliMUONPainterDataSourceFrame.h"
26 #include "AliMUONPainterHelper.h"
27 #include "AliMUONPainterMasterFrame.h"
28 #include "AliMUONPainterRegistry.h"
29 #include "AliCDBManager.h"
30 #include "AliCodeTimer.h"
32 #include <Riostream.h>
42 //_____________________________________________________________________________
43 void CreateMenuBar(TRint* app, TGMainFrame* mainFrame, UInt_t w)
45 /// Create the menu bar of the program
47 TGPopupMenu* file = new TGPopupMenu(gClient->GetRoot());
49 file->AddEntry("&Exit",1);
51 file->Connect("Activated(Int_t)","TRint",app,"Terminate()");
53 TGMenuBar* bar = new TGMenuBar(mainFrame,w);
55 bar->AddPopup("&File",file,new TGLayoutHints(kLHintsLeft|kLHintsTop));
57 mainFrame->AddFrame(bar,new TGLayoutHints(kLHintsLeft|kLHintsExpandX));
59 AliMUONPainterRegistry::Instance()->SetMenuBar(bar);
63 int main(int argc, char** argv)
65 /// Main function for the program
67 AliWarningGeneral("main","Remove default storage and run number from here...");
69 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
70 AliCDBManager::Instance()->SetRun(0);
72 TRint *theApp = new TRint("mchview", &argc, argv);
74 gROOT->SetStyle("Plain");
76 gStyle->SetPalette(1);
78 Int_t n = gStyle->GetNumberOfColors();
80 Int_t* colors = new Int_t[n+2];
82 for ( Int_t i = 1; i <= n; ++i )
84 colors[i] = gStyle->GetColorPalette(i-1);
90 gStyle->SetPalette(n+2,colors);
94 UInt_t dw = gClient->GetDisplayWidth();
95 UInt_t dh = gClient->GetDisplayHeight();
97 UInt_t w = (UInt_t)(0.7*dw);
98 UInt_t h = (UInt_t)(0.90*dh);
100 TGMainFrame* mainFrame = new TGMainFrame(gClient->GetRoot(),w,h);
104 CreateMenuBar(theApp,mainFrame,w);
106 // h -= 60; // menubar
108 TGTab* tabs = new TGTab(mainFrame,w,h);
110 TGCompositeFrame* t = tabs->AddTab("Painter Master Frame");
112 AliMUONPainterMasterFrame* pf =
113 new AliMUONPainterMasterFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2);
115 t->AddFrame(pf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
117 t = tabs->AddTab("Data Sources");
119 AliMUONPainterDataSourceFrame* dsf =
120 new AliMUONPainterDataSourceFrame(t,t->GetWidth()-kbs*2,t->GetHeight()-kbs*2);
122 t->AddFrame(dsf,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,kbs,kbs,kbs,kbs));
124 mainFrame->AddFrame(tabs,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,0,0,0,0));
126 mainFrame->SetWindowName("mchview - Visualization of MUON Tracker detector");
128 mainFrame->MapSubwindows();
130 mainFrame->MapWindow();
132 mainFrame->Connect("CloseWindow()","TRint",theApp,"Terminate()");
134 UInt_t x = dw/2 - w/2;
137 mainFrame->MoveResize(x, y, w, h);
138 mainFrame->SetWMPosition(x, y);
140 mainFrame->SetWMSizeHints(w,h,w,h,0,0);
142 AliCodeTimer::Instance()->Print();
144 // --- Start the event loop ---
147 AliMUONPainterHelper::Instance()->Save();