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.6 2000/10/02 21:28:14 fca
19 Removal of useless dependecies via forward declarations
21 Revision 1.5 2000/07/11 18:24:59 fca
22 Coding convention corrections + few minor bug fixes
24 Revision 1.4 1999/09/29 09:24:29 fca
25 Introduction of the Copyright and cvs Log
29 ///////////////////////////////////////////////////////////////////////////////
31 // This class contains the points for the ALICE event display //
35 <img src="picts/AliPointsClass.gif">
40 ///////////////////////////////////////////////////////////////////////////////
42 #include "AliPoints.h"
44 #include "AliDetector.h"
47 #include "TParticle.h"
51 //_____________________________________________________________________________
52 AliPoints::AliPoints()
55 // Default constructor
61 //_____________________________________________________________________________
62 AliPoints::AliPoints(const AliPoints &pts)
70 //_____________________________________________________________________________
71 AliPoints::AliPoints(Int_t nhits)
75 // Standard constructor
82 //_____________________________________________________________________________
83 AliPoints::~AliPoints()
86 // Default constructor
92 //_____________________________________________________________________________
93 void AliPoints::Copy(AliPoints &pts) const
96 // Copy *this onto pts
99 ((TPolyMarker3D*)this)->Copy((TPolyMarker3D&)pts);
100 pts.fGLList = fGLList;
101 pts.fLastPoint = fLastPoint;
102 pts.fDetector = fDetector;
108 //_____________________________________________________________________________
109 Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
112 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
113 //*-* =====================================================
115 //*-* Compute the closest distance of approach from point
116 //*-* px,py to each segment
117 //*-* of the polyline.
118 //*-* Returns when the distance found is below DistanceMaximum.
119 //*-* The distance is computed in pixels units.
121 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
123 //const Int_t inaxis = 7;
125 return TPolyMarker3D::DistancetoPrimitive(px,py);
128 //_____________________________________________________________________________
129 void AliPoints::DumpParticle()
132 // Dump particle corresponding to this point
134 TParticle *particle = GetParticle();
135 if (particle) particle->Dump();
138 //_____________________________________________________________________________
139 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
142 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
143 //*-* =========================================
145 //*-* This member function must be implemented to realize the action
146 //*-* corresponding to the mouse click on the object in the window
148 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
150 gPad->SetCursor(kCross);
153 gPad->GetView()->ExecuteRotateView(event, px, py);
157 //_____________________________________________________________________________
158 const Text_t *AliPoints::GetName() const
161 // Return name of the Geant3 particle corresponding to this point
163 TParticle *particle = GetParticle();
164 if (!particle) return "Particle";
165 return particle->GetName();
168 //_____________________________________________________________________________
169 Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
172 // Redefines TObject::GetObjectInfo.
173 // Displays the info (particle,etc
174 // corresponding to cursor position px,py
176 static char info[64];
177 sprintf(info,"%s %d",GetName(),fIndex);
181 //_____________________________________________________________________________
182 TParticle *AliPoints::GetParticle() const
185 // Returns pointer to particle index in AliRun::fParticles
187 if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0;
188 else return gAlice->Particle(fIndex);
191 //_____________________________________________________________________________
192 void AliPoints::InspectParticle()
195 // Inspect particle corresponding to this point
197 TParticle *particle = GetParticle();
198 if (particle) particle->Inspect();
201 //_____________________________________________________________________________
202 AliPoints & AliPoints::operator=(const AliPoints &pts)
205 // Assignment operator
211 //_____________________________________________________________________________
212 void AliPoints::Propagate()
215 // Set attributes of all detectors to be the attributes of this point
221 TIter next(gAlice->Detectors());
222 AliDetector *detector;
223 while((detector = (AliDetector*)next())) {
224 if (!detector->IsActive()) continue;
225 points = detector->Points();
226 if (!points) continue;
227 ntracks = points->GetEntriesFast();
228 for (track=0;track<ntracks;track++) {
229 pm = (AliPoints*)points->UncheckedAt(track);
231 if (fIndex == pm->GetIndex()) {
232 pm->SetMarkerColor(GetMarkerColor());
233 pm->SetMarkerSize(GetMarkerSize());
234 pm->SetMarkerStyle(GetMarkerStyle());