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 /// \class AliMpSlatPainter
22 /// Class for drawing a slat into canvas
24 /// \author Laurent Aphecetche
26 #include "AliMpSlatPainter.h"
29 #include "AliMpGraphContext.h"
31 #include "AliMpSlat.h"
33 #include "TVirtualX.h"
38 ClassImp(AliMpSlatPainter)
41 //_____________________________________________________________________________
42 AliMpSlatPainter::AliMpSlatPainter()
51 //_____________________________________________________________________________
52 AliMpSlatPainter::AliMpSlatPainter(const AliMpSlat* slat)
61 //_____________________________________________________________________________
62 AliMpSlatPainter::~AliMpSlatPainter()
69 //_____________________________________________________________________________
71 AliMpSlatPainter::GetDimensions() const
74 // Returns the half-sizes of the slat.
76 return TVector2(fkSlat->DX(),fkSlat->DY());
79 //_____________________________________________________________________________
81 AliMpSlatPainter::GetPosition() const
84 // Returns the (x,y) position of the slat.
86 return TVector2(fkSlat->DX(),fkSlat->DY());
89 //_____________________________________________________________________________
91 AliMpSlatPainter::Draw(Option_t* option)
96 // If option[0] is 'P' then PCB are drawn too.
98 AliMpGraphContext *gr = AliMpGraphContext::Instance();
103 GetPosition().Print();
104 GetDimensions().Print();
109 for ( AliMpSlat::Size_t i = 0; i < fkSlat->GetSize(); ++i )
111 AliMpPCB* pcb = fkSlat->GetPCB(i);
115 gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()),
116 TVector2(pcb->DX(),pcb->DY()));
119 DrawObject(pcb,option+1);
131 //_____________________________________________________________________________
133 AliMpSlatPainter::Paint(Option_t* /*option*/)
138 AliMpGraphContext* gr = AliMpGraphContext::Instance();
140 Int_t col=gVirtualX->GetFillColor();
142 gPad->Range(0.,0.,1.,1.);
145 PaintWholeBox(kTRUE);
148 gVirtualX->SetFillColor(col);