From: abercuci Date: Mon, 22 Sep 2008 13:55:17 +0000 (+0000) Subject: made functional track style (almost finished) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=ecbbe3711c16e713d56ad4f95b5c3d2c716dd7b3;p=u%2Fmrichter%2FAliRoot.git made functional track style (almost finished) --- diff --git a/EVE/EveDet/AliEveTRDTrackList.cxx b/EVE/EveDet/AliEveTRDTrackList.cxx index 7abb3199593..84f8eae7709 100644 --- a/EVE/EveDet/AliEveTRDTrackList.cxx +++ b/EVE/EveDet/AliEveTRDTrackList.cxx @@ -3,7 +3,6 @@ #include "AliEveTRDTrackList.h" -#include #include #include #include @@ -13,23 +12,27 @@ #include #include #include -#include + +#include +#include + ClassImp(AliEveTRDTrackList) /////////////////////////////////////////////////////////// ///////////// AliEveTRDTrackList //////////////////////// /////////////////////////////////////////////////////////// -AliEveTRDTrackList::AliEveTRDTrackList(const Text_t* n, const Text_t* t, Bool_t doColor): - TEveElementList(n, t, doColor), - fMacroList(0), - fMacroSelList(0), - fDataFromMacroList(0), - fDataTree(0), - fHistoDataSelected(0), - fMacroListSelected(0), - fMacroSelListSelected(0), - fSelectedTab(1) // Standard tab: "Apply macros" (index 1) +AliEveTRDTrackList::AliEveTRDTrackList(const Text_t* n, const Text_t* t, Bool_t doColor) + :TEveElementList(n, t, doColor) + ,fMacroList(0) + ,fMacroSelList(0) + ,fDataFromMacroList(0) + ,fDataTree(0) + ,fHistoDataSelected(0) + ,fMacroListSelected(0) + ,fMacroSelListSelected(0) + ,fSelectedTab(1) // Standard tab: "Apply macros" (index 1) + ,fSelectedStyle(0) { // Only accept childs of type AliEveTRDTrack SetChildClass(AliEveTRDTrack::Class()); @@ -38,7 +41,17 @@ AliEveTRDTrackList::AliEveTRDTrackList(const Text_t* n, const Text_t* t, Bool_t fMacroSelList = new TList(); fDataFromMacroList = new TList(); - //fDataTree = new TTreeSRedirector("TRD.TrackListMacroData.root"); + // Set the build directory for AClic + gSystem->SetBuildDir("$HOME/.trdQArec"); + + // If it does not exist, create it + // Note: gSystem->AccessPathName(...) returns kTRUE, if the access FAILED! + if(gSystem->AccessPathName("$HOME/.trdQArec")) + { + if (gSystem->mkdir("$HOME/.trdQArec") != 0) + Error("AliEveTRDTrackList - Constructor", + "Library directory \"$HOME/.trdQArec\" could not be created - no write permission!"); + } AddStandardMacros(); } @@ -69,7 +82,9 @@ AliEveTRDTrackList::~AliEveTRDTrackList() delete fDataTree; fDataTree = 0; } - if(!gSystem->AccessPathName(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")))) gSystem->Exec(Form("rm /tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER"))); + // Note: gSystem->AccessPathName(...) returns kTRUE, if the access FAILED! + if(!gSystem->AccessPathName(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")))) + gSystem->Exec(Form("rm /tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER"))); } //______________________________________________________ @@ -287,7 +302,8 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(TList* iterator) gROOT->Reset(); // Clear old data and re-allocate - if (fDataTree == 0) fDataTree = new TTreeSRedirector(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER"))); + if (fDataTree == 0) fDataTree = new TTreeSRedirector(Form("/tmp/TRD.TrackListMacroData_%s.root", + gSystem->Getenv("USER"))); if (!fDataTree) { Error("Apply process macros", "File \"TRD.TrackListMacroData.root\" could not be accessed properly!"); @@ -571,3 +587,49 @@ void AliEveTRDTrackList::RemoveSelectionMacros(TList* iterator) obj = 0; } + +//______________________________________________________ +void AliEveTRDTrackList::UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss) +{ + switch(s){ + case AliEveTRDTrack::kSource: + SETBIT(fSelectedStyle, AliEveTRDTrack::kSource); + break; + case AliEveTRDTrack::kPID: + CLRBIT(fSelectedStyle, AliEveTRDTrack::kSource); + switch(ss){ + case AliTRDReconstructor::kLQPID: + CLRBIT(fSelectedStyle, AliEveTRDTrack::kPID); + break; + case AliTRDReconstructor::kNNPID: + SETBIT(fSelectedStyle, AliEveTRDTrack::kPID); + break; + } + break; + case AliEveTRDTrack::kTrackCosmics: + SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackCosmics); + break; + case AliEveTRDTrack::kTrackModel: + CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackCosmics); + switch(ss){ + case AliEveTRDTrack::kRieman: + CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel); + break; + case AliEveTRDTrack::kKalman: + AliWarning("Kalman fit under testing for the moment."); + //SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel); + break; + } + break; + } + + + + // Walk through the list of tracks + AliEveTRDTrack* track = 0x0; + for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter) { + if (!(track = dynamic_cast(*iter))) continue; + + track->SetStatus(fSelectedStyle); + } +} diff --git a/EVE/EveDet/AliEveTRDTrackList.h b/EVE/EveDet/AliEveTRDTrackList.h index df522293369..0d4a47753cd 100644 --- a/EVE/EveDet/AliEveTRDTrackList.h +++ b/EVE/EveDet/AliEveTRDTrackList.h @@ -2,6 +2,7 @@ #define AliEveTRDTrackList_H #include +#include #define SIGNATURE_ERROR -1 #define NOT_EXIST_ERROR -2 @@ -12,8 +13,6 @@ #define MAX_MACRO_PATH_LENGTH 300 #define MAX_APPLY_COMMAND_LENGTH 50 -#define UNSETBIT(n,i) ((n) &= ~BIT(i)) - class AliEveTRDTrack; class AliTRDtrackV1; class TFile; @@ -69,24 +68,28 @@ public: // the corresponding list. void RemoveSelectionMacros(TList* iterator); // Uses the iterator (for the selected selection // macros) to remove the selection macros from - // the corresponding list. + // the corresponding list. + //void SetTrackStyleState(UChar_t c); // Sets the track model and the color model for each track in the list protected: - TList* fMacroList; // List of (process) macros - TList* fMacroSelList; // List of (selection) macros - TList* fDataFromMacroList; // List of macros that currently have data for histograms + TList* fMacroList; // List of (process) macros + TList* fMacroSelList; // List of (selection) macros + TList* fDataFromMacroList; // List of macros that currently have data for histograms TTreeSRedirector *fDataTree; // Tree containing data for histograms - Int_t fHistoDataSelected; // Stores the selection for the data of the histograms - Int_t fMacroListSelected; // Stores the selection of the process macro list - Int_t fMacroSelListSelected; // Stores the selection of the selection macro list + Int_t fHistoDataSelected; // Stores the selection for the data of the histograms + Int_t fMacroListSelected; // Stores the selection of the process macro list + Int_t fMacroSelListSelected; // Stores the selection of the selection macro list - Char_t fSelectedTab; // Holds the index of the selected tab + Char_t fSelectedTab; // Holds the index of the selected tab + UChar_t fSelectedStyle; // Holds the selected track style - Char_t GetSelectedTab() // Get the selected tab + Char_t GetSelectedTab() // Gets the selected tab { return fSelectedTab; } + UChar_t GetSelectedTrackStyle() // Gets the selected track style + { return fSelectedStyle; } Bool_t HistoDataIsSelected(Int_t index) // Is entry in list selected? { return TESTBIT(fHistoDataSelected, index); } @@ -102,17 +105,22 @@ protected: // additional check with mangled name!! void SetHistoDataSelection(Int_t index, Bool_t set) // Set selection of entry in list - { if (set) SETBIT(fHistoDataSelected, index); else UNSETBIT(fHistoDataSelected, index); } + { if (set) SETBIT(fHistoDataSelected, index); else CLRBIT(fHistoDataSelected, index); } void SetMacroListSelection(Int_t index, Bool_t set) // Set selection of entry in list - { if (set) SETBIT(fMacroListSelected, index); else UNSETBIT(fMacroListSelected, index); } + { if (set) SETBIT(fMacroListSelected, index); else CLRBIT(fMacroListSelected, index); } void SetMacroSelListSelection(Int_t index, Bool_t set) // Set selection of entry in list - { if (set) SETBIT(fMacroSelListSelected, index); else UNSETBIT(fMacroSelListSelected, index); } + { if (set) SETBIT(fMacroSelListSelected, index); else CLRBIT(fMacroSelListSelected, index); } - void SetSelectedTab(Int_t index) // Set the selected tab + void SetSelectedTab(Int_t index) // Sets the selected tab { fSelectedTab = (Char_t)index; } + void SetSelectedTrackStyle(UChar_t index) // Sets the selected track style + { fSelectedStyle = index; } + + void UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss=0); + private: AliEveTRDTrackList(const AliEveTRDTrackList&); // Not implemented AliEveTRDTrackList& operator=(const AliEveTRDTrackList&); // Not implemented diff --git a/EVE/EveDet/AliEveTRDTrackListEditor.cxx b/EVE/EveDet/AliEveTRDTrackListEditor.cxx index 580abd2accd..08726369ed3 100644 --- a/EVE/EveDet/AliEveTRDTrackListEditor.cxx +++ b/EVE/EveDet/AliEveTRDTrackListEditor.cxx @@ -1,9 +1,4 @@ -#include -#include -#include "AliEveTRDTrackListEditor.h" -#include -#include #include #include #include @@ -26,6 +21,14 @@ #include #include +#include +#include +#include "EveDet/AliEveTRDTrackListEditor.h" +#include + +#include +#include + ClassImp(AliEveTRDTrackListEditor) @@ -39,6 +42,7 @@ AliEveTRDTrackListEditor::AliEveTRDTrackListEditor(const TGWindow* p, Int_t widt fHistoCanvas(0), fHistoCanvasName(0), fInheritMacroList(kFALSE), + fStyleFrame(0), fMainFrame(0), fHistoFrame(0), fHistoSubFrame(0), @@ -63,38 +67,38 @@ AliEveTRDTrackListEditor::AliEveTRDTrackListEditor(const TGWindow* p, Int_t widt // Style stuff fLine5 = new TGHorizontal3DLine(this, 194, 8); AddFrame(fLine5, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 8)); + fStyleFrame = new TGHorizontalFrame(this); + AddFrame(fStyleFrame); // Style - Track model - fbgStyleTrack = new TGButtonGroup(this, "Track model"); + fbgStyleTrack = new TGButtonGroup(fStyleFrame, "Track model"); fbgStyleTrack->SetMapSubwindows(kTRUE); fbgStyleTrack->Resize(194, 200); - AddFrame(fbgStyleTrack); + fStyleFrame->AddFrame(fbgStyleTrack); - frbTrack[0] = new TGRadioButton(fbgStyleTrack, "Linear"); + frbTrack[0] = new TGRadioButton(fbgStyleTrack, "Rieman", 0); fbgStyleTrack->AddFrame(frbTrack[0]); - frbTrack[1] = new TGRadioButton(fbgStyleTrack, "Rieman"); + frbTrack[1] = new TGRadioButton(fbgStyleTrack, "Kalman", 1); fbgStyleTrack->AddFrame(frbTrack[1]); - frbTrack[2] = new TGRadioButton(fbgStyleTrack, "Kalman"); + frbTrack[2] = new TGRadioButton(fbgStyleTrack, "Line", 2); fbgStyleTrack->AddFrame(frbTrack[2]); - fbgStyleTrack->SetButton(2, kTRUE); // Style - Color model - fbgStyleColor = new TGButtonGroup(this, "Color model"); + fbgStyleColor = new TGButtonGroup(fStyleFrame, "Color style"); fbgStyleColor->SetMapSubwindows(kTRUE); fbgStyleColor->Resize(194, 200); - AddFrame(fbgStyleColor); + fStyleFrame->AddFrame(fbgStyleColor); - frbColor[0] = new TGRadioButton(fbgStyleColor, "PID 1"); + frbColor[0] = new TGRadioButton(fbgStyleColor, "PID LQ", 0); fbgStyleColor->AddFrame(frbColor[0]); - frbColor[1] = new TGRadioButton(fbgStyleColor, "PID 2"); + frbColor[1] = new TGRadioButton(fbgStyleColor, "PID NN", 1); fbgStyleColor->AddFrame(frbColor[1]); - frbColor[2] = new TGRadioButton(fbgStyleColor, "Source"); + frbColor[2] = new TGRadioButton(fbgStyleColor, "ESD Source", 2); fbgStyleColor->AddFrame(frbColor[2]); - fbgStyleColor->SetButton(1, kTRUE); // Functionality for adding macros - fMainFrame = CreateEditorTabSubFrame("Apply macros"); + fMainFrame = CreateEditorTabSubFrame("Analysis"); fLabel1 = new TGLabel(fMainFrame,"Add macro(s):"); fMainFrame->AddFrame(fLabel1); @@ -121,7 +125,7 @@ AliEveTRDTrackListEditor::AliEveTRDTrackListEditor(const TGWindow* p, Int_t widt fLine2 = new TGHorizontal3DLine(fMainFrame, 194, 8); fMainFrame->AddFrame(fLine2, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2)); - fLabel3 = new TGLabel(fMainFrame,"Process macros:"); + fLabel3 = new TGLabel(fMainFrame,"Analysis macros:"); fMainFrame->AddFrame(fLabel3); ftlMacroList = new TGListBox(fMainFrame); @@ -142,7 +146,7 @@ AliEveTRDTrackListEditor::AliEveTRDTrackListEditor(const TGWindow* p, Int_t widt fMainFrame->AddFrame(fbRemoveMacros); // Stuff for displaying histograms - fHistoFrame = CreateEditorTabSubFrame("Histograms"); + fHistoFrame = CreateEditorTabSubFrame("Results"); fHistoFrame->SetMapSubwindows(kTRUE); fLabel4 = new TGLabel(fHistoFrame,"Data from applied macros:"); fHistoFrame->AddFrame(fLabel4); @@ -182,7 +186,7 @@ AliEveTRDTrackListEditor::AliEveTRDTrackListEditor(const TGWindow* p, Int_t widt ftlMacroSelList->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", this, "UpdateMacroSelListSelection(Int_t)"); // Handle the signal "NewEventLoaded" - gAliEveEvent->Connect("NewEventLoaded()", "AliEveTRDTrackListEditor", this, "HandleNewEventLoaded()"); + //gAliEveEvent->Connect("NewEventLoaded()", "AliEveTRDTrackListEditor", this, "HandleNewEventLoaded()"); // Handle the signal "Selected" (another tab has been selected) GetGedEditor()->GetTab()->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", @@ -706,30 +710,13 @@ void AliEveTRDTrackListEditor::SetDrawingToHistoCanvasTab() gPad = fHistoCanvas; } -//______________________________________________________ -void AliEveTRDTrackListEditor::UpdateHistoCanvasTab() -{ - // Update name of the tab (tab has been set to current tab!) - fHistoCanvasName->SetString(fM->GetName()); - - // Use a copy of fHistoCanvasName!! -> If the user closes a tab manually, the TGString - // will be deleted -> Error might occur, when accessing the pointer - gEve->GetBrowser()->GetTab(1)->GetCurrentTab()->SetText(new TGString(fHistoCanvasName)); - - // Switch tabs to force redrawing - gEve->GetBrowser()->GetTab(1)->SetTab(0); - gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString()); - fHistoCanvas->Update(); -} - //______________________________________________________ void AliEveTRDTrackListEditor::SetModel(TObject* obj) { // Set model object fM = dynamic_cast(obj); - if (fM == 0) - { + if (fM == 0){ Error("SetModel", "Parameter is zero pointer"); return; } @@ -740,26 +727,67 @@ void AliEveTRDTrackListEditor::SetModel(TObject* obj) InheritMacroList(); fInheritMacroList = kFALSE; } + + // Select the correct styles -> Button index has offset 1! + Int_t b = 0; + UChar_t style = fM->GetSelectedTrackStyle(); + if(TESTBIT(style, AliEveTRDTrack::kSource)) b = 2; + else { + if(TESTBIT(style, AliEveTRDTrack::kPID)) b = 1; + else b = 0; + } + fbgStyleColor->SetButton(b, kTRUE); + + + if(TESTBIT(style, AliEveTRDTrack::kTrackCosmics)) b = 2; + else{ + if(TESTBIT(style, AliEveTRDTrack::kTrackModel)) b = 1; + else b = 0; + } + fbgStyleTrack->SetButton(b, kTRUE); UpdateMacroList(); UpdateHistoList(); // View correct tab - GetGedEditor()->GetTab()->SetTab(fM->fSelectedTab); + GetGedEditor()->GetTab()->SetTab(fM->GetSelectedTab()); } //______________________________________________________ -void AliEveTRDTrackListEditor::SetTrackColor(Int_t ind) +void AliEveTRDTrackListEditor::SetTrackModel(Int_t ind) { - Info("SetTrackColor", Form("Button index: %d", ind - 1)); + switch(ind){ + case AliEveTRDTrack::kRieman: + fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kRieman); + break; + case AliEveTRDTrack::kKalman: + fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kKalman); + break; + default: + fM->UpdateTrackStyle(AliEveTRDTrack::kTrackCosmics); + break; + } + gEve->Redraw3D(); } //______________________________________________________ -void AliEveTRDTrackListEditor::SetTrackModel(Int_t ind) +void AliEveTRDTrackListEditor::SetTrackColor(Int_t ind) { - Info("SetTrackModel", Form("Button index: %d", ind - 1)); + switch(ind){ + case AliTRDReconstructor::kLQPID: + fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kLQPID); + break; + case AliTRDReconstructor::kNNPID: + fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kNNPID); + break; + default: + fM->UpdateTrackStyle(AliEveTRDTrack::kSource); + break; + } + gEve->Redraw3D(); } + //______________________________________________________ void AliEveTRDTrackListEditor::UpdateDataFromMacroListSelection() { @@ -769,6 +797,22 @@ void AliEveTRDTrackListEditor::UpdateDataFromMacroListSelection() } } +//______________________________________________________ +void AliEveTRDTrackListEditor::UpdateHistoCanvasTab() +{ + // Update name of the tab (tab has been set to current tab!) + fHistoCanvasName->SetString(fM->GetName()); + + // Use a copy of fHistoCanvasName!! -> If the user closes a tab manually, the TGString + // will be deleted -> Error might occur, when accessing the pointer + gEve->GetBrowser()->GetTab(1)->GetCurrentTab()->SetText(new TGString(fHistoCanvasName)); + + // Switch tabs to force redrawing + gEve->GetBrowser()->GetTab(1)->SetTab(0); + gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString()); + fHistoCanvas->Update(); +} + //______________________________________________________ void AliEveTRDTrackListEditor::UpdateHistoList() { diff --git a/EVE/EveDet/AliEveTRDTrackListEditor.h b/EVE/EveDet/AliEveTRDTrackListEditor.h index a69e8b2e804..2c4c93db7f5 100644 --- a/EVE/EveDet/AliEveTRDTrackListEditor.h +++ b/EVE/EveDet/AliEveTRDTrackListEditor.h @@ -46,8 +46,8 @@ public: void HandleNewEventLoaded(); // Handles the "NewEventLoaded()"-signal void HandleTabChangedToIndex(Int_t); // Handles the "Selected(Int_t id)"-signal (tab changed) void RemoveMacros(); // Removes the selected macros from the lists - void SetTrackColor(Int_t ind); // Sets the track model - void SetTrackModel(Int_t ind); // Sets the track model + void SetTrackModel(Int_t ind); // Sets the track model + void SetTrackColor(Int_t ind); // Sets the track color void UpdateDataFromMacroListSelection(); // Updates the selection in the "data from macro"-list void UpdateHistoList(); // Updates the histogram list void UpdateMacroList(); // Updates the macro list @@ -69,10 +69,11 @@ private: Bool_t fInheritMacroList; // Flag indicating, whether the macro list will be inherited from the // previously loaded track list within the next call of SetModel + TGHorizontalFrame* fStyleFrame; // Frame for the style stuff TGVerticalFrame* fMainFrame; // Top frame for macro functionality. TGVerticalFrame* fHistoFrame; // Top frame for the histogram stuff TGVerticalFrame* fHistoSubFrame; // Frame for the histogram buttons themselves - TGHorizontalFrame* fBrowseFrame; // For searching macros + TGHorizontalFrame* fBrowseFrame; // Frame for features corresponding to searching macros TGButtonGroup* fbgStyleColor; // Button group for the color model TGButtonGroup* fbgStyleTrack; // Button group for the track model diff --git a/EVE/alice-macros/trd_friend_tracks.C b/EVE/alice-macros/trd_friend_tracks.C index e829d3307f1..ed4c0c1b8d1 100644 --- a/EVE/alice-macros/trd_friend_tracks.C +++ b/EVE/alice-macros/trd_friend_tracks.C @@ -26,15 +26,22 @@ void trd_friend_tracks(TEveElement *cont = 0) if(strcmp(cal->IsA()->GetName(), "AliTRDtrackV1") != 0) continue; AliTRDtrackV1 *trackObj = dynamic_cast(cal); trackObj->SetReconstructor(reco); - tracks->AddElement(new AliEveTRDTrack(trackObj)); + AliEveTRDTrack *trackEve = new AliEveTRDTrack(trackObj); + tracks->AddElement(trackEve); + trackEve->SetESDstatus(esdTrack->GetStatus()); } } tracks->SetTitle(Form("Tracks %d", tracks->NumChildren())); tracks->StampObjProps(); gEve->AddElement(tracks, cont); - + gEve->Redraw3D(); + + TGLViewer *v = gEve->GetGLViewer(); + v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); + ((TGLOrthoCamera&)v->CurrentCamera()).SetEnableRotate(kTRUE); + v->UpdateScene(); return; }