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