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