]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpArea.cxx
Applying ManuMask in motif position test
[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"
27
2c605e66 28#include <Riostream.h>
29
13985652 30/// \cond CLASSIMP
5f91c9e8 31ClassImp(AliMpArea)
13985652 32/// \endcond
5f91c9e8 33
34//_____________________________________________________________________________
35AliMpArea::AliMpArea(const TVector2& position, const TVector2& dimensions)
36 : TObject(),
37 fPosition(position),
38 fDimensions(dimensions),
dee1d5f1 39 fValidity(true)
40{
41/// Standard constructor
42
5f91c9e8 43 // Check dimensions
dee1d5f1 44 if ( fDimensions.X() < 0. || fDimensions.Y() < 0. ||
45 ( fDimensions.X() == 0 && fDimensions.Y() == 0.0 ) ) {
5f91c9e8 46 fDimensions = TVector2();
47 fValidity = false;
48 }
49}
50
51//_____________________________________________________________________________
52AliMpArea::AliMpArea()
53 : TObject(),
54 fPosition(TVector2()),
55 fDimensions(TVector2()),
dee1d5f1 56 fValidity(false)
57{
58/// Default constructor
5f91c9e8 59}
60
61//_____________________________________________________________________________
62AliMpArea::AliMpArea(const AliMpArea& rhs):
63 TObject(rhs),
64 fPosition(rhs.fPosition),
0471c97b 65 fDimensions(rhs.fDimensions),
66 fValidity(rhs.fValidity)
dee1d5f1 67{
68/// Copy constructor
5f91c9e8 69}
70
71//_____________________________________________________________________________
dee1d5f1 72AliMpArea::~AliMpArea()
73{
74/// Destructor
5f91c9e8 75}
76
77//
78// operators
79//
80
81//______________________________________________________________________________
82AliMpArea& AliMpArea::operator = (const AliMpArea& right)
83{
dee1d5f1 84/// Assignment operator
5f91c9e8 85
dee1d5f1 86 // check assignment to self
5f91c9e8 87 if (this == &right) return *this;
88
dee1d5f1 89 // base class assignment
5f91c9e8 90 TObject::operator=(right);
91
92 fPosition = right.fPosition;
93 fDimensions = right.fDimensions;
94 fValidity = right.fValidity;
95
96 return *this;
97}
98
99//
100// public methods
101//
102
103//_____________________________________________________________________________
104Double_t AliMpArea::LeftBorder() const
105{
dee1d5f1 106/// Return the position of the left edge.
5f91c9e8 107
108 return fPosition.X() - fDimensions.X();
109}
110
111//_____________________________________________________________________________
112Double_t AliMpArea::RightBorder() const
113{
dee1d5f1 114/// Return the position of right edge.
5f91c9e8 115
116 return fPosition.X() + fDimensions.X();
117}
118
119//_____________________________________________________________________________
120Double_t AliMpArea::UpBorder() const
121{
dee1d5f1 122/// Return the position of the up edge.
5f91c9e8 123
124 return fPosition.Y() + fDimensions.Y();
125}
126
127//_____________________________________________________________________________
128Double_t AliMpArea::DownBorder() const
129{
dee1d5f1 130/// Return the position of the down edge.
5f91c9e8 131
132 return fPosition.Y() - fDimensions.Y();
133}
134
135//_____________________________________________________________________________
136TVector2 AliMpArea::LeftDownCorner() const
137{
dee1d5f1 138/// Return position of the left down corner.
5f91c9e8 139
140 return TVector2(LeftBorder(), DownBorder());
141}
142
143//_____________________________________________________________________________
144TVector2 AliMpArea::LeftUpCorner() const
145{
dee1d5f1 146/// Return position of the left up corner.
5f91c9e8 147
148 return TVector2(LeftBorder(), UpBorder());
149}
150
151//_____________________________________________________________________________
152TVector2 AliMpArea::RightDownCorner() const
153{
dee1d5f1 154/// Return position of the right down corner.
5f91c9e8 155
156 return TVector2(RightBorder(), DownBorder());
157}
158
159
160//_____________________________________________________________________________
161TVector2 AliMpArea::RightUpCorner() const
162{
dee1d5f1 163/// Return position of the right up corner.
5f91c9e8 164
165 return TVector2(RightBorder(), UpBorder());
166}
167
168//_____________________________________________________________________________
169ostream& operator<< (ostream &stream,const AliMpArea& area)
170{
dee1d5f1 171/// Output streaming
172
5f91c9e8 173 stream << "Area: position: ("
174 << area.Position().X() << ", " << area.Position().Y() << ") "
175 << " dimensions: ("
176 << area.Dimensions().X() << ", " << area.Dimensions().Y() << ") "
177 << endl;
178 return stream;
179}
180