Extra header added to the list
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveKink.cxx
CommitLineData
4711ad43 1// $Id$
2// Main authors: Paraskevi Ganoti: 2009
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 "AliEveKink.h"
11
c180f65d 12#include <TDatabasePDG.h>
4711ad43 13#include <TEveTrack.h>
3e3a768d 14#include <TEveTrackPropagator.h>
4711ad43 15
3e3a768d 16#include <TEveManager.h>
4711ad43 17
18/***********************************************************************
19*
20* AliEveKink class
21*
22************************************************************************/
23
24ClassImp(AliEveKink)
25
26//______________________________________________________________________________
27AliEveKink::AliEveKink() :
28 TEvePointSet(),
29
30 fRecKinkPosition(),
31 fMotherMomentum(),
32 fDaughterMomentum(),
33 fMotherTrack(0),
34 fDaughterTrack(0),
35 fRnrStyleMoth(0),
36 fRnrStyleDaugh(0),
37 fESDKinkIndex(-1),
38 fDaugMaxProbPdg(0),
3e3a768d 39 fDaugMaxProbPid(0)
4711ad43 40{
41 // Default constructor.
42
43 // Override from TEveElement.
44 fKinkAngle[0]=fKinkAngle[1]=fKinkAngle[2]=0.0;
45 fPickable = kTRUE;
46}
47
48//______________________________________________________________________________
49AliEveKink::AliEveKink(TEveRecTrack* tMoth, TEveRecTrack* tDaug,
50 TEveRecKink* kink, TEveTrackPropagator* rsMoth, TEveTrackPropagator* rsDaugh) :
51 TEvePointSet(),
52 fRecKinkPosition(kink->fVKink),
53 fMotherMomentum(kink->fPMother),
54 fDaughterMomentum(kink->fPDaughter),
55 fMotherTrack(new TEveTrack(tMoth, rsMoth)),
3e3a768d 56 fDaughterTrack(new TEveTrack(tDaug, rsDaugh)),
4711ad43 57 fRnrStyleMoth(rsMoth),
58 fRnrStyleDaugh(rsDaugh),
59 fESDKinkIndex(-1),
60 fDaugMaxProbPdg(0),
61 fDaugMaxProbPid(0)
62{
63 // Constructor with full kink specification.
64
65 // Override from TEveElement.
66 fPickable = kTRUE;
67 fKinkAngle[0]=fKinkAngle[1]=fKinkAngle[2]=0;
68
69 fMotherTrack->SetLineColor(2); // red
70 fMotherTrack->SetStdTitle();
71 fMotherTrack->SetLineWidth(3);
34ce391d 72 TEvePathMark* pmM = new TEvePathMark(TEvePathMark::kDecay);
4711ad43 73 pmM->fV.Set(kink->fVKink);
74 fMotherTrack->AddPathMark(*pmM);
75
76 fDaughterTrack->SetLineColor(7); // light blue
3e3a768d 77 fDaughterTrack->SetLineWidth(3); //
4711ad43 78 fDaughterTrack->SetStdTitle();
3e3a768d 79
4711ad43 80 fMotherTrack->IncDenyDestroy();
81 AddElement(fMotherTrack);
82 fDaughterTrack->IncDenyDestroy();
83 AddElement(fDaughterTrack);
34ce391d 84 delete pmM;
4711ad43 85}
86
87//______________________________________________________________________________
88AliEveKink::~AliEveKink()
89{
90 // Destructor. Dereferences mother-daughter tracks
91
92 fMotherTrack->DecDenyDestroy();
93 fDaughterTrack->DecDenyDestroy();
94}
95//______________________________________________________________________________
96void AliEveKink::SetMaxProbPdgPid(Int_t rPdg, Float_t rPid)
97{
98 // Sets the maximum probability Pdg value and Pid for the daughter
99 // Should be moved to TEveTrack property eventually (or AliEveTrack creation)
100
101 fDaugMaxProbPdg = rPdg;
102 fDaugMaxProbPid = rPid;
103
104}
105
106//______________________________________________________________________________
107Float_t AliEveKink::GetInvMass(Int_t dPdgCode) const
108{
109 // Returns Invariant Mass assuming the mass of the daughter particle
110 TEveVector lDaugMomentum = fDaughterTrack->GetMomentum();
111 TEveVector lMothMomentum = fMotherTrack->GetMomentum();
112 Double_t dMass=TDatabasePDG::Instance()->GetParticle(dPdgCode)->Mass();
113
114 Double_t eDaug = TMath::Sqrt(dMass*dMass + lDaugMomentum.Mag2());
3e3a768d 115 Double_t otherDaug=TMath::Sqrt(
116 (lMothMomentum.fX-lDaugMomentum.fX)*(lMothMomentum.fX-lDaugMomentum.fX)+
117 (lMothMomentum.fY-lDaugMomentum.fY)*(lMothMomentum.fY-lDaugMomentum.fY)+
4711ad43 118 (lMothMomentum.fZ-lDaugMomentum.fZ)*(lMothMomentum.fZ-lDaugMomentum.fZ));
3e3a768d 119
4711ad43 120 return TMath::Sqrt( (eDaug+otherDaug)*(eDaug+otherDaug) - lMothMomentum.Mag2());
121}
122
123//______________________________________________________________________________
124Float_t AliEveKink::GetQt() const
125{
126 // Returns the kink daughter Qt
3e3a768d 127
4711ad43 128 TEveVector lDaugMomentum = fDaughterTrack->GetMomentum();
3e3a768d 129 Float_t daugMom=TMath::Sqrt(
130 (lDaugMomentum.fX)*(lDaugMomentum.fX)+
131 (lDaugMomentum.fY)*(lDaugMomentum.fY)+
4711ad43 132 (lDaugMomentum.fZ)*(lDaugMomentum.fZ));
3e3a768d 133
4711ad43 134 return TMath::Sin(fKinkAngle[2])*daugMom ;
135}
136
137//______________________________________________________________________________
138void AliEveKink::MakeKink()
139{
140 // Set all dependant components for drawing.
141
142 SetPoint(0, fRecKinkPosition.fX, fRecKinkPosition.fY, fRecKinkPosition.fZ);
143
144 fMotherTrack->MakeTrack();
145 fDaughterTrack->MakeTrack();
146
147}
148
149
150/***********************************************************************
151*
152* AliEveKinkList class
153*
154************************************************************************/
155
156ClassImp(AliEveKinkList)
157
158//______________________________________________________________________________
159AliEveKinkList::AliEveKinkList() :
160 TEveElementList(),
4711ad43 161 fRnrStyleMoth(0),
3e3a768d 162 fRnrStyleDaugh(0),
4711ad43 163 fRnrKinkDaughter(kTRUE),
164 fRnrKinkvtx(kTRUE),
165 fMothColor(0),
166 fDaugColor(0),
167 fMinRCut(0),
168 fMaxRCut(300),
169 fMinKinkAngle(0),
170 fMaxKinkAngle(300),
171 fMinPt(0),
172 fMaxPt(20),
173 fMinInvariantMass(0),
174 fMaxInvariantMass(1.0),
175 fDaugCheckedPid(0),
176 fDaugCheckedProb(0)
177{
178 // Default constructor.
179
180 fChildClass = AliEveKink::Class(); // override member from base TEveElementList
181}
182
183//______________________________________________________________________________
184AliEveKinkList::AliEveKinkList(TEveTrackPropagator* rsMoth,TEveTrackPropagator* rsDaugh) :
185 TEveElementList(),
4711ad43 186 fRnrStyleMoth(rsMoth),
187 fRnrStyleDaugh(rsDaugh),
188 fRnrKinkDaughter(kTRUE),
189 fRnrKinkvtx(kTRUE),
190 fMothColor(0),
191 fDaugColor(0),
192 fMinRCut(0),
193 fMaxRCut(300),
194 fMinKinkAngle(0),
195 fMaxKinkAngle(300),
196 fMinPt(0),
197 fMaxPt(20),
198 fMinInvariantMass(0),
199 fMaxInvariantMass(1.0),
200 fDaugCheckedPid(0),
3e3a768d 201 fDaugCheckedProb(0)
4711ad43 202{
203 // Constructor with given track-propagator..
204
205 fChildClass = AliEveKink::Class(); // override member from base TEveElementList
206
207 Init();
208}
209
210//______________________________________________________________________________
211AliEveKinkList::AliEveKinkList(const Text_t* name, TEveTrackPropagator* rsMoth, TEveTrackPropagator* rsDaugh) :
212 TEveElementList(),
4711ad43 213 fRnrStyleMoth(rsMoth),
214 fRnrStyleDaugh(rsDaugh),
215 fRnrKinkDaughter(kTRUE),
216 fRnrKinkvtx(kTRUE),
217 fMothColor(0),
218 fDaugColor(0),
219 fMinRCut(0),
220 fMaxRCut(300),
221 fMinKinkAngle(0),
222 fMaxKinkAngle(300),
223 fMinPt(0),
224 fMaxPt(20),
225 fMinInvariantMass(0),
226 fMaxInvariantMass(1.0),
227 fDaugCheckedPid(0),
228 fDaugCheckedProb(0)
229{
230 // Standard constructor.
231
232 fChildClass = AliEveKink::Class(); // override member from base TEveElementList
233
234 Init();
235 SetName(name);
236}
237
238//______________________________________________________________________________
239void AliEveKinkList::Init()
240{
241 // Initialize members needed for drawing operations.
242
243 if (fRnrStyleMoth== 0) fRnrStyleMoth = new TEveTrackPropagator;
244 if (fRnrStyleDaugh== 0) fRnrStyleDaugh = new TEveTrackPropagator;
245}
246
247/******************************************************************************/
248
249//______________________________________________________________________________
250void AliEveKinkList::MakeKinks()
251{
252 // Call MakeKink() for all elements.
253
254 for(List_i i=fChildren.begin(); i!=fChildren.end(); ++i) {
255 ((AliEveKink*)(*i))->MakeKink();
256 }
257 gEve->Redraw3D();
258}
259
260/******************************************************************************/
261
262//______________________________________________________________________________
263void AliEveKinkList::FilterByRadius(Float_t minR, Float_t maxR)
264{
265 // Select visibility of elements based on their axial radius.
266
267 fMinRCut = minR;
268 fMaxRCut = maxR;
269
270 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
271 {
272 AliEveKink* kink = (AliEveKink*) *i;
273 Float_t rad = kink->GetKinkRadius();
274 Bool_t show = rad >= fMinRCut && rad <= fMaxRCut;
275 kink->SetRnrState(show);
276 }
277 ElementChanged();
278 gEve->Redraw3D();
279}
280
281/******************************************************************************/
282
283//______________________________________________________________________________
284void AliEveKinkList::FilterByKinkAngle(Float_t minKinkAngle, Float_t maxKinkAngle)
285{
286 // Select visibility of elements based on the kink angle.
287
288 fMinKinkAngle = minKinkAngle;
289 fMaxKinkAngle = maxKinkAngle;
290
291 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
292 {
293 AliEveKink* kink = (AliEveKink*) *i;
294 Float_t angle = TMath::RadToDeg()*kink->GetKinkAngle(2);
295 Bool_t show = angle >= fMinKinkAngle && angle <= fMaxKinkAngle;
296 kink->SetRnrState(show);
297 }
298 ElementChanged();
299 gEve->Redraw3D();
300}
301
302/******************************************************************************/
303
304//______________________________________________________________________________
305void AliEveKinkList::FilterByPt(Float_t minPt, Float_t maxPt)
306{
307 // Select visibility of elements based on the kink pt.
308
309 fMinPt = minPt;
310 fMaxPt = maxPt;
311
312 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
313 {
314 AliEveKink* kink = (AliEveKink*) *i;
315 Float_t pt = kink->GetKinkPMotherPerp();
316 Bool_t show = pt >= fMinPt && pt <= fMaxPt;
317 kink->SetRnrState(show);
318 }
319 ElementChanged();
320 gEve->Redraw3D();
321}
322
323//______________________________________________________________________________
324void AliEveKinkList::FilterByInvariantMass(Float_t minInvariantMass, Float_t maxInvariantMass, Int_t dPdgCode)
325{
326 // Select visibility of elements based on the kink invariant mass.
327
328 fMinInvariantMass = minInvariantMass;
329 fMaxInvariantMass = maxInvariantMass;
330
331 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
332 {
333 AliEveKink* kink = (AliEveKink*) *i;
334 Float_t invMass = kink->GetInvMass(dPdgCode);
335 Bool_t show = invMass >= fMinInvariantMass && invMass <= fMaxInvariantMass;
336 kink->SetRnrState(show);
337 }
338 ElementChanged();
339 gEve->Redraw3D();
340}
341
342//______________________________________________________________________________
343void AliEveKinkList::FilterByCheckedPidMinProb(Int_t rFlag, Int_t rPid, Float_t rProb)
344{
3e3a768d 345 // Select visibility of elements based on the kink daughter PID.
346
347 fDaugCheckedPid = rPid;
348 fDaugCheckedProb = rProb;
4711ad43 349
4711ad43 350 for(List_i i = fChildren.begin(); i != fChildren.end(); ++i)
351 {
352 AliEveKink* kink = (AliEveKink*) *i;
3e3a768d 353 Int_t pid = 0;
354 Float_t prob = 0;
355 Bool_t show = kFALSE;
356
357 pid = kink->GetDaugMaxProbPdg();
358 prob = kink->GetDaugMaxProbPid();
359 show = (pid == fDaugCheckedPid && prob > fDaugCheckedProb) || !rFlag ;
360
4711ad43 361 kink->SetRnrState(show);
362 }
363 ElementChanged();
364 gEve->Redraw3D();
365}