AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpRowPainter.cxx
Go to the documentation of this file.
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 
16 // $Id$
17 // $MpId: AliMpRowPainter.cxx,v 1.8 2006/05/24 13:58:32 ivana Exp $
18 // Category: graphics
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpRowPainter
22 // ---------------------
23 // Class for drawing a row into canvas
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, IPN Orsay
26 //-----------------------------------------------------------------------------
27 
28 #include "AliMpRowPainter.h"
29 #include "AliMpGraphContext.h"
30 #include "AliMpRow.h"
31 #include "AliMpRowSegment.h"
32 
33 #include <TVirtualX.h>
34 #include <TPad.h>
35 
39 
40 //_______________________________________________________________________
42  : AliMpVPainter(),
43  fRow(0)
44 {
46 }
47 
48 //_______________________________________________________________________
50  : AliMpVPainter(),
51  fRow(row)
52 {
54 }
55 
56 //_______________________________________________________________________
58 {
60 }
61 
62 //_______________________________________________________________________
64 {
66 
67  fRow->Dump();
68 }
69 
70 //_______________________________________________________________________
72 {
74 
75  return TVector2(fRow->GetPositionX(), fRow->GetPositionY());
76 }
77 
78 //_______________________________________________________________________
80 {
82 
83  return TVector2(fRow->GetDimensionX(), fRow->GetDimensionY());
84 }
85 
86 //_______________________________________________________________________
87 void AliMpRowPainter::Draw(Option_t *option)
88 {
96 
98  if( !fRow) return;
99 
100  gr->Push();
102 
103  switch (option[0]){
104  case 'S':
105  {
106  for (Int_t iRowSeg=0;iRowSeg<fRow->GetNofRowSegments();++iRowSeg){
107  AliMpVRowSegment *rowSegment = fRow->GetRowSegment(iRowSeg);
108  gr->Push();
109 
110  gr->SetPadPosForReal(TVector2(rowSegment->GetPositionX(),rowSegment->GetPositionY()),
111  TVector2(rowSegment->GetDimensionX(),rowSegment->GetDimensionY()));
112  DrawObject(rowSegment,option+1);
113 
114  gr->Pop();
115  }
116  }
117  break;
118  default: AppendPad(option);
119  }
120  gr->Pop();
121 }
122 
123 //_______________________________________________________________________
124 void AliMpRowPainter::Paint(Option_t *option)
125 {
127 
129  if( !fRow) return;
130  Int_t col=gVirtualX->GetFillColor();
131  gr->Push();
132  gPad->Range(0.,0.,1.,1.);
133  InitGraphContext();
134  PaintWholeBox(kTRUE);
135 
136  if (option[0]=='T'){
137  Float_t textSize = gVirtualX->GetTextSize();
138  gVirtualX->SetTextSize(12);
139  gPad->PaintText(GetPadPosition().X()-0.01,GetPadPosition().Y()-0.01,
140  Form("%d",fRow->GetID()));
141  gVirtualX->SetTextSize(textSize);
142  }
143 
144 
145  gr->Pop();
146  gVirtualX->SetFillColor(col);
147 }
virtual ~AliMpRowPainter()
UInt_t GetID() const
Return row ID.
Definition: AliMpRow.h:83
Double_t GetPositionX() const
Definition: AliMpRow.cxx:338
virtual Double_t GetDimensionX() const =0
Return the x dimension of the row segment centre.
Class for drawing a row into canvas.
Double_t GetPositionY() const
Definition: AliMpRow.cxx:347
static AliMpGraphContext * Instance()
void SetPadPosForReal(const TVector2 &position, const TVector2 &dimensions)
Double_t GetDimensionY() const
Definition: AliMpRow.cxx:364
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
An interface for a row segment.
Double_t GetDimensionX() const
Definition: AliMpRow.cxx:355
AliMpVRowSegment * GetRowSegment(Int_t i) const
Definition: AliMpRow.cxx:433
virtual Double_t GetPositionX() const =0
Return the x position of the row segment centre.
virtual Double_t GetPositionY() const =0
Return the y position of the row segment centre.
TGraph * gr
Definition: CalibTime.C:25
Abstract base class for drawing objects into canvas.
Definition: AliMpVPainter.h:21
virtual void Paint(Option_t *option)
Paint the associated object.
A row composed of the row segments.
Definition: AliMpRow.h:26
void PaintWholeBox(Bool_t fill=kTRUE)
virtual Double_t GetDimensionY() const =0
Return the y dimension of the row segment centre.
virtual TVector2 GetPosition() const
Return the owned object's position.
AliMpVPainter * DrawObject(TObject *object, Option_t *option="")
Not implemented.
virtual void DumpObject()
TVector2 GetPadPosition() const
Return the position inside the graphics pad.
Definition: AliMpVPainter.h:37
Int_t GetNofRowSegments() const
Definition: AliMpRow.cxx:425
AliMpRow * fRow
the row to paint
Class describing the correspondance between a given area in pad, and a zone of real (cm) position...
void InitGraphContext()
virtual TVector2 GetDimensions() const
Return the owned object's dimensions.
virtual void Draw(Option_t *option)