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