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 ///////////////////////////////////////////////////////////////////////////////
20 // This class contains the points for the ALICE event display //
24 <img src="picts/AliPointsClass.gif">
29 ///////////////////////////////////////////////////////////////////////////////
32 #include "TParticle.h"
35 #include "AliDetector.h"
36 #include "AliPoints.h"
41 //_______________________________________________________________________
42 AliPoints::AliPoints():
47 // Default constructor
51 //_______________________________________________________________________
52 AliPoints::AliPoints(const AliPoints &pts):
63 //_______________________________________________________________________
64 AliPoints::AliPoints(Int_t nhits):
70 // Standard constructor
75 //_______________________________________________________________________
76 AliPoints::~AliPoints()
83 //_______________________________________________________________________
84 void AliPoints::Copy(AliPoints &pts) const
87 // Copy *this onto pts
90 ((TPolyMarker3D*)this)->Copy(dynamic_cast<TPolyMarker3D&>(pts));
91 pts.fGLList = fGLList;
92 pts.fLastPoint = fLastPoint;
93 pts.fDetector = fDetector;
98 //_______________________________________________________________________
99 Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
102 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
103 //*-* =====================================================
105 //*-* Compute the closest distance of approach from point
106 //*-* px,py to each segment
107 //*-* of the polyline.
108 //*-* Returns when the distance found is below DistanceMaximum.
109 //*-* The distance is computed in pixels units.
111 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
113 //const Int_t inaxis = 7;
115 return TPolyMarker3D::DistancetoPrimitive(px,py);
118 //_______________________________________________________________________
119 void AliPoints::DumpParticle() const
122 // Dump particle corresponding to this point
124 TParticle *particle = GetParticle();
125 if (particle) particle->Dump();
128 //_______________________________________________________________________
129 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
132 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
133 //*-* =========================================
135 //*-* This member function must be implemented to realize the action
136 //*-* corresponding to the mouse click on the object in the window
138 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
140 gPad->SetCursor(kCross);
143 gPad->GetView()->ExecuteRotateView(event, px, py);
147 //_______________________________________________________________________
148 const Text_t *AliPoints::GetName() const
151 // Return name of the Geant3 particle corresponding to this point
153 TParticle *particle = GetParticle();
154 if (!particle) return "Particle";
155 return particle->GetName();
158 //_______________________________________________________________________
159 Text_t *AliPoints::GetObjectInfo(Int_t, Int_t) const
162 // Redefines TObject::GetObjectInfo.
163 // Displays the info (particle,etc
164 // corresponding to cursor position px,py
166 static char info[64];
167 sprintf(info,"%s %d",GetName(),fIndex);
171 //_______________________________________________________________________
172 TParticle *AliPoints::GetParticle() const
175 // Returns pointer to particle index in AliRun::fParticles
177 if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0;
178 else return gAlice->Particle(fIndex);
181 //_______________________________________________________________________
182 void AliPoints::InspectParticle() const
185 // Inspect particle corresponding to this point
187 TParticle *particle = GetParticle();
188 if (particle) particle->Inspect();
191 //_______________________________________________________________________
192 void AliPoints::Propagate()
195 // Set attributes of all detectors to be the attributes of this point
201 TIter next(gAlice->Detectors());
202 AliDetector *detector;
203 while((detector = dynamic_cast<AliDetector*>(next()))) {
204 if (!detector->IsActive()) continue;
205 points = detector->Points();
206 if (!points) continue;
207 ntracks = points->GetEntriesFast();
208 for (track=0;track<ntracks;track++) {
209 pm = dynamic_cast<AliPoints*>(points->UncheckedAt(track));
211 if (fIndex == pm->GetIndex()) {
212 pm->SetMarkerColor(GetMarkerColor());
213 pm->SetMarkerSize(GetMarkerSize());
214 pm->SetMarkerStyle(GetMarkerStyle());