]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | **************************************************************************/ | |
a30a000f | 15 | |
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // This class contains the points for the ALICE event display // | |
21 | // // | |
22 | //Begin_Html | |
23 | /* | |
24 | <img src="gif/AliMUONPointsClass.gif"> | |
25 | */ | |
26 | //End_Html | |
27 | // // | |
28 | // // | |
29 | /////////////////////////////////////////////////////////////////////////////// | |
30 | ||
94de3818 | 31 | #include <TROOT.h> |
a9e2aefa | 32 | #include <TPolyMarker3D.h> |
33 | #include <TMatrix.h> | |
a9e2aefa | 34 | #include <TVirtualPad.h> |
a9e2aefa | 35 | #include <TPaveText.h> |
c1a185bf | 36 | #include <TMarker3DBox.h> |
a9e2aefa | 37 | |
30178c30 | 38 | #include "AliMUONPoints.h" |
39 | #include "AliMUONDisplay.h" | |
40 | #include "AliRun.h" | |
41 | #include "AliMUON.h" | |
42 | #include "AliMUONHit.h" | |
43 | #include "AliMUONDigit.h" | |
8c343c7c | 44 | #include "AliLog.h" |
30178c30 | 45 | |
a9e2aefa | 46 | ClassImp(AliMUONPoints) |
47 | ||
48 | //_____________________________________________________________________________ | |
49 | AliMUONPoints::AliMUONPoints() | |
30178c30 | 50 | : AliPoints() |
a9e2aefa | 51 | { |
52 | // | |
53 | // Default constructor | |
54 | // | |
55 | fHitIndex = 0; | |
56 | fTrackIndex = 0; | |
57 | fDigitIndex = 0; | |
58 | fMarker[0] = fMarker[1] = fMarker[2]=0; | |
59 | fMatrix = 0; | |
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
63 | AliMUONPoints::AliMUONPoints(Int_t npoints) | |
64 | :AliPoints(npoints) | |
65 | { | |
66 | // | |
67 | // Standard constructor | |
68 | // | |
69 | fHitIndex = 0; | |
70 | fTrackIndex = 0; | |
71 | fDigitIndex = 0; | |
72 | fMarker[0] = fMarker[1] = fMarker[2]=0; | |
73 | fMatrix = 0; | |
74 | } | |
75 | ||
30178c30 | 76 | //_____________________________________________________________________________ |
77 | AliMUONPoints::AliMUONPoints(const AliMUONPoints& points) | |
78 | : AliPoints(points) | |
a9e2aefa | 79 | { |
30178c30 | 80 | // Protected copy constructor |
81 | ||
8c343c7c | 82 | AliFatal("Not implemented."); |
a9e2aefa | 83 | } |
84 | ||
85 | //_____________________________________________________________________________ | |
86 | AliMUONPoints::~AliMUONPoints() | |
87 | { | |
88 | // | |
89 | // Default destructor | |
90 | // | |
91 | fHitIndex = 0; | |
92 | fTrackIndex = 0; | |
93 | fDigitIndex = 0; | |
94 | for (Int_t i=0;i<3;i++){ | |
95 | if (fMarker[i]) delete fMarker[i]; | |
96 | } | |
97 | fMatrix = 0; | |
98 | } | |
99 | ||
100 | //_____________________________________________________________________________ | |
30178c30 | 101 | void AliMUONPoints::DumpHit() const |
a9e2aefa | 102 | { |
103 | // | |
104 | // Dump hit corresponding to this point | |
105 | // | |
106 | AliMUONHit *hit = GetHit(); | |
107 | if (hit) hit->Dump(); | |
108 | } | |
109 | ||
110 | //_____________________________________________________________________________ | |
30178c30 | 111 | void AliMUONPoints::DumpDigit() const |
a9e2aefa | 112 | { |
113 | // | |
114 | // Dump digit corresponding to this point | |
115 | // | |
116 | AliMUONDigit *digit = GetDigit(); | |
117 | if (digit) digit->Dump(); | |
118 | } | |
119 | ||
120 | //_____________________________________________________________________________ | |
121 | void AliMUONPoints::InspectHit() | |
122 | { | |
123 | // | |
124 | // Inspect hit corresponding to this point | |
125 | // | |
126 | ||
127 | if (fHitIndex < 0 ) return; | |
128 | TVirtualPad *padsav = gPad; | |
129 | AliMUONHit *hit = GetHit(); | |
130 | if (hit) hit->Inspect(); | |
131 | TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect"); | |
132 | padinspect->cd(); | |
133 | Float_t xmin = gPad->GetX1(); | |
134 | Float_t xmax = gPad->GetX2(); | |
135 | Float_t ymin = gPad->GetY1(); | |
136 | Float_t ymax = gPad->GetY2(); | |
137 | Float_t dy = ymax-ymin; | |
138 | ||
139 | TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.15*dy); | |
140 | pad->SetBit(kCanDelete); | |
141 | pad->SetFillColor(42); | |
142 | pad->Draw(); | |
143 | char ptitle[100]; | |
144 | sprintf(ptitle," %s , fTrack: %d fTrackIndex: %d ",GetName(),fIndex,fTrackIndex); | |
145 | pad->AddText(ptitle); | |
146 | padinspect->cd(); | |
147 | padinspect->Update(); | |
148 | if (padsav) padsav->cd(); | |
149 | ||
150 | } | |
151 | ||
152 | //_____________________________________________________________________________ | |
153 | void AliMUONPoints::InspectDigit() | |
154 | { | |
155 | // | |
156 | // Inspect digit corresponding to this point | |
157 | // | |
158 | if (fDigitIndex < 0) return; | |
159 | TVirtualPad *padsav = gPad; | |
160 | AliMUONDigit *digit = GetDigit(); | |
161 | if (digit) digit->Inspect(); | |
162 | TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect"); | |
163 | padinspect->cd(); | |
164 | Float_t xmin = gPad->GetX1(); | |
165 | Float_t xmax = gPad->GetX2(); | |
166 | Float_t ymin = gPad->GetY1(); | |
167 | Float_t ymax = gPad->GetY2(); | |
168 | Float_t dy = ymax-ymin; | |
169 | ||
170 | TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.25*dy); | |
171 | pad->SetBit(kCanDelete); | |
172 | pad->SetFillColor(42); | |
173 | pad->Draw(); | |
174 | char ptitle[11][100]; | |
175 | // sprintf(ptitle[11],"Tracks making this digit"); | |
176 | // pad->AddText(ptitle[11]); | |
177 | for (int i=0;i<10;i++) { | |
1939e822 | 178 | if (digit->Track(i) == 0) continue; |
179 | sprintf(ptitle[i],"fTrackIndex: %d Charge: %d", | |
180 | digit->Track(i), digit->TrackCharge(i)); | |
a9e2aefa | 181 | pad->AddText(ptitle[i]); |
182 | } | |
183 | padinspect->cd(); | |
184 | padinspect->Update(); | |
185 | if (padsav) padsav->cd(); | |
186 | ||
187 | } | |
188 | ||
189 | //_____________________________________________________________________________ | |
30178c30 | 190 | Int_t AliMUONPoints::GetTrackIndex() const |
a9e2aefa | 191 | { |
192 | // | |
193 | // Dump digit corresponding to this point | |
194 | // | |
195 | ||
30178c30 | 196 | Inspect(); |
a9e2aefa | 197 | /* |
198 | if (fDigitIndex != 0) { | |
199 | Int_t ncol=this->fMatrix->GetNcols(); | |
200 | for (int i=0;i<ncol;i++) { | |
201 | printf(" track charge %f %f \n",(*(this->fMatrix))(0,i),(*(this->fMatrix))(1,i)); | |
202 | } | |
203 | } | |
204 | */ | |
205 | return fTrackIndex; | |
206 | } | |
207 | ||
208 | //_____________________________________________________________________________ | |
209 | AliMUONHit *AliMUONPoints::GetHit() const | |
210 | { | |
211 | // | |
212 | // Returns pointer to hit index in AliRun::fParticles | |
213 | // | |
214 | AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); | |
88cb7938 | 215 | |
216 | pMUON->TreeH()->GetEvent(fTrackIndex); | |
a9e2aefa | 217 | TClonesArray *muonHits = pMUON->Hits(); |
218 | Int_t nhits = muonHits->GetEntriesFast(); | |
219 | if (fHitIndex < 0 || fHitIndex >= nhits) return 0; | |
220 | return (AliMUONHit*)muonHits->UncheckedAt(fHitIndex); | |
221 | } | |
222 | ||
223 | //_____________________________________________________________________________ | |
224 | AliMUONDigit *AliMUONPoints::GetDigit() const | |
225 | { | |
226 | // | |
227 | // Returns pointer to digit index in AliRun::fParticles | |
228 | // | |
229 | ||
230 | AliMUONDisplay *display=(AliMUONDisplay*)gAlice->Display(); | |
231 | Int_t chamber=display->GetChamber(); | |
a9e2aefa | 232 | |
233 | AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); | |
1a1cdff8 | 234 | TClonesArray *muonDigits = pMUON->GetMUONData()->Digits(chamber-1); |
935b9895 | 235 | pMUON->GetMUONData()->GetDigits(); |
a9e2aefa | 236 | //gAlice->TreeD()->GetEvent(cathode); |
237 | Int_t ndigits = muonDigits->GetEntriesFast(); | |
238 | if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0; | |
239 | return (AliMUONDigit*)muonDigits->UncheckedAt(fDigitIndex); | |
240 | } | |
241 | //_____________________________________________________________________________ | |
242 | ||
30178c30 | 243 | AliMUONPoints& AliMUONPoints::operator= (const AliMUONPoints& rhs) |
a9e2aefa | 244 | { |
30178c30 | 245 | // Protected assignement operator |
246 | ||
247 | if (this == &rhs) return *this; | |
248 | ||
8c343c7c | 249 | AliFatal("Not implemented."); |
30178c30 | 250 | |
251 | return *this; | |
a9e2aefa | 252 | } |