]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveTRDTrackList.h
made functional track style (almost finished)
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTRDTrackList.h
1 #ifndef AliEveTRDTrackList_H
2 #define AliEveTRDTrackList_H
3
4 #include <TEveElement.h>
5 #include <EveDet/AliEveTRDData.h>
6
7 #define SIGNATURE_ERROR   -1
8 #define NOT_EXIST_ERROR   -2
9 #define WARNING           0
10 #define SUCCESS           1
11
12 #define MAX_MACRO_NAME_LENGTH     100
13 #define MAX_MACRO_PATH_LENGTH     300
14 #define MAX_APPLY_COMMAND_LENGTH   50
15
16 class AliEveTRDTrack;
17 class AliTRDtrackV1;
18 class TFile;
19 class TFunction;
20 class TH1;
21 class TObjString;
22 class TList;
23 class TTreeSRedirector;
24
25 class AliEveTRDTrackList: public TEveElementList
26 {
27   friend class AliEveTRDTrackListEditor;
28
29 public:
30   enum
31   {
32     // Maximum length (number of characters) for a macro name:
33     fkMaxMacroNameLength = MAX_MACRO_NAME_LENGTH,    
34     // Maximum length (number of characters) for a macro path:
35     fkMaxMacroPathLength = MAX_MACRO_PATH_LENGTH,    
36     // Maximum length (number of characters) for a macro pathname:
37     fkMaxMacroPathNameLength = MAX_MACRO_NAME_LENGTH + MAX_MACRO_PATH_LENGTH,  
38     // Maximum length (number of characters) for "apply macro" commands in addition to the length of the name, path... 
39     fkMaxApplyCommandLength = MAX_APPLY_COMMAND_LENGTH  
40   };
41
42   AliEveTRDTrackList(const Text_t* n = "AliEveTRDTrackList", const Text_t* t = "", Bool_t doColor = kFALSE);
43   virtual ~AliEveTRDTrackList();
44
45   Int_t AddMacro(const Char_t* path, const Char_t* name,        // Adds a macro (path/name) to the corresponding list
46                  Bool_t forceReload = kFALSE);                  // (automatic recognition / check) -> library will be
47                                                                 // built, if it does not exist, or updated, if the 
48                                                                 // macro code has been changed. If forceReload is
49                                                                 // kTRUE, the library will always be (re-)built!
50   void AddMacroFast(const Char_t* entry,                        // Adds an entry to the corresponding list (cf. below)
51                     Bool_t toSelectionList);     
52   void AddMacroFast(const Char_t* path, const Char_t* name,     // Adds a macro (path/name) to the selection (process)
53                     Bool_t toSelectionList);                    // macro list, if second parameter is kTRUE (kFALSE).
54                                                                 // No checks are performed (fast) and no libraries are
55                                                                 // loaded. Do use only, if library already exists!
56   virtual void AddStandardMacros();                             // Adds standard macros to the lists
57   Bool_t ApplyProcessMacros(TList* iterator);                   // Uses the iterator (for the selected process 
58                                                                 // macros) to apply the selected macros to the data.
59                                                                 // Return kTRUE on success, otherwise kFALSE. If there
60                                                                 // no process macros selected, kTRUE is returned (no 
61                                                                 // error!).
62   void ApplySelectionMacros(TList* iterator);                   // Uses the iterator (for the selected selection
63                                                                 // macros) to apply the selected macros to the data
64   Char_t* MakeMacroEntry(const Char_t* path, const Char_t* name);  // Constructs an entry for the macro
65                                                                    // lists with path and name   
66   void RemoveProcessMacros(TList* iterator);                    // Uses the iterator (for the selected process
67                                                                 // macros) to remove the process macros from 
68                                                                 // the corresponding list.    
69   void RemoveSelectionMacros(TList* iterator);                  // Uses the iterator (for the selected selection
70                                                                 // macros) to remove the selection macros from 
71                                                                 // the corresponding list.  
72   //void SetTrackStyleState(UChar_t c);   // Sets the track model and the color model for each track in the list
73
74 protected:
75   TList*  fMacroList;                 // List of (process) macros
76   TList*  fMacroSelList;              // List of (selection) macros
77   TList*  fDataFromMacroList;         // List of macros that currently have data for histograms
78
79   TTreeSRedirector *fDataTree;       // Tree containing data for histograms
80
81   Int_t   fHistoDataSelected;          // Stores the selection for the data of the histograms
82   Int_t   fMacroListSelected;          // Stores the selection of the process macro list
83   Int_t   fMacroSelListSelected;       // Stores the selection of the selection macro list
84
85   Char_t  fSelectedTab;                                            // Holds the index of the selected tab
86   UChar_t fSelectedStyle;        // Holds the selected track style
87
88   Char_t GetSelectedTab()                                         // Gets the selected tab
89     { return fSelectedTab;  }
90
91   UChar_t GetSelectedTrackStyle()     // Gets the selected track style
92     { return fSelectedStyle;  }
93   Bool_t HistoDataIsSelected(Int_t index)               // Is entry in list selected?
94     { return TESTBIT(fHistoDataSelected, index);  }  
95    
96   Bool_t MacroListIsSelected(Int_t index)               // Is entry in list selected?
97     { return TESTBIT(fMacroListSelected, index);  }     
98
99   Bool_t MacroSelListIsSelected(Int_t index)            // Is entry in list selected?
100     { return TESTBIT(fMacroSelListSelected, index);  }  
101
102   Bool_t IsHistogramMacro(const Char_t* name);          // Returns kTRUE, if a macro with name "name" has been
103                                                         // loaded into a shared library and has the signature
104                                                         // of a process macro of type 2 (histogram) -> NO
105                                                         // additional check with mangled name!!
106
107   void SetHistoDataSelection(Int_t index, Bool_t set)       // Set selection of entry in list
108     { if (set) SETBIT(fHistoDataSelected, index); else CLRBIT(fHistoDataSelected, index);  }  
109
110   void SetMacroListSelection(Int_t index, Bool_t set)       // Set selection of entry in list
111     { if (set) SETBIT(fMacroListSelected, index); else CLRBIT(fMacroListSelected, index);  }  
112
113   void SetMacroSelListSelection(Int_t index, Bool_t set)    // Set selection of entry in list
114     { if (set) SETBIT(fMacroSelListSelected, index); else CLRBIT(fMacroSelListSelected, index);  }   
115     
116   void SetSelectedTab(Int_t index)                                          // Sets the selected tab
117     { fSelectedTab = (Char_t)index; }  
118
119   void SetSelectedTrackStyle(UChar_t index)     // Sets the selected track style
120     { fSelectedStyle = index;  }
121
122   void UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss=0);
123
124 private:
125   AliEveTRDTrackList(const AliEveTRDTrackList&);            // Not implemented
126   AliEveTRDTrackList& operator=(const AliEveTRDTrackList&); // Not implemented             
127
128   ClassDef(AliEveTRDTrackList, 0);  // Class containing a list of tracks
129 };
130
131 #endif