]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONVPainter.h
Fixing (most of) compiler warnings
[u/mrichter/AliRoot.git] / MUON / AliMUONVPainter.h
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
19 #ifndef ROOT_TQObject
20 #  include <TQObject.h>
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;
38 class TH1;
39 class TList;
40 class TMap;
41 class TObjArray;
42 class TVirtualPad;
43
44 class AliMUONVPainter : public TObject, public TQObject
45 {
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   
64   /// Get our attributes
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   
74   /// Whether we are valid or not
75   virtual Bool_t IsValid() const { return fIsValid; }
76   
77   /// Mark us as not valid
78   void Invalidate() { fIsValid = kFALSE; }
79   
80   Int_t Depth() const;
81   
82   virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
83   
84   virtual void Draw(Option_t* opt="");
85   
86   virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
87   
88   /// Return the contour representing the outline of this object
89   AliMUONPainterContour* Contour() const { return fContour; }
90
91   /// Get our name
92   virtual const char* GetName() const { return Name().Data(); }
93   
94   /// Get our name
95   virtual TString Name() const { return fName; }
96   
97   /// Get our path name (aka fullname)
98   virtual TString PathName() const { return fPathName; }
99   
100   virtual TString ContourName() const;
101
102   virtual char* GetObjectInfo(Int_t px, Int_t py) const;
103   
104   void GetTypes(TObjArray& types) const;
105
106   /// Return our mother group
107   AliMUONPainterGroup* MotherGroup() const { return fGroup; }
108   
109   /// Return specific name at a given position, if needed.
110   virtual TString NameAtPosition(Double_t /*x*/, Double_t /*y*/) const { return GetName(); }
111   
112   AliMUONPainterGroup* Group(const char* type) const;
113   
114   AliMUONPainterGroup* Group(Int_t depth) const;
115   
116   /// Whether we handle mouse motion or not
117   virtual Bool_t HandleMouseMotion() const { return kFALSE; }
118   
119   Bool_t IsResponder() const;
120   
121   Bool_t IsInside(Double_t x, Double_t y) const;
122
123   /// Return our mother (0 if we're the top node)
124   AliMUONVPainter* Mother() const { return fMother; }
125
126   virtual void Paint(Option_t* opt="");
127
128   virtual void Print(Option_t* opt="") const;
129
130   /// Return the plotter group
131   AliMUONPainterGroup* PlotterGroup() const { return fPlotterGroup; }
132   
133   /// Return the responder group
134   AliMUONPainterGroup* ResponderGroup() const { return fResponderGroup; }
135
136   /// Set out contour
137   void SetContour(AliMUONPainterContour* contour);
138   
139   void SetData(const char* pattern, AliMUONVTrackerData* data, Int_t dataIndex);
140
141   void SetLine(Int_t depth, Int_t lineColor, Int_t lineWidth);
142   
143   /// Set our mother group
144   void SetMotherGroup(AliMUONPainterGroup* group) { fGroup = group; }
145   
146   void SetMother(AliMUONVPainter* painter);
147   
148   void SetOutlined(const char* pattern, Bool_t flag);
149   
150   void SetResponder(const char* pattern);
151   
152   void SetResponder(Int_t depth);
153   
154   void SetVisible(const char* pattern, Bool_t flag);
155   
156   /// Return our type (e.g. PCB, Chamber, DE, MANU, etc...)
157   const char* Type() const { return fType.Data(); }
158
159   // SIGNALS
160   
161   void Clicked(AliMUONVPainter* painter, Double_t* pos); // *SIGNAL*
162
163   void ShiftClicked(AliMUONVPainter* painter, Double_t* pos); // *SIGNAL*
164
165   void DoubleClicked(AliMUONVPainter* painter, Double_t* pos); // *SIGNAL*
166     
167   static void PixelToPad(Int_t px, Int_t py, Double_t& x, Double_t& y);
168
169   virtual void PaintOutline(Int_t color=-1, Int_t width=-1, Double_t x=FLT_MAX, Double_t y=FLT_MAX);
170
171   virtual void PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
172                          Double_t min, Double_t max);
173     
174   /// Get the pad in which we are plotted
175   TVirtualPad* Pad() const { return fPad; }
176   
177   /// Get our line color
178   Int_t GetLineColor() const { return fLineColor; }
179   
180   /// Get our line width
181   Int_t GetLineWidth() const { return fLineWidth; }
182   
183   /// Set our line color
184   void SetLineColor(Int_t lineColor) { fLineColor = lineColor; }
185   
186   /// Set our line width
187   void SetLineWidth(Int_t lineWidth) { fLineWidth = lineWidth; }
188   
189   /// Set our name
190   void SetName(const char* name) { fName = name; }
191   
192   /// Set our path name (aka fullname)
193   void SetPathName(const char* pathName) { fPathName = pathName; }
194   
195   static AliMUONVPainter* CreatePainter(const char* className, 
196                                         const AliMUONAttPainter& att,
197                                         Int_t id1, Int_t id2);
198     
199   /// Get our first ID
200   Int_t ID0() const { return fID[0]; }
201   /// Get our second ID
202   Int_t ID1() const { return fID[1]; }
203   
204   /// Set our IDs
205   void SetID(Int_t id0, Int_t id1) { fID[0] = id0; fID[1] = id1; }
206   
207   virtual TString Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
208                            Double_t x=FLT_MAX, Double_t y=FLT_MAX);
209
210   void UpdateGroupsFrom(const AliMUONVPainter& painter);
211
212   AliMUONVPainter* Master() const;
213   
214   virtual void DrawHistogram() const;
215
216   virtual void DrawHistogramClone() const;
217
218   /// Append (i.e. don't have the right the clear the array !) our list of manus to manuList
219   virtual void FillManuList(TObjArray& manuList) const;
220   
221 protected:
222     
223   virtual TCollection* Children() const;
224
225 private:
226
227     void FlatList(TList& list);
228
229   AliMUONPainterGroup* CreateGroup(const char* type, Int_t depth);
230   
231   void CreateGroups();
232   
233   void GetBoundingBox(Double_t& x1, Double_t& y1, 
234                       Double_t& x2, Double_t& y2) const;
235   
236   AliMUONVPainter* GetPainter(Int_t px, Int_t py, Double_t& x, Double_t& y) const;
237   
238 private:
239   
240   TString fName; ///< our (short) name
241   TString fPathName; ///< our long name
242   TString fType; ///< our type (DE, Chamber, MANU, etc...)
243   AliMUONVPainter* fMother;  ///< our mother
244   AliMUONPainterGroup* fGroup; ///< our group
245   AliMUONPainterContour* fContour;  ///< our contour
246   TMap* fPainterGroups; ///< map of groups
247   TObjArray* fChildren; ///< our children
248   AliMUONPainterGroup* fResponderGroup; ///< the responder group
249   AliMUONPainterGroup* fPlotterGroup; ///< the plotter group
250   Double_t fBorderFactor; ///< border factor for visu 
251   TVirtualPad* fPad; ///< the pad we're drawn in
252   AliMUONAttPainter fAttributes; ///< our attributes (e.g. view type)
253   Int_t fLineColor; ///< our outline color
254   Int_t fLineWidth; ///< our outline width
255   Int_t fID[2]; ///< our ids
256   Bool_t fIsValid; ///< whether we were properly initialized
257   
258 protected:
259   mutable TH1* fHistogram; //!< histogram
260   
261   ClassDef(AliMUONVPainter,3) // Base class of a graphical object for MUON spectrometer
262 };
263
264 #endif