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