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