]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONPainterHelper.h
First big commit of the mchview program and its accompanying library,
[u/mrichter/AliRoot.git] / MUON / AliMUONPainterHelper.h
CommitLineData
0145e89a 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
43class AliMUONAttPainter;
44class AliMUONPainterContour;
45class AliMUONPainterContourMaker;
46class AliMUONPainterEnv;
47class AliMUONPainterPadStore;
48class AliMUONVCalibParam;
49class AliMUONVTrackerData;
50class AliMpExMap;
51class AliMpMotifPosition;
52class AliMpPCB;
53class AliMpSector;
54class AliMpSlat;
55class TArrayI;
56class TList;
57class TMap;
58class TObjArray;
59
60class AliMUONPainterHelper : public TObject
61{
62public:
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 AliMUONPainterContour* GetContour(const TString& contourName) const { return GetContour(contourName.Data()); }
96
97 AliMUONPainterContour* GetLocalManuContour(Int_t detElemId, Int_t manuId) const;
98
99 AliMpMotifPosition* GetMotifPosition(Int_t detElemId, Int_t manuId) const;
100
101 AliMpPCB* GetPCB(Int_t detElemId, AliMp::PlaneType planeType,
102 Int_t pcbNumber) const;
103
104 AliMpPCB* GetPCB(Int_t detElemId, AliMp::CathodType cathodType,
105 Int_t pcbNumber) const;
106
107 AliMp::PlaneType GetPlaneType(Int_t manuId) const;
108
109 const AliMpSector* GetSector(Int_t detElemId, AliMp::PlaneType planeType) const;
110
111 const AliMpSlat* GetSlat(Int_t detElemId, AliMp::PlaneType planeType) const;
112
113 const AliMpSlat* GetSlat(Int_t detElemId, AliMp::CathodType cathodeType) const;
114
115 const AliMpSlat* GetSlat(Int_t detElemId, Int_t manuId) const;
116
117 static AliMUONPainterHelper* Instance();
118
119 AliMpPad PadByExplodedPosition(Int_t detElemId, Int_t manuId, Double_t x, Double_t y) const;
120
121 void Exploded2Real(Int_t detElemId, Double_t xe, Double_t ye, Double_t ze,
122 Double_t& xr, Double_t& yr, Double_t& zr) const;
123
124 void Local2Global(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
125 Double_t& xg, Double_t& yg, Double_t& zg) const;
126
127 void Local2GlobalReal(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
128 Double_t& xg, Double_t& yg, Double_t& zg) const;
129
130 void Global2Local(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
131 Double_t& xl, Double_t& yl, Double_t& zl) const;
132
133 void Global2LocalReal(Int_t detElemId, Double_t xg, Double_t yg, Double_t zg,
134 Double_t& xl, Double_t& yl, Double_t& zl) const;
135
136 AliMUONPainterContour* MergeContours(const TObjArray& contours,
137 const char* contourName);
138
139 virtual void Print(Option_t* opt="") const;
140
141 void RegisterContour(AliMUONPainterContour* contour);
142
143 /// Whether we were modified since our creation
144 Bool_t IsModified() const { return fIsModified; }
145
146 /// Set the modified flag
147 void Modified(Bool_t value=kTRUE) { fIsModified = value; }
148
149 void Save();
150
151 const AliMUONPainterPadStore& PadStore() const { return *fPadStore; }
152
153 TString FormatValue(const char* name, Double_t value) const;
154
155 AliMUONPainterEnv* Env() { return fEnv; }
156
157private:
158
159 /// Not implemented
160 AliMUONPainterHelper(const AliMUONPainterHelper&);
161 /// Not implemented
162 AliMUONPainterHelper& operator=(const AliMUONPainterHelper&);
163
164 void GenerateDefaultMatrices();
165 void GenerateGeometry();
166 void GeneratePadStore();
167 void GeneratePadStore(Int_t detElemId);
168
169private:
170 static AliMUONPainterHelper* fgInstance; ///< global instance
171
172 AliMUONPainterPadStore* fPadStore; ///< the pad store
173 Double_t fExplodeFactor[2]; ///< explosing factors for representation
174 AliMpExMap* fExplodedGlobalTransformations; ///< global geometric transformations (exploded)
175 AliMpExMap* fRealGlobalTransformations; ///< global geometric transformations (real)
176 Bool_t fIsModified; ///< whether we've been modified since creation
177 mutable AliMUONPainterContourMaker* fContourMaker; ///< the contour builder
178 TObjArray* fPainterMatrices; ///< default matrices
179 AliMUONPainterEnv* fEnv; ///< resources
180
181 ClassDef(AliMUONPainterHelper,1) // Helper class for painters
182};
183
184#endif