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