]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpArea.cxx
Updated comments for Doxygen - corrected warnings
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpArea.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17 // $MpId: AliMpArea.cxx,v 1.8 2006/05/24 13:58:29 ivana Exp $
18 // Category: basic
19 //
20 // Class AliMpArea
21 // ----------------
22 // Class that defines a rectangle area positioned in plane..
23 // Included in AliRoot: 2003/05/02
24 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
25
26 #include "AliMpArea.h"
27
28 #include <Riostream.h>
29
30 /// \cond CLASSIMP
31 ClassImp(AliMpArea)
32 /// \endcond
33
34 //_____________________________________________________________________________
35 AliMpArea::AliMpArea(const TVector2& position, const TVector2& dimensions)
36   : TObject(),
37     fPosition(position),
38     fDimensions(dimensions),
39     fValidity(true) 
40 {
41 /// Standard constructor
42
43   // Check dimensions
44   if (  fDimensions.X() < 0. || fDimensions.Y() < 0. ||
45       ( fDimensions.X() == 0 && fDimensions.Y() == 0.0 ) ) {
46     fDimensions = TVector2();
47     fValidity = false;
48   }  
49 }
50
51 //_____________________________________________________________________________
52 AliMpArea::AliMpArea()
53   : TObject(),
54     fPosition(TVector2()),
55     fDimensions(TVector2()), 
56     fValidity(false) 
57 {
58 /// Default constructor
59 }
60
61 //_____________________________________________________________________________
62 AliMpArea::AliMpArea(const AliMpArea& rhs):
63   TObject(rhs),
64   fPosition(rhs.fPosition),
65   fDimensions(rhs.fDimensions) 
66 {
67 /// Copy constructor
68 }
69
70 //_____________________________________________________________________________
71 AliMpArea::~AliMpArea() 
72 {
73 /// Destructor
74 }
75
76 //
77 // operators
78 //
79
80 //______________________________________________________________________________
81 AliMpArea& AliMpArea::operator = (const AliMpArea& right)
82 {
83 /// Assignment operator
84
85   // check assignment to self
86   if (this == &right) return *this;
87
88   // base class assignment
89   TObject::operator=(right);
90
91   fPosition = right.fPosition;
92   fDimensions = right.fDimensions;
93   fValidity = right.fValidity;
94
95   return *this;
96
97
98 //
99 // public methods
100 //
101
102 //_____________________________________________________________________________
103 Double_t AliMpArea::LeftBorder() const
104 {
105 /// Return the position of the left edge.
106
107   return fPosition.X() - fDimensions.X();
108 }
109
110 //_____________________________________________________________________________
111 Double_t AliMpArea::RightBorder() const
112 {
113 /// Return the position of right edge.
114
115   return fPosition.X() + fDimensions.X();
116 }
117
118 //_____________________________________________________________________________
119 Double_t AliMpArea::UpBorder() const
120 {
121 /// Return the position of the up edge.
122
123   return fPosition.Y() + fDimensions.Y();
124 }
125
126 //_____________________________________________________________________________
127 Double_t AliMpArea::DownBorder() const
128 {
129 /// Return the position of the down edge.
130
131   return fPosition.Y() - fDimensions.Y();
132 }
133
134 //_____________________________________________________________________________
135 TVector2 AliMpArea::LeftDownCorner() const
136 {
137 /// Return position of the left down corner.
138
139   return TVector2(LeftBorder(), DownBorder());
140 }  
141
142 //_____________________________________________________________________________
143 TVector2 AliMpArea::LeftUpCorner() const
144 {
145 /// Return position of the left up corner.
146
147   return TVector2(LeftBorder(), UpBorder());
148 }  
149
150 //_____________________________________________________________________________
151 TVector2 AliMpArea::RightDownCorner() const
152 {
153 /// Return position of the right down corner.
154
155   return TVector2(RightBorder(), DownBorder());
156 }  
157
158
159 //_____________________________________________________________________________
160 TVector2 AliMpArea::RightUpCorner() const
161 {
162 /// Return position of the right up corner.
163
164   return TVector2(RightBorder(), UpBorder());
165 }  
166
167 //_____________________________________________________________________________
168 ostream& operator<< (ostream &stream,const AliMpArea& area)
169 {
170 /// Output streaming
171
172   stream << "Area: position: (" 
173          << area.Position().X() << ", " << area.Position().Y() << ") " 
174          << " dimensions: (" 
175          << area.Dimensions().X() << ", " << area.Dimensions().Y() << ") " 
176          << endl;
177   return stream;
178 }
179