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