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 // $MpId: AliMpSlatPainter.cxx,v 1.6 2005/09/19 18:56:46 ivana Exp $
20 // Class AliMpSlatPainter
21 // -----------------------
22 // Class for drawing a slat into canvas
23 // Authors: Laurent Aphecetche
25 #include "AliMpSlatPainter.h"
28 #include "AliMpGraphContext.h"
30 #include "AliMpSlat.h"
32 #include "TVirtualX.h"
36 ClassImp(AliMpSlatPainter)
38 //_____________________________________________________________________________
39 AliMpSlatPainter::AliMpSlatPainter()
48 //_____________________________________________________________________________
49 AliMpSlatPainter::AliMpSlatPainter(const AliMpSlat* slat)
58 //______________________________________________________________________________
59 AliMpSlatPainter::AliMpSlatPainter(const AliMpSlatPainter& right)
60 : AliMpVPainter(right)
62 /// Protected copy constructor (not implemented)
64 AliFatal("Copy constructor not provided.");
67 //_____________________________________________________________________________
68 AliMpSlatPainter::~AliMpSlatPainter()
75 //______________________________________________________________________________
77 AliMpSlatPainter::operator=(const AliMpSlatPainter& right)
79 /// Protected assignement operator (not implemented)
81 // check assignement to self
82 if (this == &right) return *this;
84 AliFatal("Assignement operator not provided.");
89 //_____________________________________________________________________________
91 AliMpSlatPainter::GetDimensions() const
94 // Returns the half-sizes of the slat.
96 return TVector2(fkSlat->DX(),fkSlat->DY());
99 //_____________________________________________________________________________
101 AliMpSlatPainter::GetPosition() const
104 // Returns the (x,y) position of the slat.
106 return TVector2(fkSlat->DX(),fkSlat->DY());
109 //_____________________________________________________________________________
111 AliMpSlatPainter::Draw(Option_t* option)
116 // If option[0] is 'P' then PCB are drawn too.
118 AliMpGraphContext *gr = AliMpGraphContext::Instance();
123 GetPosition().Print();
124 GetDimensions().Print();
129 for ( AliMpSlat::Size_t i = 0; i < fkSlat->GetSize(); ++i )
131 AliMpPCB* pcb = fkSlat->GetPCB(i);
135 gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()),
136 TVector2(pcb->DX(),pcb->DY()));
139 DrawObject(pcb,option+1);
151 //_____________________________________________________________________________
153 AliMpSlatPainter::Paint(Option_t* /*option*/)
158 AliMpGraphContext* gr = AliMpGraphContext::Instance();
160 Int_t col=gVirtualX->GetFillColor();
162 gPad->Range(0.,0.,1.,1.);
165 PaintWholeBox(kTRUE);
168 gVirtualX->SetFillColor(col);