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