Add method:
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveTracklet.cxx
CommitLineData
3a20f984 1// $Id$
2// Author: Matevz Tadel 2009
3
4/**************************************************************************
5 * Copyright(c) 1998-2009, 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 "AliEveTracklet.h"
11
12#include <AliVVertex.h>
13#include <TEveTrackPropagator.h>
14
15//______________________________________________________________________________
16// AliEveTracklet is a representation of SPD tracklet.
17// It inherits from AliEveTrack to allow for common functionality
18// regarding track counting.
19//
20// TEveTrack::fV - stores primary vertex.
21// TEveTrack::fP - stores vector in direction of the tracklet with
22// transverse component equal to 1.
23
24ClassImp(AliEveTracklet)
25
26Float_t AliEveTracklet::fgDefaultRadius = 10;
27
28//______________________________________________________________________________
29Float_t AliEveTracklet::GetDefaultRadius()
30{
31 // Static - return defualt extrapolation radius.
32
33 return fgDefaultRadius;
34}
35
36//______________________________________________________________________________
37void AliEveTracklet::SetDefaultRadius(Float_t r)
38{
39 // Static - set defualt extrapolation radius.
40
41 fgDefaultRadius = r;
42}
43
44//==============================================================================
45
46//______________________________________________________________________________
bccc8088 47AliEveTracklet::AliEveTracklet(Int_t index, const AliVVertex* pv, Float_t theta, Float_t phi,
3a20f984 48 TEveTrackPropagator* prop) :
49 AliEveTrack()
50{
51 // Constructor.
52
bccc8088 53 fIndex = index;
3a20f984 54 fV.Set(pv->GetX(), pv->GetY(), pv->GetZ());
bccc8088 55 fP.Set(TMath::Cos(phi), TMath::Sin(phi), 1.0/TMath::Tan(theta));
3a20f984 56
57 if (prop) SetPropagator(prop);
58}
59
60//==============================================================================
61
62//______________________________________________________________________________
63void AliEveTracklet::MakeTrack(Bool_t recurse)
64{
65 // Make track -- just make a line to radius specified in propagator
66 // or use the default if it is not set.
67
68 Float_t r = fPropagator ? fPropagator->GetMaxR() : fgDefaultRadius;
69 Reset(2);
70 SetPoint(0, fV.fX, fV.fY, fV.fZ);
71 SetPoint(1, fV.fX + r*fP.fX, fV.fY + r*fP.fY, fV.fZ + r*fP.fZ);
72
73 if (recurse)
74 {
75 for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
76 {
77 TEveTrack* t = dynamic_cast<TEveTrack*>(*i);
78 if (t) t->MakeTrack(recurse);
79 }
80 }
81}
82
83//______________________________________________________________________________
84void AliEveTracklet::SecSelected(TEveTrack* track)
85{
86 // Emits "SecSelected(TEveTrack*)" signal.
87 // Called from TEveTrackGL on secondary-selection.
88
89 Emit("SecSelected(TEveTrack*)", (Long_t)track);
90 SecSelectedTracklet((AliEveTracklet*) track);
91}
92
93//______________________________________________________________________________
94void AliEveTracklet::SecSelectedTracklet(AliEveTracklet* track)
95{
96 // Emits "SecSelectedTracklet(AliEveTracklet*)" signal.
97
98 Emit("SecSelectedTracklet(AliEveTracklet*)", (Long_t)track);
99}