]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/Track.h
Fix update propagation from TrackRnrStyle::MakeTracks().
[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 <TMarker.h>
17 #include <TQObject.h>
18
19 namespace Reve {
20
21 class TrackRnrStyle;
22 class TrackList;
23
24 class Track : public Line, 
25               public TQObject
26 {
27   friend class TrackRnrStyle;
28   friend class TrackList;
29   friend class TrackCounter;
30   friend class TrackGL;
31
32 public:
33   typedef std::vector<Reve::PathMark*>           vpPathMark_t;
34   typedef std::vector<Reve::PathMark*>::iterator vpPathMark_i;
35
36 protected:
37   Reve::Vector      fV;          // Starting vertex
38   Reve::Vector      fP;          // Starting momentum
39   Double_t          fBeta;       // Relativistic beta factor
40   Int_t             fPdg;        // PDG code
41   Int_t             fCharge;     // Charge in units of e0
42   Int_t             fLabel;      // Simulation label
43   Int_t             fIndex;      // Reconstruction index
44   vpPathMark_t      fPathMarks;  // Vector of known points along the track
45
46   TrackRnrStyle*    fRnrStyle;   // Pointer to shared render-style
47
48 public:
49   Track();
50   Track(TParticle* t, Int_t label, TrackRnrStyle* rs);
51   Track(Reve::MCTrack*  t, TrackRnrStyle* rs);
52   Track(Reve::RecTrack* t, TrackRnrStyle* rs);
53   Track(const Track& t);
54   virtual ~Track();
55
56   virtual void SetStdTitle();
57
58   virtual void SetTrackParams(const Track& t);
59   virtual void SetPathMarks  (const Track& t);
60
61   virtual void MakeTrack(Bool_t recurse=kTRUE);
62
63   TrackRnrStyle* GetRnrStyle() const  { return fRnrStyle; }
64   void SetRnrStyle(TrackRnrStyle* rs);
65   void SetAttLineAttMarker(TrackList* tl);
66
67   Int_t GetPdg()    const   { return fPdg;   }
68   void SetPdg(Int_t pdg)    { fPdg = pdg;    }
69   Int_t GetCharge() const   { return fCharge; }
70   void SetCharge(Int_t chg) { fCharge = chg; }
71   Int_t GetLabel()  const   { return fLabel; }
72   void  SetLabel(Int_t lbl) { fLabel = lbl;  }
73   Int_t GetIndex()  const   { return fIndex; }
74   void  SetIndex(Int_t idx) { fIndex = idx;  }
75
76   void          AddPathMark(Reve::PathMark* pm) { fPathMarks.push_back(pm); }
77   vpPathMark_t& GetPathMarksRef()               { return fPathMarks; }
78   const vpPathMark_t& GetPathMarksRef() const   { return fPathMarks; }
79   void          SortPathMarksByTime();
80
81   //--------------------------------
82
83   void ImportHits();              // *MENU*
84   void ImportClusters();          // *MENU*
85   void ImportClustersFromIndex(); // *MENU*
86   void ImportKine();              // *MENU*
87   void ImportKineWithArgs(Bool_t importMother=kTRUE, Bool_t impDaugters=kTRUE,
88                           Bool_t colorPdg    =kTRUE, Bool_t recurse    =kTRUE); // *MENU*
89   void PrintKineStack();          // *MENU*
90   void PrintPathMarks();          // *MENU*
91
92   //--------------------------------
93
94   virtual void CtrlClicked(Reve::Track*); // *SIGNAL*
95   virtual void SetLineStyle(Style_t lstyle);
96
97   virtual const TGPicture* GetListTreeIcon() { return fgListTreeIcons[4]; }; 
98
99   virtual TClass* ProjectedClass() const;
100
101   ClassDef(Track, 1); // Visual representation of a track.
102 }; // endclass Track
103
104
105 /**************************************************************************/
106 // TrackRnrStyle
107 /**************************************************************************/
108
109 class TrackRnrStyle : public TObject,
110                       public ReferenceBackPtr
111 {
112 private:
113   void                     RebuildTracks();
114
115 public:
116   Float_t                  fMagField;      // Constant magnetic field along z.
117
118   // Track limits
119   Float_t                  fMaxR;          // Max radius for track extrapolation
120   Float_t                  fMaxZ;          // Max z-coordinate for track extrapolation.
121   // Helix limits
122   Float_t                  fMaxOrbs;       // Maximal angular path of tracks' orbits (1 ~ 2Pi).
123   Float_t                  fMinAng;        // Minimal angular step between two helix points.
124   Float_t                  fDelta;         // Maximal error at the mid-point of the line connecting to helix points.
125
126   // Path-mark control
127   Bool_t                   fEditPathMarks; // Show widgets for path-mark control in GUI editor.
128   TMarker                  fPMAtt;         // Marker attributes for rendering of path-marks.
129
130   Bool_t                   fFitDaughters;  // Pass through daughter creation points when extrapolating a track.
131   Bool_t                   fFitReferences; // Pass through given track-references when extrapolating a track.
132   Bool_t                   fFitDecay;      // Pass through decay point when extrapolating a track.
133
134   Bool_t                   fRnrDaughters;  // Render daughter path-marks.
135   Bool_t                   fRnrReferences; // Render track-reference path-marks.
136   Bool_t                   fRnrDecay;      // Render decay path-marks.
137
138   // First vertex control
139   Bool_t                   fRnrFV;         // Render first vertex.
140   TMarker                  fFVAtt;         // Marker attributes for fits vertex.
141
142   TrackRnrStyle();
143
144   // callbacks
145   void   SetEditPathMarks(Bool_t x) { fEditPathMarks = x; }
146   void   SetRnrDaughters(Bool_t x);
147   void   SetRnrReferences(Bool_t x);
148   void   SetRnrDecay(Bool_t x);
149
150   void   SetRnrFV(Bool_t x){  fRnrFV = x;}
151
152   void   SetFitDaughters(Bool_t x);
153   void   SetFitReferences(Bool_t x);
154   void   SetFitDecay(Bool_t x);
155
156   void   SetMaxR(Float_t x);
157   void   SetMaxZ(Float_t x);
158   void   SetMaxOrbs(Float_t x);
159   void   SetMinAng(Float_t x);
160   void   SetDelta(Float_t x);
161
162   Float_t GetMagField() const     { return fMagField; }
163   void    SetMagField(Float_t mf) { fMagField = mf; }
164
165   static Float_t       fgDefMagField; // Default value for constant solenoid magnetic field.
166   static const Float_t fgkB2C;        // Constant for conversion of momentum to curvature.
167   static TrackRnrStyle fgDefStyle;    // Default track render-style.
168
169   ClassDef(TrackRnrStyle, 1); // Rendering parameters for tracks.
170 }; // endclass TrackRnrStyle
171
172
173 /**************************************************************************/
174 // TrackList
175 /**************************************************************************/
176
177 class TrackList : public RenderElementList,
178                   public NLTProjectable,
179                   public TAttMarker,
180                   public TAttLine
181 {
182   friend class TrackListEditor;
183
184 private:
185   TrackList(const TrackList&);            // Not implemented
186   TrackList& operator=(const TrackList&); // Not implemented
187
188   Bool_t               fRecurse;    // Recurse when propagating marker/line attributes to tracks.
189
190 protected:
191   TrackRnrStyle*       fRnrStyle;   // Basic track rendering parameters, not enforced to elements.
192
193   Bool_t               fRnrLine;    // Render track as line.
194   Bool_t               fRnrPoints;  // Render track as points.
195
196   Float_t              fMinPt;      // Minimum track pT for display selection.
197   Float_t              fMaxPt;      // Maximum track pT for display selection.
198   Float_t              fLimPt;      // Highest track pT in the container.
199   Float_t              fMinP;       // Minimum track p for display selection.
200   Float_t              fMaxP;       // Maximum track p for display selection.
201   Float_t              fLimP;       // Highest track p in the container.
202
203   Float_t RoundMomentumLimit(Float_t x);
204
205 public:
206   TrackList(TrackRnrStyle* rs=0);
207   TrackList(const Text_t* name, TrackRnrStyle* rs=0);
208   virtual ~TrackList();
209
210   void  MakeTracks(Bool_t recurse=kTRUE);
211   void  FindMomentumLimits(RenderElement* el, Bool_t recurse);
212
213   void  SetRnrStyle(TrackRnrStyle* rs);
214   TrackRnrStyle*  GetRnrStyle(){return fRnrStyle;}
215
216   //--------------------------------
217
218   virtual void   SetMainColor(Color_t c);
219   virtual void   SetLineColor(Color_t c){SetMainColor(c);}
220   virtual void   SetLineColor(Color_t c, RenderElement* el);
221   virtual void   SetLineWidth(Width_t w);
222   virtual void   SetLineWidth(Width_t w, RenderElement* el);
223   virtual void   SetLineStyle(Style_t s);
224   virtual void   SetLineStyle(Style_t s, RenderElement* el);
225
226   virtual void   SetMarkerColor(Color_t c);
227   virtual void   SetMarkerColor(Color_t c, RenderElement* el);
228   virtual void   SetMarkerSize(Size_t s);
229   virtual void   SetMarkerSize(Size_t s, RenderElement* el);
230   virtual void   SetMarkerStyle(Style_t s);
231   virtual void   SetMarkerStyle(Style_t s, RenderElement* el);
232
233   void SetRnrLine(Bool_t rnr);
234   void SetRnrLine(Bool_t rnr, RenderElement* el);
235   Bool_t GetRnrLine(){return fRnrLine;}
236
237   void SetRnrPoints(Bool_t r);
238   void SetRnrPoints(Bool_t r, RenderElement* el);
239   Bool_t GetRnrPoints(){return fRnrPoints;}
240
241   void SelectByPt(Float_t min_pt, Float_t max_pt);
242   void SelectByPt(Float_t min_pt, Float_t max_pt, RenderElement* el);
243   void SelectByP (Float_t min_p,  Float_t max_p);
244   void SelectByP (Float_t min_p,  Float_t max_p,  RenderElement* el);
245
246   //--------------------------------
247
248   Track* FindTrackByLabel(Int_t label); // *MENU*
249   Track* FindTrackByIndex(Int_t index); // *MENU*
250
251   void ImportHits();     // *MENU*
252   void ImportClusters(); // *MENU*
253
254   virtual TClass* ProjectedClass() const;
255
256   ClassDef(TrackList, 1); // A list of tracks.
257 };
258
259
260 /**************************************************************************/
261 // TrackCounter
262 /**************************************************************************/
263
264 class TrackCounter : public RenderElement, public TNamed
265 {
266   friend class TrackCounterEditor;
267
268 public:
269   enum ClickAction_e { CA_PrintTrackInfo, CA_ToggleTrack };
270
271 private:
272   TrackCounter(const TrackCounter&);            // Not implemented
273   TrackCounter& operator=(const TrackCounter&); // Not implemented
274
275 protected:
276   Int_t fBadLineStyle;
277   Int_t fClickAction;
278
279   Int_t fEventId;
280
281   Int_t fAllTracks;
282   Int_t fGoodTracks;
283
284   TList fTrackLists;
285
286 public:
287   TrackCounter(const Text_t* name="TrackCounter", const Text_t* title="");
288   virtual ~TrackCounter();
289
290   Int_t GetEventId() const { return fEventId; }
291   void  SetEventId(Int_t id) { fEventId = id; }
292
293   void Reset();
294
295   void RegisterTracks(TrackList* tlist, Bool_t goodTracks);
296
297   void DoTrackAction(Track* track);
298
299   Int_t GetClickAction() const  { return fClickAction; }
300   void  SetClickAction(Int_t a) { fClickAction = a; }
301
302   void OutputEventTracks(FILE* out=0);
303
304   static TrackCounter* fgInstance;
305
306   ClassDef(TrackCounter, 1);
307 }; // endclass TrackCounter
308
309
310 } // namespace Reve
311
312 #endif