Added class TrackCounter; Track now inherits from TQObject and emits a Clicked()...
[u/mrichter/AliRoot.git] / EVE / Reve / Track.h
CommitLineData
5a5a1232 1// $Header$
2
3#ifndef REVE_Track_H
4#define REVE_Track_H
5
6#include <Reve/PODs.h>
7#include <Reve/RenderElement.h>
eadaa89b 8#include <Reve/Line.h>
5a5a1232 9
10#include <TPolyMarker3D.h>
eadaa89b 11// #include <TPolyLine3D.h>
5a5a1232 12
13namespace Reve {
14
15class TrackRnrStyle;
16class TrackList;
17
9c39ede9 18class Track : public Line, public TQObject
5a5a1232 19{
20 friend class TrackList;
9c39ede9 21 friend class TrackCounter;
5a5a1232 22
265ecb21 23 Track(const Track&); // Not implemented
24 Track& operator=(const Track&); // Not implemented
5a5a1232 25
26protected:
265ecb21 27 typedef std::vector<Reve::PathMark*> vpPathMark_t;
28 typedef std::vector<Reve::PathMark*>::iterator vpPathMark_i;
29
30 Reve::Vector fV;
31 Reve::Vector fP;
32 Double_t fBeta;
33 Int_t fCharge;
34 Int_t fLabel;
35 vpPathMark_t fPathMarks;
5a5a1232 36
265ecb21 37 TrackRnrStyle* fRnrStyle;
5a5a1232 38
39public:
40 Track();
3d75306d 41 Track(TParticle* t, Int_t label, TrackRnrStyle* rs);
5a5a1232 42 Track(Reve::MCTrack* t, TrackRnrStyle* rs);
43 Track(Reve::RecTrack* t, TrackRnrStyle* rs);
5a5a1232 44 virtual ~Track();
45
5a5a1232 46 void MakeTrack();
47
48dc973d 48 TrackRnrStyle* GetRnrStyle() const { return fRnrStyle; }
49 void SetRnrStyle(TrackRnrStyle* rs) { fRnrStyle = rs; }
5a5a1232 50
5a5a1232 51 Int_t GetLabel() const { return fLabel; }
265ecb21 52 void AddPathMark(Reve::PathMark* pm) { fPathMarks.push_back(pm); }
5a5a1232 53
48dc973d 54 //--------------------------------
55
56 void ImportHits(); // *MENU*
57 void ImportClusters(); // *MENU*
58
9c39ede9 59 //--------------------------------
60
61 void CtrlClicked(Reve::Track*); // *SIGNAL*
62
5a5a1232 63 ClassDef(Track, 1);
64}; // endclass Track
65
66
67/**************************************************************************/
68// TrackRnrStyle
69/**************************************************************************/
70
71// This is decoupled from Track/TrackList to allow sharing of the
72// RnrStyle among several instances. The interface is half cooked and
73// there is no good way to set RnrStyle after the object has been
74// created (shouldn't be too hard to fix).
75//
76// TrackList has Get/Set methods for RnrStlye and
77// TrackListEditor provides editor access to them.
78
9c39ede9 79class TrackRnrStyle : public TObject
5a5a1232 80{
5a5a1232 81public:
82 Color_t fColor;
2074deef 83 Width_t fWidth;
5a5a1232 84 Float_t fMagField;
85 // track limits
86 Float_t fMaxR;
87 Float_t fMaxZ;
88 // helix limits
89 Float_t fMaxOrbs; // Maximal angular path of tracks' orbits (1 ~ 2Pi).
90 Float_t fMinAng; // Minimal angular step between two helix points.
91 Float_t fDelta; // Maximal error at the mid-point of the line connecting to helix points.
92
93 Bool_t fFitDaughters;
94 Bool_t fFitDecay;
95
265ecb21 96 TrackRnrStyle();
5a5a1232 97
98 void SetColor(Color_t c) { fColor = c; }
99 Color_t GetColor() const { return fColor; }
100
48dc973d 101 Float_t GetMagField() const { return fMagField; }
102 void SetMagField(Float_t mf) { fMagField = mf; }
103
104 static Float_t fgDefMagField;
105 static const Float_t fgkB2C;
5a5a1232 106 static TrackRnrStyle fgDefStyle;
107
108 ClassDef(TrackRnrStyle, 1);
109}; // endclass TrackRnrStyle
110
111
112/**************************************************************************/
113// TrackList
114/**************************************************************************/
115
7d42b6c2 116class TrackList : public RenderElementListBase,
117 public TPolyMarker3D
5a5a1232 118{
265ecb21 119 TrackList(const TrackList&); // Not implemented
120 TrackList& operator=(const TrackList&); // Not implemented
121
5a5a1232 122private:
123 void Init();
124
125protected:
48dc973d 126 TString fTitle;
5a5a1232 127
a8600b56 128 TrackRnrStyle* fRnrStyle;
5a5a1232 129
48dc973d 130 Bool_t fRnrMarkers;
131 Bool_t fRnrTracks;
5a5a1232 132
133public:
a8600b56 134 TrackList(Int_t n_tracks=0, TrackRnrStyle* rs=0);
135 TrackList(const Text_t* name, Int_t n_tracks=0, TrackRnrStyle* rs=0);
5a5a1232 136
137 void Reset(Int_t n_tracks=0);
138
a8600b56 139 virtual const Text_t* GetTitle() const { return fTitle; }
5a5a1232 140 virtual void SetTitle(const Text_t* t) { fTitle = t; }
141
48dc973d 142 virtual Bool_t CanEditMainColor() { return kTRUE; }
5a5a1232 143
144 virtual void Paint(Option_t* option="");
145
146 virtual void AddElement(RenderElement* el);
147
a8600b56 148 void SetRnrStyle(TrackRnrStyle* rst) { fRnrStyle= rst; }
149 TrackRnrStyle* GetRnrStyle() { return fRnrStyle; }
5a5a1232 150
151 Bool_t GetRnrTracks() const { return fRnrTracks; }
152 void SetRnrTracks(Bool_t);
153
154 Bool_t GetRnrMarkers() const { return fRnrMarkers; }
155 void SetRnrMarkers(Bool_t);
156
157 void MakeTracks();
158 void MakeMarkers();
159
2074deef 160 Width_t GetWidth() const { return fRnrStyle->fWidth; }
161 void SetWidth(Width_t w);
162
a8600b56 163 Float_t GetMaxR() const { return fRnrStyle->fMaxZ; }
164 Float_t GetMaxZ() const { return fRnrStyle->fMaxR; }
165 Float_t GetMaxOrbs() const { return fRnrStyle->fMaxOrbs; }
166 Float_t GetMinAng() const { return fRnrStyle->fMinAng; }
167 Float_t GetDelta() const { return fRnrStyle->fDelta; }
168 Bool_t GetFitDaughters() const { return fRnrStyle->fFitDaughters; }
169 Bool_t GetFitDecay() const { return fRnrStyle->fFitDecay; }
5a5a1232 170
171 void SetMaxR(Float_t x);
172 void SetMaxZ(Float_t x);
173 void SetMaxOrbs(Float_t x);
174 void SetMinAng(Float_t x);
175 void SetDelta(Float_t x);
176 void SetFitDaughters(Bool_t x);
177 void SetFitDecay(Bool_t x);
178
179
180 // void UpdateBounds();
181 Int_t GetNTracks() { return fN; }
182
183 void SelectByPt(Float_t min_pt=0.2, Float_t max_pt=10); // *MENU*
184
b99aed53 185 //--------------------------------
186
187 void ImportHits(); // *MENU*
188 void ImportClusters(); // *MENU*
5a5a1232 189
190 ClassDef(TrackList, 1);
191};
192
9c39ede9 193/**************************************************************************/
194// TrackCounter
195/**************************************************************************/
196
197class TrackCounter : public RenderElement, public TNamed
198{
199 friend class TrackCounterEditor;
200
201public:
202 enum ClickAction_e { CA_PrintTrackInfo, CA_ToggleTrack };
203
204private:
205 TrackCounter(const TrackCounter&); // Not implemented
206 TrackCounter& operator=(const TrackCounter&); // Not implemented
207
208protected:
209 Int_t fBadLineStyle;
210 Int_t fClickAction;
211
212 Int_t fAllTracks;
213 Int_t fGoodTracks;
214
215 TList fTrackLists;
216
217public:
218 TrackCounter(const Text_t* name="TrackCounter", const Text_t* title="");
219 virtual ~TrackCounter();
220
221 void Reset();
222
223 void RegisterTracks(TrackList* tlist, Bool_t goodTracks);
224
225 void DoTrackAction(Track* track);
226
227 Int_t GetClickAction() const { return fClickAction; }
228 void SetClickAction(Int_t a) { fClickAction = a; }
229
230 ClassDef(TrackCounter, 1);
231}; // endclass TrackCounter
232
5a5a1232 233
234} // namespace Reve
235
236#endif