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()
47 //_____________________________________________________________________________
48 AliMpSlatPainter::AliMpSlatPainter(const AliMpSlat* slat)
56 //_____________________________________________________________________________
57 AliMpSlatPainter::~AliMpSlatPainter()
64 //_____________________________________________________________________________
66 AliMpSlatPainter::GetDimensions() const
69 // Returns the half-sizes of the slat.
71 return TVector2(fkSlat->DX(),fkSlat->DY());
74 //_____________________________________________________________________________
76 AliMpSlatPainter::GetPosition() const
79 // Returns the (x,y) position of the slat.
81 return TVector2(fkSlat->DX(),fkSlat->DY());
84 //_____________________________________________________________________________
86 AliMpSlatPainter::Draw(Option_t* option)
91 // If option[0] is 'P' then PCB are drawn too.
93 AliMpGraphContext *gr = AliMpGraphContext::Instance();
98 GetPosition().Print();
99 GetDimensions().Print();
104 for ( AliMpSlat::Size_t i = 0; i < fkSlat->GetSize(); ++i )
106 AliMpPCB* pcb = fkSlat->GetPCB(i);
110 gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()),
111 TVector2(pcb->DX(),pcb->DY()));
114 DrawObject(pcb,option+1);
126 //_____________________________________________________________________________
128 AliMpSlatPainter::Paint(Option_t* /*option*/)
133 AliMpGraphContext* gr = AliMpGraphContext::Instance();
135 Int_t col=gVirtualX->GetFillColor();
137 gPad->Range(0.,0.,1.,1.);
140 PaintWholeBox(kTRUE);
143 gVirtualX->SetFillColor(col);