ROOT logo
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
*                                                                        *
* Author: The ALICE Off-line Project.                                    *
* Contributors are mentioned in the code where appropriate.              *
*                                                                        *
* Permission to use, copy, modify and distribute this software and its   *
* documentation strictly for non-commercial purposes is hereby granted   *
* without fee, provided that the above copyright notice appears in all   *
* copies and that both the copyright notice and this permission notice   *
* appear in the supporting documentation. The authors make no claims     *
* about the suitability of this software for any purpose. It is          *
* provided "as is" without express or implied warranty.                  *
**************************************************************************/

// $Id$

///\class AliMUONPointWithRef
///
/// A class used to represent a point with an external integer reference
/// and with a specific sorting method (see AliMUONContourMaker)
///
/// \author Laurent Aphecetche, Subatech
///

#include "AliMUONPointWithRef.h"

#include "AliMUONSegment.h"
#include "Riostream.h"
#include "TString.h"

using std::cout;
using std::endl;
//\cond CLASSIMP
ClassImp(AliMUONPointWithRef)
//\endcond

//_____________________________________________________________________________
AliMUONPointWithRef::AliMUONPointWithRef() : fX(), fY(), fRef(-1)
{
  /// default ctor
}

//_____________________________________________________________________________
AliMUONPointWithRef::AliMUONPointWithRef(Double_t x, Double_t y, Int_t ref)
: fX(x), fY(y), fRef(ref)
{
  /// ctor
}

//_____________________________________________________________________________
Int_t	
AliMUONPointWithRef::Compare(const TObject* obj) const
{
  /// Should serve to sort the vertical edges in ascending order, first on absissa, 
  /// then on ordinate
  
  if ( this == obj ) return 0;
  
  const AliMUONPointWithRef* rhs = static_cast<const AliMUONPointWithRef*>(obj);

  if ( AliMUONSegment::AreEqual(Y(),rhs->Y()) )
  {
    if ( AliMUONSegment::AreEqual(X(),rhs->X()) )
    {
      return 0;
    }
    else if ( X() > rhs->X() )
    {
      return 1;
    }
    else 
      return -1;
  }
  else if ( Y() < rhs->Y() )
  {
    return -1;
  }
  else
  {
    return 1;
  }
}

//_____________________________________________________________________________
void 
AliMUONPointWithRef::Print(Option_t*) const
{
  /// Printout
  cout << Form("(%10.5f,%10.5f) [%4d]",X(),Y(),Ref()) << endl;
}
 AliMUONPointWithRef.cxx:1
 AliMUONPointWithRef.cxx:2
 AliMUONPointWithRef.cxx:3
 AliMUONPointWithRef.cxx:4
 AliMUONPointWithRef.cxx:5
 AliMUONPointWithRef.cxx:6
 AliMUONPointWithRef.cxx:7
 AliMUONPointWithRef.cxx:8
 AliMUONPointWithRef.cxx:9
 AliMUONPointWithRef.cxx:10
 AliMUONPointWithRef.cxx:11
 AliMUONPointWithRef.cxx:12
 AliMUONPointWithRef.cxx:13
 AliMUONPointWithRef.cxx:14
 AliMUONPointWithRef.cxx:15
 AliMUONPointWithRef.cxx:16
 AliMUONPointWithRef.cxx:17
 AliMUONPointWithRef.cxx:18
 AliMUONPointWithRef.cxx:19
 AliMUONPointWithRef.cxx:20
 AliMUONPointWithRef.cxx:21
 AliMUONPointWithRef.cxx:22
 AliMUONPointWithRef.cxx:23
 AliMUONPointWithRef.cxx:24
 AliMUONPointWithRef.cxx:25
 AliMUONPointWithRef.cxx:26
 AliMUONPointWithRef.cxx:27
 AliMUONPointWithRef.cxx:28
 AliMUONPointWithRef.cxx:29
 AliMUONPointWithRef.cxx:30
 AliMUONPointWithRef.cxx:31
 AliMUONPointWithRef.cxx:32
 AliMUONPointWithRef.cxx:33
 AliMUONPointWithRef.cxx:34
 AliMUONPointWithRef.cxx:35
 AliMUONPointWithRef.cxx:36
 AliMUONPointWithRef.cxx:37
 AliMUONPointWithRef.cxx:38
 AliMUONPointWithRef.cxx:39
 AliMUONPointWithRef.cxx:40
 AliMUONPointWithRef.cxx:41
 AliMUONPointWithRef.cxx:42
 AliMUONPointWithRef.cxx:43
 AliMUONPointWithRef.cxx:44
 AliMUONPointWithRef.cxx:45
 AliMUONPointWithRef.cxx:46
 AliMUONPointWithRef.cxx:47
 AliMUONPointWithRef.cxx:48
 AliMUONPointWithRef.cxx:49
 AliMUONPointWithRef.cxx:50
 AliMUONPointWithRef.cxx:51
 AliMUONPointWithRef.cxx:52
 AliMUONPointWithRef.cxx:53
 AliMUONPointWithRef.cxx:54
 AliMUONPointWithRef.cxx:55
 AliMUONPointWithRef.cxx:56
 AliMUONPointWithRef.cxx:57
 AliMUONPointWithRef.cxx:58
 AliMUONPointWithRef.cxx:59
 AliMUONPointWithRef.cxx:60
 AliMUONPointWithRef.cxx:61
 AliMUONPointWithRef.cxx:62
 AliMUONPointWithRef.cxx:63
 AliMUONPointWithRef.cxx:64
 AliMUONPointWithRef.cxx:65
 AliMUONPointWithRef.cxx:66
 AliMUONPointWithRef.cxx:67
 AliMUONPointWithRef.cxx:68
 AliMUONPointWithRef.cxx:69
 AliMUONPointWithRef.cxx:70
 AliMUONPointWithRef.cxx:71
 AliMUONPointWithRef.cxx:72
 AliMUONPointWithRef.cxx:73
 AliMUONPointWithRef.cxx:74
 AliMUONPointWithRef.cxx:75
 AliMUONPointWithRef.cxx:76
 AliMUONPointWithRef.cxx:77
 AliMUONPointWithRef.cxx:78
 AliMUONPointWithRef.cxx:79
 AliMUONPointWithRef.cxx:80
 AliMUONPointWithRef.cxx:81
 AliMUONPointWithRef.cxx:82
 AliMUONPointWithRef.cxx:83
 AliMUONPointWithRef.cxx:84
 AliMUONPointWithRef.cxx:85
 AliMUONPointWithRef.cxx:86
 AliMUONPointWithRef.cxx:87
 AliMUONPointWithRef.cxx:88
 AliMUONPointWithRef.cxx:89
 AliMUONPointWithRef.cxx:90
 AliMUONPointWithRef.cxx:91