]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliPoints.cxx
Default is no shunting.
[u/mrichter/AliRoot.git] / STEER / AliPoints.cxx
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$
18 Revision 1.6  2000/10/02 21:28:14  fca
19 Removal of useless dependecies via forward declarations
20
21 Revision 1.5  2000/07/11 18:24:59  fca
22 Coding convention corrections + few minor bug fixes
23
24 Revision 1.4  1999/09/29 09:24:29  fca
25 Introduction of the Copyright and cvs Log
26
27 */
28
29 ///////////////////////////////////////////////////////////////////////////////
30 //                                                                           //
31 //  This class contains the points for the ALICE event display               //
32 //                                                                           //
33 //Begin_Html
34 /*
35 <img src="picts/AliPointsClass.gif">
36 */
37 //End_Html
38 //                                                                           //
39 //                                                                           //
40 ///////////////////////////////////////////////////////////////////////////////
41
42 #include "AliPoints.h"
43 #include "AliRun.h"
44 #include "AliDetector.h"
45 #include "TPad.h"
46 #include "TView.h"
47 #include "TParticle.h"
48  
49 ClassImp(AliPoints)
50
51 //_____________________________________________________________________________
52 AliPoints::AliPoints()
53 {
54   //
55   // Default constructor
56   //
57   fDetector = 0;        
58   fIndex    = 0;
59 }
60
61 //_____________________________________________________________________________
62 AliPoints::AliPoints(const AliPoints &pts)
63 {
64   //
65   // Copy constructor
66   //
67   pts.Copy(*this);
68 }
69
70 //_____________________________________________________________________________
71 AliPoints::AliPoints(Int_t nhits)
72   :TPolyMarker3D(nhits)
73 {
74   //
75   // Standard constructor
76   //
77   fDetector = 0;        
78   fIndex    = 0;
79   ResetBit(kCanDelete);
80 }
81          
82 //_____________________________________________________________________________
83 AliPoints::~AliPoints()
84 {
85   //
86   // Default constructor
87   //
88   fDetector = 0;        
89   fIndex    = 0;
90 }
91
92 //_____________________________________________________________________________
93 void AliPoints::Copy(AliPoints &pts) const
94 {
95   //
96   // Copy *this onto pts
97   //
98   if(this != &pts) {
99     ((TPolyMarker3D*)this)->Copy((TPolyMarker3D&)pts);
100     pts.fGLList = fGLList;
101     pts.fLastPoint = fLastPoint;
102     pts.fDetector = fDetector;
103     pts.fIndex = fIndex;
104   }
105 }
106
107
108 //_____________________________________________________________________________
109 Int_t AliPoints::DistancetoPrimitive(Int_t px, Int_t py)
110 {
111   //
112   //*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
113   //*-*          =====================================================
114   //*-*
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.
120   //*-*
121   //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
122
123   //const Int_t inaxis = 7;
124   //Int_t dist = 9999;
125   return TPolyMarker3D::DistancetoPrimitive(px,py);
126 }
127
128 //_____________________________________________________________________________
129 void AliPoints::DumpParticle()
130 {
131   //
132   //   Dump particle corresponding to this point
133   //
134   TParticle *particle = GetParticle();
135   if (particle) particle->Dump();
136 }
137
138 //_____________________________________________________________________________
139 void AliPoints::ExecuteEvent(Int_t event, Int_t px, Int_t py)
140 {
141   //
142   //*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
143   //*-*                =========================================
144   //*-*
145   //*-*  This member function must be implemented to realize the action
146   //*-*  corresponding to the mouse click on the object in the window
147   //*-*
148   //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
149
150   gPad->SetCursor(kCross);
151   
152   if (gPad->GetView())
153     gPad->GetView()->ExecuteRotateView(event, px, py);
154
155 }
156
157 //_____________________________________________________________________________
158 const Text_t *AliPoints::GetName() const
159 {
160   //
161   // Return name of the Geant3 particle corresponding to this point
162   //
163   TParticle *particle = GetParticle();
164   if (!particle) return "Particle";
165   return particle->GetName();
166 }
167
168 //_____________________________________________________________________________
169 Text_t *AliPoints::GetObjectInfo(Int_t, Int_t)
170 {
171   //
172   //   Redefines TObject::GetObjectInfo.
173   //   Displays the info (particle,etc
174   //   corresponding to cursor position px,py
175   //
176   static char info[64];
177   sprintf(info,"%s %d",GetName(),fIndex);
178   return info;
179 }
180
181 //_____________________________________________________________________________
182 TParticle *AliPoints::GetParticle() const
183 {
184   //
185   //   Returns pointer to particle index in AliRun::fParticles
186   //
187   if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0;
188   else return gAlice->Particle(fIndex);
189 }
190
191 //_____________________________________________________________________________
192 void AliPoints::InspectParticle()
193 {
194   //
195   //   Inspect particle corresponding to this point
196   //
197   TParticle *particle = GetParticle();
198   if (particle) particle->Inspect();
199 }
200
201 //_____________________________________________________________________________
202 AliPoints & AliPoints::operator=(const AliPoints &pts)
203 {
204   //
205   // Assignment operator
206   //
207   pts.Copy(*this);
208   return (*this);
209 }
210
211 //_____________________________________________________________________________
212 void AliPoints::Propagate()
213 {
214   //
215   //   Set attributes of all detectors to be the attributes of this point
216   //
217   Int_t ntracks,track;
218   TObjArray *points;
219   AliPoints *pm;
220   //  
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);
230       if (!pm) continue;
231       if (fIndex == pm->GetIndex()) {
232         pm->SetMarkerColor(GetMarkerColor());
233         pm->SetMarkerSize(GetMarkerSize());
234         pm->SetMarkerStyle(GetMarkerStyle());
235       }
236     }
237   }
238 }