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.10 2006/05/24 13:58:32 ivana Exp $
20 //-----------------------------------------------------------------------------
21 /// \class AliMpSlatPainter
23 /// Class for drawing a slat into canvas
25 /// \author Laurent Aphecetche
26 //-----------------------------------------------------------------------------
28 #include "AliMpSlatPainter.h"
31 #include "AliMpGraphContext.h"
33 #include "AliMpSlat.h"
35 #include "TVirtualX.h"
40 ClassImp(AliMpSlatPainter)
43 //_____________________________________________________________________________
44 AliMpSlatPainter::AliMpSlatPainter()
53 //_____________________________________________________________________________
54 AliMpSlatPainter::AliMpSlatPainter(const AliMpSlat* slat)
63 //_____________________________________________________________________________
64 AliMpSlatPainter::~AliMpSlatPainter()
71 //_____________________________________________________________________________
73 AliMpSlatPainter::GetDimensions() const
76 /// Returns the half-sizes of the slat.
78 return TVector2(fkSlat->DX(),fkSlat->DY());
81 //_____________________________________________________________________________
83 AliMpSlatPainter::GetPosition() const
86 /// Returns the (x,y) position of the slat.
88 return TVector2(fkSlat->DX(),fkSlat->DY());
91 //_____________________________________________________________________________
93 AliMpSlatPainter::Draw(Option_t* option)
98 /// If option[0] is 'P' then PCB are drawn too.
100 AliMpGraphContext *gr = AliMpGraphContext::Instance();
105 // GetPosition().Print();
106 // GetDimensions().Print();
111 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
113 AliMpPCB* pcb = fkSlat->GetPCB(i);
117 gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()),
118 TVector2(pcb->DX(),pcb->DY()));
121 DrawObject(pcb,option+1);
133 //_____________________________________________________________________________
135 AliMpSlatPainter::Paint(Option_t* /*option*/)
138 /// Paint the object.
140 AliMpGraphContext* gr = AliMpGraphContext::Instance();
142 Int_t col=gVirtualX->GetFillColor();
144 gPad->Range(0.,0.,1.,1.);
147 PaintWholeBox(kTRUE);
150 gVirtualX->SetFillColor(col);