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
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"
37 ClassImp(AliMpSlatPainter)
39 //_____________________________________________________________________________
40 AliMpSlatPainter::AliMpSlatPainter()
49 //_____________________________________________________________________________
50 AliMpSlatPainter::AliMpSlatPainter(const AliMpSlat* slat)
59 //______________________________________________________________________________
60 AliMpSlatPainter::AliMpSlatPainter(const AliMpSlatPainter& right)
61 : AliMpVPainter(right)
63 /// Protected copy constructor (not implemented)
65 AliFatal("Copy constructor not provided.");
68 //_____________________________________________________________________________
69 AliMpSlatPainter::~AliMpSlatPainter()
76 //______________________________________________________________________________
78 AliMpSlatPainter::operator=(const AliMpSlatPainter& right)
80 /// Protected assignement operator (not implemented)
82 // check assignement to self
83 if (this == &right) return *this;
85 AliFatal("Assignement operator not provided.");
90 //_____________________________________________________________________________
92 AliMpSlatPainter::GetDimensions() const
95 // Returns the half-sizes of the slat.
97 return TVector2(fkSlat->DX(),fkSlat->DY());
100 //_____________________________________________________________________________
102 AliMpSlatPainter::GetPosition() const
105 // Returns the (x,y) position of the slat.
107 return TVector2(fkSlat->DX(),fkSlat->DY());
110 //_____________________________________________________________________________
112 AliMpSlatPainter::Draw(Option_t* option)
117 // If option[0] is 'P' then PCB are drawn too.
119 AliMpGraphContext *gr = AliMpGraphContext::Instance();
124 GetPosition().Print();
125 GetDimensions().Print();
130 for ( AliMpSlat::Size_t i = 0; i < fkSlat->GetSize(); ++i )
132 AliMpPCB* pcb = fkSlat->GetPCB(i);
136 gr->SetPadPosForReal(TVector2(pcb->X(),pcb->Y()),
137 TVector2(pcb->DX(),pcb->DY()));
140 DrawObject(pcb,option+1);
152 //_____________________________________________________________________________
154 AliMpSlatPainter::Paint(Option_t* /*option*/)
159 AliMpGraphContext* gr = AliMpGraphContext::Instance();
161 Int_t col=gVirtualX->GetFillColor();
163 gPad->Range(0.,0.,1.,1.);
166 PaintWholeBox(kTRUE);
169 gVirtualX->SetFillColor(col);