]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliPoints.cxx
New ITS detailed geometry to be used for the PPR. Only sensitive volumes added for...
[u/mrichter/AliRoot.git] / STEER / AliPoints.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
94de3818 18Revision 1.5 2000/07/11 18:24:59 fca
19Coding convention corrections + few minor bug fixes
20
aee8290b 21Revision 1.4 1999/09/29 09:24:29 fca
22Introduction of the Copyright and cvs Log
23
4c039060 24*/
25
fe4da5cc 26///////////////////////////////////////////////////////////////////////////////
27// //
28// This class contains the points for the ALICE event display //
29// //
30//Begin_Html
31/*
1439f98e 32<img src="picts/AliPointsClass.gif">
fe4da5cc 33*/
34//End_Html
35// //
36// //
37///////////////////////////////////////////////////////////////////////////////
38
39#include "AliPoints.h"
40#include "AliRun.h"
41#include "AliDetector.h"
42#include "TPad.h"
43#include "TView.h"
94de3818 44#include "TParticle.h"
fe4da5cc 45
46ClassImp(AliPoints)
47
48//_____________________________________________________________________________
49AliPoints::AliPoints()
50{
51 //
52 // Default constructor
53 //
54 fDetector = 0;
55 fIndex = 0;
56}
57
aee8290b 58//_____________________________________________________________________________
59AliPoints::AliPoints(const AliPoints &pts)
60{
61 //
62 // Copy constructor
63 //
64 pts.Copy(*this);
65}
66
fe4da5cc 67//_____________________________________________________________________________
68AliPoints::AliPoints(Int_t nhits)
69 :TPolyMarker3D(nhits)
70{
71 //
72 // Standard constructor
73 //
74 fDetector = 0;
75 fIndex = 0;
76 ResetBit(kCanDelete);
77}
78
79//_____________________________________________________________________________
80AliPoints::~AliPoints()
81{
82 //
83 // Default constructor
84 //
85 fDetector = 0;
86 fIndex = 0;
87}
88
aee8290b 89//_____________________________________________________________________________
90void AliPoints::Copy(AliPoints &pts) const
91{
92 //
93 // Copy *this onto pts
94 //
95 if(this != &pts) {
96 ((TPolyMarker3D*)this)->Copy((TPolyMarker3D&)pts);
97 pts.fGLList = fGLList;
98 pts.fLastPoint = fLastPoint;
99 pts.fDetector = fDetector;
100 pts.fIndex = fIndex;
101 }
102}
103
104
fe4da5cc 105//_____________________________________________________________________________
106Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
107{
108 //
109 //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
110 //*-* =====================================================
111 //*-*
112 //*-* Compute the closest distance of approach from point
113 //*-* px,py to each segment
114 //*-* of the polyline.
115 //*-* Returns when the distance found is below DistanceMaximum.
116 //*-* The distance is computed in pixels units.
117 //*-*
118 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
119
120 //const Int_t inaxis = 7;
121 //Int_t dist = 9999;
122 return TPolyMarker3D::DistancetoPrimitive(px,py);
123}
124
125//_____________________________________________________________________________
126void AliPoints::DumpParticle()
127{
128 //
129 // Dump particle corresponding to this point
130 //
1578254f 131 TParticle *particle = GetParticle();
fe4da5cc 132 if (particle) particle->Dump();
133}
134
135//_____________________________________________________________________________
136void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
137{
138 //
139 //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
140 //*-* =========================================
141 //*-*
142 //*-* This member function must be implemented to realize the action
143 //*-* corresponding to the mouse click on the object in the window
144 //*-*
145 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
146
147 gPad->SetCursor(kCross);
148
149 if (gPad->GetView())
150 gPad->GetView()->ExecuteRotateView(event, px, py);
151
152}
153
154//_____________________________________________________________________________
155const Text_t *AliPoints::GetName() const
156{
157 //
158 // Return name of the Geant3 particle corresponding to this point
159 //
1578254f 160 TParticle *particle = GetParticle();
fe4da5cc 161 if (!particle) return "Particle";
162 return particle->GetName();
163}
164
165//_____________________________________________________________________________
166Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
167{
168 //
169 // Redefines TObject::GetObjectInfo.
170 // Displays the info (particle,etc
171 // corresponding to cursor position px,py
172 //
173 static char info[64];
174 sprintf(info,"%s %d",GetName(),fIndex);
175 return info;
176}
177
178//_____________________________________________________________________________
1578254f 179TParticle *AliPoints::GetParticle() const
fe4da5cc 180{
181 //
182 // Returns pointer to particle index in AliRun::fParticles
183 //
184 TClonesArray *particles = gAlice->Particles();
185 Int_t nparticles = particles->GetEntriesFast();
186 if (fIndex < 0 || fIndex >= nparticles) return 0;
1578254f 187 return (TParticle*)particles->UncheckedAt(fIndex);
fe4da5cc 188}
189
190//_____________________________________________________________________________
191void AliPoints::InspectParticle()
192{
193 //
194 // Inspect particle corresponding to this point
195 //
1578254f 196 TParticle *particle = GetParticle();
fe4da5cc 197 if (particle) particle->Inspect();
198}
199
aee8290b 200//_____________________________________________________________________________
201AliPoints & AliPoints::operator=(const AliPoints &pts)
202{
203 //
204 // Assignment operator
205 //
206 pts.Copy(*this);
207 return (*this);
208}
209
fe4da5cc 210//_____________________________________________________________________________
211void AliPoints::Propagate()
212{
213 //
214 // Set attributes of all detectors to be the attributes of this point
215 //
216 Int_t ntracks,track;
217 TObjArray *points;
218 AliPoints *pm;
219 //
220 TIter next(gAlice->Detectors());
221 AliDetector *detector;
222 while((detector = (AliDetector*)next())) {
223 if (!detector->IsActive()) continue;
224 points = detector->Points();
225 if (!points) continue;
226 ntracks = points->GetEntriesFast();
227 for (track=0;track<ntracks;track++) {
228 pm = (AliPoints*)points->UncheckedAt(track);
229 if (!pm) continue;
230 if (fIndex == pm->GetIndex()) {
231 pm->SetMarkerColor(GetMarkerColor());
232 pm->SetMarkerSize(GetMarkerSize());
233 pm->SetMarkerStyle(GetMarkerStyle());
234 }
235 }
236 }
237}