]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MONITOR/AliQAHistViewer.cxx
"trd_adcClkPhase" DP removed from TRD configuration.
[u/mrichter/AliRoot.git] / MONITOR / AliQAHistViewer.cxx
CommitLineData
923f55ee 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////////////////////////////////////////////////////////////////////////////
17//
18// QA histogram viewer
19//
20// origin: Mikolaj Krzewicki, Nikhef, Mikolaj.Krzewicki@cern.ch
21//
22///////////////////////////////////////////////////////////////////////////
23
24#include "AliQAHistViewer.h"
25
26ClassImp(AliQAHistViewer)
27
28//_________________________________________________________________________
29void AliQAHistViewer::DoDrawNext()
30{
31 Int_t rows = 2;
32 Int_t cols = 2;
33 TString oldDirStr;
34 TString newDirStr;
35 oldDirStr = fQANavigator->GetDirName();
36
37 UpdateAllPathComboBoxes();
38
39 TCanvas *c1 = fEcan->GetCanvas();
40 c1->Clear();
41 c1->Divide(rows,cols);
42 for (Int_t i=1; i<=rows*cols;i++)
43 {
44 newDirStr = fQANavigator->GetDirName();
45 if (newDirStr!=oldDirStr)
46 {
47 oldDirStr=newDirStr;
48 break;
49 }
50 c1->cd(i);
51 TH1* hist;
d3a269ff 52 if (fQANavigator->GetHistogram(hist))
53 {
54 if (hist) hist->Draw();
55 }
923f55ee 56 if (!fQANavigator->Next())
57 {
58 break;
59 }
60 }
61 c1->Update();
62}
63
64//_________________________________________________________________________
65void AliQAHistViewer::DoDrawPrev()
66{
67 Int_t rows = 2;
68 Int_t cols = 2;
69 TString oldDirStr;
70 TString newDirStr;
71 oldDirStr = fQANavigator->GetDirName();
72
73 UpdateAllPathComboBoxes();
74
75 TCanvas *c1 = fEcan->GetCanvas();
76 c1->Clear();
77 c1->Divide(rows,cols);
78 for (Int_t i=1; i<=rows*cols;i++)
79 {
80 newDirStr = fQANavigator->GetDirName();
81 if (newDirStr!=oldDirStr)
82 {
83 oldDirStr=newDirStr;
84 break;
85 }
86 c1->cd(i);
87 TH1* hist;
d3a269ff 88 if (fQANavigator->GetHistogram(hist))
89 {
90 if (hist) hist->Draw();
91 }
923f55ee 92 if (!fQANavigator->Prev())
93 {
94 break;
95 }
96 }
97 c1->Update();
98}
99
100//_________________________________________________________________________
101void AliQAHistViewer::DoExit()
102{
103 printf("Exit application...");
104 gApplication->Terminate(0);
105}
106
107//_________________________________________________________________________
108AliQAHistViewer::AliQAHistViewer(const TGWindow *p, UInt_t w, UInt_t h, Bool_t embed) :
39116cf0 109 TGMainFrame(p, w, h),
d3a269ff 110 fEcan(NULL),
111 fQANavigator(new AliQAHistNavigator()),
923f55ee 112 fFileListBox(NULL),
113 fDetectorListBox(NULL),
114 fLevelListBox(NULL),
115 fHistListBox(NULL),
d3a269ff 116 fExpertMode(NULL),
923f55ee 117 fIsEmbedded(embed)
118{
119 //initialize the QA navigator
923f55ee 120 // horizontal frame with comboboxes for navigation
121 TGHorizontalFrame *hframenav = new TGHorizontalFrame(this, 200,40);
122 fFileListBox = new TGComboBox(hframenav);
123 fFileListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetFile(Int_t)");
124 fFileListBox->Resize(150,20);
125 hframenav->AddFrame(fFileListBox, new TGLayoutHints(kLHintsExpandY|kLHintsLeft));
126 fDetectorListBox = new TGComboBox(hframenav);
127 fDetectorListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetDetector(Int_t)");
128 fDetectorListBox->Resize(100,20);
129 hframenav->AddFrame(fDetectorListBox, new TGLayoutHints(kLHintsLeft));
130 fLevelListBox = new TGComboBox(hframenav);
131 fLevelListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetLevel(Int_t)");
132 fLevelListBox->Resize(100,20);
133 hframenav->AddFrame(fLevelListBox, new TGLayoutHints(kLHintsLeft));
134 fHistListBox = new TGComboBox(hframenav);
135 fHistListBox->Connect("Selected(Int_t)", "AliQAHistViewer", this, "DoSetHistogram(Int_t)");
136 fHistListBox->Resize(250,20);
137 hframenav->AddFrame(fHistListBox, new TGLayoutHints(kLHintsLeft));
138 AddFrame(hframenav, new TGLayoutHints((kLHintsLeft|kLHintsExpandX), 5,5,5,5));
139 UpdateAllPathComboBoxes();
d3a269ff 140 fExpertMode = new TGCheckButton(hframenav,"Expert");
141 hframenav->AddFrame(fExpertMode,new TGLayoutHints(kLHintsLeft, 0, 4, 3, 0));
142 fExpertMode->SetToolTipText("Show expert histograms");
143 fExpertMode->Connect("Toggled(Bool_t)", "AliQAHistViewer", this, "DoSetExpertMode(Bool_t)");
144 // Create the embedded canvas
145 fEcan = new TRootEmbeddedCanvas(0,this,800,600);
146 Int_t wid = fEcan->GetCanvasWindowId();
147 TCanvas *myc = new TCanvas("MyCanvas", 10,10,wid);
148 fEcan->AdoptCanvas(myc);
149 //myc->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliQAHistViewer",this,
150 // "EventInfo(Int_t,Int_t,Int_t,TObject*)");
151
152 AddFrame(fEcan, new TGLayoutHints(kLHintsTop | kLHintsLeft |
153 kLHintsExpandX | kLHintsExpandY,0,0,1,1));
154
155 // Create a horizontal frame containing the buttons
923f55ee 156 TGHorizontalFrame *hframebuttons = new TGHorizontalFrame(this, 200, 40);
157 TGTextButton *prev = new TGTextButton(hframebuttons, "&Prev");
158 prev->Connect("Clicked()", "AliQAHistViewer", this, "DoDrawPrev()");
159 hframebuttons->AddFrame(prev, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
160 TGTextButton *next = new TGTextButton(hframebuttons, "&Next");
161 next->Connect("Clicked()", "AliQAHistViewer", this, "DoDrawNext()");
162 hframebuttons->AddFrame(next, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
d3a269ff 163 AddFrame(hframebuttons, new TGLayoutHints(kLHintsCenterX, 2, 2, 2, 2));
164
923f55ee 165 if ((!fIsEmbedded))
166 {
167 TGTextButton *exit = new TGTextButton(hframebuttons, "&Exit ");
168 exit->Connect("Pressed()", "AliQAHistViewer", this, "DoExit()");
169 hframebuttons->AddFrame(exit, new TGLayoutHints(kLHintsRight, 5, 5, 3, 4));
170 }
923f55ee 171
172 // Set a name to the main frame
173 SetWindowName("Quality Assurance Monitoring");
174 MapSubwindows();
175
176 // Initialize the layout algorithm via Resize()
177 Resize(GetDefaultSize());
178
179 // Map main frame
180 MapWindow();
181 DoDrawNext();
182}
183
184//_________________________________________________________________________
185AliQAHistViewer::~AliQAHistViewer()
186{
187 // Clean up main frame...
188 Cleanup();
189 delete fEcan;
190 delete fQANavigator;
191}
192
193//_________________________________________________________________________
194void AliQAHistViewer::FillComboBoxWithListEntries( TGComboBox* box, const TList* list )
195{
196 box->RemoveAll();
197 Int_t i=0;
198 TIter listiter(list);
199 TObject* o = NULL;
200 while ((o = (TObject*)listiter.Next()))
201 {
202 TString name = o->GetName();
203 box->AddEntry( name.Data(), i++ );
204 }
205}
206
207//_________________________________________________________________________
208void AliQAHistViewer::UpdateAllPathComboBoxes()
209{
7b852582 210 if (!fQANavigator->InitOK()) return;
d3a269ff 211 FillComboBoxWithListEntries( fFileListBox, (TList*)fQANavigator->GetFileList()->GetDirs() );
212 FillComboBoxWithListEntries( fDetectorListBox, (TList*)fQANavigator->GetDetectorList()->GetDirs() );
213 FillComboBoxWithListEntries( fLevelListBox, (TList*)fQANavigator->GetLevelList()->GetDirs() );
214 FillComboBoxWithListEntries( fHistListBox, (TList*)fQANavigator->GetItemList() );
215 fFileListBox->Select(fQANavigator->GetCurrListOfFiles()->GetDirs()->IndexOf(fQANavigator->GetCurrFile()),kFALSE);
216 fDetectorListBox->Select(fQANavigator->GetCurrFile()->GetDirs()->IndexOf(fQANavigator->GetCurrDetector()),kFALSE);
217 fLevelListBox->Select(fQANavigator->GetCurrDetector()->GetDirs()->IndexOf(fQANavigator->GetCurrLevel()),kFALSE);
218 fHistListBox->Select(fQANavigator->GetItemList()->IndexOf(fQANavigator->GetCurrItem()),kFALSE);
923f55ee 219}
220
221//_________________________________________________________________________
222void AliQAHistViewer::DoSetFile( Int_t s )
223{
224 fQANavigator->SetFile(s);
225 DoDrawNext();
226}
227
228//_________________________________________________________________________
229void AliQAHistViewer::DoSetDetector( Int_t s )
230{
231 fQANavigator->SetDetector(s);
232 DoDrawNext();
233}
234
235//_________________________________________________________________________
236void AliQAHistViewer::DoSetLevel( Int_t s )
237{
238 fQANavigator->SetLevel(s);
239 DoDrawNext();
240}
241
242//_________________________________________________________________________
243void AliQAHistViewer::DoSetHistogram( Int_t s )
244{
d3a269ff 245 fQANavigator->SetItem(s);
246 DoDrawNext();
247}
248
249//_________________________________________________________________________
250void AliQAHistViewer::DoSetExpertMode(Bool_t mode)
251{
252 fQANavigator->SetExpertMode(mode);
923f55ee 253 DoDrawNext();
254}