]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveBase/AliEveV0.cxx
With Jochen: new class for arbitrarily shaped jet-cone. Will go to ROOT for the next...
[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
d4dbbb43 20#include <TDatabasePDG.h>
21#include <TParticlePDG.h>
22
b594a020 23#include <vector>
24
25
26/***********************************************************************
27*
28* AliEveV0 class
29*
30************************************************************************/
31
32ClassImp(AliEveV0)
33
e6e8b28b 34//______________________________________________________________________________
b594a020 35AliEveV0::AliEveV0() :
36 TEvePointSet(),
37
38 fRecBirthV(),
39 fRecDecayV(),
40 fRecDecayP(),
41 fNegTrack(0),
42 fPosTrack(0),
43 fRnrStyle(0),
e6e8b28b 44 fPointingLine(0),
b594a020 45 fESDIndex(-1),
ca8a6926 46 fOnFlyStatus(kFALSE),
b594a020 47 fDaughterDCA(999),
48 fChi2V0(-1)
ca8a6926 49{
50 // Default constructor.
b594a020 51
ca8a6926 52 // Override from TEveElement.
53 fPickable = kTRUE;
e6e8b28b 54 fMainColorPtr = &fMarkerColor;
ca8a6926 55}
b594a020 56
e6e8b28b 57//______________________________________________________________________________
b594a020 58AliEveV0::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),
e6e8b28b 70 fPointingLine(new TEveLine("Pointing line")),
b594a020 71 fESDIndex(-1),
ca8a6926 72 fOnFlyStatus(kFALSE),
b594a020 73 fDaughterDCA(999),
74 fChi2V0(-1)
75{
e6e8b28b 76 // Constructor with full V0 specification.
77
ca8a6926 78 // Override from TEveElement.
79 fPickable = kTRUE;
e6e8b28b 80 fMainColorPtr = &fMarkerColor;
81
82 fMarkerStyle = 2;
83 fMarkerColor = kSpring + 6;
84 fMarkerSize = 1;
85
86 fPointingLine->SetLineColor(fMarkerColor);
87 fPointingLine->SetLineWidth(2);
88 fPointingLine->IncDenyDestroy();
89 AddElement(fPointingLine);
ca8a6926 90
b594a020 91 fPosTrack->SetLineColor(2); // red
e6e8b28b 92 fPosTrack->SetStdTitle();
b594a020 93 fNegTrack->SetLineColor(7); // light blue
e6e8b28b 94 fNegTrack->SetStdTitle();
b594a020 95
e6e8b28b 96 fNegTrack->IncDenyDestroy();
b594a020 97 AddElement(fNegTrack);
e6e8b28b 98 fPosTrack->IncDenyDestroy();
b594a020 99 AddElement(fPosTrack);
100}
101
e6e8b28b 102//______________________________________________________________________________
b594a020 103AliEveV0::~AliEveV0()
b594a020 104{
e6e8b28b 105 // Destructor. Dereferences pos/neg tracks and pointing-line objects.
b594a020 106
e6e8b28b 107 fNegTrack->DecDenyDestroy();
108 fPosTrack->DecDenyDestroy();
109 fPointingLine->DecDenyDestroy();
b594a020 110}
111
d4dbbb43 112//______________________________________________________________________________
113Float_t AliEveV0::GetInvMass(Float_t nPdgCode, Float_t pPdgCode) const
114{
115 // Returns Invariant Mass assuming the masses of the daughter particles
116 TEveVector lNegMomentum = fNegTrack->GetMomentum();
117 // Does not work properly because momenta at the primary vertex !!!!!!!
118 TEveVector lPosMomentum = fPosTrack->GetMomentum();
119 Double_t nMass=TDatabasePDG::Instance()->GetParticle(nPdgCode)->Mass();
120 Double_t pMass=TDatabasePDG::Instance()->GetParticle(pPdgCode)->Mass();
121
122 printf("\n check the mass of the particle negative %.5f positive %.5f \n",nMass,pMass);
123
124 Double_t eNeg = TMath::Sqrt(nMass*nMass + lNegMomentum.Mag2());
125 Double_t ePos = TMath::Sqrt(pMass*pMass + lPosMomentum.Mag2());
126
127 return TMath::Sqrt( (eNeg+ePos)*(eNeg+ePos) - fRecDecayP.Mag2() );
128}
129
b594a020 130//______________________________________________________________________________
131void AliEveV0::MakeV0()
132{
e6e8b28b 133 // Set all dependant components for drawing.
134
b594a020 135 SetPoint(0, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
136
137 fNegTrack->MakeTrack();
138 fPosTrack->MakeTrack();
e6e8b28b 139
140 fPointingLine->SetPoint(0, fRecBirthV.fX, fRecBirthV.fY, fRecBirthV.fZ);
141 fPointingLine->SetPoint(1, fRecDecayV.fX, fRecDecayV.fY, fRecDecayV.fZ);
b594a020 142}
143
144
145/***********************************************************************
146*
147* AliEveV0List class
148*
149************************************************************************/
150
151ClassImp(AliEveV0List)
152
153//______________________________________________________________________________
154AliEveV0List::AliEveV0List() :
155 TEveElementList(),
156 fTitle(),
157 fRnrStyle(0),
158 fRnrDaughters(kTRUE),
159 fRnrV0vtx(kTRUE),
160 fRnrV0path(kTRUE),
161 fNegColor(0),
ca8a6926 162 fPosColor(0),
163 fMinRCut(0),
e1bb28b4 164 fMaxRCut(250),
165 fMinDaughterDCA(0),
166 fMaxDaughterDCA(1),
167 fMinPt(0),
168 fMaxPt(20)
b594a020 169{
e6e8b28b 170 // Default constructor.
171
b594a020 172 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
173}
174
175//______________________________________________________________________________
176AliEveV0List::AliEveV0List(TEveTrackPropagator* rs) :
177 TEveElementList(),
178 fTitle(),
179 fRnrStyle(rs),
180 fRnrDaughters(kTRUE),
181 fRnrV0vtx(kTRUE),
182 fRnrV0path(kTRUE),
183 fNegColor(0),
ca8a6926 184 fPosColor(0),
185 fMinRCut(0),
e1bb28b4 186 fMaxRCut(250),
187 fMinDaughterDCA(0),
188 fMaxDaughterDCA(1),
189 fMinPt(0),
190 fMaxPt(20)
b594a020 191{
e6e8b28b 192 // Constructor with given track-propagator..
193
b594a020 194 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
195
196 Init();
197}
198
199//______________________________________________________________________________
200AliEveV0List::AliEveV0List(const Text_t* name, TEveTrackPropagator* rs) :
201 TEveElementList(),
202 fTitle(),
203 fRnrStyle(rs),
204 fRnrDaughters(kTRUE),
205 fRnrV0vtx(kTRUE),
206 fRnrV0path(kTRUE),
207 fNegColor(0),
ca8a6926 208 fPosColor(0),
209 fMinRCut(0),
e1bb28b4 210 fMaxRCut(100),
211 fMinDaughterDCA(0),
212 fMaxDaughterDCA(1),
213 fMinPt(0),
214 fMaxPt(20)
b594a020 215{
e6e8b28b 216 // Standard constructor.
217
b594a020 218 fChildClass = AliEveV0::Class(); // override member from base TEveElementList
219
220 Init();
221 SetName(name);
222}
223
224//______________________________________________________________________________
225void AliEveV0List::Init()
226{
e6e8b28b 227 // Initialize members needed for drawing operations.
b594a020 228
e6e8b28b 229 if (fRnrStyle== 0) fRnrStyle = new TEveTrackPropagator;
b594a020 230}
231
ca8a6926 232/******************************************************************************/
b594a020 233
e6e8b28b 234//______________________________________________________________________________
b594a020 235void AliEveV0List::MakeV0s()
236{
e6e8b28b 237 // Call MakeV0() for all elements.
238
b594a020 239 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
240 ((AliEveV0*)(*i))->MakeV0();
241 }
242 gEve->Redraw3D();
243}
244
ca8a6926 245/******************************************************************************/
246
e6e8b28b 247//______________________________________________________________________________
ca8a6926 248void AliEveV0List::FilterByRadius(Float_t minR, Float_t maxR)
249{
e6e8b28b 250 // Select visibility of elements based on their axial radius.
251
ca8a6926 252 fMinRCut = minR;
253 fMaxRCut = maxR;
254
255 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
256 {
257 AliEveV0* v0 = (AliEveV0*) *i;
258 Float_t rad = v0->GetRadius();
259 Bool_t show = rad >= fMinRCut && rad <= fMaxRCut;
260 v0->SetRnrState(show);
261 }
262 ElementChanged();
263 gEve->Redraw3D();
264}
e1bb28b4 265
266/******************************************************************************/
267
268//______________________________________________________________________________
269void AliEveV0List::FilterByDaughterDCA(Float_t minDaughterDCA, Float_t maxDaughterDCA)
270{
271 // Select visibility of elements based on the DCA between daughters.
272
273 fMinDaughterDCA = minDaughterDCA;
274 fMaxDaughterDCA = maxDaughterDCA;
275
276 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
277 {
278 AliEveV0* v0 = (AliEveV0*) *i;
279 Float_t dca = v0->GetDaughterDCA();
280 Bool_t show = dca >= fMinDaughterDCA && dca <= fMaxDaughterDCA;
281 v0->SetRnrState(show);
282 }
283 ElementChanged();
284 gEve->Redraw3D();
285}
286
287/******************************************************************************/
288
289//______________________________________________________________________________
290void AliEveV0List::FilterByPt(Float_t minPt, Float_t maxPt)
291{
292 // Select visibility of elements based on the V0 pt.
293
294 fMinPt = minPt;
295 fMaxPt = maxPt;
296
297 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
298 {
299 AliEveV0* v0 = (AliEveV0*) *i;
300 Float_t pt = v0->GetPt();
301 Bool_t show = pt >= fMinPt && pt <= fMaxPt;
302 v0->SetRnrState(show);
303 }
304 ElementChanged();
305 gEve->Redraw3D();
306}