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 ///////////////////////////////////////////////////////////////////////////////
32 #include <TPolyMarker3D.h>
33 #include <TVirtualPad.h>
34 #include <TPaveText.h>
35 #include <TMarker3DBox.h>
37 #include "AliMUONPoints.h"
38 #include "AliMUONDisplay.h"
41 #include "AliMUONHit.h"
42 #include "AliMUONDigit.h"
46 ClassImp(AliMUONPoints)
49 //_____________________________________________________________________________
50 AliMUONPoints::AliMUONPoints()
58 /// Default constructor
60 fMarker[0] = fMarker[1] = fMarker[2]=0;
63 //_____________________________________________________________________________
64 AliMUONPoints::AliMUONPoints(Int_t npoints)
71 /// Standard constructor
73 fMarker[0] = fMarker[1] = fMarker[2]=0;
76 //_____________________________________________________________________________
77 AliMUONPoints::~AliMUONPoints()
84 for (Int_t i=0;i<3;i++){
85 if (fMarker[i]) delete fMarker[i];
90 //_____________________________________________________________________________
91 void AliMUONPoints::DumpHit() const
93 /// Dump hit corresponding to this point
95 AliMUONHit *hit = GetHit();
99 //_____________________________________________________________________________
100 void AliMUONPoints::DumpDigit() const
102 /// Dump digit corresponding to this point
104 AliMUONDigit *digit = GetDigit();
105 if (digit) digit->Dump();
108 //_____________________________________________________________________________
109 void AliMUONPoints::InspectHit()
111 /// Inspect hit corresponding to this point
113 if (fHitIndex < 0 ) return;
114 TVirtualPad *padsav = gPad;
115 AliMUONHit *hit = GetHit();
116 if (hit) hit->Inspect();
117 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
119 Float_t xmin = gPad->GetX1();
120 Float_t xmax = gPad->GetX2();
121 Float_t ymin = gPad->GetY1();
122 Float_t ymax = gPad->GetY2();
123 Float_t dy = ymax-ymin;
125 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.15*dy);
126 pad->SetBit(kCanDelete);
127 pad->SetFillColor(42);
130 sprintf(ptitle," %s , fTrack: %d fTrackIndex: %d ",GetName(),fIndex,fTrackIndex);
131 pad->AddText(ptitle);
133 padinspect->Update();
134 if (padsav) padsav->cd();
138 //_____________________________________________________________________________
139 void AliMUONPoints::InspectDigit()
141 /// Inspect digit corresponding to this point
143 if (fDigitIndex < 0) return;
144 TVirtualPad *padsav = gPad;
145 AliMUONDigit *digit = GetDigit();
146 if (digit) digit->Inspect();
147 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
149 Float_t xmin = gPad->GetX1();
150 Float_t xmax = gPad->GetX2();
151 Float_t ymin = gPad->GetY1();
152 Float_t ymax = gPad->GetY2();
153 Float_t dy = ymax-ymin;
155 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.25*dy);
156 pad->SetBit(kCanDelete);
157 pad->SetFillColor(42);
159 char ptitle[11][100];
160 // sprintf(ptitle[11],"Tracks making this digit");
161 // pad->AddText(ptitle[11]);
162 for (int i=0;i<digit->Ntracks();i++) {
163 if (digit->Track(i) == 0) continue;
164 sprintf(ptitle[i],"fTrackIndex: %d Charge: %d",
165 digit->Track(i), digit->TrackCharge(i));
166 pad->AddText(ptitle[i]);
169 padinspect->Update();
170 if (padsav) padsav->cd();
174 //_____________________________________________________________________________
175 Int_t AliMUONPoints::GetTrackIndex() const
177 /// Dump digit corresponding to this point
181 if (fDigitIndex != 0) {
182 Int_t ncol=this->fMatrix->GetNcols();
183 for (int i=0;i<ncol;i++) {
184 printf(" track charge %f %f \n",(*(this->fMatrix))(0,i),(*(this->fMatrix))(1,i));
191 //_____________________________________________________________________________
192 AliMUONHit *AliMUONPoints::GetHit() const
194 /// Returns pointer to hit index in AliRun::fParticles
196 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
198 pMUON->TreeH()->GetEvent(fTrackIndex);
199 TClonesArray *muonHits = pMUON->Hits();
200 Int_t nhits = muonHits->GetEntriesFast();
201 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
202 return (AliMUONHit*)muonHits->UncheckedAt(fHitIndex);
205 //_____________________________________________________________________________
206 AliMUONDigit *AliMUONPoints::GetDigit() const
208 /// Returns pointer to digit index in AliRun::fParticles
210 AliMUONDisplay *display=(AliMUONDisplay*)gAlice->Display();
211 Int_t chamber=display->GetChamber();
213 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
214 TClonesArray *muonDigits = pMUON->GetMUONData()->Digits(chamber-1);
215 pMUON->GetMUONData()->GetDigits();
216 //gAlice->TreeD()->GetEvent(cathode);
217 Int_t ndigits = muonDigits->GetEntriesFast();
218 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
219 return (AliMUONDigit*)muonDigits->UncheckedAt(fDigitIndex);