X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCCalibViewerGUItime.cxx;h=a94565a683cfec2767c38f4253a76ba2aa17997d;hb=bf05fdb7f0e134c7f1f81c2ab3516fded5195c29;hp=ced59599d6b51f586998694cc6980d01e039040e;hpb=1d32f2735ecf016a63ea0d3a7a920463a8d4f657;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCCalibViewerGUItime.cxx b/TPC/AliTPCCalibViewerGUItime.cxx index ced59599d6b..a94565a683c 100644 --- a/TPC/AliTPCCalibViewerGUItime.cxx +++ b/TPC/AliTPCCalibViewerGUItime.cxx @@ -66,6 +66,7 @@ #include "AliTPCCalibViewerGUI.h" #include "AliTPCCalibViewer.h" #include "AliTPCcalibDB.h" +#include "AliTPCcalibDButil.h" #include "AliTPCConfigParser.h" #include "AliTPCCalibViewerGUItime.h" @@ -130,6 +131,8 @@ TGCompositeFrame(p,w,h), fLblValueXVal(0x0), fLblValueYVal(0x0), fBtnDumpRuns(0x0), + fContAliases(0x0), + fListAliases(0x0), //content bottom fContCustom(0x0), fContCustomCuts(0x0), @@ -222,6 +225,7 @@ void AliTPCCalibViewerGUItime::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h 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); @@ -322,7 +326,7 @@ void AliTPCCalibViewerGUItime::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h 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 @@ -354,6 +358,37 @@ void AliTPCCalibViewerGUItime::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h 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 ********************* @@ -376,7 +411,7 @@ void AliTPCCalibViewerGUItime::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h 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); @@ -394,7 +429,8 @@ void AliTPCCalibViewerGUItime::DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h 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()); @@ -431,7 +467,7 @@ void AliTPCCalibViewerGUItime::UseFile(const char* fileName, const char* treeNam } //______________________________________________________________________________ -void AliTPCCalibViewerGUItime::UseChain(TChain* chain = 0) +void AliTPCCalibViewerGUItime::UseChain(TChain *const chain = 0) { // // @@ -514,14 +550,14 @@ void AliTPCCalibViewerGUItime::FillCalibTypes() 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++); } } @@ -595,7 +631,7 @@ void AliTPCCalibViewerGUItime::Reload(Int_t first) 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); @@ -616,7 +652,7 @@ void AliTPCCalibViewerGUItime::AddReferenceTree(const char* treeFileName, const } //______________________________________________________________________________ -const char* AliTPCCalibViewerGUItime::GetDrawString(){ +const TString AliTPCCalibViewerGUItime::GetDrawString(){ // // create draw string for ttree by combining the user requestsa // @@ -628,8 +664,10 @@ const char* AliTPCCalibViewerGUItime::GetDrawString(){ 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()); @@ -640,10 +678,10 @@ const char* AliTPCCalibViewerGUItime::GetDrawString(){ // 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 // @@ -651,7 +689,7 @@ const char* AliTPCCalibViewerGUItime::GetDrawOption(){ 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){ @@ -665,7 +703,7 @@ void AliTPCCalibViewerGUItime::GetCutString(TString &cutStr){ cutStr=cuts.GetTitle(); } //______________________________________________________________________________ -void AliTPCCalibViewerGUItime::UpdateValueArrays(Bool_t withGraph) +void AliTPCCalibViewerGUItime::UpdateValueArrays(Bool_t withGraph, const Double_t *xArr) { // // @@ -676,13 +714,20 @@ void AliTPCCalibViewerGUItime::UpdateValueArrays(Bool_t withGraph) 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]; + TMath::Sort(nrows,fTree->GetV2(),index,kFALSE); + for (Long64_t i=0; iGetV3()[index[i]]; + fRunNumbers.GetMatrixArray()[i]=fTree->GetV1()[index[i]]; + fTimeStamps.GetMatrixArray()[i]=fTree->GetV2()[index[i]]; + } + delete [] index; } } //______________________________________________________________________________ @@ -739,7 +784,8 @@ void AliTPCCalibViewerGUItime::GetHistogramTitle(TString &title) } } } - varName=SubstituteUnderscores(branchTitle.Data()); + varName=branchTitle; + SubstituteUnderscores(varName); } } title+=varName; @@ -784,11 +830,13 @@ void AliTPCCalibViewerGUItime::DoDraw() { 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"; @@ -812,43 +860,53 @@ void AliTPCCalibViewerGUItime::DoDraw() { 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); TString grDraw="p"; @@ -912,7 +970,7 @@ void AliTPCCalibViewerGUItime::DoDumpRuns() if (run!=prevRun) std::cout << Form("%d",run) << std::endl; prevRun=run; } - delete sortIndex; + delete [] sortIndex; } //______________________________________________________________________________ void AliTPCCalibViewerGUItime::DoParLimitChange() @@ -1088,7 +1146,7 @@ void AliTPCCalibViewerGUItime::MouseMove(Int_t event, Int_t x, Int_t y, TObject 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)); @@ -1123,7 +1181,7 @@ void AliTPCCalibViewerGUItime::MouseMove(Int_t event, Int_t x, Int_t y, TObject 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)); @@ -1151,13 +1209,15 @@ void AliTPCCalibViewerGUItime::SetGuiTree(Int_t run) // 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(); @@ -1165,27 +1225,106 @@ void AliTPCCalibViewerGUItime::SetGuiTree(Int_t run) 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) { @@ -1253,3 +1392,135 @@ TObjArray* AliTPCCalibViewerGUItime::ShowGUI(TChain *chain) { 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; +} +