5 * Created by schutz on 01/08/08.
6 * Copyright 2008 CERN. All rights reserved.
11 TControlBar * fQA = NULL ;
12 TControlBar * fDet = NULL ;
13 TControlBar * fHist = NULL ;
14 const Int_t fRun = 48868 ;
15 AliQA * fQAResult = NULL ;
16 TCanvas * fCa = NULL ;
20 cout << AliQA::GetQAResultFileName() << endl ;
21 TFile * qaResultFile = TFile::Open("QA.root") ; //AliQA::GetQAResultFileName() ) ;
22 if ( ! qaResultFile ) {
23 printf("File %s not found in current directory\n", AliQA::GetQAResultFileName() ) ;
26 fQAResult = (AliQA *)qaResultFile->Get("QA") ;
28 printf("QA object not found in %s\n", AliQA::GetQAResultFileName() ) ;
32 TFile * qaDataFile = TFile::Open(Form("Merged.QA.%d.root", fRun)) ;
34 printf("File Merged.QA.%d.root not found in current directory\n", fRun) ;
39 TCanvas * cc = new TCanvas("test", "", 400, 800) ;
40 fQA = new TControlBar("vertical", Form("Active detectors in Run %d", fRun), 100, 20);
41 fQA->SetButtonWidth(24) ;
42 fQA->AddButton("Clean Screen", "Cls()", "Clean the screen");
43 // search active detectors
44 TList * listOfDetectors = qaDataFile->GetListOfKeys() ;
45 for (Int_t det = 0 ; det < listOfDetectors->GetEntries() ; det++) {
46 char * detName = listOfDetectors->At(det)->GetName() ;
47 if (fQAResult->IsSetAny(AliQA::GetDetIndex(detName)))
48 char * buttonName = Form("QA SIGNALLED !! : %s", detName) ;
50 char * buttonName = Form("QA OK : %s", detName) ;
51 fQA->AddButton(buttonName, Form("MakeDetMenu(\"%s\")", detName), Form("Display the QA histograms for %s", detName));
56 void MakeDetMenu(char * detName)
64 fDet = new TControlBar("vertical", detName, 6000, 8000);
65 fDet->SetButtonWidth(100) ;
66 // serach all the QA tasks
67 TDirectory * save = gDirectory ;
68 gDirectory->cd(detName) ;
69 TList * listOfTasks = gDirectory->GetListOfKeys() ;
70 for (Int_t task = 0 ; task < listOfTasks->GetEntries() ; task++) {
71 char * taskName = listOfTasks->At(task)->GetName() ;
72 if (fQAResult->IsSetAny(AliQA::GetDetIndex(detName), AliQA::GetTaskIndex(taskName)))
73 char * buttonName = Form("QA SIGNALLED !! : %s", taskName) ;
75 char * buttonName = Form("QA OK : %s", taskName) ;
76 fDet->AddButton(buttonName, Form("MakeTaskMenu(\"%s\", \"%s\")", detName, taskName), Form("Display the QA histograms for %s", taskName));
82 void MakeTaskMenu(char * detName, char * taskName )
88 fHist = new TControlBar("vertical", Form("Found QA histo for %s/%s", detName, taskName));
89 fHist->SetButtonWidth(100) ;
90 fHist->AddButton("ALL", Form("DisplayAll(\"%s\", \"%s\")", detName, taskName), Form("Display the QA histograms for %s", detName));
91 TDirectory * save = gDirectory ;
92 gDirectory->cd(Form("%s/%s", detName, taskName)) ;
93 TList * listOfHistos = gDirectory->GetListOfKeys() ;
94 for (Int_t h = 0 ; h < listOfHistos->GetEntries() ; h++) {
95 char * hName = listOfHistos->At(h)->GetName() ;
96 fHist->AddButton(hName, Form("Display(\"%s\")", hName), Form("Display the QA histograms %s", hName));
103 void Display(char * hName)
107 cout << Display << " " << hName << endl ;
108 fCa = new TCanvas(hName, "test", 800, 600) ;
110 TH1 * hh = dynamic_cast<TH1*>(gDirectory->FindObjectAny(hName));
118 void DisplayAll(char * detName, char * taskName)
120 cout << Display << " " << detName << endl ;
121 TDirectory * save = gDirectory ;
122 gDirectory->cd(Form("%s/%s", detName, taskName)) ;
123 TList * listOfHistos = gDirectory->GetListOfKeys() ;
124 Int_t nHisto = listOfHistos->GetEntries() ;
125 Int_t ny = TMath::Sqrt(nHisto) ;
126 Int_t nx = nHisto / ny + 1 ;
129 fCa = new TCanvas(Form("QA %s in %s", taskName, detName), Form("QA %s in %s", taskName, detName), nx*300, ny*300) ;
130 fCa->Divide(nx, ny) ;
131 for (Int_t h = 0 ; h < listOfHistos->GetEntries() ; h++) {
132 char * hName = listOfHistos->At(h)->GetName() ;
133 TH1 * hh = dynamic_cast<TH1*>(gDirectory->FindObjectAny(hName));
134 TPad * pad = fCa->cd(h+1) ;