]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveV0.cxx
e7e478c5fac6cb906f6a0fbbd0985796a94adfce
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveV0.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 /***********************************************************************
11 *  This code defines the reconstructed v0 visualized with EVE
12 *
13 * Ludovic Gaudichet (gaudichet@to.infn.it)
14 ************************************************************************/
15
16 #include "AliEveV0.h"
17
18 #include <TEveTrack.h>
19 #include <TEveTrackPropagator.h>
20 #include <TEveManager.h>
21
22 #include <TPolyLine3D.h>
23 #include <TPolyMarker3D.h>
24 #include <TColor.h>
25
26 #include <vector>
27
28
29 /***********************************************************************
30 *
31 *  AliEveV0 class
32 *
33 ************************************************************************/
34
35 ClassImp(AliEveV0)
36
37 AliEveV0::AliEveV0() :
38   TEvePointSet(),
39
40   fRecBirthV(),
41   fRecDecayV(),
42   fRecDecayP(),
43   fNegTrack(0),
44   fPosTrack(0),
45   fRnrStyle(0),
46   fPolyLineV0(),
47   fESDIndex(-1),
48   fOnFlyStatus(kFALSE),
49   fDaughterDCA(999),
50   fChi2V0(-1)
51 {
52   // Default constructor.
53
54   // Override from TEveElement.
55   fPickable = kTRUE;
56 }
57
58 AliEveV0::AliEveV0(TEveRecTrack* tNeg, TEveRecTrack* tPos,
59                    TEveRecV0* v0, TEveTrackPropagator* rs) :
60   TEvePointSet(),
61
62   fRecBirthV(v0->fV0Birth),
63   fRecDecayV(v0->fVCa),
64   fRecDecayP(v0->fPNeg + v0->fPPos),
65
66   fNegTrack(new TEveTrack(tNeg, rs)),
67   fPosTrack(new TEveTrack(tPos, rs)),
68
69   fRnrStyle(rs),
70   fPolyLineV0(),
71   fESDIndex(-1),
72   fOnFlyStatus(kFALSE),
73   fDaughterDCA(999),
74   fChi2V0(-1)
75 {
76   // Override from TEveElement.
77   fPickable = kTRUE;
78
79   fPolyLineV0.SetLineColor(fMarkerColor);
80  
81   fPosTrack->SetLineColor(2);  // red
82   fNegTrack->SetLineColor(7);  // light blue
83
84   fMainColorPtr = &fMarkerColor;
85   fMarkerStyle = 20;
86   fMarkerColor = 5;
87   fMarkerSize  = 0.3;
88
89   AddElement(fNegTrack);
90   AddElement(fPosTrack);
91 }
92
93 AliEveV0::~AliEveV0()
94 {}
95
96
97 void AliEveV0::Reset(TPolyLine3D* polyLine)
98 {
99   //polyLine->SetPolyLine(n_points);
100   polyLine->SetPolyLine(0);
101 }
102
103 //______________________________________________________________________________
104 void AliEveV0::MakeV0path()
105 {
106   fPolyLineV0.SetPoint(0, fRecBirthV.fX, fRecBirthV.fY, fRecBirthV.fZ);
107   fPolyLineV0.SetPoint(1, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
108 }
109
110
111 //______________________________________________________________________________
112 void AliEveV0::MakeV0()
113 {
114   SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
115
116   fNegTrack->MakeTrack();
117   fPosTrack->MakeTrack();
118   MakeV0path();
119 }
120
121
122 /***********************************************************************
123 *
124 *  AliEveV0List class
125 *
126 ************************************************************************/
127
128 ClassImp(AliEveV0List)
129
130 //______________________________________________________________________________
131 AliEveV0List::AliEveV0List() :
132   TEveElementList(),
133   fTitle(),
134   fRnrStyle(0),
135   fRnrDaughters(kTRUE),
136   fRnrV0vtx(kTRUE),
137   fRnrV0path(kTRUE),
138   fNegColor(0),
139   fPosColor(0),
140   fMinRCut(0),
141   fMaxRCut(250)
142 {
143   fChildClass = AliEveV0::Class(); // override member from base TEveElementList
144 }
145
146 //______________________________________________________________________________
147 AliEveV0List::AliEveV0List(TEveTrackPropagator* rs) :
148   TEveElementList(),
149   fTitle(),
150   fRnrStyle(rs),
151   fRnrDaughters(kTRUE),
152   fRnrV0vtx(kTRUE),
153   fRnrV0path(kTRUE),
154   fNegColor(0),
155   fPosColor(0),
156   fMinRCut(0),
157   fMaxRCut(250)
158 {
159   fChildClass = AliEveV0::Class(); // override member from base TEveElementList
160
161   Init();
162 }
163
164 //______________________________________________________________________________
165 AliEveV0List::AliEveV0List(const Text_t* name, TEveTrackPropagator* rs) :
166   TEveElementList(),
167   fTitle(),
168   fRnrStyle(rs),
169   fRnrDaughters(kTRUE),
170   fRnrV0vtx(kTRUE),
171   fRnrV0path(kTRUE),
172   fNegColor(0),
173   fPosColor(0),
174   fMinRCut(0),
175   fMaxRCut(100)
176 {
177   fChildClass = AliEveV0::Class(); // override member from base TEveElementList
178
179   Init();
180   SetName(name);
181 }
182
183 //______________________________________________________________________________
184 void AliEveV0List::Init()
185 {
186   if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
187
188 }
189
190 //______________________________________________________________________________
191 AliEveV0List::~AliEveV0List()
192 {
193
194 }
195
196 //______________________________________________________________________________
197 void AliEveV0List::Paint(Option_t* option)
198 {
199   if(fRnrSelf) {
200
201     if(fRnrV0vtx) {
202       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
203         if((*i)->GetRnrSelf()) {
204           ((AliEveV0*)(*i))->Paint(option);
205         }
206       }
207     }
208
209     if(fRnrDaughters) {
210       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
211         if((*i)->GetRnrSelf()) {
212           ((AliEveV0*)(*i))->PaintDaughters(option);
213         }
214       }
215     }
216
217     if(fRnrV0path) {
218       for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
219         if((*i)->GetRnrSelf()) {
220           ((AliEveV0*)(*i))->PaintPath(option);
221         }
222       }
223     }
224   }
225 }
226
227
228 //______________________________________________________________________________
229
230 void AliEveV0List::SetRnrV0vtx(Bool_t rnr)
231 {
232   fRnrV0vtx = rnr;
233   gEve->Redraw3D();
234 }
235
236 void AliEveV0List::SetRnrV0path(Bool_t rnr)
237 {
238   fRnrV0path = rnr;
239   gEve->Redraw3D();
240 }
241
242 void AliEveV0List::SetRnrDaughters(Bool_t rnr)
243 {
244   fRnrDaughters = rnr;
245   gEve->Redraw3D();
246 }
247
248 /******************************************************************************/
249
250 void AliEveV0List::MakeV0s()
251 {
252   for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
253     ((AliEveV0*)(*i))->MakeV0();
254   }
255   gEve->Redraw3D();
256 }
257
258
259 void AliEveV0List::MakeMarkers()
260 {
261   gEve->Redraw3D();
262 }
263
264 /******************************************************************************/
265
266 void AliEveV0List::FilterByRadius(Float_t minR, Float_t maxR)
267 {
268   fMinRCut = minR;
269   fMaxRCut = maxR;
270
271   for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
272   {
273     AliEveV0* v0 = (AliEveV0*) *i;
274     Float_t  rad = v0->GetRadius();
275     Bool_t  show = rad >= fMinRCut && rad <= fMaxRCut;
276     v0->SetRnrState(show);
277   }
278   ElementChanged();
279   gEve->Redraw3D();
280 }