]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveCascade.cxx
Merge revs 30349 and 30378 from the EVE-root-trunk branch - they were committed there...
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveCascade.cxx
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include "AliEveCascade.h"
11
12 #include <TEveTrack.h>
13 #include <TEveTrackPropagator.h>
14 #include <TEveManager.h>
15
16 #include <TPolyLine3D.h>
17 #include <TPolyMarker3D.h>
18 #include <TColor.h>
19
20 #include <vector>
21
22
23 /***********************************************************************
24 *
25 *  AliEveCascade class
26 *
27 ************************************************************************/
28
29 ClassImp(AliEveCascade)
30
31 //______________________________________________________________________________
32 AliEveCascade::AliEveCascade() :
33   TEvePointSet(),
34
35   fRecBirthV(),
36   fRecDecayV(),
37   fRecDecayP(),
38   fRecDecayV0(),
39   fBacTrack(0),
40   fRnrStyle(0),
41   fPointingCurve(0),
42   fV0Path(0),
43   fESDIndex(-1),
44   fDaughterDCA(999),
45   fChi2Cascade(-1)
46 {
47   // Default constructor.
48
49   // Override from TEveElement.
50   fPickable = kTRUE;
51   fMainColorPtr = &fMarkerColor;
52 }
53
54 //______________________________________________________________________________
55 AliEveCascade::AliEveCascade(TEveRecTrack* tBac, TEveRecV0* v0, TEveRecCascade* cascade, TEveTrackPropagator* rs) :
56   TEvePointSet(),
57
58   fRecBirthV(cascade->fCascadeBirth),
59   fRecDecayV(cascade->fCascadeVCa),
60   fRecDecayP(cascade->fPBac + v0->fPNeg + v0->fPPos),
61   fRecDecayV0(v0->fVCa),
62   fBacTrack(new TEveTrack(tBac, rs)),
63
64   fRnrStyle(rs),
65   fPointingCurve(new TEveLine("Pointing Curve")),
66   fV0Path(new TEveLine("V0 Path")),
67   fESDIndex(-1),
68   fDaughterDCA(999),
69   fChi2Cascade(-1)
70 {
71   // Constructor with full Cascade specification.
72
73   // Override from TEveElement.
74   fPickable = kTRUE;
75   fMainColorPtr = &fMarkerColor;
76
77   fMarkerStyle = 2;
78   fMarkerColor = kViolet;
79   fMarkerSize  = 1;
80
81   fPointingCurve->SetLineColor(fMarkerColor);
82   fPointingCurve->SetLineWidth(2);
83   fPointingCurve->IncDenyDestroy();
84   AddElement(fPointingCurve);
85
86   fV0Path->SetLineColor(fMarkerColor);
87   fV0Path->SetLineStyle(3);
88   fV0Path->SetLineWidth(2);
89   fV0Path->IncDenyDestroy();
90   AddElement(fV0Path);
91
92   fBacTrack->SetLineColor(6);
93   fBacTrack->SetStdTitle();
94
95   fBacTrack->IncDenyDestroy();
96   AddElement(fBacTrack);
97 }
98
99 //______________________________________________________________________________
100 AliEveCascade::~AliEveCascade()
101 {
102   // Destructor. Dereferences bachelor track and pointing-line objects.
103
104   fBacTrack->DecDenyDestroy();
105   fPointingCurve->DecDenyDestroy();
106   fV0Path->DecDenyDestroy();
107 }
108
109 //______________________________________________________________________________
110 void AliEveCascade::MakeCascade()
111 {
112   // Set all dependant components for drawing.
113
114   SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
115
116   fBacTrack->MakeTrack();
117
118   fPointingCurve->SetPoint(0, fRecBirthV.fX, fRecBirthV.fY, fRecBirthV.fZ);
119   fPointingCurve->SetPoint(1, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
120
121   fV0Path->SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
122   fV0Path->SetPoint(1, fRecDecayV0.fX, fRecDecayV0.fY, fRecDecayV0.fZ);
123 }
124
125
126 /***********************************************************************
127 *
128 *  AliEveCascadeList class
129 *
130 ************************************************************************/
131
132 ClassImp(AliEveCascadeList)
133
134 //______________________________________________________________________________
135 AliEveCascadeList::AliEveCascadeList() :
136   TEveElementList(),
137   fTitle(),
138   fRnrStyle(0),
139   fRnrDaughters(kTRUE),
140   fRnrCascadevtx(kTRUE),
141   fRnrCascadepath(kTRUE),
142   fBacColor(0),
143   fMinRCut(0),
144   fMaxRCut(250),
145   fMinDaughterDCA(0),
146   fMaxDaughterDCA(1),
147   fMinPt(0),
148   fMaxPt(20)
149 {
150   // Default constructor.
151
152   fChildClass = AliEveCascade::Class(); // override member from base TEveElementList
153 }
154
155 //______________________________________________________________________________
156 AliEveCascadeList::AliEveCascadeList(TEveTrackPropagator* rs) :
157   TEveElementList(),
158   fTitle(),
159   fRnrStyle(rs),
160   fRnrDaughters(kTRUE),
161   fRnrCascadevtx(kTRUE),
162   fRnrCascadepath(kTRUE),
163   fBacColor(0),
164   fMinRCut(0),
165   fMaxRCut(250),
166   fMinDaughterDCA(0),
167   fMaxDaughterDCA(1),
168   fMinPt(0),
169   fMaxPt(20)
170 {
171   // Constructor with given track-propagator..
172
173   fChildClass = AliEveCascade::Class(); // override member from base TEveElementList
174
175   Init();
176 }
177
178 //______________________________________________________________________________
179 AliEveCascadeList::AliEveCascadeList(const Text_t* name, TEveTrackPropagator* rs) :
180   TEveElementList(),
181   fTitle(),
182   fRnrStyle(rs),
183   fRnrDaughters(kTRUE),
184   fRnrCascadevtx(kTRUE),
185   fRnrCascadepath(kTRUE),
186   fBacColor(0),
187   fMinRCut(0),
188   fMaxRCut(100),
189   fMinDaughterDCA(0),
190   fMaxDaughterDCA(1),
191   fMinPt(0),
192   fMaxPt(20)
193 {
194   // Standard constructor.
195
196   fChildClass = AliEveCascade::Class(); // override member from base TEveElementList
197
198   Init();
199   SetName(name);
200 }
201
202 //______________________________________________________________________________
203 void AliEveCascadeList::Init()
204 {
205   // Initialize members needed for drawing operations.
206
207   if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
208 }
209
210 /******************************************************************************/
211
212 //______________________________________________________________________________
213 void AliEveCascadeList::MakeCascades()
214 {
215   // Call MakeCascade() for all elements.
216
217   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
218     ((AliEveCascade*)(*i))->MakeCascade();
219   }
220   gEve->Redraw3D();
221 }
222
223 /******************************************************************************/
224
225 //______________________________________________________________________________
226 void AliEveCascadeList::FilterByRadius(Float_t minR, Float_t maxR)
227 {
228   // Select visibility of elements based on their axial radius.
229
230   fMinRCut = minR;
231   fMaxRCut = maxR;
232
233   for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
234   {
235     AliEveCascade* cascade = (AliEveCascade*) *i;
236     Float_t  rad = cascade->GetRadius();
237     Bool_t  show = rad >= fMinRCut && rad <= fMaxRCut;
238     cascade->SetRnrState(show);
239   }
240   ElementChanged();
241   gEve->Redraw3D();
242 }
243
244 /******************************************************************************/
245
246 //______________________________________________________________________________
247 void AliEveCascadeList::FilterByDaughterDCA(Float_t minDaughterDCA, Float_t maxDaughterDCA)
248 {
249   // Select visibility of elements based on the DCA between daughters.
250
251   fMinDaughterDCA = minDaughterDCA;
252   fMaxDaughterDCA = maxDaughterDCA;
253
254   for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
255   {
256     AliEveCascade* cascade = (AliEveCascade*) *i;
257     Float_t  dca = cascade->GetDaughterDCA();
258     Bool_t  show = dca >= fMinDaughterDCA && dca <= fMaxDaughterDCA;
259     cascade->SetRnrState(show);
260   }
261   ElementChanged();
262   gEve->Redraw3D();
263 }
264
265 /******************************************************************************/
266
267 //______________________________________________________________________________
268 void AliEveCascadeList::FilterByPt(Float_t minPt, Float_t maxPt)
269 {
270   // Select visibility of elements based on the Cascade pt.
271
272   fMinPt = minPt;
273   fMaxPt = maxPt;
274
275   for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
276   {
277     AliEveCascade* cascade = (AliEveCascade*) *i;
278     Float_t  pt = cascade->GetPt();
279     Bool_t  show = pt >= fMinPt && pt <= fMaxPt;
280     cascade->SetRnrState(show);
281   }
282   ElementChanged();
283   gEve->Redraw3D();
284 }