]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPainterHelper.h
introducing SDD, SSD layer misal (Andrea Dainese)
[u/mrichter/AliRoot.git] / MUON / AliMUONPainterHelper.h
1 #ifndef ALIMUONPAINTERHELPER_H
2 #define ALIMUONPAINTERHELPER_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice                               */
6
7 // $Id$
8
9 /// \ingroup graphics
10 /// \class AliMUONPainterHelper
11 /// \brief Utility class for the painters display
12 /// 
13 // Author Laurent Aphecetche, Subatech
14
15 #ifndef ROOT_TObject
16 #  include "TObject.h"
17 #endif
18
19 #ifndef ROOT_TString
20 #  include "TString.h"
21 #endif
22
23 #ifndef ROOT_TVector2
24 #  include "TVector2.h"
25 #endif
26
27 #ifndef ALI_MP_PLANE_TYPE_H
28 #  include "AliMpPlaneType.h"
29 #endif
30
31 #ifndef ALI_MP_CATHOD_TYPE_H
32 #  include "AliMpCathodType.h"
33 #endif
34
35 #ifndef ALIMUONVPAINTER_H
36 #  include "AliMUONVPainter.h"
37 #endif
38
39 #ifndef ALI_MP_PAD_H
40 #  include "AliMpPad.h"
41 #endif
42
43 class AliMUONAttPainter;
44 class AliMUONPainterContour;
45 class AliMUONPainterContourMaker;
46 class AliMUONPainterEnv;
47 class AliMUONPainterPadStore;
48 class AliMUONVCalibParam;
49 class AliMUONVTrackerData;
50 class AliMpExMap;
51 class AliMpMotifPosition;
52 class AliMpPCB;
53 class AliMpSector;
54 class AliMpSlat;
55 class TArrayI;
56 class TList;
57 class TMap;
58 class TObjArray;
59
60 class AliMUONPainterHelper : public TObject
61 {
62 public:
63   AliMUONPainterHelper();
64   virtual ~AliMUONPainterHelper();
65     
66   TString ChamberName(Int_t chamberId) const;
67   TString StationName(Int_t stationId) const;
68   TString DEName(Int_t detElemId) const;
69   TString ManuName(Int_t manuId) const;
70   TString BusPatchName(Int_t busPatchId) const;
71   TString PCBName(Int_t pcbNumber) const;
72
73   TString ChamberPathName(Int_t chamberId) const;
74   TString StationPathName(Int_t stationId) const;
75   TString DEPathName(Int_t detElemId) const;
76   TString ManuPathName(Int_t detElemId, Int_t manuId) const;
77   TString BusPatchPathName(Int_t busPatchId) const;
78   TString PCBPathName(Int_t detElemId, Int_t pcbNumber) const;
79   
80   Int_t ColorFromValue(Double_t value, Double_t min, Double_t max) const;
81   
82   Int_t FindPadID(const TArrayI& pads, Double_t x, Double_t y) const;
83     
84   AliMp::CathodType GetCathodeType(Int_t detElemId, Int_t manuId) const;
85
86   AliMUONPainterContour* GenerateManuContour(Int_t detElemId, Int_t manuId,
87                                              AliMUONAttPainter viewType,
88                                              const char* contourName);
89
90   void GetBoundaries(const TArrayI& pads, Double_t& xmin, Double_t& ymin,
91                      Double_t& xmax, Double_t& ymax) const;
92
93   AliMUONPainterContour* GetContour(const char* contourName) const;
94
95   /// Return a contour by name
96   AliMUONPainterContour* GetContour(const TString& contourName) const { return GetContour(contourName.Data()); }
97
98   AliMUONPainterContour* GetLocalManuContour(Int_t detElemId, Int_t manuId) const;
99
100   AliMpMotifPosition* GetMotifPosition(Int_t detElemId, Int_t manuId) const;
101   
102   AliMpPCB* GetPCB(Int_t detElemId, AliMp::PlaneType planeType, 
103                    Int_t pcbNumber) const;
104
105   AliMpPCB* GetPCB(Int_t detElemId, AliMp::CathodType cathodType,
106                    Int_t pcbNumber) const;
107
108   AliMp::PlaneType GetPlaneType(Int_t manuId) const;
109   
110   const AliMpSector* GetSector(Int_t detElemId, AliMp::PlaneType planeType) const;
111     
112   const AliMpSlat* GetSlat(Int_t detElemId, AliMp::PlaneType planeType) const;
113
114   const AliMpSlat* GetSlat(Int_t detElemId, AliMp::CathodType cathodeType) const;
115
116   const AliMpSlat* GetSlat(Int_t detElemId, Int_t manuId) const;
117
118   static AliMUONPainterHelper* Instance();
119
120   AliMpPad PadByExplodedPosition(Int_t detElemId, Int_t manuId, Double_t x, Double_t y) const;
121   
122   void Exploded2Real(Int_t detElemId, Double_t xe, Double_t ye, Double_t ze,
123                      Double_t& xr, Double_t& yr, Double_t& zr) const;
124   
125   void Local2Global(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
126                     Double_t& xg, Double_t& yg, Double_t& zg) const;
127
128   void Local2GlobalReal(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
129                         Double_t& xg, Double_t& yg, Double_t& zg) const;
130
131   void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
132                      Double_t& xl, Double_t& yl, Double_t& zl) const;
133
134   void Global2LocalReal(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
135                         Double_t& xl, Double_t& yl, Double_t& zl) const;
136
137   AliMUONPainterContour* MergeContours(const TObjArray& contours, 
138                                        const char* contourName);
139   
140   virtual void Print(Option_t* opt="") const;
141   
142   void RegisterContour(AliMUONPainterContour* contour);
143   
144   /// Whether we were modified since our creation
145   Bool_t IsModified() const { return fIsModified; }
146   
147   /// Set the modified flag
148   void Modified(Bool_t value=kTRUE) { fIsModified = value; }
149
150   void Save();
151   
152   /// Return the pad store
153   const AliMUONPainterPadStore& PadStore() const { return *fPadStore; }
154   
155   TString FormatValue(const char* name, Double_t value) const;
156   
157   /// Return the environment
158   AliMUONPainterEnv* Env() { return fEnv; }
159   
160 private:
161     
162   /// Not implemented
163   AliMUONPainterHelper(const AliMUONPainterHelper&);
164   /// Not implemented
165   AliMUONPainterHelper& operator=(const AliMUONPainterHelper&);
166   
167   void GenerateDefaultMatrices();
168   void GenerateGeometry();
169   void GeneratePadStore();
170   void GeneratePadStore(Int_t detElemId);  
171
172 private:
173   static AliMUONPainterHelper* fgInstance; ///< global instance
174   
175   AliMUONPainterPadStore* fPadStore; ///< the pad store
176   Double_t fExplodeFactor[2]; ///< explosing factors for representation
177   AliMpExMap* fExplodedGlobalTransformations; ///< global geometric transformations (exploded)
178   AliMpExMap* fRealGlobalTransformations; ///< global geometric transformations (real)
179   Bool_t fIsModified; ///< whether we've been modified since creation
180   mutable AliMUONPainterContourMaker* fContourMaker; ///< the contour builder
181   TObjArray* fPainterMatrices; ///< default matrices
182   AliMUONPainterEnv* fEnv; ///< resources
183   
184   ClassDef(AliMUONPainterHelper,1) // Helper class for painters
185 };
186
187 #endif