]>
Commit | Line | Data |
---|---|---|
0145e89a | 1 | #ifndef ALIMUONVPAINTER_H |
2 | #define ALIMUONVPAINTER_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 AliMUONVPainter | |
11 | /// \brief Base class for a graphical object representing some part of the | |
12 | /// MUON tracking system | |
13 | /// | |
14 | // Author Laurent Aphecetche, Subatech | |
15 | ||
16 | #ifndef ALIMUONATTPAINTER_H | |
17 | # include "AliMUONAttPainter.h" | |
18 | #endif | |
4a3224ff | 19 | #ifndef ROOT_TQObject |
20 | # include <TQObject.h> | |
0145e89a | 21 | #endif |
22 | #ifndef ROOT_TString | |
23 | # include "TString.h" | |
24 | #endif | |
25 | #ifndef ROOT_TObject | |
26 | # include "TObject.h" | |
27 | #endif | |
28 | #ifndef AL_MP_AREA_H | |
29 | # include "AliMpArea.h" | |
30 | #endif | |
31 | #include <float.h> | |
32 | ||
33 | class AliMUONPainterContour; | |
34 | class AliMUONPainterGroup; | |
35 | class AliMUONVTrackerData; | |
36 | class AliMpArea; | |
37 | class TCollection; | |
10eb3d17 | 38 | class TH1; |
0145e89a | 39 | class TList; |
40 | class TMap; | |
41 | class TObjArray; | |
42 | class TVirtualPad; | |
43 | ||
4a3224ff | 44 | class AliMUONVPainter : public TObject, public TQObject |
0145e89a | 45 | { |
0145e89a | 46 | public: |
47 | ||
48 | AliMUONVPainter(const char* type=""); | |
49 | AliMUONVPainter(const AliMUONVPainter& rhs); | |
50 | AliMUONVPainter& operator=(const AliMUONVPainter& rhs); | |
51 | virtual ~AliMUONVPainter(); | |
52 | ||
53 | /// Add a painter to our list of children. We adopt this painter (i.e. we become owner). | |
54 | void Add(AliMUONVPainter* painter); | |
55 | ||
56 | /// Return the area containing this painter | |
57 | AliMpArea Area() const; | |
58 | ||
59 | virtual void SetAttributes(const AliMUONAttPainter& attributes); | |
60 | ||
61 | /// Convert attributes so they are valid ones for us. | |
62 | virtual AliMUONAttPainter Validate(const AliMUONAttPainter& attributes) const { return attributes; } | |
63 | ||
9016a84e | 64 | /// Get our attributes |
0145e89a | 65 | const AliMUONAttPainter& Attributes() const { return fAttributes; } |
66 | ||
67 | virtual void ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex, | |
68 | Double_t& dataMin, Double_t& dataMax) const; | |
69 | ||
70 | virtual void Copy(TObject& object) const; | |
71 | ||
72 | AliMUONVPainter* Detach() const; | |
73 | ||
49419555 | 74 | virtual Bool_t CanBeDetached() const { return kTRUE; } |
75 | ||
9016a84e | 76 | /// Whether we are valid or not |
0145e89a | 77 | virtual Bool_t IsValid() const { return fIsValid; } |
78 | ||
9016a84e | 79 | /// Mark us as not valid |
0145e89a | 80 | void Invalidate() { fIsValid = kFALSE; } |
81 | ||
82 | Int_t Depth() const; | |
83 | ||
84 | virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); | |
85 | ||
86 | virtual void Draw(Option_t* opt=""); | |
87 | ||
88 | virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py); | |
89 | ||
90 | /// Return the contour representing the outline of this object | |
91 | AliMUONPainterContour* Contour() const { return fContour; } | |
92 | ||
9016a84e | 93 | /// Get our name |
0145e89a | 94 | virtual const char* GetName() const { return Name().Data(); } |
95 | ||
9016a84e | 96 | /// Get our name |
0145e89a | 97 | virtual TString Name() const { return fName; } |
98 | ||
9016a84e | 99 | /// Get our path name (aka fullname) |
0145e89a | 100 | virtual TString PathName() const { return fPathName; } |
101 | ||
102 | virtual TString ContourName() const; | |
103 | ||
104 | virtual char* GetObjectInfo(Int_t px, Int_t py) const; | |
105 | ||
106 | void GetTypes(TObjArray& types) const; | |
107 | ||
108 | /// Return our mother group | |
109 | AliMUONPainterGroup* MotherGroup() const { return fGroup; } | |
110 | ||
111 | /// Return specific name at a given position, if needed. | |
112 | virtual TString NameAtPosition(Double_t /*x*/, Double_t /*y*/) const { return GetName(); } | |
113 | ||
114 | AliMUONPainterGroup* Group(const char* type) const; | |
115 | ||
116 | AliMUONPainterGroup* Group(Int_t depth) const; | |
117 | ||
9016a84e | 118 | /// Whether we handle mouse motion or not |
0145e89a | 119 | virtual Bool_t HandleMouseMotion() const { return kFALSE; } |
120 | ||
121 | Bool_t IsResponder() const; | |
122 | ||
123 | Bool_t IsInside(Double_t x, Double_t y) const; | |
124 | ||
125 | /// Return our mother (0 if we're the top node) | |
126 | AliMUONVPainter* Mother() const { return fMother; } | |
127 | ||
128 | virtual void Paint(Option_t* opt=""); | |
129 | ||
130 | virtual void Print(Option_t* opt="") const; | |
131 | ||
132 | /// Return the plotter group | |
133 | AliMUONPainterGroup* PlotterGroup() const { return fPlotterGroup; } | |
134 | ||
135 | /// Return the responder group | |
136 | AliMUONPainterGroup* ResponderGroup() const { return fResponderGroup; } | |
137 | ||
138 | /// Set out contour | |
139 | void SetContour(AliMUONPainterContour* contour); | |
140 | ||
141 | void SetData(const char* pattern, AliMUONVTrackerData* data, Int_t dataIndex); | |
142 | ||
143 | void SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth); | |
144 | ||
145 | /// Set our mother group | |
146 | void SetMotherGroup(AliMUONPainterGroup* group) { fGroup = group; } | |
147 | ||
148 | void SetMother(AliMUONVPainter* painter); | |
149 | ||
150 | void SetOutlined(const char* pattern, Bool_t flag); | |
151 | ||
152 | void SetResponder(const char* pattern); | |
153 | ||
154 | void SetResponder(Int_t depth); | |
155 | ||
156 | void SetVisible(const char* pattern, Bool_t flag); | |
157 | ||
158 | /// Return our type (e.g. PCB, Chamber, DE, MANU, etc...) | |
159 | const char* Type() const { return fType.Data(); } | |
160 | ||
161 | // SIGNALS | |
162 | ||
163 | void Clicked(AliMUONVPainter* painter, Double_t* pos); // *SIGNAL* | |
164 | ||
165 | void ShiftClicked(AliMUONVPainter* painter, Double_t* pos); // *SIGNAL* | |
166 | ||
167 | void DoubleClicked(AliMUONVPainter* painter, Double_t* pos); // *SIGNAL* | |
168 | ||
169 | static void PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y); | |
170 | ||
171 | virtual void PaintOutline(Int_t color=-1, Int_t width=-1, Double_t x=FLT_MAX, Double_t y=FLT_MAX); | |
172 | ||
173 | virtual void PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex, | |
174 | Double_t min, Double_t max); | |
175 | ||
9016a84e | 176 | /// Get the pad in which we are plotted |
0145e89a | 177 | TVirtualPad* Pad() const { return fPad; } |
178 | ||
9016a84e | 179 | /// Get our line color |
0145e89a | 180 | Int_t GetLineColor() const { return fLineColor; } |
181 | ||
9016a84e | 182 | /// Get our line width |
0145e89a | 183 | Int_t GetLineWidth() const { return fLineWidth; } |
184 | ||
9016a84e | 185 | /// Set our line color |
0145e89a | 186 | void SetLineColor(Int_t lineColor) { fLineColor = lineColor; } |
187 | ||
9016a84e | 188 | /// Set our line width |
0145e89a | 189 | void SetLineWidth(Int_t lineWidth) { fLineWidth = lineWidth; } |
190 | ||
9016a84e | 191 | /// Set our name |
0145e89a | 192 | void SetName(const char* name) { fName = name; } |
193 | ||
9016a84e | 194 | /// Set our path name (aka fullname) |
0145e89a | 195 | void SetPathName(const char* pathName) { fPathName = pathName; } |
196 | ||
197 | static AliMUONVPainter* CreatePainter(const char* className, | |
198 | const AliMUONAttPainter& att, | |
199 | Int_t id1, Int_t id2); | |
200 | ||
9016a84e | 201 | /// Get our first ID |
0145e89a | 202 | Int_t ID0() const { return fID[0]; } |
9016a84e | 203 | /// Get our second ID |
0145e89a | 204 | Int_t ID1() const { return fID[1]; } |
205 | ||
9016a84e | 206 | /// Set our IDs |
0145e89a | 207 | void SetID(Int_t id0, Int_t id1) { fID[0] = id0; fID[1] = id1; } |
208 | ||
209 | virtual TString Describe(const AliMUONVTrackerData& data, Int_t dataIndex, | |
210 | Double_t x=FLT_MAX, Double_t y=FLT_MAX); | |
211 | ||
212 | void UpdateGroupsFrom(const AliMUONVPainter& painter); | |
213 | ||
214 | AliMUONVPainter* Master() const; | |
215 | ||
49419555 | 216 | virtual void DrawHistogram(Double_t* values=0x0) const; |
217 | ||
218 | /// To avoid getting a popup asking for the parameter in the GUI... | |
219 | void DrawHistogram0() const { DrawHistogram(0x0); } | |
220 | void DrawHistogramClone0() const { DrawHistogramClone(0x0); } | |
221 | ||
222 | virtual void DrawHistogramClone(Double_t* values=0x0) const; | |
223 | ||
224 | virtual void DrawInternalHistogram(Int_t dim) const; | |
10eb3d17 | 225 | |
49419555 | 226 | virtual void DrawInternalHistogramClone(Int_t dim) const; |
10eb3d17 | 227 | |
49419555 | 228 | /// Append (i.e. don't have the right to clear the array !) our list of manus to manuList |
10eb3d17 | 229 | virtual void FillManuList(TObjArray& manuList) const; |
230 | ||
49419555 | 231 | /// following kind of stupid lines, because I don't know how to |
232 | /// pass parameters to TClassMenuItem for context menu (don't even | |
233 | /// know if that's possible at all) | |
234 | ||
235 | void DrawInternalHistogramClone0() { DrawInternalHistogramClone(0); } | |
236 | void DrawInternalHistogramClone1() { DrawInternalHistogramClone(1); } | |
237 | void DrawInternalHistogramClone2() { DrawInternalHistogramClone(2); } | |
238 | void DrawInternalHistogramClone3() { DrawInternalHistogramClone(3); } | |
239 | void DrawInternalHistogramClone4() { DrawInternalHistogramClone(4); } | |
240 | void DrawInternalHistogramClone5() { DrawInternalHistogramClone(5); } | |
241 | void DrawInternalHistogramClone6() { DrawInternalHistogramClone(6); } | |
242 | void DrawInternalHistogramClone7() { DrawInternalHistogramClone(7); } | |
243 | void DrawInternalHistogramClone8() { DrawInternalHistogramClone(8); } | |
244 | void DrawInternalHistogramClone9() { DrawInternalHistogramClone(9); } | |
245 | ||
0145e89a | 246 | protected: |
247 | ||
248 | virtual TCollection* Children() const; | |
10eb3d17 | 249 | |
0145e89a | 250 | private: |
49419555 | 251 | |
0145e89a | 252 | void FlatList(TList& list); |
253 | ||
254 | AliMUONPainterGroup* CreateGroup(const char* type, Int_t depth); | |
255 | ||
256 | void CreateGroups(); | |
257 | ||
258 | void GetBoundingBox(Double_t& x1, Double_t& y1, | |
259 | Double_t& x2, Double_t& y2) const; | |
260 | ||
261 | AliMUONVPainter* GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const; | |
262 | ||
263 | private: | |
264 | ||
265 | TString fName; ///< our (short) name | |
266 | TString fPathName; ///< our long name | |
267 | TString fType; ///< our type (DE, Chamber, MANU, etc...) | |
268 | AliMUONVPainter* fMother; ///< our mother | |
269 | AliMUONPainterGroup* fGroup; ///< our group | |
270 | AliMUONPainterContour* fContour; ///< our contour | |
271 | TMap* fPainterGroups; ///< map of groups | |
272 | TObjArray* fChildren; ///< our children | |
273 | AliMUONPainterGroup* fResponderGroup; ///< the responder group | |
274 | AliMUONPainterGroup* fPlotterGroup; ///< the plotter group | |
275 | Double_t fBorderFactor; ///< border factor for visu | |
276 | TVirtualPad* fPad; ///< the pad we're drawn in | |
277 | AliMUONAttPainter fAttributes; ///< our attributes (e.g. view type) | |
278 | Int_t fLineColor; ///< our outline color | |
279 | Int_t fLineWidth; ///< our outline width | |
280 | Int_t fID[2]; ///< our ids | |
281 | Bool_t fIsValid; ///< whether we were properly initialized | |
282 | ||
10eb3d17 | 283 | protected: |
4a3224ff | 284 | mutable TH1* fHistogram; //!< histogram |
10eb3d17 | 285 | |
4a3224ff | 286 | ClassDef(AliMUONVPainter,3) // Base class of a graphical object for MUON spectrometer |
0145e89a | 287 | }; |
288 | ||
289 | #endif |