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