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