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"
37 #include "AliPoints.h"
42 //_______________________________________________________________________
43 AliPoints::AliPoints():
48 // Default constructor
52 //_______________________________________________________________________
53 AliPoints::AliPoints(const AliPoints &pts):
64 //_______________________________________________________________________
65 AliPoints::AliPoints(Int_t nhits):
71 // Standard constructor
76 //_______________________________________________________________________
77 AliPoints::~AliPoints()
84 //_______________________________________________________________________
85 void AliPoints::Copy(TObject &pts) const
88 // Copy *this onto pts
90 if((TObject*)this != &pts) {
91 ((TPolyMarker3D*)this)->Copy(dynamic_cast<TPolyMarker3D&>(pts));
92 (dynamic_cast<AliPoints&>(pts)).fGLList = fGLList;
93 (dynamic_cast<AliPoints&>(pts)).fLastPoint = fLastPoint;
94 (dynamic_cast<AliPoints&>(pts)).fDetector = fDetector;
95 (dynamic_cast<AliPoints&>(pts)).fIndex = fIndex;
99 //_______________________________________________________________________
100 Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
103 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
104 //*-* =====================================================
106 //*-* Compute the closest distance of approach from point
107 //*-* px,py to each segment
108 //*-* of the polyline.
109 //*-* Returns when the distance found is below DistanceMaximum.
110 //*-* The distance is computed in pixels units.
112 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
114 //const Int_t inaxis = 7;
116 return TPolyMarker3D::DistancetoPrimitive(px,py);
119 //_______________________________________________________________________
120 void AliPoints::DumpParticle() const
123 // Dump particle corresponding to this point
125 TParticle *particle = GetParticle();
126 if (particle) particle->Dump();
129 //_______________________________________________________________________
130 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
133 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
134 //*-* =========================================
136 //*-* This member function must be implemented to realize the action
137 //*-* corresponding to the mouse click on the object in the window
139 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
141 gPad->SetCursor(kCross);
144 gPad->GetView()->ExecuteRotateView(event, px, py);
148 //_______________________________________________________________________
149 const Text_t *AliPoints::GetName() const
152 // Return name of the Geant3 particle corresponding to this point
154 TParticle *particle = GetParticle();
155 if (!particle) return "Particle";
156 return particle->GetName();
159 //_______________________________________________________________________
160 Text_t *AliPoints::GetObjectInfo(Int_t, Int_t) const
163 // Redefines TObject::GetObjectInfo.
164 // Displays the info (particle,etc
165 // corresponding to cursor position px,py
167 static char info[64];
168 sprintf(info,"%s %d",GetName(),fIndex);
172 //_______________________________________________________________________
173 TParticle *AliPoints::GetParticle() const
176 // Returns pointer to particle index in AliRun::fParticles
178 if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0;
179 else return gAlice->GetMCApp()->Particle(fIndex);
182 //_______________________________________________________________________
183 void AliPoints::InspectParticle() const
186 // Inspect particle corresponding to this point
188 TParticle *particle = GetParticle();
189 if (particle) particle->Inspect();
192 //_______________________________________________________________________
193 void AliPoints::Propagate()
196 // Set attributes of all detectors to be the attributes of this point
202 TIter next(gAlice->Detectors());
203 AliDetector *detector;
204 while((detector = (AliDetector*)(next()))) {
205 if (!detector->IsActive()) continue;
206 points = detector->Points();
207 if (!points) continue;
208 ntracks = points->GetEntriesFast();
209 for (track=0;track<ntracks;track++) {
210 pm = dynamic_cast<AliPoints*>(points->UncheckedAt(track));
212 if (fIndex == pm->GetIndex()) {
213 pm->SetMarkerColor(GetMarkerColor());
214 pm->SetMarkerSize(GetMarkerSize());
215 pm->SetMarkerStyle(GetMarkerStyle());