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 **************************************************************************/
16 ////////////////////////////////////////////////////////////////////////////
18 // QA histogram viewer
20 // origin: Mikolaj Krzewicki, Nikhef, Mikolaj.Krzewicki@cern.ch
22 ///////////////////////////////////////////////////////////////////////////
24 #include "AliQAHistViewer.h"
26 ClassImp(AliQAHistViewer)
28 //_________________________________________________________________________
29 void AliQAHistViewer::DoDrawNext()
35 oldDirStr = fQANavigator->GetDirName();
37 UpdateAllPathComboBoxes();
39 TCanvas *c1 = fEcan->GetCanvas();
41 c1->Divide(rows,cols);
42 for (Int_t i=1; i<=rows*cols;i++)
44 newDirStr = fQANavigator->GetDirName();
45 if (newDirStr!=oldDirStr)
52 if (!fQANavigator->GetHistogram(hist)) break;
53 if (hist) hist->Draw();
55 if (!fQANavigator->Next())
63 //_________________________________________________________________________
64 void AliQAHistViewer::DoDrawPrev()
70 oldDirStr = fQANavigator->GetDirName();
72 UpdateAllPathComboBoxes();
74 TCanvas *c1 = fEcan->GetCanvas();
76 c1->Divide(rows,cols);
77 for (Int_t i=1; i<=rows*cols;i++)
79 newDirStr = fQANavigator->GetDirName();
80 if (newDirStr!=oldDirStr)
87 if (!fQANavigator->GetHistogram(hist)) break;
88 if (hist) hist->Draw();
90 if (!fQANavigator->Prev())
98 //_________________________________________________________________________
99 void AliQAHistViewer::DoExit()
101 printf("Exit application...");
102 gApplication->Terminate(0);
105 //_________________________________________________________________________
106 AliQAHistViewer::AliQAHistViewer(const TGWindow *p, UInt_t w, UInt_t h, Bool_t embed) :
107 TGMainFrame(p, w, h),
109 fDetectorListBox(NULL),
114 //initialize the QA navigator
115 fQANavigator = new AliQAHistNavigator();
116 // Create the embedded canvas
117 fEcan = new TRootEmbeddedCanvas(0,this,800,600);
118 Int_t wid = fEcan->GetCanvasWindowId();
119 TCanvas *myc = new TCanvas("MyCanvas", 10,10,wid);
120 fEcan->AdoptCanvas(myc);
121 //myc->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliQAHistViewer",this,
122 // "EventInfo(Int_t,Int_t,Int_t,TObject*)");
124 AddFrame(fEcan, new TGLayoutHints(kLHintsTop | kLHintsLeft |
125 kLHintsExpandX | kLHintsExpandY,0,0,1,1));
127 // horizontal frame with comboboxes for navigation
128 TGHorizontalFrame *hframenav = new TGHorizontalFrame(this, 200,40);
129 fFileListBox = new TGComboBox(hframenav);
130 fFileListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetFile(Int_t)");
131 fFileListBox->Resize(150,20);
132 hframenav->AddFrame(fFileListBox, new TGLayoutHints(kLHintsExpandY|kLHintsLeft));
133 fDetectorListBox = new TGComboBox(hframenav);
134 fDetectorListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetDetector(Int_t)");
135 fDetectorListBox->Resize(100,20);
136 hframenav->AddFrame(fDetectorListBox, new TGLayoutHints(kLHintsLeft));
137 fLevelListBox = new TGComboBox(hframenav);
138 fLevelListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetLevel(Int_t)");
139 fLevelListBox->Resize(100,20);
140 hframenav->AddFrame(fLevelListBox, new TGLayoutHints(kLHintsLeft));
141 fHistListBox = new TGComboBox(hframenav);
142 fHistListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetHistogram(Int_t)");
143 fHistListBox->Resize(250,20);
144 hframenav->AddFrame(fHistListBox, new TGLayoutHints(kLHintsLeft));
145 AddFrame(hframenav, new TGLayoutHints((kLHintsLeft|kLHintsExpandX), 5,5,5,5));
146 UpdateAllPathComboBoxes();
147 // Create a horizontal frame containing two buttons
148 TGHorizontalFrame *hframebuttons = new TGHorizontalFrame(this, 200, 40);
149 TGTextButton *prev = new TGTextButton(hframebuttons, "&Prev");
150 prev->Connect("Clicked()", "AliQAHistViewer", this, "DoDrawPrev()");
151 hframebuttons->AddFrame(prev, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
152 TGTextButton *next = new TGTextButton(hframebuttons, "&Next");
153 next->Connect("Clicked()", "AliQAHistViewer", this, "DoDrawNext()");
154 hframebuttons->AddFrame(next, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
157 TGTextButton *exit = new TGTextButton(hframebuttons, "&Exit ");
158 exit->Connect("Pressed()", "AliQAHistViewer", this, "DoExit()");
159 hframebuttons->AddFrame(exit, new TGLayoutHints(kLHintsRight, 5, 5, 3, 4));
161 AddFrame(hframebuttons, new TGLayoutHints(kLHintsCenterX, 2, 2, 2, 2));
163 // Set a name to the main frame
164 SetWindowName("Quality Assurance Monitoring");
167 // Initialize the layout algorithm via Resize()
168 Resize(GetDefaultSize());
175 //_________________________________________________________________________
176 AliQAHistViewer::~AliQAHistViewer()
178 // Clean up main frame...
184 //_________________________________________________________________________
185 void AliQAHistViewer::FillComboBoxWithListEntries( TGComboBox* box, const TList* list )
189 TIter listiter(list);
191 while ((o = (TObject*)listiter.Next()))
193 TString name = o->GetName();
194 box->AddEntry( name.Data(), i++ );
198 //_________________________________________________________________________
199 void AliQAHistViewer::UpdateAllPathComboBoxes()
201 if (!fQANavigator->InitOK()) return;
202 FillComboBoxWithListEntries( fFileListBox, fQANavigator->GetFileList() );
203 FillComboBoxWithListEntries( fDetectorListBox, fQANavigator->GetDetectorList() );
204 FillComboBoxWithListEntries( fLevelListBox, fQANavigator->GetLevelList() );
205 FillComboBoxWithListEntries( fHistListBox, fQANavigator->GetHistList() );
206 fFileListBox->Select(fQANavigator->GetCurrListOfFiles()->IndexOf(fQANavigator->GetCurrFile()),kFALSE);
207 fDetectorListBox->Select(fQANavigator->GetCurrFile()->IndexOf(fQANavigator->GetCurrDetector()),kFALSE);
208 fLevelListBox->Select(fQANavigator->GetCurrDetector()->IndexOf(fQANavigator->GetCurrLevel()),kFALSE);
209 fHistListBox->Select(fQANavigator->GetCurrLevel()->IndexOf(fQANavigator->GetCurrHistName()),kFALSE);
212 //_________________________________________________________________________
213 void AliQAHistViewer::DoSetFile( Int_t s )
215 fQANavigator->SetFile(s);
219 //_________________________________________________________________________
220 void AliQAHistViewer::DoSetDetector( Int_t s )
222 fQANavigator->SetDetector(s);
226 //_________________________________________________________________________
227 void AliQAHistViewer::DoSetLevel( Int_t s )
229 fQANavigator->SetLevel(s);
233 //_________________________________________________________________________
234 void AliQAHistViewer::DoSetHistogram( Int_t s )
236 fQANavigator->SetHist(s);