1 #ifndef ALIMUONPAINTERHELPER_H
2 #define ALIMUONPAINTERHELPER_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
10 /// \class AliMUONPainterHelper
11 /// \brief Utility class for the painters display
13 // Author Laurent Aphecetche, Subatech
24 # include "TVector2.h"
27 #ifndef ALI_MP_PLANE_TYPE_H
28 # include "AliMpPlaneType.h"
31 #ifndef ALI_MP_CATHOD_TYPE_H
32 # include "AliMpCathodType.h"
35 #ifndef ALIMUONVPAINTER_H
36 # include "AliMUONVPainter.h"
40 # include "AliMpPad.h"
43 class AliMUONAttPainter;
44 class AliMUONPainterContour;
45 class AliMUONPainterContourMaker;
46 class AliMUONPainterEnv;
47 class AliMUONPainterPadStore;
48 class AliMUONVCalibParam;
49 class AliMUONVTrackerData;
51 class AliMpMotifPosition;
60 class AliMUONPainterHelper : public TObject
63 AliMUONPainterHelper();
64 virtual ~AliMUONPainterHelper();
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;
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;
80 Int_t ColorFromValue(Double_t value, Double_t min, Double_t max) const;
82 Int_t FindPadID(const TArrayI& pads, Double_t x, Double_t y) const;
84 AliMp::CathodType GetCathodeType(Int_t detElemId, Int_t manuId) const;
86 AliMUONPainterContour* GenerateManuContour(Int_t detElemId, Int_t manuId,
87 AliMUONAttPainter viewType,
88 const char* contourName);
90 void GetBoundaries(const TArrayI& pads, Double_t& xmin, Double_t& ymin,
91 Double_t& xmax, Double_t& ymax) const;
93 AliMUONPainterContour* GetContour(const char* contourName) const;
95 /// Return a contour by name
96 AliMUONPainterContour* GetContour(const TString& contourName) const { return GetContour(contourName.Data()); }
98 AliMUONPainterContour* GetLocalManuContour(Int_t detElemId, Int_t manuId) const;
100 AliMpMotifPosition* GetMotifPosition(Int_t detElemId, Int_t manuId) const;
102 AliMpPCB* GetPCB(Int_t detElemId, AliMp::PlaneType planeType,
103 Int_t pcbNumber) const;
105 AliMpPCB* GetPCB(Int_t detElemId, AliMp::CathodType cathodType,
106 Int_t pcbNumber) const;
108 AliMp::PlaneType GetPlaneType(Int_t manuId) const;
110 const AliMpSector* GetSector(Int_t detElemId, AliMp::PlaneType planeType) const;
112 const AliMpSlat* GetSlat(Int_t detElemId, AliMp::PlaneType planeType) const;
114 const AliMpSlat* GetSlat(Int_t detElemId, AliMp::CathodType cathodeType) const;
116 const AliMpSlat* GetSlat(Int_t detElemId, Int_t manuId) const;
118 static AliMUONPainterHelper* Instance();
120 AliMpPad PadByExplodedPosition(Int_t detElemId, Int_t manuId, Double_t x, Double_t y) const;
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;
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;
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;
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;
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;
137 AliMUONPainterContour* MergeContours(const TObjArray& contours,
138 const char* contourName);
140 virtual void Print(Option_t* opt="") const;
142 void RegisterContour(AliMUONPainterContour* contour);
144 /// Whether we were modified since our creation
145 Bool_t IsModified() const { return fIsModified; }
147 /// Set the modified flag
148 void Modified(Bool_t value=kTRUE) { fIsModified = value; }
152 /// Return the pad store
153 const AliMUONPainterPadStore& PadStore() const { return *fPadStore; }
155 TString FormatValue(const char* name, Double_t value) const;
157 /// Return the environment
158 AliMUONPainterEnv* Env() { return fEnv; }
163 AliMUONPainterHelper(const AliMUONPainterHelper&);
165 AliMUONPainterHelper& operator=(const AliMUONPainterHelper&);
167 void GenerateDefaultMatrices();
168 void GenerateGeometry();
169 void GeneratePadStore();
170 void GeneratePadStore(Int_t detElemId);
173 static AliMUONPainterHelper* fgInstance; ///< global instance
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
184 ClassDef(AliMUONPainterHelper,1) // Helper class for painters