]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONPoints.cxx
12-sep-2006 NvE Memberfunctions GetNslots and AddNamedSlot introduced and various
[u/mrichter/AliRoot.git] / MUON / AliMUONPoints.cxx
CommitLineData
a9e2aefa 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 **************************************************************************/
a30a000f 15
88cb7938 16/* $Id$ */
a9e2aefa 17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// This class contains the points for the ALICE event display //
21// //
22//Begin_Html
23/*
24<img src="gif/AliMUONPointsClass.gif">
25*/
26//End_Html
27// //
28// //
29///////////////////////////////////////////////////////////////////////////////
30
94de3818 31#include <TROOT.h>
a9e2aefa 32#include <TPolyMarker3D.h>
a9e2aefa 33#include <TVirtualPad.h>
a9e2aefa 34#include <TPaveText.h>
c1a185bf 35#include <TMarker3DBox.h>
a9e2aefa 36
30178c30 37#include "AliMUONPoints.h"
38#include "AliMUONDisplay.h"
39#include "AliRun.h"
40#include "AliMUON.h"
41#include "AliMUONHit.h"
42#include "AliMUONDigit.h"
8c343c7c 43#include "AliLog.h"
30178c30 44
5398f946 45/// \cond CLASSIMP
a9e2aefa 46ClassImp(AliMUONPoints)
5398f946 47/// \endcond
a9e2aefa 48
49//_____________________________________________________________________________
50AliMUONPoints::AliMUONPoints()
5398f946 51 : AliPoints(),
52 fHitIndex(0),
53 fTrackIndex(0),
54 fDigitIndex(0),
55 fMatrix(0)
56
a9e2aefa 57{
5398f946 58 /// Default constructor
59
a9e2aefa 60 fMarker[0] = fMarker[1] = fMarker[2]=0;
a9e2aefa 61}
62
63//_____________________________________________________________________________
64AliMUONPoints::AliMUONPoints(Int_t npoints)
5398f946 65 : AliPoints(npoints),
66 fHitIndex(0),
67 fTrackIndex(0),
68 fDigitIndex(0),
69 fMatrix(0)
a9e2aefa 70{
5398f946 71 /// Standard constructor
72
a9e2aefa 73 fMarker[0] = fMarker[1] = fMarker[2]=0;
a9e2aefa 74}
75
a9e2aefa 76//_____________________________________________________________________________
77AliMUONPoints::~AliMUONPoints()
78{
5398f946 79 /// Destructor
80
a9e2aefa 81 fHitIndex = 0;
82 fTrackIndex = 0;
83 fDigitIndex = 0;
84 for (Int_t i=0;i<3;i++){
85 if (fMarker[i]) delete fMarker[i];
86 }
87 fMatrix = 0;
88}
89
90//_____________________________________________________________________________
30178c30 91void AliMUONPoints::DumpHit() const
a9e2aefa 92{
5398f946 93 /// Dump hit corresponding to this point
94
a9e2aefa 95 AliMUONHit *hit = GetHit();
96 if (hit) hit->Dump();
97}
98
99//_____________________________________________________________________________
30178c30 100void AliMUONPoints::DumpDigit() const
a9e2aefa 101{
5398f946 102 /// Dump digit corresponding to this point
103
a9e2aefa 104 AliMUONDigit *digit = GetDigit();
105 if (digit) digit->Dump();
106}
107
108//_____________________________________________________________________________
109void AliMUONPoints::InspectHit()
110{
5398f946 111 /// Inspect hit corresponding to this point
a9e2aefa 112
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");
118 padinspect->cd();
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;
124
125 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.15*dy);
126 pad->SetBit(kCanDelete);
127 pad->SetFillColor(42);
128 pad->Draw();
129 char ptitle[100];
130 sprintf(ptitle," %s , fTrack: %d fTrackIndex: %d ",GetName(),fIndex,fTrackIndex);
131 pad->AddText(ptitle);
132 padinspect->cd();
133 padinspect->Update();
134 if (padsav) padsav->cd();
135
136}
137
138//_____________________________________________________________________________
139void AliMUONPoints::InspectDigit()
140{
5398f946 141 /// Inspect digit corresponding to this point
142
a9e2aefa 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");
148 padinspect->cd();
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;
154
155 TPaveText *pad = new TPaveText(xmin, ymin+0.1*dy, xmax, ymin+0.25*dy);
156 pad->SetBit(kCanDelete);
157 pad->SetFillColor(42);
158 pad->Draw();
159 char ptitle[11][100];
160 // sprintf(ptitle[11],"Tracks making this digit");
161 // pad->AddText(ptitle[11]);
209848d2 162 for (int i=0;i<digit->Ntracks();i++) {
1939e822 163 if (digit->Track(i) == 0) continue;
164 sprintf(ptitle[i],"fTrackIndex: %d Charge: %d",
165 digit->Track(i), digit->TrackCharge(i));
a9e2aefa 166 pad->AddText(ptitle[i]);
167 }
168 padinspect->cd();
169 padinspect->Update();
170 if (padsav) padsav->cd();
171
172}
173
174//_____________________________________________________________________________
30178c30 175Int_t AliMUONPoints::GetTrackIndex() const
a9e2aefa 176{
5398f946 177 /// Dump digit corresponding to this point
a9e2aefa 178
30178c30 179 Inspect();
a9e2aefa 180 /*
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));
185 }
186 }
187 */
188 return fTrackIndex;
189}
190
191//_____________________________________________________________________________
192AliMUONHit *AliMUONPoints::GetHit() const
193{
5398f946 194 /// Returns pointer to hit index in AliRun::fParticles
195
a9e2aefa 196 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
88cb7938 197
198 pMUON->TreeH()->GetEvent(fTrackIndex);
a9e2aefa 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);
203}
204
205//_____________________________________________________________________________
206AliMUONDigit *AliMUONPoints::GetDigit() const
207{
5398f946 208 /// Returns pointer to digit index in AliRun::fParticles
a9e2aefa 209
210 AliMUONDisplay *display=(AliMUONDisplay*)gAlice->Display();
211 Int_t chamber=display->GetChamber();
a9e2aefa 212
213 AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON");
1a1cdff8 214 TClonesArray *muonDigits = pMUON->GetMUONData()->Digits(chamber-1);
935b9895 215 pMUON->GetMUONData()->GetDigits();
a9e2aefa 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);
220}