#ifndef ALIMUONSEGMENT_H
#define ALIMUONSEGMENT_H
+
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
+* See cxx source for full Copyright notice */
-/*$Id$*/
+// $Id$
-#include <TROOT.h>
+/// \ingroup geometry
+/// \class AliMUONSegment
+/// \brief A basic line segment, used for contour making algorithm(s)
+///
+// author Laurent Aphecetche
-class AliMUONHitForRec;
-class AliMUONTrackParam;
+#ifndef ROOT_TObject
+# include "TObject.h"
+#endif
-class AliMUONSegment : public TObject {
- public:
- virtual ~AliMUONSegment(){
- // Destructor
- ;} // Destructor
- AliMUONSegment (const AliMUONSegment& AliMUONSegment); // copy constructor
- AliMUONSegment& operator=(const AliMUONSegment& AliMUONSegment); // assignment operator
- AliMUONSegment(AliMUONHitForRec* Hit1=0, AliMUONHitForRec* Hit2=0); // Constructor from two HitForRec's
+class AliMUONSegment : public TObject
+{
+public:
+ AliMUONSegment();
+ AliMUONSegment(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
+ /// dtor
+ virtual ~AliMUONSegment() {}
+
+ virtual Int_t Compare(const TObject* obj) const;
- // Inline functions for Get and Set
- AliMUONHitForRec* GetHitForRec1(void) {
- // Get fHitForRecPtr1
- return fHitForRecPtr1;}
- AliMUONHitForRec* GetHitForRec2(void) {
- // Get fHitForRecPtr2
- return fHitForRecPtr2;}
- Double_t GetBendingCoor(void) {
- // Get fBendingCoor
- return fBendingCoor;}
- void SetBendingCoor(Double_t BendingCoor) {
- // Set fBendingCoor
- fBendingCoor = BendingCoor;}
- Double_t GetBendingSlope(void) {
- // Get fBendingSlope
- return fBendingSlope;}
- void SetBendingSlope(Double_t BendingSlope) {
- // Set fBendingSlope
- fBendingSlope = BendingSlope;}
- Double_t GetNonBendingCoor(void) {
- // Get fNonBendingCoor
- return fNonBendingCoor;}
- void SetNonBendingCoor(Double_t NonBendingCoor) {
- // Set fNonBendingCoor
- fNonBendingCoor = NonBendingCoor;}
- Double_t GetNonBendingSlope(void) {
- // Get fNonBendingSlope
- return fNonBendingSlope;}
- void SetNonBendingSlope(Double_t NonBendingSlope) {
- // Set fNonBendingSlope
- fNonBendingSlope = NonBendingSlope;}
- Double_t GetBendingCoorReso2(void) {
- // Get fBendingCoorReso2
- return fBendingCoorReso2;}
- void SetBendingCoorReso2(Double_t BendingCoorReso2) {
- // Set fBendingCoorReso2
- fBendingCoorReso2 = BendingCoorReso2;}
- Double_t GetNonBendingCoorReso2(void) {
- // Get fNonBendingCoorReso2
- return fNonBendingCoorReso2;}
- void SetNonBendingCoorReso2(Double_t NonBendingCoorReso2) {
- // Set fNonBendingCoorReso2
- fNonBendingCoorReso2 = NonBendingCoorReso2;}
- Double_t GetBendingImpact(void) {
- // Get fBendingImpact
- return fBendingImpact;}
- Bool_t GetInTrack(void) {
- // Get fInTrack
- return fInTrack;}
- void SetInTrack(Bool_t InTrack) {
- // Set fInTrack
- fInTrack = InTrack;}
+ /// We are sortable
+ virtual Bool_t IsSortable() const { return kTRUE; }
+
+ /// Return the x-coordinate of our starting point
+ Double_t StartX() const { return fStartX; }
+ /// Return the y-coordinate of our starting point
+ Double_t StartY() const { return fStartY; }
+ /// Return the x-coordinate of our ending point
+ Double_t EndX() const { return fEndX; }
+ /// Return the y-coordinate of our ending point
+ Double_t EndY() const { return fEndY; }
+
+ /// Return our smallest y (of starting or ending point)
+ double SmallerY() const { return fSmallerY; }
- AliMUONSegment* CreateSegmentFromLinearExtrapToStation (Int_t Station, Double_t MCSfactor);
- Double_t NormalizedChi2WithSegment(AliMUONSegment* Segment, Double_t Sigma2Cut);
- AliMUONHitForRec* CreateHitForRecFromLinearExtrapToChamber (Int_t Chamber, Double_t MCSfactor);
- void UpdateFromStationTrackParam(AliMUONTrackParam *TrackParam, Double_t MCSfactor, Double_t Dz1, Double_t Dz2, Double_t Dz3, Int_t Station, Double_t InverseMomentum);
+ /// Whether we are a horizontal segment
+ Bool_t IsHorizontal() const { return fIsHorizontal; }
+
+ /// Whethere we are a vertical segment
+ Bool_t IsVertical() const { return fIsVertical; }
+
+ /// Whether we are a left edge
+ Bool_t IsLeftEdge() const { return fIsLeftEdge; }
+
+ /// Whether we are a right edge
+ Bool_t IsRightEdge() const { return fIsRightEdge; }
+
+ /// Return our bottom y
+ double Bottom() const { return SmallerY(); }
+
+ double Top() const;
+
+ double Distance() const;
+
+ /// Whether we're just a point
+ Bool_t IsAPoint() const { return fIsAPoint; }
+
+ const char* AsString() const;
+
+ static Bool_t AreEqual(double a, double b);
- // What is necessary for sorting TClonesArray's; sufficient too ????
- Bool_t IsSortable() const { return kTRUE; }
- Int_t Compare(TObject* Segment); // "Compare" function for sorting
- protected:
- private:
- AliMUONHitForRec* fHitForRecPtr1; // pointer to HitForRec in first chamber
- AliMUONHitForRec* fHitForRecPtr2; // pointer to HitForRec in second chamber
- // Bending plane:
- Double_t fBendingCoor; // Coordinate in bending plane
- Double_t fBendingSlope; // Slope in bending plane
- // Covariance in bending plane:
- Double_t fBendingCoorReso2; // Covariance(coordinate C1 in first chamber)
- Double_t fBendingSlopeReso2; // Covariance(slope)
- Double_t fBendingCoorSlopeReso2; // Covariance(C1,slope)
- Double_t fBendingImpact; // Impact parameter in bending plane
- // Non Bending plane:
- Double_t fNonBendingCoor; // Coordinate in non bending plane
- Double_t fNonBendingSlope; // Slope in non bending plane
- // Covariance in non bending plane:
- Double_t fNonBendingCoorReso2; // Covariance(coordinate C1 in first chamber)
- Double_t fNonBendingSlopeReso2; // Covariance(slope)
- Double_t fNonBendingCoorSlopeReso2; // Covariance(C1,slope)
- Double_t fNonBendingImpact; // Impact parameter in non bending plane
- Bool_t fInTrack; // TRUE if segment belongs to one track
+ void Print(Option_t* opt="") const;
+
+ void Set(Double_t xstart, Double_t ystart, Double_t xend, Double_t yend);
- ClassDef(AliMUONSegment, 1) // Segment for reconstruction in ALICE dimuon spectrometer
- };
-
+private:
+ Double_t fStartX; ///< x of start point
+ Double_t fStartY; ///< y of start point
+ Double_t fEndX; ///< x of end point
+ Double_t fEndY; ///< y of end point
+ Double_t fSmallerY; ///< Either StartY or EndY
+ Bool_t fIsHorizontal; ///< Whether the segment is horizontal
+ Bool_t fIsVertical; ///< Whether the segment is vertical
+ Bool_t fIsLeftEdge; ///< Whether the segment is a left edge
+ Bool_t fIsRightEdge; ///< Whether the segment is a right edge
+ Bool_t fIsAPoint; ///< Whether start==end
+
+ static const Double_t fgkPrecision; ///< Floating point precision used in comparisons
+
+ ClassDef(AliMUONSegment,1) // A basic line segment
+};
+
+
#endif