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 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // This class contains the points for the ALICE event display //
26 <img src="picts/AliPointsClass.gif">
31 ///////////////////////////////////////////////////////////////////////////////
33 #include "AliPoints.h"
35 #include "AliDetector.h"
41 //_____________________________________________________________________________
42 AliPoints::AliPoints()
45 // Default constructor
51 //_____________________________________________________________________________
52 AliPoints::AliPoints(Int_t nhits)
56 // Standard constructor
63 //_____________________________________________________________________________
64 AliPoints::~AliPoints()
67 // Default constructor
73 //_____________________________________________________________________________
74 Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
77 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
78 //*-* =====================================================
80 //*-* Compute the closest distance of approach from point
81 //*-* px,py to each segment
82 //*-* of the polyline.
83 //*-* Returns when the distance found is below DistanceMaximum.
84 //*-* The distance is computed in pixels units.
86 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
88 //const Int_t inaxis = 7;
90 return TPolyMarker3D::DistancetoPrimitive(px,py);
93 //_____________________________________________________________________________
94 void AliPoints::DumpParticle()
97 // Dump particle corresponding to this point
99 TParticle *particle = GetParticle();
100 if (particle) particle->Dump();
103 //_____________________________________________________________________________
104 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
107 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
108 //*-* =========================================
110 //*-* This member function must be implemented to realize the action
111 //*-* corresponding to the mouse click on the object in the window
113 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
115 gPad->SetCursor(kCross);
118 gPad->GetView()->ExecuteRotateView(event, px, py);
122 //_____________________________________________________________________________
123 const Text_t *AliPoints::GetName() const
126 // Return name of the Geant3 particle corresponding to this point
128 TParticle *particle = GetParticle();
129 if (!particle) return "Particle";
130 return particle->GetName();
133 //_____________________________________________________________________________
134 Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
137 // Redefines TObject::GetObjectInfo.
138 // Displays the info (particle,etc
139 // corresponding to cursor position px,py
141 static char info[64];
142 sprintf(info,"%s %d",GetName(),fIndex);
146 //_____________________________________________________________________________
147 TParticle *AliPoints::GetParticle() const
150 // Returns pointer to particle index in AliRun::fParticles
152 TClonesArray *particles = gAlice->Particles();
153 Int_t nparticles = particles->GetEntriesFast();
154 if (fIndex < 0 || fIndex >= nparticles) return 0;
155 return (TParticle*)particles->UncheckedAt(fIndex);
158 //_____________________________________________________________________________
159 void AliPoints::InspectParticle()
162 // Inspect particle corresponding to this point
164 TParticle *particle = GetParticle();
165 if (particle) particle->Inspect();
168 //_____________________________________________________________________________
169 void AliPoints::Propagate()
172 // Set attributes of all detectors to be the attributes of this point
178 TIter next(gAlice->Detectors());
179 AliDetector *detector;
180 while((detector = (AliDetector*)next())) {
181 if (!detector->IsActive()) continue;
182 points = detector->Points();
183 if (!points) continue;
184 ntracks = points->GetEntriesFast();
185 for (track=0;track<ntracks;track++) {
186 pm = (AliPoints*)points->UncheckedAt(track);
188 if (fIndex == pm->GetIndex()) {
189 pm->SetMarkerColor(GetMarkerColor());
190 pm->SetMarkerSize(GetMarkerSize());
191 pm->SetMarkerStyle(GetMarkerStyle());