#include "AliEveTRDTrackList.h"
+#include <AliTRDReconstructor.h>
+#include <AliTRDtrackV1.h>
#include <TFile.h>
#include <TFunction.h>
#include <TH1.h>
#include <TList.h>
+#include <TMap.h>
#include <TObjString.h>
#include <TROOT.h>
#include <TSystem.h>
#include <TTree.h>
#include <TTreeStream.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)
- ,fSelectedStyle(0)
+AliEveTRDTrackList::AliEveTRDTrackList(const Text_t* n, const Text_t* t, Bool_t doColor):
+ TEveElementList(n, t, doColor),
+ fMacroList(0),
+ fMacroSelList(0),
+ fDataFromMacroList(0),
+ fMacroTypes(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();
+ fMacroTypes = new TMap();
+
// 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 (fMacroTypes != 0)
+ {
+ fMacroTypes->DeleteAll();
+ delete fMacroTypes;
+ fMacroTypes = 0;
+ }
// 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")));
// void MacroName(AliTRDtrackV1*, Double_t*&, Int_t&)
// it is assumed to be a process macro.
// In all other cases: Macro is rejected
- Bool_t isHistoMacro = kFALSE;
- Bool_t isSelectionMacro = kFALSE;
- Bool_t hasCorrectSignature = kFALSE;
-
Char_t* entryName = MakeMacroEntry(path, nameC);
Char_t pathname[fkMaxMacroPathNameLength];
}
// Clean up root, load the desired macro and then check the type of the macro
- //gROOT->Reset("a");
gROOT->Reset();
if (forceReload) gROOT->ProcessLineSync(Form(".L %s++", pathname));
else gROOT->ProcessLineSync(Form(".L %s+", pathname));
- // Selection macro or process macro of type 2 (histo)?
- TFunction* f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*", kTRUE);
- if (f != 0x0)
- {
- // Some additional check (is the parameter EXACTLY of the desired type?)
- if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0)
- {
- // Selection macro?
- if (!strcmp(f->GetReturnTypeName(), "Bool_t"))
- {
- hasCorrectSignature = kTRUE;
- isSelectionMacro = kTRUE;
- isHistoMacro = kFALSE;
- }
- // Process macro of type 2 (histo)?
- else if (!strcmp(f->GetReturnTypeName(), "TH1*"))
- {
- hasCorrectSignature = kTRUE;
- isSelectionMacro = kFALSE;
- isHistoMacro = kTRUE;
- }
- }
- }
- // Process macro of type 1?
- else if ((f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*, Double_t*&, Int_t&", kTRUE)) != 0x0)
- {
- if (!strcmp(f->GetReturnTypeName(), "void"))
- {
- // Some additional check (are the parameters EXACTLY of the desired type?)
- if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 &&
- strstr(f->GetMangledName(), "cODouble_tmUaNsP") != 0x0 &&
- strstr(f->GetMangledName(), "cOInt_taNsP") != 0x0)
- {
- hasCorrectSignature = kTRUE;
- isSelectionMacro = kFALSE;
- isHistoMacro = kFALSE;
- }
- }
- }
+ AliEveTRDTrackListMacroType type = GetMacroType(entryName, kFALSE);
- //// Clean up again / unload this function
- //gROOT->ProcessLineSync(Form(".U %s", pathname));
- //gROOT->Reset("a");
// Clean up again
gROOT->Reset();
// Has not the correct signature!
- if (!hasCorrectSignature)
+ if (type == kUnknown)
{
if (entryName != 0) delete entryName;
entryName = 0;
Int_t returnValue = WARNING;
// Only add macro, if it is not already in the list
- if (!isSelectionMacro && fMacroList->FindObject(entryName) == 0)
+ if ((type == kHistoMacro || type == kProcessMacro) && fMacroList->FindObject(entryName) == 0)
{
fMacroList->Add(new TObjString(entryName));
fMacroList->Sort();
+ fMacroTypes->Add(new TObjString(entryName), new TObjString(Form("%d", type)));
+
// We do not know, where the element has been inserted - deselect this list
fMacroListSelected = 0;
returnValue = SUCCESS;
}
- else if (isSelectionMacro && fMacroSelList->FindObject(entryName) == 0)
+ else if (type == kSelectionMacro && fMacroSelList->FindObject(entryName) == 0)
{
fMacroSelList->Add(new TObjString(entryName));
fMacroSelList->Sort();
+
+ fMacroTypes->Add(new TObjString(entryName), new TObjString(Form("%d", kSelectionMacro)));
// We do not know, where the element has been inserted - deselect this list
fMacroSelListSelected = 0;
}
//______________________________________________________
-void AliEveTRDTrackList::AddMacroFast(const Char_t* entry, Bool_t toSelectionList)
+void AliEveTRDTrackList::AddMacroFast(const Char_t* entry, AliEveTRDTrackListMacroType type)
{
- if (toSelectionList)
+ switch (type)
{
- fMacroSelList->Add(new TObjString(entry));
- fMacroSelList->Sort();
+ case kSelectionMacro:
+ fMacroSelList->Add(new TObjString(entry));
+ fMacroSelList->Sort();
- // We do not know, where the element has been inserted - deselect this list
- fMacroSelListSelected = 0;
- }
- else
- {
- fMacroList->Add(new TObjString(entry));
- fMacroList->Sort();
+ fMacroTypes->Add(new TObjString(entry), new TObjString(Form("%d", type)));
- // We do not know, where the element has been inserted - deselect this list
- fMacroListSelected = 0;
+ // We do not know, where the element has been inserted - deselect this list
+ fMacroSelListSelected = 0;
+
+ break;
+ case kProcessMacro:
+ fMacroList->Add(new TObjString(entry));
+ fMacroList->Sort();
+
+ fMacroTypes->Add(new TObjString(entry), new TObjString(Form("%d", type)));
+
+ // We do not know, where the element has been inserted - deselect this list
+ fMacroListSelected = 0;
+ break;
+ case kHistoMacro:
+ fMacroList->Add(new TObjString(entry));
+ fMacroList->Sort();
+
+ fMacroTypes->Add(new TObjString(entry), new TObjString(Form("%d", type)));
+
+ // We do not know, where the element has been inserted - deselect this list
+ fMacroListSelected = 0;
+ break;
+ default:
+ Error("AliEveTRDTrackList::AddMacroFast", Form("Unknown macro type for entry \"%s\"!", entry));
+ break;
}
}
//______________________________________________________
-void AliEveTRDTrackList::AddMacroFast(const Char_t* path, const Char_t* name, Bool_t toSelectionList)
+void AliEveTRDTrackList::AddMacroFast(const Char_t* path, const Char_t* name, AliEveTRDTrackListMacroType type)
{
Char_t* entry = MakeMacroEntry(path, name);
if (entry != 0)
{
- AddMacroFast(entry, toSelectionList);
+ AddMacroFast(entry, type);
#ifdef ALIEVETRDTRACKLIST_DEBUG
// Successfull add will only be displayed in debug mode
- printf("#AliEveTRDTrackList::AddMacroFast: Added macro \"%s/%s\" to %s list\n", path, name,
- (toSelectionList ? "selection" : "process"));
+ printf("#AliEveTRDTrackList::AddMacroFast: Added macro \"%s/%s\" to the corresponding list\n", path, name);
#endif
delete entry;
else
{
// Error will always be displayed
- printf("#AliEveTRDTrackList::AddMacroFast: ERROR: Could not add macro \"%s/%s\" to %s list\n", path, name,
- (toSelectionList ? "selection" : "process"));
+ printf("#AliEveTRDTrackList::AddMacroFast: ERROR: Could not add macro \"%s/%s\" to the corresponding list\n",
+ path, name);
}
}
void AliEveTRDTrackList::AddStandardMacros()
{
// Add your standard macros here, e.g.:
- // To add a macro without any checks (very fast, but unsafe):
- // AddMacroFast("$(ALICE_ROOT)/myFolder", "myMacroName.C", isSelMacro);
- // To add a macro with checks (slower, but safe):
+ // To add a macro use:
// AddMacro("$(ALICE_ROOT)/myFolder", "myMacroName.C");
// -> If the file does not exist, nothing happens. So if you want to handle this,
// use the return value of AddMacro (NOT_EXIST_ERROR is returned, if file does not exist)
gSystem->Getenv("USER")));
if (!fDataTree)
{
- Error("Apply process macros", "File \"TRD.TrackListMacroData.root\" could not be accessed properly!");
+ Error("Apply process macros", Form("File \"/tmp/TRD.TrackListMacroData_%s.root\" could not be accessed properly!",
+ gSystem->Getenv("USER")));
return kFALSE;
}
Char_t** cmds = new Char_t*[iterator->GetEntries()];
Bool_t* isHistoMacro = new Bool_t[iterator->GetEntries()];
+ AliEveTRDTrackListMacroType macroType = kUnknown;
Int_t numHistoMacros = 0;
TH1** histos = 0;
dotC++;
*dotC = '\0';
}
-
- // Add to "data-from-list"
- fDataFromMacroList->Add(new TObjString(name));
-
+
// Find the type of the process macro
- if (!IsHistogramMacro(name))
+ macroType = GetMacroType(iterator->At(i)->GetTitle(), kTRUE);
+ if (macroType == kHistoMacro)
+ {
+ // Type 2 (histo)
+ isHistoMacro[i] = kTRUE;
+ numHistoMacros++;
+ // Create the command
+ sprintf(cmds[i], "%s(automaticTrackV1);", name);
+
+ // Add to "data-from-list" -> Mark as a histo macro with the substring "(histo macro)"
+ fDataFromMacroList->Add(new TObjString(Form("%s (histo macro)", name)));
+ }
+ else if (macroType == kProcessMacro)
{
// Type 1
isHistoMacro[i] = kFALSE;
// Create the command
sprintf(cmds[i], "%s(automaticTrackV1, results, n);", name);
+
+ // Add to "data-from-list"
+ fDataFromMacroList->Add(new TObjString(name));
}
else
{
- // Type 2 (histo)
- isHistoMacro[i] = kTRUE;
- numHistoMacros++;
- // Create the command
- sprintf(cmds[i], "%s(automaticTrackV1);", name);
+ Error("Apply process macros",
+ Form("Process macro list corrupted: Macro \"%s\" is not registered as a process macro!", name));
+ isHistoMacro[i] = kFALSE;
}
}
// If there is data, select the first data set
if (iterator->GetEntries() > 0) SETBIT(fHistoDataSelected, 0);
- // Now the data is stored in "TRD.TrackListMacroData.root"
+ // Now the data is stored in "TRD.TrackListMacroData_$USER.root"
// The editor will access this file to display the data
return kTRUE;
}
gROOT->Reset();
}
+//______________________________________________________
+AliEveTRDTrackList::AliEveTRDTrackListMacroType AliEveTRDTrackList::GetMacroType(const Char_t* entry, Bool_t UseList)
+{
+ AliEveTRDTrackListMacroType type = kUnknown;
+
+ // Re do the check of the macro type
+ if (!UseList)
+ {
+ Char_t name[fkMaxMacroNameLength];
+
+ memset(name, '\0', sizeof(Char_t) * fkMaxMacroNameLength);
+
+ // Extract the name
+ sscanf(entry, "%s (Path: %*s)", name);
+
+ // Delete ".C" at the end
+ // -> Note: Physical address pointer, do NOT delete. / Changes "name" as well!
+ Char_t* dotC = (Char_t*)strrchr(name, '.');
+ if (dotC != 0)
+ {
+ *dotC = '\0';
+ dotC++;
+ *dotC = '\0';
+ }
+
+ // Selection macro or process macro of type 2 (histo)?
+ TFunction* f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*", kTRUE);
+ if (f != 0x0)
+ {
+ // Some additional check (is the parameter EXACTLY of the desired type?)
+ if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0)
+ {
+ // Selection macro?
+ if (!strcmp(f->GetReturnTypeName(), "Bool_t"))
+ {
+ type = kSelectionMacro;
+ }
+ // Process macro of type 2 (histo)?
+ else if (!strcmp(f->GetReturnTypeName(), "TH1*"))
+ {
+ type = kHistoMacro;
+ }
+ }
+ }
+ // Process macro of type 1?
+ else if ((f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*, Double_t*&, Int_t&", kTRUE))
+ != 0x0)
+ {
+ if (!strcmp(f->GetReturnTypeName(), "void"))
+ {
+ // Some additional check (are the parameters EXACTLY of the desired type?)
+ if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 &&
+ strstr(f->GetMangledName(), "cODouble_tmUaNsP") != 0x0 &&
+ strstr(f->GetMangledName(), "cOInt_taNsP") != 0x0)
+ {
+ type = kProcessMacro;
+ }
+ }
+ }
+ }
+ // Use list to look up the macro type
+ else
+ {
+ TObjString* objEntry = 0;
+ objEntry = (TObjString*)fMacroTypes->GetValue(entry);
+ if (objEntry == 0) return kUnknown;
+
+ type = (AliEveTRDTrackListMacroType)objEntry->GetString().Atoi();
+ switch (type)
+ {
+ case kSelectionMacro:
+ case kProcessMacro:
+ case kHistoMacro:
+ break;
+ default:
+ type = kUnknown;
+ break;
+ }
+ }
+
+ return type;
+}
+
//______________________________________________________
Char_t* AliEveTRDTrackList::MakeMacroEntry(const Char_t* path, const Char_t* name)
{
return entry;
}
-//______________________________________________________
-Bool_t AliEveTRDTrackList::IsHistogramMacro(const Char_t* name)
-{
- TFunction* f = 0x0;
- if ((f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*", kTRUE)) != 0x0)
- if (strcmp(f->GetReturnTypeName(), "TH1*") == 0) return kTRUE;
-
- return kFALSE;
-}
-
//______________________________________________________
void AliEveTRDTrackList::RemoveProcessMacros(TList* iterator)
{
TObjString* obj = 0;
for (Int_t i = 0; i < iterator->GetEntries(); i++)
{
+ fMacroTypes->DeleteEntry(fMacroTypes->FindObject(iterator->At(i)->GetTitle()));
+
obj = (TObjString*)fMacroList->Remove(fMacroList->FindObject(iterator->At(i)->GetTitle()));
if (obj != 0) delete obj;
TObjString* obj = 0;
for (Int_t i = 0; i < iterator->GetEntries(); i++)
{
+ fMacroTypes->DeleteEntry(fMacroTypes->FindObject(iterator->At(i)->GetTitle()));
+
obj = (TObjString*)fMacroSelList->Remove(fMacroSelList->FindObject(iterator->At(i)->GetTitle()));
if (obj != 0) delete obj;
}
obj = 0;
}
-
//______________________________________________________
void AliEveTRDTrackList::UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss)
{
- switch(s){
+ switch(s)
+ {
case AliEveTRDTrack::kSource:
SETBIT(fSelectedStyle, AliEveTRDTrack::kSource);
break;
case AliEveTRDTrack::kPID:
CLRBIT(fSelectedStyle, AliEveTRDTrack::kSource);
- switch(ss){
+ switch(ss)
+ {
case AliTRDReconstructor::kLQPID:
CLRBIT(fSelectedStyle, AliEveTRDTrack::kPID);
break;
break;
case AliEveTRDTrack::kTrackModel:
CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackCosmics);
- switch(ss){
+ switch(ss)
+ {
case AliEveTRDTrack::kRieman:
CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel);
break;
}
-
// Walk through the list of tracks
AliEveTRDTrack* track = 0x0;
- for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter) {
+ for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
+ {
if (!(track = dynamic_cast<AliEveTRDTrack*>(*iter))) continue;
track->SetStatus(fSelectedStyle);
#define MAX_MACRO_PATH_LENGTH 300
#define MAX_APPLY_COMMAND_LENGTH 50
+#define UNSETBIT(n,i) ((n) &= ~BIT(i))
+
class AliEveTRDTrack;
+class AliTRDReconstructor;
class AliTRDtrackV1;
class TFile;
class TFunction;
class TH1;
class TObjString;
class TList;
+class TMap;
class TTreeSRedirector;
class AliEveTRDTrackList: public TEveElementList
fkMaxApplyCommandLength = MAX_APPLY_COMMAND_LENGTH
};
+ enum AliEveTRDTrackListMacroType
+ {
+ kUnknown = 0,
+ kSelectionMacro = 1,
+ kProcessMacro = 2,
+ kHistoMacro = 3
+ };
+
AliEveTRDTrackList(const Text_t* n = "AliEveTRDTrackList", const Text_t* t = "", Bool_t doColor = kFALSE);
virtual ~AliEveTRDTrackList();
// macro code has been changed. If forceReload is
// kTRUE, the library will always be (re-)built!
void AddMacroFast(const Char_t* entry, // Adds an entry to the corresponding list (cf. below)
- Bool_t toSelectionList);
- void AddMacroFast(const Char_t* path, const Char_t* name, // Adds a macro (path/name) to the selection (process)
- Bool_t toSelectionList); // macro list, if second parameter is kTRUE (kFALSE).
+ AliEveTRDTrackListMacroType type);
+ void AddMacroFast(const Char_t* path, const Char_t* name, // Adds a macro (path/name) to the list associated
+ AliEveTRDTrackListMacroType type); // with the "type" parameter.
// No checks are performed (fast) and no libraries are
// loaded. Do use only, if library already exists!
virtual void AddStandardMacros(); // Adds standard macros to the lists
// error!).
void ApplySelectionMacros(TList* iterator); // Uses the iterator (for the selected selection
// macros) to apply the selected macros to the data
+ AliEveTRDTrackListMacroType GetMacroType(const Char_t* entry, // Returns the type of the macro of the corresponding
+ Bool_t UseList = kTRUE);// entry (i.e. "macro.C (Path: path)"). If you have
+ // only the name and the path, you can simply use
+ // MakeMacroEntry.
+ // If "UseList" is kTRUE, the type will be looked up
+ // in the internal list (very fast). But if this list
+ // does not exist, you have to use kFALSE for this
+ // parameter. Then the type will be determined by the
+ // prototype! NOTE: It is assumed that the macro has
+ // been compiled! If not, the return value is not.
+ // predictable, but normally will be kUnknown.
+ // Note: AddMacro(Fast) will update the internal list
+ // and RemoveProcess(/Selection)Macros respectively.
Char_t* MakeMacroEntry(const Char_t* path, const Char_t* name); // Constructs an entry for the macro
// lists with path and name
void RemoveProcessMacros(TList* iterator); // Uses the iterator (for the selected process
void RemoveSelectionMacros(TList* iterator); // Uses the iterator (for the selected selection
// macros) to remove the selection macros from
// 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
+
+ TMap* fMacroTypes; // Contains the type of each macro
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
- UChar_t fSelectedStyle; // Holds the selected track style
+ Char_t fSelectedTab; // Holds the index of the selected tab
+ UChar_t fSelectedStyle; // Holds the selected track style
- Char_t GetSelectedTab() // Gets the selected tab
+ Char_t GetSelectedTab() // Gets the selected tab
{ return fSelectedTab; }
- UChar_t GetSelectedTrackStyle() // Gets the selected track style
+ 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); }
Bool_t MacroSelListIsSelected(Int_t index) // Is entry in list selected?
{ return TESTBIT(fMacroSelListSelected, index); }
- Bool_t IsHistogramMacro(const Char_t* name); // Returns kTRUE, if a macro with name "name" has been
- // loaded into a shared library and has the signature
- // of a process macro of type 2 (histogram) -> NO
- // 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 CLRBIT(fHistoDataSelected, index); }
+ { if (set) SETBIT(fHistoDataSelected, index); else UNSETBIT(fHistoDataSelected, index); }
void SetMacroListSelection(Int_t index, Bool_t set) // Set selection of entry in list
- { if (set) SETBIT(fMacroListSelected, index); else CLRBIT(fMacroListSelected, index); }
+ { if (set) SETBIT(fMacroListSelected, index); else UNSETBIT(fMacroListSelected, index); }
void SetMacroSelListSelection(Int_t index, Bool_t set) // Set selection of entry in list
- { if (set) SETBIT(fMacroSelListSelected, index); else CLRBIT(fMacroSelListSelected, index); }
+ { if (set) SETBIT(fMacroSelListSelected, index); else UNSETBIT(fMacroSelListSelected, index); }
- void SetSelectedTab(Int_t index) // Sets 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
+ void SetSelectedTrackStyle(UChar_t index) // Sets the selected track style
{ fSelectedStyle = index; }
- void UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss=0);
+ void UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss = 0); // Updates the track style
+
private:
AliEveTRDTrackList(const AliEveTRDTrackList&); // Not implemented
+#include <EveDet/AliEveTRDData.h>
+#include <EveDet/AliEveTRDTrackList.h>
+#include "AliEveTRDTrackListEditor.h"
+#include <EveBase/AliEveEventManager.h>
+#include <AliTRDReconstructor.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)
fM(0),
fHistoCanvas(0),
fHistoCanvasName(0),
- fInheritMacroList(kFALSE),
+ fInheritSettings(kFALSE),
fStyleFrame(0),
fMainFrame(0),
fHistoFrame(0),
fStyleFrame->AddFrame(fbgStyleTrack);
frbTrack[0] = new TGRadioButton(fbgStyleTrack, "Rieman", 0);
+ frbTrack[0]->SetToolTipText("Set the track model to \"Rieman\"");
fbgStyleTrack->AddFrame(frbTrack[0]);
frbTrack[1] = new TGRadioButton(fbgStyleTrack, "Kalman", 1);
+ frbTrack[1]->SetToolTipText("Set the track model to \"Kalman\"");
fbgStyleTrack->AddFrame(frbTrack[1]);
frbTrack[2] = new TGRadioButton(fbgStyleTrack, "Line", 2);
+ frbTrack[2]->SetToolTipText("Set the track model to \"Line\"");
fbgStyleTrack->AddFrame(frbTrack[2]);
// Style - Color model
- fbgStyleColor = new TGButtonGroup(fStyleFrame, "Color style");
+ fbgStyleColor = new TGButtonGroup(fStyleFrame, "Color model");
fbgStyleColor->SetMapSubwindows(kTRUE);
fbgStyleColor->Resize(194, 200);
fStyleFrame->AddFrame(fbgStyleColor);
frbColor[0] = new TGRadioButton(fbgStyleColor, "PID LQ", 0);
+ frbColor[0]->SetToolTipText("Set color model to \"PID LQ\"");
fbgStyleColor->AddFrame(frbColor[0]);
frbColor[1] = new TGRadioButton(fbgStyleColor, "PID NN", 1);
+ frbColor[1]->SetToolTipText("Set color model to \"PID NN\"");
fbgStyleColor->AddFrame(frbColor[1]);
frbColor[2] = new TGRadioButton(fbgStyleColor, "ESD Source", 2);
+ frbColor[2]->SetToolTipText("Set color model to \"ESD Source\"");
fbgStyleColor->AddFrame(frbColor[2]);
// Functionality for adding macros
- fMainFrame = CreateEditorTabSubFrame("Analysis");
+ fMainFrame = CreateEditorTabSubFrame("Apply macros");
fLabel1 = new TGLabel(fMainFrame,"Add macro(s):");
fMainFrame->AddFrame(fLabel1);
fBrowseFrame = new TGHorizontalFrame(fMainFrame);
fteField = new TGTextEntry(fBrowseFrame);
+ fteField->SetToolTipText("Enter the pathname of the macro you want to add here and press \"Enter\"");
fteField->Connect("ReturnPressed()","AliEveTRDTrackListEditor", this, "HandleMacroPathSet()");
fBrowseFrame->AddFrame(fteField);
fbBrowse = new TGTextButton(fBrowseFrame, "Browse");
+ fbBrowse->SetToolTipText("Browse the macro you want to add");
fbBrowse->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "BrowseMacros()");
fBrowseFrame->AddFrame(fbBrowse);
fMainFrame->AddFrame(fBrowseFrame);
fLine2 = new TGHorizontal3DLine(fMainFrame, 194, 8);
fMainFrame->AddFrame(fLine2, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2));
- fLabel3 = new TGLabel(fMainFrame,"Analysis macros:");
+ fLabel3 = new TGLabel(fMainFrame,"Process macros:");
fMainFrame->AddFrame(fLabel3);
ftlMacroList = new TGListBox(fMainFrame);
fMainFrame->AddFrame(fLine3, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2));
fbApplyMacros = new TGTextButton(fMainFrame, "Apply selected macro(s)");
+ fbApplyMacros->SetToolTipText("Apply all selected macros to the tracklist -> A data file will be generated");
fbApplyMacros->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "ApplyMacros()");
fbApplyMacros->SetRightMargin(12);
fMainFrame->AddFrame(fbApplyMacros);
fbRemoveMacros = new TGTextButton(fMainFrame, "Remove selected macro(s)");
+ fbRemoveMacros->SetToolTipText("Remove the selected macro(s) from the list(s)");
fbRemoveMacros->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "RemoveMacros()");
fMainFrame->AddFrame(fbRemoveMacros);
// Stuff for displaying histograms
- fHistoFrame = CreateEditorTabSubFrame("Results");
+ fHistoFrame = CreateEditorTabSubFrame("Histograms");
fHistoFrame->SetMapSubwindows(kTRUE);
fLabel4 = new TGLabel(fHistoFrame,"Data from applied macros:");
fHistoFrame->AddFrame(fLabel4);
fHistoFrame->AddFrame(fLine4, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2));
fbDrawHisto = new TGTextButton(fHistoFrame, "Draw histogram");
+ fbDrawHisto->SetToolTipText("Uses the data file created by the last \"Apply selected macro(s)\".\nClick here to display the data histograms of the selected macros.\nSelect multiple macros to create correlated, multi-dimensional plots.\nHisto macros cannot be correlated!");
fbDrawHisto->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "DrawHistos()");
fHistoFrame->AddFrame(fbDrawHisto);
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",
{
selectedChecked++;
- // Histo macro?
- if (fM->IsHistogramMacro(fM->fDataFromMacroList->At(j)->GetName()))
+ // Histo macro? -> To check this, look for the substring "(histo macro)"
+ if (strstr(fM->fDataFromMacroList->At(j)->GetName(), "(histo macro)") != 0)
{
// Is also another macro selected?
if (nHistograms > 1)
}
}
- TFile* file = new TFile("TRD.TrackListMacroData.root", "READ");
+ TFile* file = new TFile(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")), "READ");
if (!file)
{
- Error("Draw histograms", "Cannot open file \"TRD.TrackListMacroData.root\"");
+ Error("Draw histograms", Form("Cannot open file \"/tmp/TRD.TrackListMacroData_%s.root\"",
+ gSystem->Getenv("USER")));
new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
- "Cannot open file \"TRD.TrackListMacroData.root\"", kMBIconExclamation, kMBOk);
+ Form("Cannot open file \"/tmp/TRD.TrackListMacroData_%s.root\"", gSystem->Getenv("USER")),
+ kMBIconExclamation, kMBOk);
return;
}
if (nHistograms == 1)
{
SetDrawingToHistoCanvasTab();
-
+
t->Draw(Form("Macro%d", indexOfMacro1), "1");
((TH1*)gPad->GetPrimitive("htemp"))->SetTitle(Form("%s;%s",
fM->fDataFromMacroList->At(indexOfMacro1)->GetName(),
fM->fDataFromMacroList->At(indexOfMacro1)->GetName()));
-
- UpdateHistoCanvasTab();
+ UpdateHistoCanvasTab();
break;
}
//______________________________________________________
void AliEveTRDTrackListEditor::HandleNewEventLoaded()
{
- // Inherit the macro list for the next track list!
- fInheritMacroList = kTRUE;
+ // Inherit the macro list and track style for the next track list!
+ fInheritSettings = kTRUE;
// Close the tabs
CloseTabs();
fM->fMacroSelList->Delete();
for (Int_t i = 0; i < ftlMacroSelList->GetNumberOfEntries(); i++)
{
- fM->AddMacroFast(ftlMacroSelList->GetEntry(i)->GetTitle(), kTRUE);
+ fM->AddMacroFast(ftlMacroSelList->GetEntry(i)->GetTitle(), AliEveTRDTrackList::kSelectionMacro);
}
// Process macros
fM->fMacroList->Delete();
for (Int_t i = 0; i < ftlMacroList->GetNumberOfEntries(); i++)
{
- fM->AddMacroFast(ftlMacroList->GetEntry(i)->GetTitle(), kFALSE);
+ fM->AddMacroFast(ftlMacroList->GetEntry(i)->GetTitle(), fM->GetMacroType(ftlMacroList->GetEntry(i)->GetTitle(),
+ kFALSE));
+ }
+}
+
+//______________________________________________________
+void AliEveTRDTrackListEditor::InheritStyle()
+{
+ // The old styles are stored in the corresponding button groups -> set them in track list
+
+ for (Int_t ind = 0; ind < 3; ind++)
+ {
+ if (fbgStyleTrack->GetButton(ind)->IsOn())
+ {
+ SetTrackModel(ind);
+ break;
+ }
+ }
+ for (Int_t ind = 0; ind < 3; ind++)
+ {
+ if (fbgStyleColor->GetButton(ind)->IsOn())
+ {
+ SetTrackColor(ind);
+ break;
+ }
}
}
// Set model object
fM = dynamic_cast<AliEveTRDTrackList*>(obj);
- if (fM == 0){
+ if (fM == 0)
+ {
Error("SetModel", "Parameter is zero pointer");
return;
}
- // If macro list shall be inherited from previously loaded track list, do so
- if (fInheritMacroList)
+ // If macro list + track style shall be inherited from previously loaded track list, do so
+ if (fInheritSettings)
{
InheritMacroList();
- fInheritMacroList = kFALSE;
+ InheritStyle();
+
+ fInheritSettings = kFALSE;
}
- // Select the correct styles -> Button index has offset 1!
+ // Select the correct styles
Int_t b = 0;
UChar_t style = fM->GetSelectedTrackStyle();
- if(TESTBIT(style, AliEveTRDTrack::kSource)) b = 2;
- else {
- if(TESTBIT(style, AliEveTRDTrack::kPID)) b = 1;
+ 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;
+ if (TESTBIT(style, AliEveTRDTrack::kTrackCosmics)) b = 2;
+ else
+ {
+ if (TESTBIT(style, AliEveTRDTrack::kTrackModel)) b = 1;
else b = 0;
}
fbgStyleTrack->SetButton(b, kTRUE);
}
//______________________________________________________
-void AliEveTRDTrackListEditor::SetTrackModel(Int_t ind)
+void AliEveTRDTrackListEditor::SetTrackColor(Int_t ind)
{
- switch(ind){
- case AliEveTRDTrack::kRieman:
- fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kRieman);
+ switch(ind)
+ {
+ case AliTRDReconstructor::kLQPID:
+ fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kLQPID);
break;
- case AliEveTRDTrack::kKalman:
- fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kKalman);
+ case AliTRDReconstructor::kNNPID:
+ fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kNNPID);
break;
default:
- fM->UpdateTrackStyle(AliEveTRDTrack::kTrackCosmics);
+ fM->UpdateTrackStyle(AliEveTRDTrack::kSource);
break;
}
+
gEve->Redraw3D();
}
//______________________________________________________
-void AliEveTRDTrackListEditor::SetTrackColor(Int_t ind)
+void AliEveTRDTrackListEditor::SetTrackModel(Int_t ind)
{
- switch(ind){
- case AliTRDReconstructor::kLQPID:
- fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kLQPID);
+ switch(ind)
+ {
+ case AliEveTRDTrack::kRieman:
+ fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kRieman);
break;
- case AliTRDReconstructor::kNNPID:
- fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kNNPID);
+ case AliEveTRDTrack::kKalman:
+ fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kKalman);
break;
default:
- fM->UpdateTrackStyle(AliEveTRDTrack::kSource);
+ fM->UpdateTrackStyle(AliEveTRDTrack::kTrackCosmics);
break;
}
+
gEve->Redraw3D();
}
-
//______________________________________________________
void AliEveTRDTrackListEditor::UpdateDataFromMacroListSelection()
{
class AliEveTRDTrack;
class AliEveTRDTrackList;
+class AliTRDReconstructor;
class TCanvas;
class TEveBrowser;
class TEveGedEditor;
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 SetTrackModel(Int_t ind); // Sets the track model
- void SetTrackColor(Int_t ind); // Sets the track color
+ void SetTrackColor(Int_t ind); // Sets the color model
+ void SetTrackModel(Int_t ind); // Sets the track model
void UpdateDataFromMacroListSelection(); // Updates the selection in the "data from macro"-list
void UpdateHistoList(); // Updates the histogram list
void UpdateMacroList(); // Updates the macro list
AliEveTRDTrackList* fM; // Model object
void InheritMacroList(); // Inherits macro list from the previously loaded track list
+ void InheritStyle(); // Inherits the style from the previously loaded track list
private:
AliEveTRDTrackListEditor(const AliEveTRDTrackListEditor&); // Not implemented
TCanvas* fHistoCanvas; // Canvas for the histograms
TGString* fHistoCanvasName; // Name of the histogram canvas
- Bool_t fInheritMacroList; // Flag indicating, whether the macro list will be inherited from the
- // previously loaded track list within the next call of SetModel
+ Bool_t fInheritSettings; // Flag indicating, whether the macro list and the style settings 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.