4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
11 #include <Reve/PODs.h>
12 #include <Reve/RenderElement.h>
13 #include <Reve/Line.h>
15 #include <TPolyMarker3D.h>
24 class Track : public Line,
27 friend class TrackRnrStyle;
28 friend class TrackList;
29 friend class TrackCounter;
33 typedef std::vector<Reve::PathMark*> vpPathMark_t;
34 typedef std::vector<Reve::PathMark*>::iterator vpPathMark_i;
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
46 TrackRnrStyle* fRnrStyle; // Pointer to shared render-style
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);
56 virtual void SetStdTitle();
58 virtual void SetTrackParams(const Track& t);
59 virtual void SetPathMarks (const Track& t);
61 virtual void MakeTrack(Bool_t recurse=kTRUE);
63 TrackRnrStyle* GetRnrStyle() const { return fRnrStyle; }
64 void SetRnrStyle(TrackRnrStyle* rs);
65 void SetAttLineAttMarker(TrackList* tl);
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; }
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();
81 //--------------------------------
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*
92 //--------------------------------
94 virtual void CtrlClicked(Reve::Track*); // *SIGNAL*
95 virtual void SetLineStyle(Style_t lstyle);
97 virtual const TGPicture* GetListTreeIcon() { return fgListTreeIcons[4]; };
99 virtual TClass* ProjectedClass() const;
101 ClassDef(Track, 1); // Visual representation of a track.
105 /**************************************************************************/
107 /**************************************************************************/
109 class TrackRnrStyle : public TObject,
110 public ReferenceBackPtr
113 void RebuildTracks();
116 Float_t fMagField; // Constant magnetic field along z.
119 Float_t fMaxR; // Max radius for track extrapolation
120 Float_t fMaxZ; // Max z-coordinate for track extrapolation.
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.
127 Bool_t fEditPathMarks; // Show widgets for path-mark control in GUI editor.
128 TMarker fPMAtt; // Marker attributes for rendering of path-marks.
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.
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.
138 // First vertex control
139 Bool_t fRnrFV; // Render first vertex.
140 TMarker fFVAtt; // Marker attributes for fits vertex.
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);
150 void SetRnrFV(Bool_t x){ fRnrFV = x;}
152 void SetFitDaughters(Bool_t x);
153 void SetFitReferences(Bool_t x);
154 void SetFitDecay(Bool_t x);
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);
162 Float_t GetMagField() const { return fMagField; }
163 void SetMagField(Float_t mf) { fMagField = mf; }
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.
169 ClassDef(TrackRnrStyle, 1); // Rendering parameters for tracks.
170 }; // endclass TrackRnrStyle
173 /**************************************************************************/
175 /**************************************************************************/
177 class TrackList : public RenderElementList,
178 public NLTProjectable,
182 friend class TrackListEditor;
185 TrackList(const TrackList&); // Not implemented
186 TrackList& operator=(const TrackList&); // Not implemented
188 Bool_t fRecurse; // Recurse when propagating marker/line attributes to tracks.
191 TrackRnrStyle* fRnrStyle; // Basic track rendering parameters, not enforced to elements.
193 Bool_t fRnrLine; // Render track as line.
194 Bool_t fRnrPoints; // Render track as points.
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.
203 Float_t RoundMomentumLimit(Float_t x);
206 TrackList(TrackRnrStyle* rs=0);
207 TrackList(const Text_t* name, TrackRnrStyle* rs=0);
208 virtual ~TrackList();
210 void MakeTracks(Bool_t recurse=kTRUE);
211 void FindMomentumLimits(RenderElement* el, Bool_t recurse);
213 void SetRnrStyle(TrackRnrStyle* rs);
214 TrackRnrStyle* GetRnrStyle(){return fRnrStyle;}
216 //--------------------------------
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);
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);
233 void SetRnrLine(Bool_t rnr);
234 void SetRnrLine(Bool_t rnr, RenderElement* el);
235 Bool_t GetRnrLine(){return fRnrLine;}
237 void SetRnrPoints(Bool_t r);
238 void SetRnrPoints(Bool_t r, RenderElement* el);
239 Bool_t GetRnrPoints(){return fRnrPoints;}
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);
246 //--------------------------------
248 Track* FindTrackByLabel(Int_t label); // *MENU*
249 Track* FindTrackByIndex(Int_t index); // *MENU*
251 void ImportHits(); // *MENU*
252 void ImportClusters(); // *MENU*
254 virtual TClass* ProjectedClass() const;
256 ClassDef(TrackList, 1); // A list of tracks.
260 /**************************************************************************/
262 /**************************************************************************/
264 class TrackCounter : public RenderElement, public TNamed
266 friend class TrackCounterEditor;
269 enum ClickAction_e { CA_PrintTrackInfo, CA_ToggleTrack };
272 TrackCounter(const TrackCounter&); // Not implemented
273 TrackCounter& operator=(const TrackCounter&); // Not implemented
287 TrackCounter(const Text_t* name="TrackCounter", const Text_t* title="");
288 virtual ~TrackCounter();
290 Int_t GetEventId() const { return fEventId; }
291 void SetEventId(Int_t id) { fEventId = id; }
295 void RegisterTracks(TrackList* tlist, Bool_t goodTracks);
297 void DoTrackAction(Track* track);
299 Int_t GetClickAction() const { return fClickAction; }
300 void SetClickAction(Int_t a) { fClickAction = a; }
302 void OutputEventTracks(FILE* out=0);
304 static TrackCounter* fgInstance;
306 ClassDef(TrackCounter, 1);
307 }; // endclass TrackCounter