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