]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/Track.h
d25547ac75e91682a716570e024375b5cc49ed75
[u/mrichter/AliRoot.git] / EVE / Reve / Track.h
1 #ifndef REVE_Track_H
2 #define REVE_Track_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 #include <vector>
10
11 #include <Reve/PODs.h>
12 #include <Reve/RenderElement.h>
13 #include <Reve/Line.h>
14
15 #include <TPolyMarker3D.h>
16 #include <TQObject.h>
17
18 namespace Reve {
19
20 class TrackRnrStyle;
21 class TrackList;
22
23 class Track : public Line, public TQObject
24 {
25   friend class TrackList;
26   friend class TrackCounter;
27   friend class TrackGL;
28
29   Track(const Track&);            // Not implemented
30   Track& operator=(const Track&); // Not implemented
31
32 protected:
33   typedef std::vector<Reve::PathMark*>           vpPathMark_t;
34   typedef std::vector<Reve::PathMark*>::iterator vpPathMark_i;
35
36   Reve::Vector      fV;
37   Reve::Vector      fP;
38   Double_t          fBeta;
39   Int_t             fCharge;
40   Int_t             fLabel;
41   Int_t             fIndex;
42   vpPathMark_t      fPathMarks;
43
44   TrackRnrStyle*    fRnrStyle;
45
46 public: 
47   Track();
48   Track(TParticle* t, Int_t label, TrackRnrStyle* rs);
49   Track(Reve::MCTrack*  t, TrackRnrStyle* rs);
50   Track(Reve::RecTrack* t, TrackRnrStyle* rs);
51   virtual ~Track();
52
53   void MakeTrack();
54
55   TrackRnrStyle* GetRnrStyle() const  { return fRnrStyle; }
56   void SetRnrStyle(TrackRnrStyle* rs) { fRnrStyle = rs; }
57
58   Int_t GetLabel() const    { return fLabel; }
59   void  SetLabel(Int_t lbl) { fLabel = lbl;  }
60   Int_t GetIndex() const    { return fIndex; }
61   void  SetIndex(Int_t idx) { fIndex = idx;  }
62
63   void  AddPathMark(Reve::PathMark* pm) { fPathMarks.push_back(pm); }
64
65   //--------------------------------
66
67   void ImportHits();              // *MENU*
68   void ImportClusters();          // *MENU*
69   void ImportClustersFromIndex(); // *MENU*
70   void PrintKineStack();          // *MENU*
71
72   //--------------------------------
73
74   void CtrlClicked(Reve::Track*); // *SIGNAL*
75
76   ClassDef(Track, 1);
77 }; // endclass Track
78
79
80 /**************************************************************************/
81 // TrackRnrStyle
82 /**************************************************************************/
83
84 // This is decoupled from Track/TrackList to allow sharing of the
85 // RnrStyle among several instances. The interface is half cooked and
86 // there is no good way to set RnrStyle after the object has been
87 // created (shouldn't be too hard to fix).
88 //
89 // TrackList has Get/Set methods for RnrStlye and
90 // TrackListEditor provides editor access to them.
91
92 class TrackRnrStyle : public TObject
93 {
94 public:
95   Color_t                  fColor;
96   Width_t                  fWidth;
97   Float_t                  fMagField;  
98   // track limits
99   Float_t                  fMaxR;       
100   Float_t                  fMaxZ;       
101   // helix limits 
102   Float_t                  fMaxOrbs; // Maximal angular path of tracks' orbits (1 ~ 2Pi).
103   Float_t                  fMinAng;  // Minimal angular step between two helix points.
104   Float_t                  fDelta;   // Maximal error at the mid-point of the line connecting to helix points.
105
106   Color_t                  fPMColor;
107   Style_t                  fPMStyle;
108   Size_t                   fPMSize;
109
110   Bool_t                   fFitDaughters;   
111   Bool_t                   fFitReferences;   
112   Bool_t                   fFitDecay;   
113
114   Bool_t                   fRnrDaughters;
115   Bool_t                   fRnrReferences;
116   Bool_t                   fRnrDecay;
117
118   TrackRnrStyle();
119
120   void    SetColor(Color_t c) { fColor = c; }
121   Color_t GetColor() const    { return fColor; }
122
123   Float_t GetMagField() const     { return fMagField; }
124   void    SetMagField(Float_t mf) { fMagField = mf; }
125
126   static Float_t       fgDefMagField;
127   static const Float_t fgkB2C;
128   static TrackRnrStyle fgDefStyle;
129
130   ClassDef(TrackRnrStyle, 1);
131 }; // endclass TrackRnrStyle
132
133
134 /**************************************************************************/
135 // TrackList
136 /**************************************************************************/
137
138 class TrackList : public RenderElementListBase,
139                   public TPolyMarker3D
140 {
141   TrackList(const TrackList&);            // Not implemented
142   TrackList& operator=(const TrackList&); // Not implemented
143
144 private:
145   void  Init();
146
147 protected:
148   TString              fTitle;
149
150   TrackRnrStyle*       fRnrStyle;
151
152   Bool_t               fRnrMarkers;
153   Bool_t               fRnrTracks;
154   Bool_t               fEditPathMarks;
155
156 public:
157   TrackList(Int_t n_tracks=0, TrackRnrStyle* rs=0);
158   TrackList(const Text_t* name, Int_t n_tracks=0, TrackRnrStyle* rs=0);
159
160   void Reset(Int_t n_tracks=0);
161
162   virtual const Text_t* GetTitle() const  { return fTitle; }
163   virtual void  SetTitle(const Text_t* t) { fTitle = t; }
164
165   virtual Bool_t CanEditMainColor()  { return kTRUE; }
166
167   virtual void Paint(Option_t* option="");
168
169   virtual void AddElement(RenderElement* el);
170
171   virtual void SetMarkerColor(Color_t c) {TAttMarker::SetMarkerColor(c); if(fRnrStyle) fRnrStyle->fPMColor =c;}
172   virtual void SetMarkerStyle(Style_t s){TAttMarker::SetMarkerStyle(s); if(fRnrStyle) fRnrStyle->fPMStyle = s;}
173   virtual void SetMarkerSize(Size_t s){TAttMarker::SetMarkerSize(s); if(fRnrStyle) fRnrStyle->fPMSize = s;}
174
175   TrackRnrStyle* GetRnrStyle()           { fRnrStyle->fPMColor = GetMarkerColor();fRnrStyle->fPMStyle = GetMarkerStyle();fRnrStyle->fPMSize = GetMarkerSize(); return fRnrStyle;  } 
176   void   SetRnrStyle(TrackRnrStyle* rst) { fRnrStyle= rst; }
177
178   Bool_t GetEditPathMarks() const   { return fEditPathMarks; }
179   void   SetEditPathMarks(Bool_t x) { fEditPathMarks = x; }
180
181   Bool_t GetRnrTracks() const { return fRnrTracks; }
182   void   SetRnrTracks(Bool_t);
183
184   Bool_t GetRnrDaughters() const { return fRnrStyle->fRnrDaughters; }
185   Bool_t GetRnrReferences() const { return fRnrStyle->fRnrReferences; }
186   Bool_t GetRnrDecay() const { return fRnrStyle->fRnrDecay; }
187
188   void   SetRnrDaughters(Bool_t x);
189   void   SetRnrReferences(Bool_t x);
190   void   SetRnrDecay(Bool_t x);
191
192   Bool_t GetRnrMarkers() const { return fRnrMarkers; }
193   void   SetRnrMarkers(Bool_t);
194
195   void   MakeTracks();
196   void   MakeMarkers();
197
198   Width_t GetWidth() const { return fRnrStyle->fWidth; }
199   void  SetWidth(Width_t w);
200
201   Float_t GetMaxR()         const { return fRnrStyle->fMaxZ; }
202   Float_t GetMaxZ()         const { return fRnrStyle->fMaxR; }
203   Float_t GetMaxOrbs()      const { return fRnrStyle->fMaxOrbs; }
204   Float_t GetMinAng()       const { return fRnrStyle->fMinAng; }
205   Float_t GetDelta()        const { return fRnrStyle->fDelta; }
206
207   Bool_t  GetFitDaughters()  const { return fRnrStyle->fFitDaughters; }
208   Bool_t  GetFitReferences() const { return fRnrStyle->fFitReferences; }
209   Bool_t  GetFitDecay()      const { return fRnrStyle->fFitDecay; }
210
211   void SetFitDaughters(Bool_t x);
212   void SetFitReferences(Bool_t x);
213   void SetFitDecay(Bool_t x);
214
215   void SetMaxR(Float_t x);
216   void SetMaxZ(Float_t x);
217   void SetMaxOrbs(Float_t x);
218   void SetMinAng(Float_t x);
219   void SetDelta(Float_t x);
220
221   // void  UpdateBounds();
222   Int_t   GetNTracks() { return fN; }
223
224   void SelectByPt(Float_t min_pt=0.2, Float_t max_pt=10); // *MENU*
225
226   //--------------------------------
227
228   void ImportHits();     // *MENU*
229   void ImportClusters(); // *MENU*
230
231   ClassDef(TrackList, 1);
232 };
233
234 /**************************************************************************/
235 // TrackCounter
236 /**************************************************************************/
237
238 class TrackCounter : public RenderElement, public TNamed
239 {
240   friend class TrackCounterEditor;
241
242 public:
243   enum ClickAction_e { CA_PrintTrackInfo, CA_ToggleTrack };
244
245 private:
246   TrackCounter(const TrackCounter&);            // Not implemented
247   TrackCounter& operator=(const TrackCounter&); // Not implemented
248
249 protected:
250   Int_t fBadLineStyle;
251   Int_t fClickAction;
252
253   Int_t fEventId;
254
255   Int_t fAllTracks;
256   Int_t fGoodTracks;
257
258   TList fTrackLists;
259
260 public:
261   TrackCounter(const Text_t* name="TrackCounter", const Text_t* title="");
262   virtual ~TrackCounter();
263
264   Int_t GetEventId() const { return fEventId; }
265   void  SetEventId(Int_t id) { fEventId = id; }
266
267   void Reset();
268
269   void RegisterTracks(TrackList* tlist, Bool_t goodTracks);
270
271   void DoTrackAction(Track* track);
272
273   Int_t GetClickAction() const  { return fClickAction; }
274   void  SetClickAction(Int_t a) { fClickAction = a; }
275
276   void OutputEventTracks(FILE* out=0);
277
278   static TrackCounter* fgInstance;
279
280   ClassDef(TrackCounter, 1);
281 }; // endclass TrackCounter
282
283
284 } // namespace Reve
285
286 #endif