1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // This class contains the points for the ALICE event display //
24 <img src="gif/AliMUONPointsClass.gif">
29 ///////////////////////////////////////////////////////////////////////////////
31 #include "AliMUONPoints.h"
32 #include "AliMUONDisplay.h"
35 #include "AliMUONChamber.h"
36 #include "AliMUONResponse.h"
37 #include "AliMUONHit.h"
38 #include "AliMUONPadHit.h"
39 #include "AliMUONDigit.h"
40 #include "AliMUONRawCluster.h"
45 #include <TPolyMarker3D.h>
48 #include <TVirtualPad.h>
49 #include <TPolyLine3D.h>
50 #include <TPaveText.h>
53 #include <TMarker3DBox.h>
55 ClassImp(AliMUONPoints)
57 //_____________________________________________________________________________
58 AliMUONPoints::AliMUONPoints()
61 // Default constructor
66 fMarker[0] = fMarker[1] = fMarker[2]=0;
70 //_____________________________________________________________________________
71 AliMUONPoints::AliMUONPoints(Int_t npoints)
75 // Standard constructor
80 fMarker[0] = fMarker[1] = fMarker[2]=0;
84 AliMUONPoints::AliMUONPoints(const AliMUONPoints& points):AliPoints(points)
89 //_____________________________________________________________________________
90 AliMUONPoints::~AliMUONPoints()
98 for (Int_t i=0;i<3;i++){
99 if (fMarker[i]) delete fMarker[i];
104 //_____________________________________________________________________________
105 void AliMUONPoints::DumpHit()
108 // Dump hit corresponding to this point
110 AliMUONHit *hit = GetHit();
111 if (hit) hit->Dump();
114 //_____________________________________________________________________________
115 void AliMUONPoints::DumpDigit()
118 // Dump digit corresponding to this point
120 AliMUONDigit *digit = GetDigit();
121 if (digit) digit->Dump();
124 //_____________________________________________________________________________
125 void AliMUONPoints::InspectHit()
128 // Inspect hit corresponding to this point
131 if (fHitIndex < 0 ) return;
132 TVirtualPad *padsav = gPad;
133 AliMUONHit *hit = GetHit();
134 if (hit) hit->Inspect();
135 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
137 Float_t xmin = gPad->GetX1();
138 Float_t xmax = gPad->GetX2();
139 Float_t ymin = gPad->GetY1();
140 Float_t ymax = gPad->GetY2();
141 Float_t dy = ymax-ymin;
143 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.15*dy);
144 pad->SetBit(kCanDelete);
145 pad->SetFillColor(42);
148 sprintf(ptitle," %s , fTrack: %d fTrackIndex: %d ",GetName(),fIndex,fTrackIndex);
149 pad->AddText(ptitle);
151 padinspect->Update();
152 if (padsav) padsav->cd();
156 //_____________________________________________________________________________
157 void AliMUONPoints::InspectDigit()
160 // Inspect digit corresponding to this point
162 if (fDigitIndex < 0) return;
163 TVirtualPad *padsav = gPad;
164 AliMUONDigit *digit = GetDigit();
165 if (digit) digit->Inspect();
166 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
168 Float_t xmin = gPad->GetX1();
169 Float_t xmax = gPad->GetX2();
170 Float_t ymin = gPad->GetY1();
171 Float_t ymax = gPad->GetY2();
172 Float_t dy = ymax-ymin;
174 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.25*dy);
175 pad->SetBit(kCanDelete);
176 pad->SetFillColor(42);
178 char ptitle[11][100];
179 // sprintf(ptitle[11],"Tracks making this digit");
180 // pad->AddText(ptitle[11]);
181 for (int i=0;i<10;i++) {
182 if (digit->Track(i) == 0) continue;
183 sprintf(ptitle[i],"fTrackIndex: %d Charge: %d",
184 digit->Track(i), digit->TrackCharge(i));
185 pad->AddText(ptitle[i]);
188 padinspect->Update();
189 if (padsav) padsav->cd();
193 //_____________________________________________________________________________
194 Int_t AliMUONPoints::GetTrackIndex()
197 // Dump digit corresponding to this point
202 if (fDigitIndex != 0) {
203 Int_t ncol=this->fMatrix->GetNcols();
204 for (int i=0;i<ncol;i++) {
205 printf(" track charge %f %f \n",(*(this->fMatrix))(0,i),(*(this->fMatrix))(1,i));
212 //_____________________________________________________________________________
213 AliMUONHit *AliMUONPoints::GetHit() const
216 // Returns pointer to hit index in AliRun::fParticles
218 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
220 pMUON->TreeH()->GetEvent(fTrackIndex);
221 TClonesArray *muonHits = pMUON->Hits();
222 Int_t nhits = muonHits->GetEntriesFast();
223 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
224 return (AliMUONHit*)muonHits->UncheckedAt(fHitIndex);
227 //_____________________________________________________________________________
228 AliMUONDigit *AliMUONPoints::GetDigit() const
231 // Returns pointer to digit index in AliRun::fParticles
234 AliMUONDisplay *display=(AliMUONDisplay*)gAlice->Display();
235 Int_t chamber=display->GetChamber();
236 Int_t cathode=display->GetCathode();
238 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
239 TClonesArray *muonDigits = pMUON->GetMUONData()->Digits(chamber-1);
240 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
241 pMUON->GetMUONData()->GetCathode(nent-2+cathode-1);
242 //gAlice->TreeD()->GetEvent(cathode);
243 Int_t ndigits = muonDigits->GetEntriesFast();
244 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
245 return (AliMUONDigit*)muonDigits->UncheckedAt(fDigitIndex);
247 //_____________________________________________________________________________
249 AliMUONPoints& AliMUONPoints::operator= (const AliMUONPoints& /*rhs*/)