- Adding new CreateIterator() and GetNeighbours() methods (Laurent)
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Feb 2007 15:28:39 +0000 (15:28 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Feb 2007 15:28:39 +0000 (15:28 +0000)
- Corrected PadByXDirection(),PadByYDirection() (Ivana)

MUON/mapping/AliMpSectorSegmentation.cxx
MUON/mapping/AliMpSectorSegmentation.h

index 1aa48fb..f6f1731 100755 (executable)
@@ -282,10 +282,11 @@ AliMpSectorSegmentation::PadByXDirection(const TVector2& startPosition,
     pad = PadByPosition(position, false);
     position += TVector2(stepX, 0.);
   }   
-  while ( !pad.IsValid() && position.X() < maxX ); 
+  while ( !pad.IsValid() && 
+          position.X() - fkSector->GetMaxPadDimensions().X() < maxX ); 
   
   // Invalidate pad if it is outside limits
-  if ((pad.Position().X() - pad.Dimensions().X()) > maxX) 
+  if ( (pad.Position().X() - pad.Dimensions().X()) > maxX ) 
     pad = AliMpPad::Invalid();
 
   return pad;
@@ -309,7 +310,8 @@ AliMpSectorSegmentation::PadByYDirection(const TVector2& startPosition,
     pad = PadByPosition(position, false);
     position += TVector2(0., stepY);
   }   
-  while ( !pad.IsValid() && position.Y() < maxY ); 
+  while ( !pad.IsValid() && 
+          position.Y() - fkSector->GetMaxPadDimensions().Y()< maxY ); 
   
   // Invalidate pad if it is outside limits
   if ((pad.Position().Y() - pad.Dimensions().Y()) > maxY) 
@@ -324,6 +326,14 @@ AliMpSectorSegmentation::PadByYDirection(const TVector2& startPosition,
 
 //______________________________________________________________________________
 AliMpVPadIterator* 
+AliMpSectorSegmentation::CreateIterator() const
+{
+  /// Currently uses default implementation
+  return AliMpVSegmentation::CreateIterator();
+}
+
+//______________________________________________________________________________
+AliMpVPadIterator* 
 AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const
 {
 /// Create the area iterator. 
@@ -341,11 +351,21 @@ AliMpSectorSegmentation::CreateIterator(const AliMpArea& area) const
 }   
   
 //______________________________________________________________________________
+Int_t 
+AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
+                                       Bool_t includeSelf,
+                                       Bool_t includeVoid) const
+{
+  /// Uses default implementation
+  return AliMpVSegmentation::GetNeighbours(pad,neighbours,includeSelf,includeVoid);
+}
+
+//______________________________________________________________________________
 AliMpVPadIterator* 
 AliMpSectorSegmentation::CreateIterator(const AliMpPad& centerPad,
                                         Bool_t includeCenter) const
 {
-/// Create the neighbours pad iterator.
+  /// Create the neighbours pad iterator.
 
   return new AliMpNeighboursPadIterator(this, centerPad, includeCenter);
 }   
index 46dbfb9..719b745 100755 (executable)
@@ -56,9 +56,15 @@ class AliMpSectorSegmentation : public AliMpVSegmentation
     
     // factory methods  
     virtual AliMpVPadIterator* CreateIterator(const AliMpArea& area) const;
+    virtual AliMpVPadIterator* CreateIterator() const;
+    
     AliMpVPadIterator* CreateIterator(const AliMpPad& centerPad,
-                                  Bool_t includeCenter=kFALSE) const;
+                                      Bool_t includeCenter=kFALSE) const;
 
+     Int_t GetNeighbours(const AliMpPad& pad, TObjArray& neighbours,
+                         Bool_t includeSelf = kFALSE,
+                         Bool_t includeVoid = kFALSE) const;
+    
     // methods  
     virtual AliMpPad PadByLocation(const AliMpIntPair& location,
                                Bool_t warning = kTRUE) const;