]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpArea.h
Coverity
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpArea.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 // $Id$
5 // $MpId: AliMpArea.h,v 1.9 2006/05/24 13:58:07 ivana Exp $
6
7 /// \ingroup basic
8 /// \class AliMpArea
9 /// \brief A rectangle area positioned in plane..
10 ///
11 /// \author David Guez, Ivana Hrivnacova; IPN Orsay
12
13 #ifndef ALI_MP_AREA_H
14 #define ALI_MP_AREA_H
15
16 #include <TObject.h>
17
18 class AliMpArea : public TObject
19 {
20  public:
21   AliMpArea(Double_t x, Double_t y, 
22             Double_t dx, Double_t dy);
23   AliMpArea(const AliMpArea& rhs);
24   AliMpArea();
25   virtual ~AliMpArea();
26
27   // operators
28   AliMpArea& operator = (const AliMpArea& right);
29
30   // methods
31   Double_t LeftBorder() const;
32   Double_t RightBorder() const;
33   Double_t UpBorder() const;
34   Double_t DownBorder() const;
35
36   void LeftDownCorner(Double_t& x, Double_t& y) const;
37   void LeftUpCorner(Double_t& x, Double_t& y) const;
38   void RightDownCorner(Double_t& x, Double_t& y) const;
39   void RightUpCorner(Double_t& x, Double_t& y) const;
40
41   AliMpArea Intersect(const AliMpArea& area) const;
42   Bool_t    Overlap(const AliMpArea& area) const;
43   Bool_t    Contains(const AliMpArea& area) const;
44   
45   void Print(Option_t* opt="") const;
46
47   // get methods
48   void      GetParameters(Double_t& x, Double_t& y,
49                           Double_t& dx, Double_t& dy) const;
50   Double_t  GetPositionX() const;
51   Double_t  GetPositionY() const;
52   Double_t  GetDimensionX() const;    
53   Double_t  GetDimensionY() const;    
54   Bool_t    IsValid() const;
55   
56   
57  private:
58   // data members
59   Double_t  fPositionX;  ///<  x position
60   Double_t  fPositionY;  ///<  y position
61   Double_t  fDimensionX; ///<   x dimension (half lengths)
62   Double_t  fDimensionY; ///<   y dimension (half lengths)
63   Bool_t    fValidity;   ///<  validity
64
65   ClassDef(AliMpArea,2) //utility class for area iterators
66 };
67
68 ostream& operator << (ostream &stream,const AliMpArea& area);
69
70 // inline functions
71
72                  /// Return x position
73 inline Double_t  AliMpArea::GetPositionX() const   { return fPositionX; }
74                  /// Return y position
75 inline Double_t  AliMpArea::GetPositionY() const   { return fPositionY; }
76                  /// Return x dimensions
77 inline Double_t  AliMpArea::GetDimensionX() const { return fDimensionX; }    
78                  /// Return y dimensions
79 inline Double_t  AliMpArea::GetDimensionY() const { return fDimensionY; }    
80                  /// Return validity
81 inline Bool_t    AliMpArea::IsValid() const    { return fValidity; }
82
83 #endif //ALI_MP_AREA_H