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