]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliPoints.cxx
New code from Piergiorgio added
[u/mrichter/AliRoot.git] / STEER / AliPoints.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
aee8290b 18Revision 1.4 1999/09/29 09:24:29 fca
19Introduction of the Copyright and cvs Log
20
4c039060 21*/
22
fe4da5cc 23///////////////////////////////////////////////////////////////////////////////
24// //
25// This class contains the points for the ALICE event display //
26// //
27//Begin_Html
28/*
1439f98e 29<img src="picts/AliPointsClass.gif">
fe4da5cc 30*/
31//End_Html
32// //
33// //
34///////////////////////////////////////////////////////////////////////////////
35
36#include "AliPoints.h"
37#include "AliRun.h"
38#include "AliDetector.h"
39#include "TPad.h"
40#include "TView.h"
41
42ClassImp(AliPoints)
43
44//_____________________________________________________________________________
45AliPoints::AliPoints()
46{
47 //
48 // Default constructor
49 //
50 fDetector = 0;
51 fIndex = 0;
52}
53
aee8290b 54//_____________________________________________________________________________
55AliPoints::AliPoints(const AliPoints &pts)
56{
57 //
58 // Copy constructor
59 //
60 pts.Copy(*this);
61}
62
fe4da5cc 63//_____________________________________________________________________________
64AliPoints::AliPoints(Int_t nhits)
65 :TPolyMarker3D(nhits)
66{
67 //
68 // Standard constructor
69 //
70 fDetector = 0;
71 fIndex = 0;
72 ResetBit(kCanDelete);
73}
74
75//_____________________________________________________________________________
76AliPoints::~AliPoints()
77{
78 //
79 // Default constructor
80 //
81 fDetector = 0;
82 fIndex = 0;
83}
84
aee8290b 85//_____________________________________________________________________________
86void AliPoints::Copy(AliPoints &pts) const
87{
88 //
89 // Copy *this onto pts
90 //
91 if(this != &pts) {
92 ((TPolyMarker3D*)this)->Copy((TPolyMarker3D&)pts);
93 pts.fGLList = fGLList;
94 pts.fLastPoint = fLastPoint;
95 pts.fDetector = fDetector;
96 pts.fIndex = fIndex;
97 }
98}
99
100
fe4da5cc 101//_____________________________________________________________________________
102Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
103{
104 //
105 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
106 //*-* =====================================================
107 //*-*
108 //*-* Compute the closest distance of approach from point
109 //*-* px,py to each segment
110 //*-* of the polyline.
111 //*-* Returns when the distance found is below DistanceMaximum.
112 //*-* The distance is computed in pixels units.
113 //*-*
114 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
115
116 //const Int_t inaxis = 7;
117 //Int_t dist = 9999;
118 return TPolyMarker3D::DistancetoPrimitive(px,py);
119}
120
121//_____________________________________________________________________________
122void AliPoints::DumpParticle()
123{
124 //
125 // Dump particle corresponding to this point
126 //
1578254f 127 TParticle *particle = GetParticle();
fe4da5cc 128 if (particle) particle->Dump();
129}
130
131//_____________________________________________________________________________
132void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
133{
134 //
135 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
136 //*-* =========================================
137 //*-*
138 //*-* This member function must be implemented to realize the action
139 //*-* corresponding to the mouse click on the object in the window
140 //*-*
141 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
142
143 gPad->SetCursor(kCross);
144
145 if (gPad->GetView())
146 gPad->GetView()->ExecuteRotateView(event, px, py);
147
148}
149
150//_____________________________________________________________________________
151const Text_t *AliPoints::GetName() const
152{
153 //
154 // Return name of the Geant3 particle corresponding to this point
155 //
1578254f 156 TParticle *particle = GetParticle();
fe4da5cc 157 if (!particle) return "Particle";
158 return particle->GetName();
159}
160
161//_____________________________________________________________________________
162Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
163{
164 //
165 // Redefines TObject::GetObjectInfo.
166 // Displays the info (particle,etc
167 // corresponding to cursor position px,py
168 //
169 static char info[64];
170 sprintf(info,"%s %d",GetName(),fIndex);
171 return info;
172}
173
174//_____________________________________________________________________________
1578254f 175TParticle *AliPoints::GetParticle() const
fe4da5cc 176{
177 //
178 // Returns pointer to particle index in AliRun::fParticles
179 //
180 TClonesArray *particles = gAlice->Particles();
181 Int_t nparticles = particles->GetEntriesFast();
182 if (fIndex < 0 || fIndex >= nparticles) return 0;
1578254f 183 return (TParticle*)particles->UncheckedAt(fIndex);
fe4da5cc 184}
185
186//_____________________________________________________________________________
187void AliPoints::InspectParticle()
188{
189 //
190 // Inspect particle corresponding to this point
191 //
1578254f 192 TParticle *particle = GetParticle();
fe4da5cc 193 if (particle) particle->Inspect();
194}
195
aee8290b 196//_____________________________________________________________________________
197AliPoints & AliPoints::operator=(const AliPoints &pts)
198{
199 //
200 // Assignment operator
201 //
202 pts.Copy(*this);
203 return (*this);
204}
205
fe4da5cc 206//_____________________________________________________________________________
207void AliPoints::Propagate()
208{
209 //
210 // Set attributes of all detectors to be the attributes of this point
211 //
212 Int_t ntracks,track;
213 TObjArray *points;
214 AliPoints *pm;
215 //
216 TIter next(gAlice->Detectors());
217 AliDetector *detector;
218 while((detector = (AliDetector*)next())) {
219 if (!detector->IsActive()) continue;
220 points = detector->Points();
221 if (!points) continue;
222 ntracks = points->GetEntriesFast();
223 for (track=0;track<ntracks;track++) {
224 pm = (AliPoints*)points->UncheckedAt(track);
225 if (!pm) continue;
226 if (fIndex == pm->GetIndex()) {
227 pm->SetMarkerColor(GetMarkerColor());
228 pm->SetMarkerSize(GetMarkerSize());
229 pm->SetMarkerStyle(GetMarkerStyle());
230 }
231 }
232 }
233}