]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONPainterContourMaker.h
Fixed coding conventions in MUONQADataMaker classes.
[u/mrichter/AliRoot.git] / MUON / AliMUONPainterContourMaker.h
CommitLineData
0145e89a 1#ifndef ALIMUONPAINTERCONTOURMAKER_H
2#define ALIMUONPAINTERCONTOURMAKER_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 AliMUONPainterContourMaker
11/// \brief Utility class to build painter contours
12///
13// Author Laurent Aphecetche, Subatech
14
15#ifndef ROOT_TVector2
16# include "TVector2.h"
17#endif
18
19#ifndef ROOT_TObject
20# include "TObject.h"
21#endif
22
23#ifndef ALIMUONVPAINTER_H
24# include "AliMUONVPainter.h"
25#endif
26
27class AliMpExMap;
28class AliMpMotifPosition;
29class AliMUONAttPainter;
30class AliMUONPainterContour;
31class AliMUONPainterPadStore;
32class TArrayI;
33class TMap;
34#include <TLine.h>
35class TPolyLine;
36class TObjArray;
37
38class AliMUONPainterContourMaker : public TObject
39{
40public:
41 AliMUONPainterContourMaker(AliMpExMap* globalTransformations=0x0);
42 virtual ~AliMUONPainterContourMaker();
43
44 void Add(AliMUONPainterContour* contour);
45
46 AliMUONPainterContour* FindLocalManuContour(Int_t detElemId, Int_t manuId) const;
47
48 AliMUONPainterContour* GetContour(const char* name) const;
49
50 AliMUONPainterContour* GenerateManuContour(const char* name,
51 Int_t detElemId,
52 Int_t manuId,
53 AliMUONAttPainter viewType) const;
54
55 Bool_t HasContour(const char* name) const;
56
57 AliMUONPainterContour* MergeContours(const TObjArray& contours,
58 const char* contourName) const;
59
60 Int_t Size() const;
61
62 void Print(Option_t* opt="") const;
63
64public:
65
66 class AliMUONNeighbour : public TObject
67 {
68public:
69 AliMUONNeighbour()
70 : fID(-1), fPosition(), fDimensions(),
71 fLeft(kFALSE), fRight(kFALSE),
72 fTop(kFALSE), fBottom(kFALSE) {}
73
74 AliMUONNeighbour(Int_t absID,
75 const TVector2& position,
76 const TVector2& dimensions,
77 Bool_t hasLeftNeighbour, Bool_t hasRightNeighbour,
78 Bool_t hasTopNeighbour, Bool_t hasBottomNeighbour)
79 : fID(absID), fPosition(position), fDimensions(dimensions),
80 fLeft(hasLeftNeighbour), fRight(hasRightNeighbour),
81 fTop(hasTopNeighbour), fBottom(hasBottomNeighbour) {}
82
83 virtual ~AliMUONNeighbour() {}
84
85 virtual Bool_t IsSortable() const { return kTRUE; }
86
87 virtual Int_t Compare(const TObject* object) const;
88
89 Int_t ID() const { return fID; }
90 Bool_t HasLeftNeighbour() const { return fLeft; }
91 Bool_t HasRightNeighbour() const { return fRight; }
92 Bool_t HasTopNeighbour() const { return fTop; }
93 Bool_t HasBottomNeighbour() const { return fBottom; }
94
95 TVector2 Position() const { return fPosition; }
96 TVector2 Dimensions() const { return fDimensions; }
97
98 TVector2 LowerLeft() const { return fPosition - fDimensions; }
99 TVector2 UpperRight() const { return fPosition + fDimensions; }
100
101 void Print(Option_t* opt="") const;
102
103 void SetPosition(Double_t x, Double_t y) { fPosition.Set(x,y); }
104
105private:
106 Int_t fID; ///< id of the pad
107 TVector2 fPosition; ///< position
108 TVector2 fDimensions; ///< (half)dimension
109 Bool_t fLeft; ///< do we have a neighbour on our left ?
110 Bool_t fRight; ///< do we have a neighbour on our right ?
111 Bool_t fTop; ///< do we have a neighbour on top of us ?
112 Bool_t fBottom; ///< do we have a neighbour below us ?
113
114 ClassDef(AliMUONNeighbour,1) // Neighbour internal class
115 };
116
117private:
118 /// not implemented
119 AliMUONPainterContourMaker(const AliMUONPainterContourMaker& rhs);
120 /// not implemented
121 AliMUONPainterContourMaker& operator=(const AliMUONPainterContourMaker& rhs);
122
123public:
124
125
126 void AddSegments(TObjArray& segments, const AliMUONPainterContour& contour) const;
127
128 void AddSegment(TObjArray& segments, Double_t x1, Double_t y1,
129 Double_t x2, Double_t y2, Int_t padID) const;
130
131 TLine* AddToLine(TPolyLine& line, TObjArray& segments, Int_t i) const;
132
133 AliMpMotifPosition* FindMotifPosition(Int_t detElemId, Int_t manuId) const;
134
135 Int_t FindPoint(const TPolyLine& lines, Double_t x, Double_t y) const;
136
137 Int_t FindPoint(Double_t x, Double_t y, TObjArray& segments) const;
138
139 TLine* InsertSegment(TPolyLine& lines, TLine& l) const;
140
141 using TObject::IsEqual;
142
143 Bool_t IsEqual(Double_t x, Double_t y) const;
144
145 Int_t Overlap(const TLine& line1, const TLine& line2) const;
146
147 Bool_t IsLineClosed(const TPolyLine& line) const;
148
149 AliMUONPainterContour* ConvertEdgePadsToContour(TObjArray& edgePads, const char* name) const;
150
151 AliMUONPainterContour* ConvertSegmentsToContour(TObjArray& segments, const char* name) const;
152
153 void Local2Global(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
154 Double_t& xg, Double_t& yg, Double_t& zg) const;
155
156 TString NameIt(const AliMpMotifPosition& motifPosition) const;
157
158 TPolyLine* Simplify(const TPolyLine& lines) const;
159
160 Double_t Slope(const TLine& line) const;
161
162 Bool_t IsPoint(const TLine& line) const;
163
164 void PrintLine(const TLine& line, const char* msg="") const;
165
166 void PrintSegments(const TObjArray& segments) const;
167
168 Bool_t SameDirection(const TLine& line1, const TLine& line2) const;
169
170 void Swap(TLine& line) const;
171
172 TLine Shift(const TLine& line, Double_t x, Double_t y) const;
173
174 Int_t IsInside(const TLine& line1, const TLine& line2,
175 Bool_t useEndPoints=kFALSE) const;
176
177 Bool_t IsInside(const TObjArray& segments, const TLine& line) const;
178
179 Int_t IsInLine(const TLine& line, Double_t x, Double_t y,
180 Bool_t strict=kTRUE) const;
181
182 Bool_t IsEqual(const TLine& line1, const TLine& line2) const;
183
184 Bool_t SanityCheck(const TObjArray& contours, const TObjArray& segments, Bool_t check=kTRUE) const;
185
186 TString LineAsString(const TLine& line, Bool_t slope=kTRUE) const;
187
188 Int_t IsInRange(Double_t x, Double_t a, Double_t b,
189 Bool_t strict=kTRUE) const;
190
191 Bool_t HasLine(const TObjArray& segments, const TLine& line) const;
192
193 void CleanSegments(TObjArray& segments, const TArrayI& toBeRemoved) const;
194
195 Int_t SplitSegments(TObjArray& segments) const;
196
197 Int_t RemoveInsideSegments(const TObjArray& contours, TObjArray& segments) const;
198
199 Bool_t IsHorizontal(const TLine& line) const;
200
201 Bool_t IsVertical(const TLine& line) const;
202
203 Int_t CountPoint(const TObjArray& segments, Double_t x, Double_t y) const;
204
205 Bool_t ShouldBeRemoved(const TObjArray& contours, Double_t x, Double_t y) const;
206
207private:
208 AliMpExMap* fGlobalTransformations; ///< store of global transformations for DEs
209 TMap* fLocalManuContours; ///< store for local contours of all manus
210 TMap* fContours; ///< store for all our contours
211
212 ClassDef(AliMUONPainterContourMaker,1) // Painter contour builder
213};
214
215#endif
216