- Removed not implemented methods AddData(), GetGlobalTriggerPattern
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSlatPainter.cxx
CommitLineData
dee1d5f1 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$
13985652 17// $MpId: AliMpSlatPainter.cxx,v 1.10 2006/05/24 13:58:32 ivana Exp $
85fec35d 18
19///
20/// \class AliMpSlatPainter
21///
22/// Class for drawing a slat into canvas
23///
24/// \author Laurent Aphecetche
dee1d5f1 25
26#include "AliMpSlatPainter.h"
27
28#include "AliLog.h"
29#include "AliMpGraphContext.h"
30#include "AliMpPCB.h"
31#include "AliMpSlat.h"
32
33#include "TVirtualX.h"
34#include "TPad.h"
35#include <iostream>
36
13985652 37/// \cond CLASSIMP
dee1d5f1 38ClassImp(AliMpSlatPainter)
13985652 39/// \endcond
dee1d5f1 40
41//_____________________________________________________________________________
42AliMpSlatPainter::AliMpSlatPainter()
884a73f1 43 : AliMpVPainter(),
44 fkSlat(0)
dee1d5f1 45{
46 //
47 // Empty ctor.
48 //
49}
50
51//_____________________________________________________________________________
52AliMpSlatPainter::AliMpSlatPainter(const AliMpSlat* slat)
884a73f1 53 : AliMpVPainter(),
54 fkSlat(slat)
dee1d5f1 55{
56 //
57 // Normal ctor.
58 //
59}
60
61//_____________________________________________________________________________
62AliMpSlatPainter::~AliMpSlatPainter()
63{
64 //
65 // Dtor.
66 //
67}
68
69//_____________________________________________________________________________
70TVector2
71AliMpSlatPainter::GetDimensions() const
72{
73 //
74 // Returns the half-sizes of the slat.
75 //
76 return TVector2(fkSlat->DX(),fkSlat->DY());
77}
78
79//_____________________________________________________________________________
80TVector2
81AliMpSlatPainter::GetPosition() const
82{
83 //
84 // Returns the (x,y) position of the slat.
85 //
86 return TVector2(fkSlat->DX(),fkSlat->DY());
87}
88
89//_____________________________________________________________________________
90void
91AliMpSlatPainter::Draw(Option_t* option)
92{
93 //
94 // Draws the slat.
95 //
96 // If option[0] is 'P' then PCB are drawn too.
97 //
98 AliMpGraphContext *gr = AliMpGraphContext::Instance();
99
100 gr->Push();
101 InitGraphContext();
102
84da36f2 103// GetPosition().Print();
104// GetDimensions().Print();
dee1d5f1 105
106 switch (option[0])
107 {
108 case 'P':
109 for ( AliMpSlat::Size_t i = 0; i < fkSlat->GetSize(); ++i )
110 {
111 AliMpPCB* pcb = fkSlat->GetPCB(i);
112
113 gr->Push();
114
dee1d5f1 115 gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()),
116 TVector2(pcb->DX(),pcb->DY()));
117 gr->SetColor(i+2);
118
119 DrawObject(pcb,option+1);
120
121 gr->Pop();
122 }
123 break;
124 default:
125 AppendPad(option);
126 }
127
128 gr->Pop();
129}
130
131//_____________________________________________________________________________
132void
133AliMpSlatPainter::Paint(Option_t* /*option*/)
134{
135 //
136 // Paint the object.
137 //
138 AliMpGraphContext* gr = AliMpGraphContext::Instance();
139
140 Int_t col=gVirtualX->GetFillColor();
141 gr->Push();
142 gPad->Range(0.,0.,1.,1.);
143 InitGraphContext();
144
145 PaintWholeBox(kTRUE);
146
147 gr->Pop();
148 gVirtualX->SetFillColor(col);
149}
150
151