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