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