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 <TClonesArray.h>
33 #include <TPolyMarker3D.h>
34 #include <TVirtualPad.h>
35 #include <TPaveText.h>
36 #include <TMarker3DBox.h>
38 #include "AliMUONPoints.h"
39 #include "AliMUONDisplay.h"
42 #include "AliMUONHit.h"
43 #include "AliMUONDigit.h"
47 ClassImp(AliMUONPoints)
50 //_____________________________________________________________________________
51 AliMUONPoints::AliMUONPoints()
59 /// Default constructor
61 fMarker[0] = fMarker[1] = fMarker[2]=0;
64 //_____________________________________________________________________________
65 AliMUONPoints::AliMUONPoints(Int_t npoints)
72 /// Standard constructor
74 fMarker[0] = fMarker[1] = fMarker[2]=0;
77 //_____________________________________________________________________________
78 AliMUONPoints::~AliMUONPoints()
85 for (Int_t i=0;i<3;i++){
86 if (fMarker[i]) delete fMarker[i];
91 //_____________________________________________________________________________
92 void AliMUONPoints::DumpHit() const
94 /// Dump hit corresponding to this point
96 AliMUONHit *hit = GetHit();
100 //_____________________________________________________________________________
101 void AliMUONPoints::DumpDigit() const
103 /// Dump digit corresponding to this point
105 AliMUONDigit *digit = GetDigit();
106 if (digit) digit->Dump();
109 //_____________________________________________________________________________
110 void AliMUONPoints::InspectHit()
112 /// Inspect hit corresponding to this point
114 if (fHitIndex < 0 ) return;
115 TVirtualPad *padsav = gPad;
116 AliMUONHit *hit = GetHit();
117 if (hit) hit->Inspect();
118 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
120 Float_t xmin = gPad->GetX1();
121 Float_t xmax = gPad->GetX2();
122 Float_t ymin = gPad->GetY1();
123 Float_t ymax = gPad->GetY2();
124 Float_t dy = ymax-ymin;
126 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.15*dy);
127 pad->SetBit(kCanDelete);
128 pad->SetFillColor(42);
131 sprintf(ptitle," %s , fTrack: %d fTrackIndex: %d ",GetName(),fIndex,fTrackIndex);
132 pad->AddText(ptitle);
134 padinspect->Update();
135 if (padsav) padsav->cd();
139 //_____________________________________________________________________________
140 void AliMUONPoints::InspectDigit()
142 /// Inspect digit corresponding to this point
144 if (fDigitIndex < 0) return;
145 TVirtualPad *padsav = gPad;
146 AliMUONDigit *digit = GetDigit();
147 if (digit) digit->Inspect();
148 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
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;
156 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.25*dy);
157 pad->SetBit(kCanDelete);
158 pad->SetFillColor(42);
160 char ptitle[11][100];
161 // sprintf(ptitle[11],"Tracks making this digit");
162 // pad->AddText(ptitle[11]);
163 for (int i=0;i<digit->Ntracks();i++) {
164 if (digit->Track(i) == 0) continue;
165 sprintf(ptitle[i],"fTrackIndex: %d Charge: %e",
166 digit->Track(i), digit->TrackCharge(i));
167 pad->AddText(ptitle[i]);
170 padinspect->Update();
171 if (padsav) padsav->cd();
175 //_____________________________________________________________________________
176 Int_t AliMUONPoints::GetTrackIndex() const
178 /// Dump digit corresponding to this point
182 if (fDigitIndex != 0) {
183 Int_t ncol=this->fMatrix->GetNcols();
184 for (int i=0;i<ncol;i++) {
185 printf(" track charge %f %f \n",(*(this->fMatrix))(0,i),(*(this->fMatrix))(1,i));
192 //_____________________________________________________________________________
193 AliMUONHit *AliMUONPoints::GetHit() const
195 /// Returns pointer to hit index in AliRun::fParticles
197 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
199 pMUON->TreeH()->GetEvent(fTrackIndex);
200 TClonesArray *muonHits = pMUON->Hits();
201 Int_t nhits = muonHits->GetEntriesFast();
202 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
203 return (AliMUONHit*)muonHits->UncheckedAt(fHitIndex);
206 //_____________________________________________________________________________
207 AliMUONDigit *AliMUONPoints::GetDigit() const
209 /// Returns pointer to digit index in AliRun::fParticles
211 AliMUONDisplay *display=(AliMUONDisplay*)gAlice->Display();
212 Int_t chamber=display->GetChamber();
214 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
215 TClonesArray *muonDigits = pMUON->GetMUONData()->Digits(chamber-1);
216 pMUON->GetMUONData()->GetDigits();
217 //gAlice->TreeD()->GetEvent(cathode);
218 Int_t ndigits = muonDigits->GetEntriesFast();
219 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
220 return (AliMUONDigit*)muonDigits->UncheckedAt(fDigitIndex);