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