]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpRowSegmentPainter.cxx
Separating run-dependent mapping data from data, which are not
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRowSegmentPainter.cxx
CommitLineData
dee1d5f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
5f91c9e8 16// $Id$
13985652 17// $MpId: AliMpRowSegmentPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
5f91c9e8 18// Category: graphics
3d1463c8 19
20//-----------------------------------------------------------------------------
5f91c9e8 21// Class AliMpRowSegmentPainter
22// ----------------------------
23// Class for drawing a motif into canvas
dbe945cc 24// Included in AliRoot: 2003/05/02
5f91c9e8 25// Authors: David Guez, IPN Orsay
3d1463c8 26//-----------------------------------------------------------------------------
5f91c9e8 27
28#include "AliMpRowSegmentPainter.h"
29#include "AliMpGraphContext.h"
30#include "AliMpVRowSegment.h"
31#include "AliMpRow.h"
32#include "AliMpMotifMap.h"
33#include "AliMpMotifPosition.h"
34
2c605e66 35#include <TVirtualX.h>
36#include <TPad.h>
37
13985652 38/// \cond CLASSIMP
5f91c9e8 39ClassImp(AliMpRowSegmentPainter)
13985652 40/// \endcond
5f91c9e8 41
42//_______________________________________________________________________
43AliMpRowSegmentPainter::AliMpRowSegmentPainter()
44 : AliMpVPainter(),
45 fRowSegment(0)
46{
dee1d5f1 47 /// Default constructor
5f91c9e8 48}
fb1bf5c0 49
5f91c9e8 50//_______________________________________________________________________
51AliMpRowSegmentPainter::AliMpRowSegmentPainter(AliMpVRowSegment *row)
52 : AliMpVPainter(),
53 fRowSegment(row)
54{
dee1d5f1 55 /// Standard constructor
5f91c9e8 56
57}
fb1bf5c0 58
5f91c9e8 59//_______________________________________________________________________
2998a151 60AliMpRowSegmentPainter::~AliMpRowSegmentPainter()
61{
dee1d5f1 62 /// Destructor
2998a151 63}
fb1bf5c0 64
2998a151 65//_______________________________________________________________________
5f91c9e8 66TVector2 AliMpRowSegmentPainter::GetPosition() const
67{
dee1d5f1 68/// Get the owned object's position
5f91c9e8 69
dee1d5f1 70 return fRowSegment->Position();
5f91c9e8 71}
dee1d5f1 72
5f91c9e8 73//_______________________________________________________________________
74TVector2 AliMpRowSegmentPainter::GetDimensions() const
75{
dee1d5f1 76/// Get the owned object's dimensions
5f91c9e8 77
dee1d5f1 78 return fRowSegment->Dimensions();
5f91c9e8 79}
80
81//_______________________________________________________________________
82void AliMpRowSegmentPainter::DumpObject()
83{
dee1d5f1 84/// Draw the owned object
5f91c9e8 85
dee1d5f1 86 fRowSegment->Dump();
5f91c9e8 87}
88
89//_______________________________________________________________________
90void AliMpRowSegmentPainter::Draw(Option_t *option)
91{
dee1d5f1 92/// Draw the sector on the current pad
13985652 93/// The first letter of \a option is treated as follows:
dee1d5f1 94/// - case "S" : each row segments are drawn separately
95/// - case "" : the whole row is drawn at once
96/// in both cases, the rest of the option is passed
97/// as argument to the Draw function of respectively
98/// zone or row objects.
99
5f91c9e8 100 AliMpGraphContext *gr = AliMpGraphContext::Instance();
101 if( !fRowSegment) return;
102
103 gr->Push();
104 InitGraphContext();
105 switch (option[0]){
106 case 'M':
107 {
108
109 for (Int_t iMotif=0;iMotif<fRowSegment->GetNofMotifs();++iMotif){
110 gr->Push();
111
112 Int_t motifPositionId = fRowSegment->GetMotifPositionId(iMotif);
113 AliMpMotifPosition *motifPos =
114 fRowSegment->GetRow()->GetMotifMap()
115 ->FindMotifPosition(motifPositionId);
116
117 gr->SetPadPosForReal(motifPos->Position(),motifPos->Dimensions());
118 gr->SetColor(GetColor());
119 DrawObject(motifPos,option+1);
120
121 gr->Pop();
122 }
123 }
124 break;
125 default: AppendPad(option);
126 }
127 gr->Pop();
128}
129
130
131//_______________________________________________________________________
2998a151 132void AliMpRowSegmentPainter::Paint(Option_t* /*option*/)
5f91c9e8 133{
dee1d5f1 134/// Paint the object
135
5f91c9e8 136 AliMpGraphContext *gr = AliMpGraphContext::Instance();
137 if (!fRowSegment) return;
138 Int_t col=gVirtualX->GetFillColor();
139 gr->Push();
140 gPad->Range(0.,0.,1.,1.);
141 InitGraphContext();
142 PaintWholeBox(kTRUE);
143
144// Float_t textSize = gVirtualX->GetTextSize();
145// if (option[0]=='T')
146// gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
147// Form("%d",fRowSegment->GetMotif()->GetID()));
148// gVirtualX->SetTextSize(textSize);
149 gr->Pop();
150 gVirtualX->SetFillColor(col);
151}