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 **************************************************************************/
17 Revision 1.2 2000/06/15 07:58:48 morsch
18 Code from MUON-dev joined
20 Revision 1.1.2.6 2000/06/09 21:57:40 morsch
21 Most coding rule violations corrected.
23 Revision 1.1.2.5 2000/05/05 11:33:56 morsch
26 Revision 1.1.2.4 2000/05/05 10:12:09 morsch
30 ///////////////////////////////////////////////////////////////////////////////
32 // This class contains the points for the ALICE event display //
36 <img src="gif/AliMUONPointsClass.gif">
41 ///////////////////////////////////////////////////////////////////////////////
43 #include "AliMUONPoints.h"
44 #include "AliMUONDisplay.h"
47 #include "AliMUONChamber.h"
48 #include "AliMUONSegmentation.h"
49 #include "AliMUONResponse.h"
50 #include "AliMUONHit.h"
51 #include "AliMUONPadHit.h"
52 #include "AliMUONDigit.h"
53 #include "AliMUONRawCluster.h"
56 #include <TPolyMarker3D.h>
59 #include <TVirtualPad.h>
60 #include <TPolyLine3D.h>
61 #include <TPaveText.h>
66 ClassImp(AliMUONPoints)
68 //_____________________________________________________________________________
69 AliMUONPoints::AliMUONPoints()
72 // Default constructor
77 fMarker[0] = fMarker[1] = fMarker[2]=0;
81 //_____________________________________________________________________________
82 AliMUONPoints::AliMUONPoints(Int_t npoints)
86 // Standard constructor
91 fMarker[0] = fMarker[1] = fMarker[2]=0;
95 AliMUONPoints::AliMUONPoints(const AliMUONPoints& points)
100 //_____________________________________________________________________________
101 AliMUONPoints::~AliMUONPoints()
104 // Default destructor
109 for (Int_t i=0;i<3;i++){
110 if (fMarker[i]) delete fMarker[i];
115 //_____________________________________________________________________________
116 void AliMUONPoints::DumpHit()
119 // Dump hit corresponding to this point
121 AliMUONHit *hit = GetHit();
122 if (hit) hit->Dump();
125 //_____________________________________________________________________________
126 void AliMUONPoints::DumpDigit()
129 // Dump digit corresponding to this point
131 AliMUONDigit *digit = GetDigit();
132 if (digit) digit->Dump();
135 //_____________________________________________________________________________
136 void AliMUONPoints::InspectHit()
139 // Inspect hit corresponding to this point
142 if (fHitIndex < 0 ) return;
143 TVirtualPad *padsav = gPad;
144 AliMUONHit *hit = GetHit();
145 if (hit) hit->Inspect();
146 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
148 Float_t xmin = gPad->GetX1();
149 Float_t xmax = gPad->GetX2();
150 Float_t ymin = gPad->GetY1();
151 Float_t ymax = gPad->GetY2();
152 Float_t dy = ymax-ymin;
154 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.15*dy);
155 pad->SetBit(kCanDelete);
156 pad->SetFillColor(42);
159 sprintf(ptitle," %s , fTrack: %d fTrackIndex: %d ",GetName(),fIndex,fTrackIndex);
160 pad->AddText(ptitle);
162 padinspect->Update();
163 if (padsav) padsav->cd();
167 //_____________________________________________________________________________
168 void AliMUONPoints::InspectDigit()
171 // Inspect digit corresponding to this point
173 if (fDigitIndex < 0) return;
174 TVirtualPad *padsav = gPad;
175 AliMUONDigit *digit = GetDigit();
176 if (digit) digit->Inspect();
177 TVirtualPad *padinspect = (TVirtualPad*)(gROOT->GetListOfCanvases())->FindObject("inspect");
179 Float_t xmin = gPad->GetX1();
180 Float_t xmax = gPad->GetX2();
181 Float_t ymin = gPad->GetY1();
182 Float_t ymax = gPad->GetY2();
183 Float_t dy = ymax-ymin;
185 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.25*dy);
186 pad->SetBit(kCanDelete);
187 pad->SetFillColor(42);
189 char ptitle[11][100];
190 // sprintf(ptitle[11],"Tracks making this digit");
191 // pad->AddText(ptitle[11]);
192 for (int i=0;i<10;i++) {
193 if (digit->fTracks[i] == 0) continue;
194 sprintf(ptitle[i],"fTrackIndex: %d Charge: %d",digit->fTracks[i],digit->fTcharges[i]);
195 pad->AddText(ptitle[i]);
198 padinspect->Update();
199 if (padsav) padsav->cd();
203 //_____________________________________________________________________________
204 Int_t AliMUONPoints::GetTrackIndex()
207 // Dump digit corresponding to this point
212 if (fDigitIndex != 0) {
213 Int_t ncol=this->fMatrix->GetNcols();
214 for (int i=0;i<ncol;i++) {
215 printf(" track charge %f %f \n",(*(this->fMatrix))(0,i),(*(this->fMatrix))(1,i));
222 //_____________________________________________________________________________
223 AliMUONHit *AliMUONPoints::GetHit() const
226 // Returns pointer to hit index in AliRun::fParticles
228 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
229 gAlice->TreeH()->GetEvent(fTrackIndex);
230 TClonesArray *muonHits = pMUON->Hits();
231 Int_t nhits = muonHits->GetEntriesFast();
232 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
233 return (AliMUONHit*)muonHits->UncheckedAt(fHitIndex);
236 //_____________________________________________________________________________
237 AliMUONDigit *AliMUONPoints::GetDigit() const
240 // Returns pointer to digit index in AliRun::fParticles
243 AliMUONDisplay *display=(AliMUONDisplay*)gAlice->Display();
244 Int_t chamber=display->GetChamber();
245 Int_t cathode=display->GetCathode();
247 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
248 TClonesArray *muonDigits = pMUON->DigitsAddress(chamber-1);
249 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
250 gAlice->TreeD()->GetEvent(nent-2+cathode-1);
251 //gAlice->TreeD()->GetEvent(cathode);
252 Int_t ndigits = muonDigits->GetEntriesFast();
253 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
254 return (AliMUONDigit*)muonDigits->UncheckedAt(fDigitIndex);
256 //_____________________________________________________________________________
258 AliMUONPoints& AliMUONPoints::operator= (const AliMUONPoints& rhs)