AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpSlatPainter.cxx
Go to the documentation of this file.
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  **************************************************************************/
15 
16 // $Id$
17 // $MpId: AliMpSlatPainter.cxx,v 1.10 2006/05/24 13:58:32 ivana Exp $
18 
19 
20 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
27 
28 #include "AliMpSlatPainter.h"
29 
30 #include "AliLog.h"
31 #include "AliMpGraphContext.h"
32 #include "AliMpPCB.h"
33 #include "AliMpSlat.h"
34 
35 #include "TVirtualX.h"
36 #include "TPad.h"
37 #include <iostream>
38 
42 
43 //_____________________________________________________________________________
45  : AliMpVPainter(),
46  fkSlat(0)
47 {
51 }
52 
53 //_____________________________________________________________________________
55  : AliMpVPainter(),
56  fkSlat(slat)
57 {
61 }
62 
63 //_____________________________________________________________________________
65 {
69 }
70 
71 //_____________________________________________________________________________
72 TVector2
74 {
78  return TVector2(fkSlat->DX(),fkSlat->DY());
79 }
80 
81 //_____________________________________________________________________________
82 TVector2
84 {
88  return TVector2(fkSlat->DX(),fkSlat->DY());
89 }
90 
91 //_____________________________________________________________________________
92 void
93 AliMpSlatPainter::Draw(Option_t* option)
94 {
101 
102  gr->Push();
104 
105 // GetPosition().Print();
106 // GetDimensions().Print();
107 
108  switch (option[0])
109  {
110  case 'P':
111  for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
112  {
113  AliMpPCB* pcb = fkSlat->GetPCB(i);
114 
115  gr->Push();
116 
117  gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()),
118  TVector2(pcb->DX(),pcb->DY()));
119  gr->SetColor(i+2);
120 
121  DrawObject(pcb,option+1);
122 
123  gr->Pop();
124  }
125  break;
126  default:
127  AppendPad(option);
128  }
129 
130  gr->Pop();
131 }
132 
133 //_____________________________________________________________________________
134 void
135 AliMpSlatPainter::Paint(Option_t* /*option*/)
136 {
141 
142  Int_t col=gVirtualX->GetFillColor();
143  gr->Push();
144  gPad->Range(0.,0.,1.,1.);
146 
147  PaintWholeBox(kTRUE);
148 
149  gr->Pop();
150  gVirtualX->SetFillColor(col);
151 }
152 
153 
TVector2 GetPosition() const
Return the owned object's position.
Double_t DX() const
Definition: AliMpPCB.cxx:454
Double_t X() const
Definition: AliMpPCB.cxx:756
A PCB for station 3,4 or 5.
Definition: AliMpPCB.h:46
TVector2 GetDimensions() const
Return the owned object's dimensions.
Class for drawing a slat into canvas.
static AliMpGraphContext * Instance()
A slat (building block of stations 3, 4 and 5)
Definition: AliMpSlat.h:51
void SetPadPosForReal(const TVector2 &position, const TVector2 &dimensions)
void SetColor(Int_t color)
Set color to use.
const AliMpSlat * fkSlat
! pointer to the slat to be drawn
Double_t DY() const
Definition: AliMpSlat.cxx:171
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Double_t DX() const
Definition: AliMpSlat.cxx:161
AliMpPCB * GetPCB(Int_t i) const
Returns the i-th PCB of this slat.
Definition: AliMpSlat.cxx:435
TGraph * gr
Definition: CalibTime.C:25
Abstract base class for drawing objects into canvas.
Definition: AliMpVPainter.h:21
void PaintWholeBox(Bool_t fill=kTRUE)
void Paint(Option_t *option)
Paint the associated object.
Double_t DY() const
Definition: AliMpPCB.cxx:480
AliMpVPainter * DrawObject(TObject *object, Option_t *option="")
Not implemented.
Double_t Y() const
Definition: AliMpPCB.cxx:789
void Draw(Option_t *option)
Class describing the correspondance between a given area in pad, and a zone of real (cm) position...
Int_t GetSize() const
Returns the number of PCBs of this slat.
Definition: AliMpSlat.cxx:446
void InitGraphContext()
virtual ~AliMpSlatPainter()