* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-
////////////////////////////////////////////////////////////////////////////
//
// QA histogram viewer
+// scans the current directory fro files with QA
+// and plots them.
//
// origin: Mikolaj Krzewicki, Nikhef, Mikolaj.Krzewicki@cern.ch
//
///////////////////////////////////////////////////////////////////////////
+#include <TApplication.h>
+#include <TGButton.h>
+#include <TGFrame.h>
+#include <TFrame.h>
+#include <TRootEmbeddedCanvas.h>
+#include <TGStatusBar.h>
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TF1.h>
+#include <TString.h>
+#include <TGComboBox.h>
+#include <TList.h>
+#include "AliQAHistNavigator.h"
#include "AliQAHistViewer.h"
ClassImp(AliQAHistViewer)
//_________________________________________________________________________
void AliQAHistViewer::DoDrawNext()
{
+ //draw next histogram
Int_t rows = 2;
Int_t cols = 2;
TString oldDirStr;
}
c1->cd(i);
TH1* hist;
- if (!fQANavigator->GetHistogram(hist)) break;
- if (hist) hist->Draw();
- else continue;
+ if (fQANavigator->GetHistogram(hist))
+ {
+ if (hist) hist->Draw();
+ }
if (!fQANavigator->Next())
{
break;
}
}
+ c1->cd(0);
c1->Update();
}
//_________________________________________________________________________
void AliQAHistViewer::DoDrawPrev()
{
+ //draw previous histogram
Int_t rows = 2;
Int_t cols = 2;
TString oldDirStr;
}
c1->cd(i);
TH1* hist;
- if (!fQANavigator->GetHistogram(hist)) break;
- if (hist) hist->Draw();
- else continue;
+ if (fQANavigator->GetHistogram(hist))
+ {
+ if (hist) hist->Draw();
+ }
if (!fQANavigator->Prev())
{
break;
}
}
+ c1->cd(0);
c1->Update();
}
//_________________________________________________________________________
void AliQAHistViewer::DoExit()
{
+ //exit
printf("Exit application...");
gApplication->Terminate(0);
}
//_________________________________________________________________________
AliQAHistViewer::AliQAHistViewer(const TGWindow *p, UInt_t w, UInt_t h, Bool_t embed) :
TGMainFrame(p, w, h),
+ fEcan(NULL),
+ fQANavigator(new AliQAHistNavigator()),
fFileListBox(NULL),
fDetectorListBox(NULL),
fLevelListBox(NULL),
fHistListBox(NULL),
+ fExpertMode(NULL),
fIsEmbedded(embed)
{
//initialize the QA navigator
- fQANavigator = new AliQAHistNavigator();
- // Create the embedded canvas
- fEcan = new TRootEmbeddedCanvas(0,this,800,600);
- Int_t wid = fEcan->GetCanvasWindowId();
- TCanvas *myc = new TCanvas("MyCanvas", 10,10,wid);
- fEcan->AdoptCanvas(myc);
- //myc->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliQAHistViewer",this,
- // "EventInfo(Int_t,Int_t,Int_t,TObject*)");
-
- AddFrame(fEcan, new TGLayoutHints(kLHintsTop | kLHintsLeft |
- kLHintsExpandX | kLHintsExpandY,0,0,1,1));
-
// horizontal frame with comboboxes for navigation
TGHorizontalFrame *hframenav = new TGHorizontalFrame(this, 200,40);
fFileListBox = new TGComboBox(hframenav);
hframenav->AddFrame(fHistListBox, new TGLayoutHints(kLHintsLeft));
AddFrame(hframenav, new TGLayoutHints((kLHintsLeft|kLHintsExpandX), 5,5,5,5));
UpdateAllPathComboBoxes();
- // Create a horizontal frame containing two buttons
+ fExpertMode = new TGCheckButton(hframenav,"Expert");
+ hframenav->AddFrame(fExpertMode,new TGLayoutHints(kLHintsLeft, 0, 4, 3, 0));
+ fExpertMode->SetToolTipText("Show expert histograms");
+ fExpertMode->Connect("Toggled(Bool_t)", "AliQAHistViewer", this, "DoSetExpertMode(Bool_t)");
+ // Create the embedded canvas
+ fEcan = new TRootEmbeddedCanvas(0,this,800,600);
+ Int_t wid = fEcan->GetCanvasWindowId();
+ TCanvas *myc = new TCanvas("MyCanvas", 10,10,wid);
+ fEcan->AdoptCanvas(myc);
+ //myc->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","AliQAHistViewer",this,
+ // "EventInfo(Int_t,Int_t,Int_t,TObject*)");
+
+ AddFrame(fEcan, new TGLayoutHints(kLHintsTop | kLHintsLeft |
+ kLHintsExpandX | kLHintsExpandY,0,0,1,1));
+
+ // Create a horizontal frame containing the buttons
TGHorizontalFrame *hframebuttons = new TGHorizontalFrame(this, 200, 40);
TGTextButton *prev = new TGTextButton(hframebuttons, "&Prev");
prev->Connect("Clicked()", "AliQAHistViewer", this, "DoDrawPrev()");
TGTextButton *next = new TGTextButton(hframebuttons, "&Next");
next->Connect("Clicked()", "AliQAHistViewer", this, "DoDrawNext()");
hframebuttons->AddFrame(next, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));
+ AddFrame(hframebuttons, new TGLayoutHints(kLHintsCenterX, 2, 2, 2, 2));
+
if ((!fIsEmbedded))
{
TGTextButton *exit = new TGTextButton(hframebuttons, "&Exit ");
exit->Connect("Pressed()", "AliQAHistViewer", this, "DoExit()");
hframebuttons->AddFrame(exit, new TGLayoutHints(kLHintsRight, 5, 5, 3, 4));
}
- AddFrame(hframebuttons, new TGLayoutHints(kLHintsCenterX, 2, 2, 2, 2));
// Set a name to the main frame
SetWindowName("Quality Assurance Monitoring");
{
// Clean up main frame...
Cleanup();
- delete fEcan;
+ //delete fEcan;
delete fQANavigator;
}
//_________________________________________________________________________
void AliQAHistViewer::FillComboBoxWithListEntries( TGComboBox* box, const TList* list )
{
+ //fill the combobox with list entries
box->RemoveAll();
Int_t i=0;
TIter listiter(list);
//_________________________________________________________________________
void AliQAHistViewer::UpdateAllPathComboBoxes()
{
- FillComboBoxWithListEntries( fFileListBox, fQANavigator->GetFileList() );
- FillComboBoxWithListEntries( fDetectorListBox, fQANavigator->GetDetectorList() );
- FillComboBoxWithListEntries( fLevelListBox, fQANavigator->GetLevelList() );
- FillComboBoxWithListEntries( fHistListBox, fQANavigator->GetHistList() );
- fFileListBox->Select(fQANavigator->GetCurrListOfFiles()->IndexOf(fQANavigator->GetCurrFile()),kFALSE);
- fDetectorListBox->Select(fQANavigator->GetCurrFile()->IndexOf(fQANavigator->GetCurrDetector()),kFALSE);
- fLevelListBox->Select(fQANavigator->GetCurrDetector()->IndexOf(fQANavigator->GetCurrLevel()),kFALSE);
- fHistListBox->Select(fQANavigator->GetCurrLevel()->IndexOf(fQANavigator->GetCurrHistName()),kFALSE);
+ //make gui elements up to date
+ if (!fQANavigator->InitOK()) return;
+ FillComboBoxWithListEntries( fFileListBox, (TList*)fQANavigator->GetFileList()->GetDirs() );
+ FillComboBoxWithListEntries( fDetectorListBox, (TList*)fQANavigator->GetDetectorList()->GetDirs() );
+ FillComboBoxWithListEntries( fLevelListBox, (TList*)fQANavigator->GetLevelList()->GetDirs() );
+ FillComboBoxWithListEntries( fHistListBox, (TList*)fQANavigator->GetItemList() );
+ fFileListBox->Select(fQANavigator->GetCurrListOfFiles()->GetDirs()->IndexOf(fQANavigator->GetCurrFile()),kFALSE);
+ fDetectorListBox->Select(fQANavigator->GetCurrFile()->GetDirs()->IndexOf(fQANavigator->GetCurrDetector()),kFALSE);
+ fLevelListBox->Select(fQANavigator->GetCurrDetector()->GetDirs()->IndexOf(fQANavigator->GetCurrLevel()),kFALSE);
+ fHistListBox->Select(fQANavigator->GetItemList()->IndexOf(fQANavigator->GetCurrItem()),kFALSE);
}
//_________________________________________________________________________
void AliQAHistViewer::DoSetFile( Int_t s )
{
+ //set file from user choice
fQANavigator->SetFile(s);
DoDrawNext();
}
//_________________________________________________________________________
void AliQAHistViewer::DoSetDetector( Int_t s )
{
+ //set detector number from user choice
fQANavigator->SetDetector(s);
DoDrawNext();
}
//_________________________________________________________________________
void AliQAHistViewer::DoSetLevel( Int_t s )
{
+ //set QA level
fQANavigator->SetLevel(s);
DoDrawNext();
}
//_________________________________________________________________________
void AliQAHistViewer::DoSetHistogram( Int_t s )
{
- fQANavigator->SetHist(s);
+ //set histogram
+ fQANavigator->SetItem(s);
+ DoDrawNext();
+}
+
+//_________________________________________________________________________
+void AliQAHistViewer::DoSetExpertMode(Bool_t mode)
+{
+ //set expert mode
+ fQANavigator->SetExpertMode(mode);
DoDrawNext();
}