1 #ifndef ALIMUONSEGMENT_H
2 #define ALIMUONSEGMENT_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
10 /// \class AliMUONSegment
11 /// \brief A basic line segment, used for contour making algorithm(s)
13 // author Laurent Aphecetche
19 class AliMUONSegment : public TObject
23 AliMUONSegment(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
25 virtual ~AliMUONSegment() {}
27 virtual Int_t Compare(const TObject* obj) const;
30 virtual Bool_t IsSortable() const { return kTRUE; }
32 /// Return the x-coordinate of our starting point
33 Double_t StartX() const { return fStartX; }
34 /// Return the y-coordinate of our starting point
35 Double_t StartY() const { return fStartY; }
36 /// Return the x-coordinate of our ending point
37 Double_t EndX() const { return fEndX; }
38 /// Return the y-coordinate of our ending point
39 Double_t EndY() const { return fEndY; }
41 /// Return our smallest y (of starting or ending point)
42 double SmallerY() const { return fSmallerY; }
44 /// Whether we are a horizontal segment
45 Bool_t IsHorizontal() const { return fIsHorizontal; }
47 /// Whethere we are a vertical segment
48 Bool_t IsVertical() const { return fIsVertical; }
50 /// Whether we are a left edge
51 Bool_t IsLeftEdge() const { return fIsLeftEdge; }
53 /// Whether we are a right edge
54 Bool_t IsRightEdge() const { return fIsRightEdge; }
56 /// Return our bottom y
57 double Bottom() const { return SmallerY(); }
61 double Distance() const;
63 /// Whether we're just a point
64 Bool_t IsAPoint() const { return fIsAPoint; }
66 const char* AsString() const;
68 static Bool_t AreEqual(double a, double b);
70 void Print(Option_t* opt="") const;
72 void Set(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
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
86 static const Double_t fgkPrecision; ///< Floating point precision used in comparisons
88 ClassDef(AliMUONSegment,1) // A basic line segment