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