6 // Class that defines a rectangle area positioned in plane..
7 // Included in AliRoot: 2003/05/02
8 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10 #include <Riostream.h>
12 #include "AliMpArea.h"
17 //_____________________________________________________________________________
18 AliMpArea::AliMpArea(const TVector2& position, const TVector2& dimensions)
21 fDimensions(dimensions),
25 if (fDimensions.X() <= 0. || fDimensions.Y() <=0.) {
26 fDimensions = TVector2();
31 //_____________________________________________________________________________
32 AliMpArea::AliMpArea()
34 fPosition(TVector2()),
35 fDimensions(TVector2()),
40 //_____________________________________________________________________________
41 AliMpArea::AliMpArea(const AliMpArea& rhs):
43 fPosition(rhs.fPosition),
44 fDimensions(rhs.fDimensions) {
48 //_____________________________________________________________________________
49 AliMpArea::~AliMpArea() {
57 //______________________________________________________________________________
58 AliMpArea& AliMpArea::operator = (const AliMpArea& right)
60 // Assignement operator
62 // check assignement to self
63 if (this == &right) return *this;
65 // base class assignement
66 TObject::operator=(right);
68 fPosition = right.fPosition;
69 fDimensions = right.fDimensions;
70 fValidity = right.fValidity;
79 //_____________________________________________________________________________
80 Double_t AliMpArea::LeftBorder() const
82 // Returns the position of the left edge.
85 return fPosition.X() - fDimensions.X();
88 //_____________________________________________________________________________
89 Double_t AliMpArea::RightBorder() const
91 // Returns the position of right edge.
94 return fPosition.X() + fDimensions.X();
97 //_____________________________________________________________________________
98 Double_t AliMpArea::UpBorder() const
100 // Returns the position of the up edge.
103 return fPosition.Y() + fDimensions.Y();
106 //_____________________________________________________________________________
107 Double_t AliMpArea::DownBorder() const
109 // Returns the position of the down edge.
112 return fPosition.Y() - fDimensions.Y();
115 //_____________________________________________________________________________
116 TVector2 AliMpArea::LeftDownCorner() const
118 // Returns position of the left down corner.
121 return TVector2(LeftBorder(), DownBorder());
124 //_____________________________________________________________________________
125 TVector2 AliMpArea::LeftUpCorner() const
127 // Returns position of the left up corner.
130 return TVector2(LeftBorder(), UpBorder());
133 //_____________________________________________________________________________
134 TVector2 AliMpArea::RightDownCorner() const
136 // Returns position of the right down corner.
139 return TVector2(RightBorder(), DownBorder());
143 //_____________________________________________________________________________
144 TVector2 AliMpArea::RightUpCorner() const
146 // Returns position of the right up corner.
149 return TVector2(RightBorder(), UpBorder());
152 //_____________________________________________________________________________
153 ostream& operator<< (ostream &stream,const AliMpArea& area)
155 stream << "Area: position: ("
156 << area.Position().X() << ", " << area.Position().Y() << ") "
158 << area.Dimensions().X() << ", " << area.Dimensions().Y() << ") "