1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.4 1999/09/29 09:24:29 fca
19 Introduction of the Copyright and cvs Log
23 ///////////////////////////////////////////////////////////////////////////////
25 // This class contains the points for the ALICE event display //
29 <img src="picts/AliPointsClass.gif">
34 ///////////////////////////////////////////////////////////////////////////////
36 #include "AliPoints.h"
38 #include "AliDetector.h"
44 //_____________________________________________________________________________
45 AliPoints::AliPoints()
48 // Default constructor
54 //_____________________________________________________________________________
55 AliPoints::AliPoints(const AliPoints &pts)
63 //_____________________________________________________________________________
64 AliPoints::AliPoints(Int_t nhits)
68 // Standard constructor
75 //_____________________________________________________________________________
76 AliPoints::~AliPoints()
79 // Default constructor
85 //_____________________________________________________________________________
86 void AliPoints::Copy(AliPoints &pts) const
89 // Copy *this onto pts
92 ((TPolyMarker3D*)this)->Copy((TPolyMarker3D&)pts);
93 pts.fGLList = fGLList;
94 pts.fLastPoint = fLastPoint;
95 pts.fDetector = fDetector;
101 //_____________________________________________________________________________
102 Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
105 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
106 //*-* =====================================================
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.
114 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
116 //const Int_t inaxis = 7;
118 return TPolyMarker3D::DistancetoPrimitive(px,py);
121 //_____________________________________________________________________________
122 void AliPoints::DumpParticle()
125 // Dump particle corresponding to this point
127 TParticle *particle = GetParticle();
128 if (particle) particle->Dump();
131 //_____________________________________________________________________________
132 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
135 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
136 //*-* =========================================
138 //*-* This member function must be implemented to realize the action
139 //*-* corresponding to the mouse click on the object in the window
141 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
143 gPad->SetCursor(kCross);
146 gPad->GetView()->ExecuteRotateView(event, px, py);
150 //_____________________________________________________________________________
151 const Text_t *AliPoints::GetName() const
154 // Return name of the Geant3 particle corresponding to this point
156 TParticle *particle = GetParticle();
157 if (!particle) return "Particle";
158 return particle->GetName();
161 //_____________________________________________________________________________
162 Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
165 // Redefines TObject::GetObjectInfo.
166 // Displays the info (particle,etc
167 // corresponding to cursor position px,py
169 static char info[64];
170 sprintf(info,"%s %d",GetName(),fIndex);
174 //_____________________________________________________________________________
175 TParticle *AliPoints::GetParticle() const
178 // Returns pointer to particle index in AliRun::fParticles
180 TClonesArray *particles = gAlice->Particles();
181 Int_t nparticles = particles->GetEntriesFast();
182 if (fIndex < 0 || fIndex >= nparticles) return 0;
183 return (TParticle*)particles->UncheckedAt(fIndex);
186 //_____________________________________________________________________________
187 void AliPoints::InspectParticle()
190 // Inspect particle corresponding to this point
192 TParticle *particle = GetParticle();
193 if (particle) particle->Inspect();
196 //_____________________________________________________________________________
197 AliPoints & AliPoints::operator=(const AliPoints &pts)
200 // Assignment operator
206 //_____________________________________________________________________________
207 void AliPoints::Propagate()
210 // Set attributes of all detectors to be the attributes of this point
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);
226 if (fIndex == pm->GetIndex()) {
227 pm->SetMarkerColor(GetMarkerColor());
228 pm->SetMarkerSize(GetMarkerSize());
229 pm->SetMarkerStyle(GetMarkerStyle());