]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpArea.cxx
Comments for Doxygen (mostly added comments for inline functions)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpArea.cxx
CommitLineData
dee1d5f1 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
5f91c9e8 16// $Id$
13985652 17// $MpId: AliMpArea.cxx,v 1.8 2006/05/24 13:58:29 ivana Exp $
5f91c9e8 18// Category: basic
19//
20// Class AliMpArea
21// ----------------
22// Class that defines a rectangle area positioned in plane..
3ffe1a93 23// Included in AliRoot: 2003/05/02
5f91c9e8 24// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
25
5f91c9e8 26#include "AliMpArea.h"
52dd0c39 27#include "AliMpConstants.h"
5f91c9e8 28
2c605e66 29#include <Riostream.h>
30
13985652 31/// \cond CLASSIMP
5f91c9e8 32ClassImp(AliMpArea)
13985652 33/// \endcond
5f91c9e8 34
35//_____________________________________________________________________________
36AliMpArea::AliMpArea(const TVector2& position, const TVector2& dimensions)
37 : TObject(),
38 fPosition(position),
39 fDimensions(dimensions),
dee1d5f1 40 fValidity(true)
41{
42/// Standard constructor
43
5f91c9e8 44 // Check dimensions
52dd0c39 45 if ( fDimensions.X() < - AliMpConstants::LengthTolerance() ||
46 fDimensions.Y() < - AliMpConstants::LengthTolerance() ||
47 ( fDimensions.X() < AliMpConstants::LengthTolerance() &&
48 fDimensions.Y() < AliMpConstants::LengthTolerance() ) )
49 {
5f91c9e8 50 fDimensions = TVector2();
51 fValidity = false;
52 }
53}
54
55//_____________________________________________________________________________
56AliMpArea::AliMpArea()
57 : TObject(),
58 fPosition(TVector2()),
59 fDimensions(TVector2()),
dee1d5f1 60 fValidity(false)
61{
62/// Default constructor
5f91c9e8 63}
64
65//_____________________________________________________________________________
66AliMpArea::AliMpArea(const AliMpArea& rhs):
67 TObject(rhs),
68 fPosition(rhs.fPosition),
0471c97b 69 fDimensions(rhs.fDimensions),
70 fValidity(rhs.fValidity)
dee1d5f1 71{
72/// Copy constructor
5f91c9e8 73}
74
75//_____________________________________________________________________________
dee1d5f1 76AliMpArea::~AliMpArea()
77{
78/// Destructor
5f91c9e8 79}
80
81//
82// operators
83//
84
85//______________________________________________________________________________
86AliMpArea& AliMpArea::operator = (const AliMpArea& right)
87{
dee1d5f1 88/// Assignment operator
5f91c9e8 89
dee1d5f1 90 // check assignment to self
5f91c9e8 91 if (this == &right) return *this;
92
dee1d5f1 93 // base class assignment
5f91c9e8 94 TObject::operator=(right);
95
96 fPosition = right.fPosition;
97 fDimensions = right.fDimensions;
98 fValidity = right.fValidity;
99
100 return *this;
101}
102
103//
104// public methods
105//
106
107//_____________________________________________________________________________
108Double_t AliMpArea::LeftBorder() const
109{
dee1d5f1 110/// Return the position of the left edge.
5f91c9e8 111
112 return fPosition.X() - fDimensions.X();
113}
114
115//_____________________________________________________________________________
116Double_t AliMpArea::RightBorder() const
117{
dee1d5f1 118/// Return the position of right edge.
5f91c9e8 119
120 return fPosition.X() + fDimensions.X();
121}
122
123//_____________________________________________________________________________
124Double_t AliMpArea::UpBorder() const
125{
dee1d5f1 126/// Return the position of the up edge.
5f91c9e8 127
128 return fPosition.Y() + fDimensions.Y();
129}
130
131//_____________________________________________________________________________
132Double_t AliMpArea::DownBorder() const
133{
dee1d5f1 134/// Return the position of the down edge.
5f91c9e8 135
136 return fPosition.Y() - fDimensions.Y();
137}
138
139//_____________________________________________________________________________
140TVector2 AliMpArea::LeftDownCorner() const
141{
dee1d5f1 142/// Return position of the left down corner.
5f91c9e8 143
144 return TVector2(LeftBorder(), DownBorder());
145}
146
147//_____________________________________________________________________________
148TVector2 AliMpArea::LeftUpCorner() const
149{
dee1d5f1 150/// Return position of the left up corner.
5f91c9e8 151
152 return TVector2(LeftBorder(), UpBorder());
153}
154
155//_____________________________________________________________________________
156TVector2 AliMpArea::RightDownCorner() const
157{
dee1d5f1 158/// Return position of the right down corner.
5f91c9e8 159
160 return TVector2(RightBorder(), DownBorder());
161}
162
163
164//_____________________________________________________________________________
165TVector2 AliMpArea::RightUpCorner() const
166{
dee1d5f1 167/// Return position of the right up corner.
5f91c9e8 168
169 return TVector2(RightBorder(), UpBorder());
170}
171
52dd0c39 172//_____________________________________________________________________________
173void
174AliMpArea::Print(Option_t*) const
175{
71a2d3aa 176/// Printing
177
52dd0c39 178 cout << (*this) << endl;
179}
180
5f91c9e8 181//_____________________________________________________________________________
182ostream& operator<< (ostream &stream,const AliMpArea& area)
183{
dee1d5f1 184/// Output streaming
185
5f91c9e8 186 stream << "Area: position: ("
187 << area.Position().X() << ", " << area.Position().Y() << ") "
188 << " dimensions: ("
189 << area.Dimensions().X() << ", " << area.Dimensions().Y() << ") "
52dd0c39 190 << " valid: " << (area.IsValid()==true ? "YES":"NO")
5f91c9e8 191 << endl;
192 return stream;
193}
194