]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliPoints.cxx
Introducing Copyright include file
[u/mrichter/AliRoot.git] / STEER / AliPoints.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// This class contains the points for the ALICE event display //
4// //
5//Begin_Html
6/*
1439f98e 7<img src="picts/AliPointsClass.gif">
fe4da5cc 8*/
9//End_Html
10// //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#include "AliPoints.h"
15#include "AliRun.h"
16#include "AliDetector.h"
17#include "TPad.h"
18#include "TView.h"
19
20ClassImp(AliPoints)
21
22//_____________________________________________________________________________
23AliPoints::AliPoints()
24{
25 //
26 // Default constructor
27 //
28 fDetector = 0;
29 fIndex = 0;
30}
31
32//_____________________________________________________________________________
33AliPoints::AliPoints(Int_t nhits)
34 :TPolyMarker3D(nhits)
35{
36 //
37 // Standard constructor
38 //
39 fDetector = 0;
40 fIndex = 0;
41 ResetBit(kCanDelete);
42}
43
44//_____________________________________________________________________________
45AliPoints::~AliPoints()
46{
47 //
48 // Default constructor
49 //
50 fDetector = 0;
51 fIndex = 0;
52}
53
54//_____________________________________________________________________________
55Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
56{
57 //
58 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
59 //*-* =====================================================
60 //*-*
61 //*-* Compute the closest distance of approach from point
62 //*-* px,py to each segment
63 //*-* of the polyline.
64 //*-* Returns when the distance found is below DistanceMaximum.
65 //*-* The distance is computed in pixels units.
66 //*-*
67 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
68
69 //const Int_t inaxis = 7;
70 //Int_t dist = 9999;
71 return TPolyMarker3D::DistancetoPrimitive(px,py);
72}
73
74//_____________________________________________________________________________
75void AliPoints::DumpParticle()
76{
77 //
78 // Dump particle corresponding to this point
79 //
1578254f 80 TParticle *particle = GetParticle();
fe4da5cc 81 if (particle) particle->Dump();
82}
83
84//_____________________________________________________________________________
85void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
86{
87 //
88 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
89 //*-* =========================================
90 //*-*
91 //*-* This member function must be implemented to realize the action
92 //*-* corresponding to the mouse click on the object in the window
93 //*-*
94 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
95
96 gPad->SetCursor(kCross);
97
98 if (gPad->GetView())
99 gPad->GetView()->ExecuteRotateView(event, px, py);
100
101}
102
103//_____________________________________________________________________________
104const Text_t *AliPoints::GetName() const
105{
106 //
107 // Return name of the Geant3 particle corresponding to this point
108 //
1578254f 109 TParticle *particle = GetParticle();
fe4da5cc 110 if (!particle) return "Particle";
111 return particle->GetName();
112}
113
114//_____________________________________________________________________________
115Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
116{
117 //
118 // Redefines TObject::GetObjectInfo.
119 // Displays the info (particle,etc
120 // corresponding to cursor position px,py
121 //
122 static char info[64];
123 sprintf(info,"%s %d",GetName(),fIndex);
124 return info;
125}
126
127//_____________________________________________________________________________
1578254f 128TParticle *AliPoints::GetParticle() const
fe4da5cc 129{
130 //
131 // Returns pointer to particle index in AliRun::fParticles
132 //
133 TClonesArray *particles = gAlice->Particles();
134 Int_t nparticles = particles->GetEntriesFast();
135 if (fIndex < 0 || fIndex >= nparticles) return 0;
1578254f 136 return (TParticle*)particles->UncheckedAt(fIndex);
fe4da5cc 137}
138
139//_____________________________________________________________________________
140void AliPoints::InspectParticle()
141{
142 //
143 // Inspect particle corresponding to this point
144 //
1578254f 145 TParticle *particle = GetParticle();
fe4da5cc 146 if (particle) particle->Inspect();
147}
148
149//_____________________________________________________________________________
150void AliPoints::Propagate()
151{
152 //
153 // Set attributes of all detectors to be the attributes of this point
154 //
155 Int_t ntracks,track;
156 TObjArray *points;
157 AliPoints *pm;
158 //
159 TIter next(gAlice->Detectors());
160 AliDetector *detector;
161 while((detector = (AliDetector*)next())) {
162 if (!detector->IsActive()) continue;
163 points = detector->Points();
164 if (!points) continue;
165 ntracks = points->GetEntriesFast();
166 for (track=0;track<ntracks;track++) {
167 pm = (AliPoints*)points->UncheckedAt(track);
168 if (!pm) continue;
169 if (fIndex == pm->GetIndex()) {
170 pm->SetMarkerColor(GetMarkerColor());
171 pm->SetMarkerSize(GetMarkerSize());
172 pm->SetMarkerStyle(GetMarkerStyle());
173 }
174 }
175 }
176}