]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Correcting Compare method (Laurent)
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Jul 2007 16:35:34 +0000 (16:35 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Jul 2007 16:35:34 +0000 (16:35 +0000)
MUON/AliMUONPad.cxx
MUON/AliMUONPad.h

index 20bb9417453e8975fac38a9027a3708359027309..74040625f90db9b378d9fcc8f7c72c33d8f36987 100644 (file)
@@ -250,8 +250,10 @@ AliMUONPad::Compare(const TObject* obj) const
   
   const AliMUONPad* pad = static_cast<const AliMUONPad*>(obj);
     
-  if (DetElemId() < 0) {
+  if (DetElemId() < 0)
+  {
     // AZ - For "pixels" from MLEM cluster finder
+    // we only sort on charge
     if (Charge() == pad->Charge()) return 0;
     return ( Charge() < pad->Charge() ) ? 1:-1;
   }
@@ -262,7 +264,7 @@ AliMUONPad::Compare(const TObject* obj) const
   }
   else if ( DetElemId() > pad->DetElemId() )
   {
-    return 1;
+    return -1;
   }
   else
   {
@@ -322,13 +324,25 @@ AliMUONPad::Compare(const TObject* obj) const
             else
             {
               // same Y
-              return ( Charge() < pad->Charge() ) ? -1:1;              
-            }            
+              if ( Charge() < pad->Charge() ) 
+              {
+                return -1;
+              }
+              else if ( Charge() > pad->Charge() )
+              {
+                return 1;
+              }
+              else
+              {
+                return 0;
+              }
+            }
           }          
         }        
       }
     }
   }
+  return 0;
 }
 
 //_____________________________________________________________________________
index 10acb80fbe90c75ec59b5a8bb670ed0625ccc4df..7b72f38ef51866cd072cea7a9e5005c4c31d618d 100644 (file)
@@ -49,8 +49,6 @@ public:
   /// Return backup charge
   Double_t ChargeBackup() const { return fChargeBackup; }
 
-  virtual Int_t Compare(const TObject* obj) const;
-
   /// Return detection element id
   Int_t DetElemId() const { return fDetElemId; }
   
@@ -72,9 +70,11 @@ public:
   /// Return info whether this pad is saturated or not
   Bool_t IsSaturated() const { return fIsSaturated; }
   
-  /// Return true as the function Sort is implemented
+  /// Return true as the function Compare is implemented
   Bool_t IsSortable() const { return kTRUE; }
   
+  virtual Int_t Compare(const TObject* obj) const;
+
   /// Return true if is used
   Bool_t IsUsed() const { return fClusterId >= 0; }