]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpGraphContext.h
Adding new option to get the DE by its name (moreover to get it by its ID).
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpGraphContext.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 // $Id$
5 // $MpId: AliMpGraphContext.h,v 1.11 2006/05/24 13:58:13 ivana Exp $
6
7 /// \ingroup graphics
8 /// \class AliMpGraphContext
9 /// \brief Class describing the correspondance between a given area
10 /// in pad, and a zone of real (cm) position
11 ///
12 /// \author David GUEZ, IPN Orsay
13
14 #ifndef ALI_MP_GRAPH_CONTEXT_H
15 #define ALI_MP_GRAPH_CONTEXT_H
16
17 #include <TObject.h>
18
19 #include "AliMpContainers.h"
20
21 #include <TVector2.h>
22 #ifdef WITH_ROOT
23 #include "AliMpExMap.h"
24 #endif
25
26 #ifdef WITH_STL
27 #include <vector>
28 #endif
29
30 class MPainter;
31
32 class AliMpGraphContext : public TObject
33 {
34  public:
35 #ifdef WITH_STL
36   /// GraphContextVector type
37   typedef std::vector<AliMpGraphContext*> GraphContextVector;
38 #endif
39 #ifdef WITH_ROOT
40   /// GraphContextVector type
41   typedef TObjArray GraphContextVector;
42 #endif
43
44  public:
45   void Push() const;
46   void Pop();
47   static AliMpGraphContext *Instance();
48
49   //
50   // set methods
51   //
52            /// Set position of the pad area where to draw
53   void SetPadPosition(const TVector2 &position){fPadPosition=position;}
54            /// Set dimensions of the pad area where to draw
55   void SetPadDimensions(const TVector2 &dimensions){fPadDimensions=dimensions;}
56            /// Set position of the real area where to draw
57   void SetRealPosition(const TVector2 &position){fRealPosition=position;}
58            /// Set dimensions of the real area where to draw
59   void SetRealDimensions(const TVector2 &dimensions){fRealDimensions=dimensions;}
60            /// Set color to use
61   void SetColor(Int_t color){fColor=color;}
62
63   //
64   // get methods
65   //
66
67            /// Return position of the pad area where to draw
68   TVector2 GetPadPosition() const {return fPadPosition;}
69            /// Return dimensions of the pad area where to draw
70   TVector2 GetPadDimensions() const {return fPadDimensions;}
71            /// Return position of the real area where to draw
72   TVector2 GetRealPosition() const{return fRealPosition;}
73            /// Return dimensions of the real area where to draw
74   TVector2 GetRealDimensions() const{return fRealDimensions;}
75            /// Return color to use
76   Int_t GetColor() const {return fColor;}
77
78   //methods
79   TVector2 RealToPad(const TVector2 &position) const;
80   void RealToPad(const TVector2 &position
81                  ,const TVector2 &dimensions,
82                  TVector2 &padPosition,
83                  TVector2 &padDimensions) const;
84   void SetPadPosForReal(const TVector2 &position,const TVector2 &dimensions);
85
86  protected:
87   AliMpGraphContext(const AliMpGraphContext& right);
88   AliMpGraphContext&  operator = (const AliMpGraphContext& right);
89
90  private:
91   //private constructor (not instanciable from outside)
92   AliMpGraphContext();
93
94   ///< static data members
95   static AliMpGraphContext *fgInstance; ///< the global instance
96   static GraphContextVector fgStack;    ///< the object stack
97 #ifdef WITH_ROOT
98   static Int_t fgStackSize;  ///< the object stack size
99 #endif
100
101   //data members
102   Int_t    fColor;          ///< color to use
103   TVector2 fPadPosition;    ///< Position of the pad area where to draw
104   TVector2 fPadDimensions;  ///< Dimensions of the pad area where to draw
105
106   TVector2 fRealPosition;   ///< Position of the real area to draw
107   TVector2 fRealDimensions; ///< Dimensions of the real area to draw
108
109   ClassDef(AliMpGraphContext,1) // Correspondance pad area/real world
110 };
111
112 #endif //ALI_MP_GRAPH_CONTEXT_H
113
114