]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/Track.h
Proper management of dependent render-elements, renamed FullUpdate() to UpdateItems...
[u/mrichter/AliRoot.git] / EVE / Reve / Track.h
1 // $Header$
2
3 #ifndef REVE_Track_H
4 #define REVE_Track_H
5
6 #include <Reve/PODs.h>
7 #include <Reve/RenderElement.h>
8
9 #include <TPolyMarker3D.h>
10 #include <TPolyLine3D.h>
11
12 namespace Reve {
13
14 class TrackRnrStyle;
15 class TrackList;
16
17 class Track : public RenderElement,
18               public TPolyLine3D
19 {
20   friend class TrackList;
21
22 private:
23   void                   Init();
24
25 protected:
26   Reve::Vector           fV;
27   Reve::Vector           fP;
28   Double_t               fBeta;
29   Int_t                  fCharge;
30   Int_t                  fLabel;
31
32   TrackRnrStyle*         fRnrStyle;
33     
34   TString                fName; 
35   TString                fTitle; 
36
37 public: 
38   Track();
39   Track(Reve::MCTrack*  t, TrackRnrStyle* rs);
40   Track(Reve::RecTrack* t, TrackRnrStyle* rs);
41   std::vector<Reve::PathMark*> fPathMarks;
42   virtual ~Track();
43
44   void Reset(Int_t n_points=0);
45
46   virtual void SetLineColor(Color_t col)
47   { SetMainColor(col); }
48
49   virtual void Paint(Option_t* option="")
50   { if(fRnrElement) TPolyLine3D::Paint(option); }
51
52   void MakeTrack();
53
54   TrackRnrStyle* GetRnrStyle() const  { return fRnrStyle; }
55   void SetRnrStyle(TrackRnrStyle* rs) { fRnrStyle = rs; }
56
57   virtual const Text_t* GetName() const    { return fName; }
58   virtual void SetName(const Text_t* name) { fName = name; }
59
60   virtual const Text_t* GetTitle() const     { return fTitle; }
61   virtual void SetTitle(const Text_t* title) { fTitle = title; }
62
63   Int_t GetLabel() const { return fLabel; }
64
65   //--------------------------------
66
67   void ImportHits();     // *MENU*
68   void ImportClusters(); // *MENU*
69
70   ClassDef(Track, 1);
71 }; // endclass Track
72
73
74 /**************************************************************************/
75 // TrackRnrStyle
76 /**************************************************************************/
77
78 // This is decoupled from Track/TrackList to allow sharing of the
79 // RnrStyle among several instances. The interface is half cooked and
80 // there is no good way to set RnrStyle after the object has been
81 // created (shouldn't be too hard to fix).
82 //
83 // TrackList has Get/Set methods for RnrStlye and
84 // TrackListEditor provides editor access to them.
85
86 class TrackRnrStyle : public TObject 
87 {
88 private:
89   void         Init();
90
91 public:
92   Color_t                  fColor;
93   Float_t                  fMagField;  
94   // track limits
95   Float_t                  fMaxR;       
96   Float_t                  fMaxZ;       
97   // helix limits 
98   Float_t                  fMaxOrbs; // Maximal angular path of tracks' orbits (1 ~ 2Pi).
99   Float_t                  fMinAng;  // Minimal angular step between two helix points.
100   Float_t                  fDelta;   // Maximal error at the mid-point of the line connecting to helix points.
101
102   Bool_t                   fFitDaughters;   
103   Bool_t                   fFitDecay;   
104
105   TrackRnrStyle() { Init(); }
106
107   void    SetColor(Color_t c) { fColor = c; }
108   Color_t GetColor() const    { return fColor; }
109
110   Float_t GetMagField() const     { return fMagField; }
111   void    SetMagField(Float_t mf) { fMagField = mf; }
112
113   static Float_t       fgDefMagField;
114   static const Float_t fgkB2C;
115   static TrackRnrStyle fgDefStyle;
116
117   ClassDef(TrackRnrStyle, 1);
118 }; // endclass TrackRnrStyle
119
120
121 /**************************************************************************/
122 // TrackList
123 /**************************************************************************/
124
125 class TrackList : public RenderElementListBase,
126                   public TPolyMarker3D
127 {
128 private:
129   void  Init();
130
131 protected:
132   TString              fTitle;
133
134   TrackRnrStyle*       mRnrStyle;
135
136   Bool_t               fRnrMarkers;
137   Bool_t               fRnrTracks;
138
139 public:
140   TrackList(Int_t n_tracks=0);
141   TrackList(const Text_t* name, Int_t n_tracks=0);
142
143   void Reset(Int_t n_tracks=0);
144
145   virtual const Text_t* GetTile() const  { return fTitle; }
146   virtual void SetTitle(const Text_t* t) { fTitle = t; }
147
148   virtual Bool_t CanEditMainColor()  { return kTRUE; }
149
150   virtual void Paint(Option_t* option="");
151
152   virtual void AddElement(RenderElement* el);
153
154   void  SetRnrStyle(TrackRnrStyle* rst) { mRnrStyle= rst; }
155   TrackRnrStyle* GetRnrStyle()          { return mRnrStyle; } 
156
157   Bool_t GetRnrTracks() const { return fRnrTracks; }
158   void   SetRnrTracks(Bool_t);
159
160   Bool_t GetRnrMarkers() const { return fRnrMarkers; }
161   void   SetRnrMarkers(Bool_t);
162
163   void   MakeTracks();
164   void   MakeMarkers();
165
166   Float_t GetMaxR()         const { return mRnrStyle->fMaxZ; }
167   Float_t GetMaxZ()         const { return mRnrStyle->fMaxR; }
168   Float_t GetMaxOrbs()      const { return mRnrStyle->fMaxOrbs; }
169   Float_t GetMinAng()       const { return mRnrStyle->fMinAng; }
170   Float_t GetDelta()        const { return mRnrStyle->fDelta; }
171   Bool_t  GetFitDaughters() const { return mRnrStyle->fFitDaughters; }
172   Bool_t  GetFitDecay()     const { return mRnrStyle->fFitDecay; }
173
174   void SetMaxR(Float_t x);
175   void SetMaxZ(Float_t x);
176   void SetMaxOrbs(Float_t x);
177   void SetMinAng(Float_t x);
178   void SetDelta(Float_t x);
179   void SetFitDaughters(Bool_t x);
180   void SetFitDecay(Bool_t x);
181
182
183   // void  UpdateBounds();
184   Int_t   GetNTracks() { return fN; }
185
186   void SelectByPt(Float_t min_pt=0.2, Float_t max_pt=10); // *MENU*
187
188   //--------------------------------
189
190   void ImportHits();     // *MENU*
191   void ImportClusters(); // *MENU*
192
193   ClassDef(TrackList, 1);
194 };
195
196
197 } // namespace Reve
198
199 #endif