#include "AliTPCCalibViewerGUI.h"
#include "AliTPCCalibViewer.h"
#include "AliTPCcalibDB.h"
+#include "AliTPCcalibDButil.h"
#include "AliTPCConfigParser.h"
#include "AliTPCCalibViewerGUItime.h"
fContLeft(0x0),
fContDrawOpt(0x0),
fChkDrawOptSame(0x0),
+ fChkDrawOptSparse(0x0),
fComboAddDrawOpt(0x0),
fContDrawSel(0x0),
fContDrawSelSubRunTime(0x0),
fLblValueXVal(0x0),
fLblValueYVal(0x0),
fBtnDumpRuns(0x0),
+ fContAliases(0x0),
+ fListAliases(0x0),
//content bottom
fContCustom(0x0),
fContCustomCuts(0x0),
// draw options
fContDrawOpt = new TGGroupFrame(fContLeft, "Draw options", kVerticalFrame | kFitWidth | kFitHeight);
fContLeft->AddFrame(fContDrawOpt, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
- fChkDrawOptSame = new TGCheckButton(fContDrawOpt, "Same");
- fContDrawOpt->AddFrame(fChkDrawOptSame, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
+
+ TGCompositeFrame *cfr = new TGCompositeFrame(fContDrawOpt, 200, 23, kHorizontalFrame | kFitWidth | kFixedHeight);
+ fContDrawOpt->AddFrame(cfr, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX , 0, 0, 0, 0));
+
+ fChkDrawOptSame = new TGCheckButton(cfr, "Same");
+ cfr->AddFrame(fChkDrawOptSame, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
fChkDrawOptSame->SetToolTipText("Add draw option 'same'");
+
+ fChkDrawOptSparse = new TGCheckButton(cfr, "Sparse");
+ cfr->AddFrame(fChkDrawOptSparse, new TGLayoutHints(kLHintsNormal, 0, 2, 0, 0));
+ fChkDrawOptSparse->Connect("Clicked()", "AliTPCCalibViewerGUItime", this, "DoNewSelection()");
+ fChkDrawOptSparse->SetToolTipText("In case of run trending only plot runs with information");
+
// additional draw options combo box
fComboAddDrawOpt = new TGComboBox(fContDrawOpt);
fComboAddDrawOpt->Resize(0, 22);
fContDrawOpt->AddFrame(fComboAddDrawOpt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
// fComboAddDrawOpt->Connect("ReturnPressed()", "AliTPCCalibViewerGUI", this, "HandleButtonsGeneral(=14)");
// fComboAddDrawOpt->Connect("Selected(Int_t)", "AliTPCCalibViewerGUI", this, "DoNewSelection()");
+ fComboAddDrawOpt->GetTextEntry()->SetText("",kFALSE);
// draw selection group
fContDrawSel = new TGGroupFrame(fContLeft, "Draw selection", kVerticalFrame | kFitWidth | kFitHeight);
fLblRunNumber->SetTextJustify(kTextLeft);
fContValues->AddFrame(fLblRunNumber, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
//run number
- fLblRunNumberVal = new TGLabel(fContValues, "00000");
+ fLblRunNumberVal = new TGLabel(fContValues, "000000");
fLblRunNumberVal->SetTextJustify(kTextLeft);
fContValues->AddFrame(fLblRunNumberVal, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0));
//time stamp label
fContRight->AddFrame(fBtnDumpRuns, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
fBtnDumpRuns->Connect("Clicked()", "AliTPCCalibViewerGUItime", this, "DoDumpRuns()");
fBtnDumpRuns->SetToolTipText("Press to dump the run numbers of the current selection.");
+ //group frame for value information
+ fContAliases = new TGGroupFrame(fContRight, "Aliases", kVerticalFrame | kFitWidth | kFitHeight);
+ fContRight->AddFrame(fContAliases, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 10, 0));
+ // list of aliases
+ fListAliases = new TGListBox(fContAliases);
+ fContAliases->AddFrame(fListAliases, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0));
+ fListAliases->Connect("Selected(Int_t)", "AliTPCCalibViewerGUItime", this, "DoNewSelectionAliases()");
+// fListAliases->Resize(0,88);
+ //buttons
+ TGCompositeFrame *frame1 = new TGCompositeFrame(fContAliases, 200, 23, kHorizontalFrame | kFitWidth | kFitHeight);
+ fContAliases->AddFrame(frame1, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX , 0, 0, 0, 0));
+ // add button
+ TGTextButton *btnAdd = new TGTextButton(frame1, "&Add");
+ frame1->AddFrame(btnAdd, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
+ btnAdd->Connect("Clicked()", "AliTPCCalibViewerGUItime", this, "DoAddAlias()");
+ btnAdd->SetToolTipText("Press to add an alias.");
+ btnAdd->Resize(0,22);
+ // del button
+ TGTextButton *btnDel = new TGTextButton(frame1, "&Del");
+ frame1->AddFrame(btnDel, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
+ btnDel->Connect("Clicked()", "AliTPCCalibViewerGUItime", this, "DoDelAlias()");
+ btnDel->SetToolTipText("Press to delete the selected alias.");
+ btnDel->Resize(0,22);
+ // update button
+ TGTextButton *btnUp = new TGTextButton(frame1, "&Upd");
+ frame1->AddFrame(btnUp, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
+ btnUp->Connect("Clicked()", "AliTPCCalibViewerGUItime", this, "UpdateAliasList()");
+ btnUp->SetToolTipText("Press to update the alias list.");
+ btnUp->Resize(0,22);
+
+
// =========================================================================
// ****************** bottom content of fContTopBottom *********************
fContCustom->AddFrame(fComboCustomDraw, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
fComboCustomDraw->Connect("ReturnPressed()", "AliTPCCalibViewerGUItime", this, "DoCustomDraw()");
fComboCustomDraw->Connect("Selected(Int_t)", "AliTPCCalibViewerGUItime", this, "DoCustomDraw()");
-
+ fComboCustomDraw->GetTextEntry()->SetText("",kFALSE);
// additional cuts container
fContCustomCuts = new TGCompositeFrame(fContTopBottom, 200, 200, kHorizontalFrame | kFitWidth | kFitHeight);
fContCustomCuts->AddFrame(fComboCustomCuts, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 0, 0));
fComboCustomCuts->Connect("ReturnPressed()", "AliTPCCalibViewerGUItime", this, "DoCustomCutsDraw()");
fComboCustomCuts->Connect("Selected(Int_t)", "AliTPCCalibViewerGUItime", this, "DoCustomCutsDraw()");
-
+ fComboCustomCuts->GetTextEntry()->SetText("",kFALSE);
+
SetWindowName("AliTPCCalibViewer GUI - Time");
MapSubwindows();
Resize(GetDefaultSize());
//
// retrieve tree from file
//
- TString s=gSystem->GetFromPipe(Form("ls %s",fileName));
-// TString s(fileName);
- TObjArray *arr=s.Tokenize("\n");
+ TObjArray *arr=0x0;
+ TString file(fileName);
+ if (file.Contains("://")) {
+ if (file.Contains(";")) {
+ arr=file.Tokenize(";");
+ } else {
+ arr=new TObjArray;
+ arr->Add(new TObjString(fileName));
+ }
+ } else {
+ TString s=gSystem->GetFromPipe(Form("ls %s",fileName));
+ arr=s.Tokenize("\n");
+ }
+
+ if (!arr) return;
TIter next(arr);
TObject *o=0;
if (fTree) delete fTree;
while ( (o=next()) ){
fTree->AddFile(o->GetName());
}
+ arr->SetOwner();
delete arr;
if (!CheckChain()) return;
UseConfigFile(fConfigFile.Data());
}
//______________________________________________________________________________
-void AliTPCCalibViewerGUItime::UseChain(TChain* chain = 0)
+void AliTPCCalibViewerGUItime::UseChain(TChain *const chain = 0)
{
//
//
if (type.IsNull()) type="UNSPECIFIED";
// printf("CalibType: '%s'\n",type.Data());
if (!fListCalibType->FindEntry(type.Data())) {
- fListCalibType->AddEntry(type,id);
+ fListCalibType->AddEntry(type.Data(),id);
fListCalibType->Select(id++);
}
}
//add type for unspecified calibration type
type="UNSPECIFIED";
if (!fListCalibType->FindEntry(type.Data())) {
- fListCalibType->AddEntry(SubstituteUnderscores(type.Data()),id);
+ fListCalibType->AddEntry(type.Data(),id);
fListCalibType->Select(id++);
}
}
if (!active){
TString s=branchName;
if (branchName.EndsWith(".")) s+="*";
- fTree->SetBranchStatus(s.Data(),0);
+// fTree->SetBranchStatus(s.Data(),0);
continue;
}
// fListVariables->AddEntry(SubstituteUnderscores(branchTitle.Data()),id);
}
//______________________________________________________________________________
-const char* AliTPCCalibViewerGUItime::GetDrawString(){
+const TString AliTPCCalibViewerGUItime::GetDrawString(){
//
// create draw string for ttree by combining the user requestsa
//
id=fListVariables->GetSelectedEntry()->EntryId();
// printf("id: %d\n",id);
TString branchName=selectedVariable;
- const TObject *key=(*fConfigParser)(id);
- if (key) branchName=(*fConfigParser)(id)->GetName();
+ if (fConfigParser){
+ const TObject *key=(*fConfigParser)(id);
+ if (key) branchName=(*fConfigParser)(id)->GetName();
+ }
//treat case of TVector
if (branchName.EndsWith(".")){
Int_t par = (Int_t)(fNmbPar->GetNumber());
// if (fRadioXtime->GetState()==kButtonDown)
// selectedVariable.Append(":time");
- return branchName.Data();
+ return branchName;
}
//______________________________________________________________________________
-const char* AliTPCCalibViewerGUItime::GetDrawOption(){
+const TString AliTPCCalibViewerGUItime::GetDrawOptionString(){
//
// get user selected draw options
//
if (fComboAddDrawOpt->GetSelectedEntry()) drawOpt=fComboAddDrawOpt->GetSelectedEntry()->GetTitle();
if (fChkDrawOptSame->GetState()==kButtonDown && !drawOpt.Contains("same",TString::kIgnoreCase))
drawOpt+="same";
- return drawOpt.Data();
+ return drawOpt;
}
//______________________________________________________________________________
void AliTPCCalibViewerGUItime::GetCutString(TString &cutStr){
cutStr=cuts.GetTitle();
}
//______________________________________________________________________________
-void AliTPCCalibViewerGUItime::UpdateValueArrays(Bool_t withGraph)
+void AliTPCCalibViewerGUItime::UpdateValueArrays(Bool_t withGraph, const Double_t *xArr)
{
//
//
fRunNumbers.ResizeTo(1);
fTimeStamps.ResizeTo(1);
} else {
- fValuesX.ResizeTo(fTree->GetSelectedRows());
- fValuesY.ResizeTo(fTree->GetSelectedRows());
- fRunNumbers.ResizeTo(fTree->GetSelectedRows());
- fTimeStamps.ResizeTo(fTree->GetSelectedRows());
- fValuesY.SetElements(fTree->GetV3());
- fRunNumbers.SetElements(fTree->GetV1());
- fTimeStamps.SetElements(fTree->GetV2());
+ const Long64_t nrows=fTree->GetSelectedRows();
+ fValuesX.ResizeTo(nrows);
+ fValuesY.ResizeTo(nrows);
+ fRunNumbers.ResizeTo(nrows);
+ fTimeStamps.ResizeTo(nrows);
+ long long *index=new long long[nrows];
+
+ //sort data
+ Int_t nTime0=0;
+ for (Int_t i=0;i<fTree->GetSelectedRows();++i){
+ if (fTree->GetV2()[i]<1) ++nTime0;
+ }
+
+ if (nTime0==fTree->GetSelectedRows()){
+ TMath::Sort(nrows,fTree->GetV1(),index,kFALSE);
+ } else {
+ TMath::Sort(nrows,fTree->GetV2(),index,kFALSE);
+ }
+
+ Double_t lastRun=-1.;
+ Int_t entries=0;
+ const Bool_t drawSparse=(fRadioXrun->GetState()==kButtonDown && fChkDrawOptSparse->GetState()==kButtonDown);
+ for (Long64_t i=0; i<nrows; ++i){
+ // in case of sparse drawing only use the first entry per run
+ Double_t run = fTree->GetV1()[index[i]];
+ Double_t xval = xArr[index[i]];
+
+ if (drawSparse){
+ if (TMath::Abs(lastRun-run)<.1) {
+ lastRun=run;
+ continue;
+ }
+ xval=entries+0.5;
+ }
+ fValuesX.GetMatrixArray()[entries]=xval;
+ fValuesY.GetMatrixArray()[entries]=fTree->GetV3()[index[i]];
+ fRunNumbers.GetMatrixArray()[entries]=run;
+ fTimeStamps.GetMatrixArray()[entries]=fTree->GetV2()[index[i]];
+ lastRun=run;
+ ++entries;
+ }
+
+ if (drawSparse){
+ fValuesX.ResizeTo(entries);
+ fValuesY.ResizeTo(entries);
+ fRunNumbers.ResizeTo(entries);
+ fTimeStamps.ResizeTo(entries);
+ // printf("entries: %d\n",entries);
+ }
+
+ delete [] index;
}
}
//______________________________________________________________________________
}
}
}
- varName=SubstituteUnderscores(branchTitle.Data());
+ varName=branchTitle;
+ SubstituteUnderscores(varName);
}
}
title+=varName;
//
TIter nextGraphicObject(fTrashBox);
TObject *o=0x0;
- Float_t min=0,max=0;
+ Float_t min=1,max=0;
while ( (o=nextGraphicObject()) ){
if (o->IsA()==TGraph::Class()){
TGraph *gr=(TGraph*)o;
- if (min==max) {
+ if (min>max) {
min=TMath::MinElement(gr->GetN(),gr->GetY());
max=TMath::MaxElement(gr->GetN(),gr->GetY());
} else {
TString drawString=fDrawString;
TString cutString;
GetCutString(cutString);
- TString optString = GetDrawOption();
+ TString optString = GetDrawOptionString();
Bool_t graphOutput=!fNoGraph; //ttree buffer for V1, V2... too small
graphOutput&=(drawString.First(">>")<0); //histogram output in custom draw
graphOutput&=fRadioXhist->GetState()!=kButtonDown; //histogram drawing selected
- graphOutput&=!(fIsCustomDraw&&!fDrawString.Contains(":")); //custom draw 1D
+// graphOutput&=!(fIsCustomDraw&&!fDrawString.Contains(":")); //custom draw 1D
+// graphOutput&=fDrawString.CountChar(':')<2; //custom draw 1D
+ if (fIsCustomDraw&&fDrawString.Contains(":")) HandleButtonsDrawSel(-kRadioXhist);
if (fIsCustomDraw&&fDrawString.Contains(":")) HandleButtonsDrawSel(-kRadioXhist);
Bool_t drawSame=optString.Contains("same",TString::kIgnoreCase);
// optString+="goff";
fCurrentGraph=0x0;
fCurrentHist=0x0;
}
-// if (fCurrentGraph) {
-// delete fCurrentGraph;
-// fCurrentGraph=0x0;
-// //fCurrentHist in case of graph is the interrnal histogram,
-// // which is deleted by the graph itself.
-// fCurrentHist=0x0;
-// }
-// if (fCurrentHist) {
-// delete fCurrentHist;
-// fCurrentHist=0x0;
-// }
+// printf("%s (%s) [%s]\n",drawString.Data(), cutString.Data(), optString.Data());
//select data
fTree->Draw(drawString.Data(),cutString.Data(),optString.Data());
if (fTree->GetSelectedRows()==-1) return;
- UpdateValueArrays(graphOutput);
+
TString title;
GetHistogramTitle(title);
Bool_t drawGraph=kFALSE;
+ Double_t *xArr=0;
if (graphOutput){
- if (fIsCustomDraw){
- if (fDrawString.Contains(":")){
- fValuesX.SetElements(fTree->GetV4());
- drawGraph=kTRUE;
- } else {
- drawGraph=kFALSE;
- }
+ drawGraph=kTRUE;
+ if (fIsCustomDraw&&fDrawString.Contains(":")){
+// fValuesX.SetElements(fTree->GetV4());
+ xArr=fTree->GetV4();
}else{
- drawGraph=kTRUE;
if (fRadioXrun->GetState()==kButtonDown){
- fValuesX.SetElements(fTree->GetV1());
+// fValuesX.SetElements(fTree->GetV1());
+ xArr=fTree->GetV1();
} else if (fRadioXtime->GetState()==kButtonDown){
- fValuesX.SetElements(fTree->GetV2());
+// fValuesX.SetElements(fTree->GetV2());
+ xArr=fTree->GetV2();
} else {
drawGraph=kFALSE;
}
}
- }//create graph according to selection
+ }
+ if (xArr) UpdateValueArrays(graphOutput, xArr);
+// if (graphOutput){
+// if (fIsCustomDraw){
+// if (fDrawString.Contains(":")){
+// fValuesX.SetElements(fTree->GetV4());
+// drawGraph=kTRUE;
+// } else {
+// drawGraph=kFALSE;
+// }
+// }else{
+// drawGraph=kTRUE;
+// if (fRadioXrun->GetState()==kButtonDown){
+// fValuesX.SetElements(fTree->GetV1());
+// } else if (fRadioXtime->GetState()==kButtonDown){
+// fValuesX.SetElements(fTree->GetV2());
+// } else {
+// drawGraph=kFALSE;
+// }
+// }
+// }
+//create graph according to selection
if (drawGraph){
TGraph *graph=new TGraph(fValuesX,fValuesY);
+// graph->Sort();
TString grDraw="p";
if (!drawSame) grDraw+="a";
if (!fIsCustomDraw) grDraw+="l";
+ // sparse drawing, set bin labels
+ if (fRadioXrun->GetState()==kButtonDown && fChkDrawOptSparse->GetState()==kButtonDown){
+ Int_t nrows=fValuesX.GetNrows();
+ Double_t *newBins = new Double_t[nrows+1];
+ for (Int_t ibin=0; ibin<nrows+1; ++ibin) newBins[ibin]=ibin;
+ graph->GetXaxis()->Set(nrows,newBins);
+ graph->GetXaxis()->LabelsOption("v");
+ for (Int_t i=0; i<nrows;++i)
+ graph->GetXaxis()->SetBinLabel(i+1,Form("%.0f",fRunNumbers.GetMatrixArray()[i]));
+ delete [] newBins;
+ }
graph->Draw(grDraw.Data());
graph->SetEditable(kFALSE);
TH1 *hist=graph->GetHistogram();
if (run!=prevRun) std::cout << Form("%d",run) << std::endl;
prevRun=run;
}
- delete sortIndex;
+ delete [] sortIndex;
}
//______________________________________________________________________________
void AliTPCCalibViewerGUItime::DoParLimitChange()
UInt_t dd=0,mm=0,yy=0,HH=0,MM=0,SS=0,run=0;
Double_t valx=0.,valy=0.;
if (!fCurrentGraph) {
- fLblRunNumberVal->SetText(Form("%05u",run));
+ fLblRunNumberVal->SetText(Form("%06u",run));
fLblRunTimeVal->SetText(Form("%02u.%02u.%04u\n%02u:%02u:%02u",dd,mm,yy,HH,MM,SS));
fLblValueXVal->SetText(Form("%.3e", valx));
fLblValueYVal->SetText(Form("%.3e", valy));
valx=0.;
valy=0.;
}
- fLblRunNumberVal->SetText(Form("%05u",run));
+ fLblRunNumberVal->SetText(Form("%06u",run));
fLblRunTimeVal->SetText(Form("%02u.%02u.%04u\n%02u.%02u.%02u",dd,mm,yy,HH,MM,SS));
if (fIsCustomDraw){
fLblValueXVal->SetText(Form("%.3e", valx));
// retrieve file from this directory if it already exists
//
+ //
+ //Create and set GUI tree
+ //
//try to find file for run in fOutputCacheDir
TString fileName=fOutputCacheDir;
if (!fileName.EndsWith("/")) fileName+="/";
fileName+=Form("guiTreeRun_%d.root",run);
Bool_t load=kTRUE;
- TFile f(fileName.Data());
- if (!f.IsOpen()){
+ if (gSystem->AccessPathName(fileName.Data())){
load=AliTPCcalibDB::CreateGUITree(run,fileName.Data());
if (!load){
fCalibViewerGUI->Reset();
return;
}
}
- f.Close();
fCalibViewerGUI->Initialize(fileName.Data());
if (fCalibViewerGUItab) fCalibViewerGUItab->SetText(new TGString(Form("Detail - %05d",run)));
+
+ //
+ //Create and set Reference GUI tree
+ //
+ AliTPCcalibDButil util;
+ util.SetReferenceRun(run);
+ fileName=fOutputCacheDir;
+ if (!fileName.EndsWith("/")) fileName+="/";
+ fileName+=util.GetGUIRefTreeDefaultName();
+ //only update if file does not exist
+ if (gSystem->AccessPathName(fileName.Data())){
+ util.UpdateRefDataFromOCDB();
+ util.CreateGUIRefTree(fileName.Data());
+ }
+
+ fCalibViewerGUI->GetViewer()->AddReferenceTree(fileName.Data(),"calPads","Ref");
+
+ //
+ // Process additional reference trees
+ //
TIter nextRefTree(fMapRefTrees);
TObject *o=0x0;
+ //Set static reference data
while ( (o=nextRefTree()) ){
fCalibViewerGUI->GetViewer()->AddReferenceTree(fMapRefTrees->GetValue(o)->GetName(),"calPads",o->GetName());
}
fCalibViewerGUI->Reload();
}
//______________________________________________________________________________
-const char* AliTPCCalibViewerGUItime::SubstituteUnderscores(const char* in)
+void AliTPCCalibViewerGUItime::SubstituteUnderscores(TString &s)
{
//
//
//
- TString s(in);
s.ReplaceAll("_{","|{");
s.ReplaceAll("_"," ");
s.ReplaceAll("|{","_{");
- return s.Data();
+}
+
+//______________________________________________________________________________
+void AliTPCCalibViewerGUItime::DoNewSelectionAliases()
+{
+ //
+ //
+ //
+ if (!fTree) return;
+ TList *l=fTree->GetListOfAliases();
+ if (!l) return;
+ TString selectedVariable="";
+ if (!fListAliases->GetSelectedEntry()) return;
+ selectedVariable = fListAliases->GetSelectedEntry()->GetTitle();
+ fDrawString=selectedVariable;
+ fIsCustomDraw=kFALSE;
+ DoDraw();
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUItime::DoAddAlias()
+{
+ //
+ //
+ //
+ new AliTPCCalibViewerGUItimeAddAliasFrame(gClient->GetRoot(), fContTopBottom, 400, 200, kVerticalFrame, this);
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUItime::DoDelAlias()
+{
+ //
+ //
+ //
+ if (!fTree) return;
+ TList *l=fTree->GetListOfAliases();
+ if (!l) return;
+ TString selectedVariable="";
+ if (!fListAliases->GetSelectedEntry()) return;
+ selectedVariable = fListAliases->GetSelectedEntry()->GetTitle();
+ l->Remove(l->FindObject(selectedVariable.Data()));
+ UpdateAliasList();
+}
+
+//______________________________________________________________________________
+void AliTPCCalibViewerGUItime::UpdateAliasList()
+{
+ //
+ //
+ //
+ printf("UpdateAliasList\n");
+ if (!fTree) return;
+ TList *l=fTree->GetListOfAliases();
+ if (!l) return;
+ TIter nextAlias(l);
+ TObject *o;
+ fListAliases->RemoveAll();
+ Int_t id=0;
+ while( (o=nextAlias()) ){
+ fListAliases->AddEntry(o->GetName(),id++);
+ }
+ fListAliases->Resize(fListAliases->GetWidth()-1, fListAliases->GetHeight());
+ fListAliases->Resize(fListAliases->GetWidth()+1, fListAliases->GetHeight());
}
//______________________________________________________________________________
TObjArray* AliTPCCalibViewerGUItime::ShowGUI(const char* fileName, const char* treeName) {
return guiArray;
}
+
+
+////////////////////////////////////////////////////////////////////////
+//
+// GUI Alias frame
+//
+////////////////////////////////////////////////////////////////////////
+
+
+ClassImp(AliTPCCalibViewerGUItimeAddAliasFrame)
+
+AliTPCCalibViewerGUItimeAddAliasFrame::AliTPCCalibViewerGUItimeAddAliasFrame(const TGWindow *p, const TGWindow *main,
+ UInt_t w, UInt_t h, UInt_t options,
+ AliTPCCalibViewerGUItime *gui, TString strAlias) :
+ fMain(0x0),
+ fTxt1(0x0),
+ fTxt2(0x0),
+ fGUI(0x0)
+{
+ fMain = new TGTransientFrame(p, main, w, h, options);
+ fMain->Connect("CloseWindow()", "AliTPCCalibViewerGUItimeAddAliasFrame", this, "DoCancel()");
+ fMain->DontCallClose(); // to avoid double deletions.
+
+ // use hierarchical cleaning
+ fMain->SetCleanup(kDeepCleanup);
+
+ //layout
+ TGLayoutHints *l1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2);
+ TGLayoutHints *l2 = new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandX, 2, 2, 0, 5);
+// TGLayoutHints *l3 = new TGLayoutHints(kLHintsTop | kLHintsRight, 5, 5, 5, 5);
+
+ //input fields
+ TGCompositeFrame *f1 = new TGCompositeFrame(fMain, 60, 20, kVerticalFrame);
+ fMain->AddFrame(f1, l1);
+ TGCompositeFrame *frameName = new TGCompositeFrame(f1);
+ TGCompositeFrame *frameFormula = new TGCompositeFrame(f1);
+ f1->AddFrame(frameName,l2);
+ f1->AddFrame(frameFormula,l2);
+ TGLabel *lblTxt1 = new TGLabel(frameName, "Name:");
+ TGLabel *lblTxt2 = new TGLabel(frameFormula, "Formula:");
+ fTxt1 = new TGTextEntry(frameName, new TGTextBuffer(1000));
+ fTxt2 = new TGTextEntry(frameFormula, new TGTextBuffer(1000));
+
+ frameName->AddFrame(lblTxt1, l2);
+ frameName->AddFrame(fTxt1, l2);
+ frameFormula->AddFrame(lblTxt2, l2);
+ frameFormula->AddFrame(fTxt2, l2);
+
+ fTxt1->Resize(350, fTxt1->GetDefaultHeight());
+ fTxt2->Resize(350, fTxt2->GetDefaultHeight());
+
+ //ok and cancel buttons
+ TGHorizontalFrame *frame = new TGHorizontalFrame(fMain, 60, 20, kFixedWidth);
+
+ TGTextButton *okButton = new TGTextButton(frame, "&Ok", 1);
+ okButton->Connect("Clicked()", "AliTPCCalibViewerGUItimeAddAliasFrame", this, "DoOK()");
+ TGTextButton *cancelButton = new TGTextButton(frame, "&Cancel", 2);
+ cancelButton->Connect("Clicked()", "AliTPCCalibViewerGUItimeAddAliasFrame", this, "DoCancel()");
+
+
+ frame->AddFrame(okButton, l1);
+ frame->AddFrame(cancelButton, l1);
+
+ frame->Resize(150, okButton->GetDefaultHeight());
+
+ fMain->AddFrame(frame, new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1));
+
+ fGUI=gui;
+ TString aliasName, alias;
+ if (!strAlias.IsNull()){
+ TChain *c=fGUI->GetChain();
+ if (c){
+ TList *l=c->GetListOfAliases();
+ if (l){
+ TNamed *d=(TNamed*)l->FindObject(strAlias);
+ if (d){
+ aliasName=d->GetName();
+ alias=d->GetTitle();
+ }
+ }
+ }
+ }else{
+ alias=fGUI->GetCustomDrawString();
+ }
+ fTxt1->SetText(aliasName.Data(),kFALSE);
+ fTxt2->SetText(alias.Data(),kFALSE);
+
+ fMain->MapSubwindows();
+ fMain->Resize();
+
+ // position relative to the parent's window
+ fMain->CenterOnParent();
+
+ fMain->SetWindowName("Alias Editor");
+
+ fMain->MapWindow();
+
+}
+//______________________________________________________________________________
+AliTPCCalibViewerGUItimeAddAliasFrame::~AliTPCCalibViewerGUItimeAddAliasFrame()
+{
+ //
+ //
+ //
+ fMain->DeleteWindow(); // deletes fMain
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUItimeAddAliasFrame::DoOK()
+{
+ //
+ //
+ //
+ TString aliasName=fTxt1->GetText();
+ TString alias=fTxt2->GetText();
+ if (!aliasName.IsNull()&&!alias.IsNull()){
+ TChain *c=fGUI->GetChain();
+ if (c){
+ c->SetAlias(aliasName.Data(),alias.Data());
+ }
+ }
+ fGUI->UpdateAliasList();
+ delete this;
+}
+//______________________________________________________________________________
+void AliTPCCalibViewerGUItimeAddAliasFrame::DoCancel()
+{
+ //
+ //
+ //
+ delete this;
+}
+