With Boris and Antonin - improvements for V0 visualization.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveV0.cxx
CommitLineData
b594a020 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
b594a020 10#include "AliEveV0.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* AliEveV0 class
26*
27************************************************************************/
28
29ClassImp(AliEveV0)
30
e6e8b28b 31//______________________________________________________________________________
b594a020 32AliEveV0::AliEveV0() :
33 TEvePointSet(),
34
35 fRecBirthV(),
36 fRecDecayV(),
37 fRecDecayP(),
38 fNegTrack(0),
39 fPosTrack(0),
40 fRnrStyle(0),
e6e8b28b 41 fPointingLine(0),
b594a020 42 fESDIndex(-1),
ca8a6926 43 fOnFlyStatus(kFALSE),
b594a020 44 fDaughterDCA(999),
45 fChi2V0(-1)
ca8a6926 46{
47 // Default constructor.
b594a020 48
ca8a6926 49 // Override from TEveElement.
50 fPickable = kTRUE;
e6e8b28b 51 fMainColorPtr = &fMarkerColor;
ca8a6926 52}
b594a020 53
e6e8b28b 54//______________________________________________________________________________
b594a020 55AliEveV0::AliEveV0(TEveRecTrack* tNeg, TEveRecTrack* tPos,
56 TEveRecV0* v0, TEveTrackPropagator* rs) :
57 TEvePointSet(),
58
59 fRecBirthV(v0->fV0Birth),
60 fRecDecayV(v0->fVCa),
61 fRecDecayP(v0->fPNeg + v0->fPPos),
62
63 fNegTrack(new TEveTrack(tNeg, rs)),
64 fPosTrack(new TEveTrack(tPos, rs)),
65
66 fRnrStyle(rs),
e6e8b28b 67 fPointingLine(new TEveLine("Pointing line")),
b594a020 68 fESDIndex(-1),
ca8a6926 69 fOnFlyStatus(kFALSE),
b594a020 70 fDaughterDCA(999),
71 fChi2V0(-1)
72{
e6e8b28b 73 // Constructor with full V0 specification.
74
ca8a6926 75 // Override from TEveElement.
76 fPickable = kTRUE;
e6e8b28b 77 fMainColorPtr = &fMarkerColor;
78
79 fMarkerStyle = 2;
80 fMarkerColor = kSpring + 6;
81 fMarkerSize = 1;
82
83 fPointingLine->SetLineColor(fMarkerColor);
84 fPointingLine->SetLineWidth(2);
85 fPointingLine->IncDenyDestroy();
86 AddElement(fPointingLine);
ca8a6926 87
b594a020 88 fPosTrack->SetLineColor(2); // red
e6e8b28b 89 fPosTrack->SetStdTitle();
b594a020 90 fNegTrack->SetLineColor(7); // light blue
e6e8b28b 91 fNegTrack->SetStdTitle();
b594a020 92
e6e8b28b 93 fNegTrack->IncDenyDestroy();
b594a020 94 AddElement(fNegTrack);
e6e8b28b 95 fPosTrack->IncDenyDestroy();
b594a020 96 AddElement(fPosTrack);
97}
98
e6e8b28b 99//______________________________________________________________________________
b594a020 100AliEveV0::~AliEveV0()
b594a020 101{
e6e8b28b 102 // Destructor. Dereferences pos/neg tracks and pointing-line objects.
b594a020 103
e6e8b28b 104 fNegTrack->DecDenyDestroy();
105 fPosTrack->DecDenyDestroy();
106 fPointingLine->DecDenyDestroy();
b594a020 107}
108
b594a020 109//______________________________________________________________________________
110void AliEveV0::MakeV0()
111{
e6e8b28b 112 // Set all dependant components for drawing.
113
b594a020 114 SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
115
116 fNegTrack->MakeTrack();
117 fPosTrack->MakeTrack();
e6e8b28b 118
119 fPointingLine->SetPoint(0, fRecBirthV.fX, fRecBirthV.fY, fRecBirthV.fZ);
120 fPointingLine->SetPoint(1, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
b594a020 121}
122
123
124/***********************************************************************
125*
126* AliEveV0List class
127*
128************************************************************************/
129
130ClassImp(AliEveV0List)
131
132//______________________________________________________________________________
133AliEveV0List::AliEveV0List() :
134 TEveElementList(),
135 fTitle(),
136 fRnrStyle(0),
137 fRnrDaughters(kTRUE),
138 fRnrV0vtx(kTRUE),
139 fRnrV0path(kTRUE),
140 fNegColor(0),
ca8a6926 141 fPosColor(0),
142 fMinRCut(0),
143 fMaxRCut(250)
b594a020 144{
e6e8b28b 145 // Default constructor.
146
b594a020 147 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
148}
149
150//______________________________________________________________________________
151AliEveV0List::AliEveV0List(TEveTrackPropagator* rs) :
152 TEveElementList(),
153 fTitle(),
154 fRnrStyle(rs),
155 fRnrDaughters(kTRUE),
156 fRnrV0vtx(kTRUE),
157 fRnrV0path(kTRUE),
158 fNegColor(0),
ca8a6926 159 fPosColor(0),
160 fMinRCut(0),
161 fMaxRCut(250)
b594a020 162{
e6e8b28b 163 // Constructor with given track-propagator..
164
b594a020 165 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
166
167 Init();
168}
169
170//______________________________________________________________________________
171AliEveV0List::AliEveV0List(const Text_t* name, TEveTrackPropagator* rs) :
172 TEveElementList(),
173 fTitle(),
174 fRnrStyle(rs),
175 fRnrDaughters(kTRUE),
176 fRnrV0vtx(kTRUE),
177 fRnrV0path(kTRUE),
178 fNegColor(0),
ca8a6926 179 fPosColor(0),
180 fMinRCut(0),
181 fMaxRCut(100)
b594a020 182{
e6e8b28b 183 // Standard constructor.
184
b594a020 185 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
186
187 Init();
188 SetName(name);
189}
190
191//______________________________________________________________________________
192void AliEveV0List::Init()
193{
e6e8b28b 194 // Initialize members needed for drawing operations.
b594a020 195
e6e8b28b 196 if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
b594a020 197}
198
ca8a6926 199/******************************************************************************/
b594a020 200
e6e8b28b 201//______________________________________________________________________________
b594a020 202void AliEveV0List::MakeV0s()
203{
e6e8b28b 204 // Call MakeV0() for all elements.
205
b594a020 206 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
207 ((AliEveV0*)(*i))->MakeV0();
208 }
209 gEve->Redraw3D();
210}
211
ca8a6926 212/******************************************************************************/
213
e6e8b28b 214//______________________________________________________________________________
ca8a6926 215void AliEveV0List::FilterByRadius(Float_t minR, Float_t maxR)
216{
e6e8b28b 217 // Select visibility of elements based on their axial radius.
218
ca8a6926 219 fMinRCut = minR;
220 fMaxRCut = maxR;
221
222 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
223 {
224 AliEveV0* v0 = (AliEveV0*) *i;
225 Float_t rad = v0->GetRadius();
226 Bool_t show = rad >= fMinRCut && rad <= fMaxRCut;
227 v0->SetRnrState(show);
228 }
229 ElementChanged();
230 gEve->Redraw3D();
231}