Line data Source code
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 0 : class AliMUONSegment : public TObject
20 : {
21 : public:
22 : AliMUONSegment();
23 : AliMUONSegment(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
24 : /// dtor
25 0 : virtual ~AliMUONSegment() {}
26 :
27 : virtual Int_t Compare(const TObject* obj) const;
28 :
29 : /// We are sortable
30 0 : virtual Bool_t IsSortable() const { return kTRUE; }
31 :
32 : /// Return the x-coordinate of our starting point
33 0 : Double_t StartX() const { return fStartX; }
34 : /// Return the y-coordinate of our starting point
35 0 : Double_t StartY() const { return fStartY; }
36 : /// Return the x-coordinate of our ending point
37 0 : Double_t EndX() const { return fEndX; }
38 : /// Return the y-coordinate of our ending point
39 0 : Double_t EndY() const { return fEndY; }
40 :
41 : /// Return our smallest y (of starting or ending point)
42 0 : double SmallerY() const { return fSmallerY; }
43 :
44 : /// Whether we are a horizontal segment
45 0 : Bool_t IsHorizontal() const { return fIsHorizontal; }
46 :
47 : /// Whethere we are a vertical segment
48 0 : Bool_t IsVertical() const { return fIsVertical; }
49 :
50 : /// Whether we are a left edge
51 0 : Bool_t IsLeftEdge() const { return fIsLeftEdge; }
52 :
53 : /// Whether we are a right edge
54 0 : Bool_t IsRightEdge() const { return fIsRightEdge; }
55 :
56 : /// Return our bottom y
57 0 : double Bottom() const { return SmallerY(); }
58 :
59 : double Top() const;
60 :
61 : double Distance() const;
62 :
63 : /// Whether we're just a point
64 0 : Bool_t IsAPoint() const { return fIsAPoint; }
65 :
66 : const char* AsString() const;
67 :
68 : static Bool_t AreEqual(double a, double b);
69 :
70 : void Print(Option_t* opt="") const;
71 :
72 : void Set(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
73 :
74 : private:
75 : Double_t fStartX; ///< x of start point
76 : Double_t fStartY; ///< y of start point
77 : Double_t fEndX; ///< x of end point
78 : Double_t fEndY; ///< y of end point
79 : Double_t fSmallerY; ///< Either StartY or EndY
80 : Bool_t fIsHorizontal; ///< Whether the segment is horizontal
81 : Bool_t fIsVertical; ///< Whether the segment is vertical
82 : Bool_t fIsLeftEdge; ///< Whether the segment is a left edge
83 : Bool_t fIsRightEdge; ///< Whether the segment is a right edge
84 : Bool_t fIsAPoint; ///< Whether start==end
85 :
86 : static const Double_t fgkPrecision; ///< Floating point precision used in comparisons
87 :
88 12 : ClassDef(AliMUONSegment,1) // A basic line segment
89 : };
90 :
91 :
92 : #endif
|