]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPainterHelper.h
RAW QA only for calibration events
[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 #ifndef ROOT_TMap
44 #  include "TMap.h"
45 #endif
46
47 class AliMUONAttPainter;
48 class AliMUONContour;
49 class AliMUONPainterEnv;
50 class AliMUONVCalibParam;
51 class AliMUONVTrackerData;
52 class AliMpExMap;
53 class AliMpMotifPosition;
54 class AliMpPCB;
55 class AliMpSector;
56 class AliMpSlat;
57 class TArrayI;
58 class TList;
59 class TMap;
60 class TObjArray;
61
62 class AliMUONPainterHelper : public TObject
63 {
64 public:
65   AliMUONPainterHelper();
66   virtual ~AliMUONPainterHelper();
67     
68   TString ChamberName(Int_t chamberId) const;
69   TString StationName(Int_t stationId) const;
70   TString DEName(Int_t detElemId) const;
71   TString ManuName(Int_t manuId) const;
72   TString BusPatchName(Int_t busPatchId) const;
73   TString PCBName(Int_t pcbNumber) const;
74
75   TString ChamberPathName(Int_t chamberId) const;
76   TString StationPathName(Int_t stationId) const;
77   TString DEPathName(Int_t detElemId) const;
78   TString ManuPathName(Int_t detElemId, Int_t manuId) const;
79   TString BusPatchPathName(Int_t busPatchId) const;
80   TString PCBPathName(Int_t detElemId, Int_t pcbNumber) const;
81   
82   Int_t ColorFromValue(Double_t value, Double_t min, Double_t max) const;
83   
84   AliMp::CathodType GetCathodeType(Int_t detElemId, Int_t manuId) const;
85
86   AliMUONContour* GenerateManuContour(Int_t detElemId, Int_t manuId,
87                                              AliMUONAttPainter viewType,
88                                              const char* contourName);
89
90   AliMUONContour* GetContour(const char* contourName) const;
91
92   /// Return a contour by name
93   AliMUONContour* GetContour(const TString& contourName) const { return GetContour(contourName.Data()); }
94
95   AliMpMotifPosition* GetMotifPosition(Int_t detElemId, Int_t manuId) const;
96   
97   AliMpPCB* GetPCB(Int_t detElemId, AliMp::PlaneType planeType, 
98                    Int_t pcbNumber) const;
99
100   AliMpPCB* GetPCB(Int_t detElemId, AliMp::CathodType cathodType,
101                    Int_t pcbNumber) const;
102
103   AliMp::PlaneType GetPlaneType(Int_t manuId) const;
104   
105   const AliMpSector* GetSector(Int_t detElemId, AliMp::PlaneType planeType) const;
106     
107   const AliMpSlat* GetSlat(Int_t detElemId, AliMp::PlaneType planeType) const;
108
109   const AliMpSlat* GetSlat(Int_t detElemId, AliMp::CathodType cathodeType) const;
110
111   const AliMpSlat* GetSlat(Int_t detElemId, Int_t manuId) const;
112
113   static AliMUONPainterHelper* Instance();
114
115   AliMpPad PadByExplodedPosition(Int_t detElemId, Int_t manuId, Double_t x, Double_t y) const;
116   
117   void Exploded2Real(Int_t detElemId, Double_t xe, Double_t ye, Double_t ze,
118                      Double_t& xr, Double_t& yr, Double_t& zr) const;
119   
120   void Local2Global(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
121                     Double_t& xg, Double_t& yg, Double_t& zg) const;
122
123   void Local2GlobalReal(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
124                         Double_t& xg, Double_t& yg, Double_t& zg) const;
125
126   void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
127                      Double_t& xl, Double_t& yl, Double_t& zl) const;
128
129   void Global2LocalReal(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
130                         Double_t& xl, Double_t& yl, Double_t& zl) const;
131
132   AliMUONContour* MergeContours(const TObjArray& contours, 
133                                        const char* contourName);
134   
135   virtual void Print(Option_t* opt="") const;
136   
137   void RegisterContour(AliMUONContour* contour);
138   
139   TString FormatValue(const char* name, Double_t value) const;
140   
141   /// Return the environment
142   AliMUONPainterEnv* Env() { return fEnv; }
143   
144 private:
145     
146   /// Not implemented
147   AliMUONPainterHelper(const AliMUONPainterHelper&);
148   /// Not implemented
149   AliMUONPainterHelper& operator=(const AliMUONPainterHelper&);
150   
151   void GenerateDefaultMatrices();
152   void GenerateGeometry();
153
154 private:
155   static AliMUONPainterHelper* fgInstance; ///< global instance
156   
157   Double_t fExplodeFactor[2]; ///< explosing factors for representation
158   AliMpExMap* fExplodedGlobalTransformations; ///< global geometric transformations (exploded)
159   AliMpExMap* fRealGlobalTransformations; ///< global geometric transformations (real)
160   TObjArray* fPainterMatrices; ///< default matrices
161   AliMUONPainterEnv* fEnv; ///< resources
162   TMap fAllContours; ///< all contours
163   
164   ClassDef(AliMUONPainterHelper,2) // Helper class for painters
165 };
166
167 #endif