]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding IsEqual and Compare methods (Laurent)
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Jun 2007 14:12:12 +0000 (14:12 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Jun 2007 14:12:12 +0000 (14:12 +0000)
MUON/AliMUONVDigit.cxx
MUON/AliMUONVDigit.h

index 3f507333d7c5d3e9ae40a04bb6c452470db20271..56721f5793234b347cab80748afa59e068a3c73b 100644 (file)
@@ -69,6 +69,61 @@ AliMUONVDigit::~AliMUONVDigit()
   /// dtor
 }
 
+//_____________________________________________________________________________
+Bool_t 
+AliMUONVDigit::IsEqual(const TObject* object) const
+{
+  const AliMUONVDigit* d = static_cast<const AliMUONVDigit*>(object);
+    
+  return ( DetElemId() == d->DetElemId() &&
+           Cathode() == d->Cathode() &&
+           ManuId() == d->ManuId() &&
+           ManuChannel() == d->ManuChannel() );
+}
+
+//_____________________________________________________________________________
+Int_t 
+AliMUONVDigit::Compare(const TObject* object) const
+{
+  const AliMUONVDigit* d = static_cast<const AliMUONVDigit*>(object);
+  
+  if ( DetElemId() > d->DetElemId() ) 
+  {
+    return 1;
+  }
+  else if ( DetElemId() < d->DetElemId() )
+  {
+    return -1;
+  }
+  else
+  {
+    if ( Charge() > d->Charge() )
+    {
+      return 1;
+    }
+    else if ( Charge() < d->Charge() )
+    {
+      return -1;
+    }
+    else
+    {
+      if ( ManuId() < d->ManuId() )
+      {
+        return 1;
+      }
+      else if ( ManuId() > d->ManuId() )
+      {
+        return -1;
+      }
+      else
+      {
+        return ( ManuChannel() < d->ManuChannel() ) ? 1 : -1;
+      }
+    }
+  }
+  return 0;
+}
+
 //_____________________________________________________________________________
 UInt_t 
 AliMUONVDigit::BuildUniqueID(Int_t detElemId, Int_t manuId, 
index add33000f3c361477cf87697b38d2ba872bc139c..99e6eca03db71a7c0a1b4e7531876e326a37e69e 100644 (file)
@@ -22,6 +22,10 @@ public:
   AliMUONVDigit(Int_t detElemId, Int_t manuId, Int_t manuChannel, Int_t cathode);
   virtual ~AliMUONVDigit();
   
+  virtual Bool_t IsEqual(const TObject* object) const;
+  virtual Bool_t IsSortable() const { return kTRUE; }
+  virtual Int_t Compare(const TObject* object) const;
+  
   virtual const char* GetName() const;
   
   /// The detection element this digit belongs to