]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSegment.h
Adding classes forgotten in previous commit
[u/mrichter/AliRoot.git] / MUON / AliMUONSegment.h
1 #ifndef ALIMUONSEGMENT_H
2 #define ALIMUONSEGMENT_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice                               */
6
7 // $Id$
8
9 /// \ingroup geometry
10 /// \class AliMUONSegment
11 /// \brief A basic line segment, used for contour making algorithm(s)
12 /// 
13 // author Laurent Aphecetche
14
15 #ifndef ROOT_TObject
16 #  include "TObject.h"
17 #endif
18
19 class AliMUONSegment : public TObject
20 {
21 public:
22   AliMUONSegment();
23   AliMUONSegment(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
24   virtual ~AliMUONSegment() {}
25   
26   virtual Int_t Compare(const TObject* obj) const;
27
28   /// We are sortable
29   virtual Bool_t IsSortable() const { return kTRUE; }
30   
31   /// Return the x-coordinate of our starting point
32   Double_t StartX() const { return fStartX; }
33   /// Return the y-coordinate of our starting point
34   Double_t StartY() const { return fStartY; }  
35   /// Return the x-coordinate of our ending point
36   Double_t EndX() const { return fEndX; }
37   /// Return the y-coordinate of our ending point
38   Double_t EndY() const { return fEndY; }
39     
40   /// Return our smallest y (of starting or ending point)
41   double SmallerY() const { return fSmallerY; }
42
43   /// Whether we are a horizontal segment
44   Bool_t IsHorizontal() const { return fIsHorizontal; }
45   
46   /// Whethere we are a vertical segment
47   Bool_t IsVertical() const { return fIsVertical; }
48   
49   /// Whether we are a left edge
50   Bool_t IsLeftEdge() const { return fIsLeftEdge; }
51
52   /// Whether we are a right edge
53   Bool_t IsRightEdge() const { return fIsRightEdge; }
54   
55   /// Return our bottom y
56   double Bottom() const { return SmallerY(); }
57   
58   double Top() const;
59   
60   double Distance() const;
61   
62   /// Whether we're just a point
63   Bool_t IsAPoint() const { return fIsAPoint; }
64   
65   const char* AsString() const;
66   
67   static Bool_t AreEqual(double a, double b);
68
69   void Print(Option_t* opt="") const;
70   
71   void Set(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
72   
73 private:
74   Double_t fStartX; /// x of start point
75   Double_t fStartY; /// y of start point
76   Double_t fEndX; /// x of end point
77   Double_t fEndY; /// y of end point
78   Double_t fSmallerY; /// Either StartY or EndY
79   Bool_t fIsHorizontal; /// Whether the segment is horizontal
80   Bool_t fIsVertical; /// Whether the segment is vertical
81   Bool_t fIsLeftEdge; /// Whether the segment is a left edge 
82   Bool_t fIsRightEdge; /// Whether the segment is a right edge
83   Bool_t fIsAPoint; /// Whether start==end
84   
85   static const Double_t fgkPrecision; /// Floating point precision used in comparisons
86   
87   ClassDef(AliMUONSegment,1) // A basic line segment
88 };
89
90
91 #endif