#include "AliEveTRDTrackList.h"
-#include <AliTRDtrackV1.h>
#include <TFile.h>
#include <TFunction.h>
#include <TH1.h>
#include <TSystem.h>
#include <TTree.h>
#include <TTreeStream.h>
-#include <EveDet/AliEveTRDData.h>
+
+#include <AliTRDtrackV1.h>
+#include <AliTRDReconstructor.h>
+
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());
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();
}
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")));
}
//______________________________________________________
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!");
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<AliEveTRDTrack*>(*iter))) continue;
+
+ track->SetStatus(fSelectedStyle);
+ }
+}
#define AliEveTRDTrackList_H
#include <TEveElement.h>
+#include <EveDet/AliEveTRDData.h>
#define SIGNATURE_ERROR -1
#define NOT_EXIST_ERROR -2
#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;
// 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); }
// 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
-#include <EveDet/AliEveTRDData.h>
-#include <EveDet/AliEveTRDTrackList.h>
-#include "AliEveTRDTrackListEditor.h"
-#include <EveBase/AliEveEventManager.h>
-#include <AliTRDtrackV1.h>
#include <TGButton.h>
#include <TCanvas.h>
#include <TEveBrowser.h>
#include <TH1.h>
#include <TTreeStream.h>
+#include <EveDet/AliEveTRDData.h>
+#include <EveDet/AliEveTRDTrackList.h>
+#include "EveDet/AliEveTRDTrackListEditor.h"
+#include <EveBase/AliEveEventManager.h>
+
+#include <AliTRDtrackV1.h>
+#include <AliTRDReconstructor.h>
+
ClassImp(AliEveTRDTrackListEditor)
fHistoCanvas(0),
fHistoCanvasName(0),
fInheritMacroList(kFALSE),
+ fStyleFrame(0),
fMainFrame(0),
fHistoFrame(0),
fHistoSubFrame(0),
// 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);
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);
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);
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",
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<AliEveTRDTrackList*>(obj);
- if (fM == 0)
- {
+ if (fM == 0){
Error("SetModel", "Parameter is zero pointer");
return;
}
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()
{
}
}
+//______________________________________________________
+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()
{
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
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
if(strcmp(cal->IsA()->GetName(), "AliTRDtrackV1") != 0) continue;
AliTRDtrackV1 *trackObj = dynamic_cast<AliTRDtrackV1 *>(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;
}