]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONPainterContourMaker.h
remoe duplicate QA initialisation and do ESD QA for same detectors as RecPoint QA
[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
9016a84e 66 /// \ingroup graphics
67 /// \brief Store information about one pad's neighbours.
cec5da80 68 /// \author Laurent Aphecetche, Subatech
0145e89a 69 class AliMUONNeighbour : public TObject
70 {
71public:
9016a84e 72 /// default ctor
0145e89a 73 AliMUONNeighbour()
74 : fID(-1), fPosition(), fDimensions(),
75 fLeft(kFALSE), fRight(kFALSE),
76 fTop(kFALSE), fBottom(kFALSE) {}
77
9016a84e 78 /// normal ctor
0145e89a 79 AliMUONNeighbour(Int_t absID,
80 const TVector2& position,
81 const TVector2& dimensions,
82 Bool_t hasLeftNeighbour, Bool_t hasRightNeighbour,
83 Bool_t hasTopNeighbour, Bool_t hasBottomNeighbour)
84 : fID(absID), fPosition(position), fDimensions(dimensions),
85 fLeft(hasLeftNeighbour), fRight(hasRightNeighbour),
86 fTop(hasTopNeighbour), fBottom(hasBottomNeighbour) {}
87
9016a84e 88 /// dtor
0145e89a 89 virtual ~AliMUONNeighbour() {}
90
9016a84e 91 /// we are sortable
0145e89a 92 virtual Bool_t IsSortable() const { return kTRUE; }
93
94 virtual Int_t Compare(const TObject* object) const;
95
9016a84e 96 /// our id
0145e89a 97 Int_t ID() const { return fID; }
9016a84e 98
99 /// Whether we have a neighbour on our left
0145e89a 100 Bool_t HasLeftNeighbour() const { return fLeft; }
9016a84e 101 /// Whether we have a neighbour on our right
0145e89a 102 Bool_t HasRightNeighbour() const { return fRight; }
9016a84e 103 /// Whether we have a neighbour above
0145e89a 104 Bool_t HasTopNeighbour() const { return fTop; }
9016a84e 105 /// Whether we have a neighbour below
0145e89a 106 Bool_t HasBottomNeighbour() const { return fBottom; }
107
9016a84e 108 /// Our position
0145e89a 109 TVector2 Position() const { return fPosition; }
9016a84e 110 /// Our (half-)dimensions
0145e89a 111 TVector2 Dimensions() const { return fDimensions; }
112
9016a84e 113 /// Lower left corner
0145e89a 114 TVector2 LowerLeft() const { return fPosition - fDimensions; }
9016a84e 115 /// Upper right corner
0145e89a 116 TVector2 UpperRight() const { return fPosition + fDimensions; }
117
118 void Print(Option_t* opt="") const;
119
9016a84e 120 /// Set our position
0145e89a 121 void SetPosition(Double_t x, Double_t y) { fPosition.Set(x,y); }
122
123private:
124 Int_t fID; ///< id of the pad
125 TVector2 fPosition; ///< position
126 TVector2 fDimensions; ///< (half)dimension
127 Bool_t fLeft; ///< do we have a neighbour on our left ?
128 Bool_t fRight; ///< do we have a neighbour on our right ?
129 Bool_t fTop; ///< do we have a neighbour on top of us ?
130 Bool_t fBottom; ///< do we have a neighbour below us ?
131
132 ClassDef(AliMUONNeighbour,1) // Neighbour internal class
133 };
134
0145e89a 135
136public:
137
138
139 void AddSegments(TObjArray& segments, const AliMUONPainterContour& contour) const;
140
141 void AddSegment(TObjArray& segments, Double_t x1, Double_t y1,
142 Double_t x2, Double_t y2, Int_t padID) const;
143
144 TLine* AddToLine(TPolyLine& line, TObjArray& segments, Int_t i) const;
145
146 AliMpMotifPosition* FindMotifPosition(Int_t detElemId, Int_t manuId) const;
147
148 Int_t FindPoint(const TPolyLine& lines, Double_t x, Double_t y) const;
149
150 Int_t FindPoint(Double_t x, Double_t y, TObjArray& segments) const;
151
152 TLine* InsertSegment(TPolyLine& lines, TLine& l) const;
153
154 using TObject::IsEqual;
155
156 Bool_t IsEqual(Double_t x, Double_t y) const;
157
158 Int_t Overlap(const TLine& line1, const TLine& line2) const;
159
160 Bool_t IsLineClosed(const TPolyLine& line) const;
161
162 AliMUONPainterContour* ConvertEdgePadsToContour(TObjArray& edgePads, const char* name) const;
163
164 AliMUONPainterContour* ConvertSegmentsToContour(TObjArray& segments, const char* name) const;
165
166 void Local2Global(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl,
167 Double_t& xg, Double_t& yg, Double_t& zg) const;
168
169 TString NameIt(const AliMpMotifPosition& motifPosition) const;
170
171 TPolyLine* Simplify(const TPolyLine& lines) const;
172
173 Double_t Slope(const TLine& line) const;
174
175 Bool_t IsPoint(const TLine& line) const;
176
177 void PrintLine(const TLine& line, const char* msg="") const;
178
179 void PrintSegments(const TObjArray& segments) const;
180
181 Bool_t SameDirection(const TLine& line1, const TLine& line2) const;
182
183 void Swap(TLine& line) const;
184
185 TLine Shift(const TLine& line, Double_t x, Double_t y) const;
186
187 Int_t IsInside(const TLine& line1, const TLine& line2,
188 Bool_t useEndPoints=kFALSE) const;
189
190 Bool_t IsInside(const TObjArray& segments, const TLine& line) const;
191
192 Int_t IsInLine(const TLine& line, Double_t x, Double_t y,
193 Bool_t strict=kTRUE) const;
194
195 Bool_t IsEqual(const TLine& line1, const TLine& line2) const;
196
197 Bool_t SanityCheck(const TObjArray& contours, const TObjArray& segments, Bool_t check=kTRUE) const;
198
199 TString LineAsString(const TLine& line, Bool_t slope=kTRUE) const;
200
201 Int_t IsInRange(Double_t x, Double_t a, Double_t b,
202 Bool_t strict=kTRUE) const;
203
204 Bool_t HasLine(const TObjArray& segments, const TLine& line) const;
205
206 void CleanSegments(TObjArray& segments, const TArrayI& toBeRemoved) const;
207
208 Int_t SplitSegments(TObjArray& segments) const;
209
210 Int_t RemoveInsideSegments(const TObjArray& contours, TObjArray& segments) const;
211
212 Bool_t IsHorizontal(const TLine& line) const;
213
214 Bool_t IsVertical(const TLine& line) const;
215
216 Int_t CountPoint(const TObjArray& segments, Double_t x, Double_t y) const;
217
218 Bool_t ShouldBeRemoved(const TObjArray& contours, Double_t x, Double_t y) const;
219
220private:
9016a84e 221 /// not implemented
222 AliMUONPainterContourMaker(const AliMUONPainterContourMaker& rhs);
223 /// not implemented
224 AliMUONPainterContourMaker& operator=(const AliMUONPainterContourMaker& rhs);
225
0145e89a 226 AliMpExMap* fGlobalTransformations; ///< store of global transformations for DEs
227 TMap* fLocalManuContours; ///< store for local contours of all manus
228 TMap* fContours; ///< store for all our contours
229
230 ClassDef(AliMUONPainterContourMaker,1) // Painter contour builder
231};
232
233#endif
234