Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveTrack.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TEveTrack
13 #define ROOT_TEveTrack
14 
15 #include <vector>
16 
17 #include "TEveVector.h"
18 #include "TEvePathMark.h"
19 #include "TEveVSDStructs.h"
20 #include "TEveElement.h"
21 #include "TEveLine.h"
22 
23 #include "TPolyMarker3D.h"
24 #include "TMarker.h"
25 
26 class TEveTrackPropagator;
27 class TEveTrackList;
28 
29 class TEveMCTrack;
30 class TParticle;
31 
32 class TEveTrack : public TEveLine
33 {
34  friend class TEveTrackPropagator;
35  friend class TEveTrackList;
36  friend class TEveTrackGL;
37 
38 private:
39  TEveTrack& operator=(const TEveTrack&); // Not implemented
40 
41 public:
42  typedef std::vector<TEvePathMarkD> vPathMark_t;
43  typedef vPathMark_t::iterator vPathMark_i;
44  typedef vPathMark_t::const_iterator vPathMark_ci;
45 
46  // Deprecated -- to be removed.
47  enum EBreakProjectedTracks_e { kBPTDefault, kBPTAlways, kBPTNever };
48 
49 protected:
50  TEveVectorD fV; // Starting vertex
51  TEveVectorD fP; // Starting momentum
52  TEveVectorD fPEnd; // Momentum at the last point of extrapolation
53  Double_t fBeta; // Relativistic beta factor
54  Double_t fDpDs; // Momentum loss over distance
55  Int_t fPdg; // PDG code
56  Int_t fCharge; // Charge in units of e0
57  Int_t fLabel; // Simulation label
58  Int_t fIndex; // Reconstruction index
59  Int_t fStatus; // Status-word, user-defined.
60  Bool_t fLockPoints; // Lock points that are currently in - do nothing in MakeTrack().
61  vPathMark_t fPathMarks; // TEveVector of known points along the track
62  Int_t fLastPMIdx; //!Last path-mark index tried in track-propagation.
63 
64  TEveTrackPropagator *fPropagator; // Pointer to shared render-style
65 
66 public:
67  TEveTrack();
68  TEveTrack(TParticle* t, Int_t label, TEveTrackPropagator* prop=0);
69  TEveTrack(TEveMCTrack* t, TEveTrackPropagator* prop=0);
70  TEveTrack(TEveRecTrack* t, TEveTrackPropagator* prop=0);
71  TEveTrack(TEveRecTrackD* t, TEveTrackPropagator* prop=0);
72  TEveTrack(const TEveTrack& t);
73  virtual ~TEveTrack();
74 
75  virtual void ComputeBBox();
76 
77  virtual void SetStdTitle();
78 
79  virtual void SetTrackParams(const TEveTrack& t);
80  virtual void SetPathMarks (const TEveTrack& t);
81 
82  virtual void MakeTrack(Bool_t recurse=kTRUE);
83 
84  TEveTrackPropagator* GetPropagator() const { return fPropagator; }
85  Int_t GetLastPMIdx() const { return fLastPMIdx; }
86  void SetPropagator(TEveTrackPropagator* prop);
87  void SetAttLineAttMarker(TEveTrackList* tl);
88 
89  const TEveVectorD& GetVertex() const { return fV; }
90  const TEveVectorD& GetMomentum() const { return fP; }
91  const TEveVectorD& GetEndMomentum() const { return fPEnd; }
92 
93  Double_t GetDpDs() const { return fDpDs; }
94  void SetDpDs(Double_t dpds) { fDpDs = dpds; }
95 
96  Int_t GetPdg() const { return fPdg; }
97  void SetPdg(Int_t pdg) { fPdg = pdg; }
98  Int_t GetCharge() const { return fCharge; }
99  void SetCharge(Int_t chg) { fCharge = chg; }
100  Int_t GetLabel() const { return fLabel; }
101  void SetLabel(Int_t lbl) { fLabel = lbl; }
102  Int_t GetIndex() const { return fIndex; }
103  void SetIndex(Int_t idx) { fIndex = idx; }
104  Int_t GetStatus() const { return fStatus; }
105  void SetStatus(Int_t idx) { fStatus = idx; }
106 
107  void AddPathMark(const TEvePathMarkD& pm) { fPathMarks.push_back(pm); }
108  void AddPathMark(const TEvePathMark& pm) { fPathMarks.push_back(pm); }
109 
110  void SortPathMarksByTime();
111  vPathMark_t& RefPathMarks() { return fPathMarks; }
112  const vPathMark_t& RefPathMarks() const { return fPathMarks; }
113 
114  void PrintPathMarks(); // *MENU*
115 
116  void SetLockPoints(Bool_t l) { fLockPoints = l; }
117  Bool_t GetLockPoints() const { return fLockPoints; }
118 
119  //-------------------------------------------------------------------
120 
121  virtual void SecSelected(TEveTrack*); // *SIGNAL*
122 
123  virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE);
124 
125  virtual void CopyVizParams(const TEveElement* el);
126  virtual void WriteVizParams(std::ostream& out, const TString& var);
127 
128  virtual TClass* ProjectedClass(const TEveProjection* p) const;
129 
130  ClassDef(TEveTrack, 0); // Track with given vertex, momentum and optional referece-points (path-marks) along its path.
131 };
132 
133 /******************************************************************************/
134 // TEveTrackList
135 /******************************************************************************/
136 
137 class TEveTrackList : public TEveElementList,
138  public TAttMarker,
139  public TAttLine
140 {
141  friend class TEveTrackListEditor;
142 
143 private:
144  TEveTrackList(const TEveTrackList&); // Not implemented
145  TEveTrackList& operator=(const TEveTrackList&); // Not implemented
146 
147 protected:
148  TEveTrackPropagator* fPropagator; // Basic track rendering parameters, not enforced to elements.
149 
150  Bool_t fRecurse; // Recurse when propagating marker/line/etc attributes to tracks.
151 
152  Bool_t fRnrLine; // Render track as line.
153  Bool_t fRnrPoints; // Render track as points.
154 
155  Double_t fMinPt; // Minimum track pTfor display selection.
156  Double_t fMaxPt; // Maximum track pTfor display selection.
157  Double_t fLimPt; // Highest track pT in the container.
158  Double_t fMinP; // Minimum track pfor display selection.
159  Double_t fMaxP; // Maximum track pfor display selection.
160  Double_t fLimP; // Highest track p in the container.
161 
162  void FindMomentumLimits(TEveElement* el, Bool_t recurse=kTRUE);
163  Double_t RoundMomentumLimit(Double_t x);
164  void SanitizeMinMaxCuts();
165 
166 public:
167  TEveTrackList(TEveTrackPropagator* prop=0);
168  TEveTrackList(const char* name, TEveTrackPropagator* prop=0);
169  virtual ~TEveTrackList();
170 
171  void MakeTracks(Bool_t recurse=kTRUE);
172  void FindMomentumLimits(Bool_t recurse=kTRUE);
173 
174  void SetPropagator(TEveTrackPropagator* prop);
175  TEveTrackPropagator* GetPropagator() { return fPropagator; }
176 
177  Bool_t GetRecurse() const { return fRecurse; }
178  void SetRecurse(Bool_t x) { fRecurse = x; }
179 
180  //--------------------------------
181 
182  virtual void SetMainColor(Color_t c);
183  virtual void SetLineColor(Color_t c) { SetMainColor(c); }
184  virtual void SetLineColor(Color_t c, TEveElement* el);
185  virtual void SetLineWidth(Width_t w);
186  virtual void SetLineWidth(Width_t w, TEveElement* el);
187  virtual void SetLineStyle(Style_t s);
188  virtual void SetLineStyle(Style_t s, TEveElement* el);
189 
190  virtual void SetMarkerColor(Color_t c);
191  virtual void SetMarkerColor(Color_t c, TEveElement* el);
192  virtual void SetMarkerSize(Size_t s);
193  virtual void SetMarkerSize(Size_t s, TEveElement* el);
194  virtual void SetMarkerStyle(Style_t s);
195  virtual void SetMarkerStyle(Style_t s, TEveElement* el);
196 
197  void SetRnrLine(Bool_t rnr);
198  void SetRnrLine(Bool_t rnr, TEveElement* el);
199  Bool_t GetRnrLine() const { return fRnrLine; }
200 
201  void SetRnrPoints(Bool_t r);
202  void SetRnrPoints(Bool_t r, TEveElement* el);
203  Bool_t GetRnrPoints() const { return fRnrPoints; }
204 
205  void SelectByPt(Double_t min_pt, Double_t max_pt);
206  void SelectByPt(Double_t min_pt, Double_t max_pt, TEveElement* el);
207  void SelectByP (Double_t min_p, Double_t max_p);
208  void SelectByP (Double_t min_p, Double_t max_p, TEveElement* el);
209 
210  Double_t GetMinPt() const { return fMinPt; }
211  Double_t GetMaxPt() const { return fMaxPt; }
212  Double_t GetLimPt() const { return fLimPt; }
213  Double_t GetMinP() const { return fMinP; }
214  Double_t GetMaxP() const { return fMaxP; }
215  Double_t GetLimP() const { return fLimP; }
216 
217  //-------------------------------------------------------------------
218 
219  TEveTrack* FindTrackByLabel(Int_t label); // *MENU*
220  TEveTrack* FindTrackByIndex(Int_t index); // *MENU*
221 
222  virtual void CopyVizParams(const TEveElement* el);
223  virtual void WriteVizParams(std::ostream& out, const TString& var);
224 
225  virtual TClass* ProjectedClass(const TEveProjection* p) const;
226 
227  ClassDef(TEveTrackList, 0); // A list of tracks supporting change of common attributes and selection based on track parameters.
228 };
229 
230 #endif