]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpNeighboursPadIterator.cxx
Updated/added comments for Doxygen
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpNeighboursPadIterator.cxx
index 42c3f033806c33af66b5960e3ee4e25c888d9ad0..9203fd36431b5029b521d729ebbe786d33b12f2e 100755 (executable)
@@ -14,7 +14,7 @@
  **************************************************************************/
 
 // $Id$
-// $MpId: AliMpNeighboursPadIterator.cxx,v 1.8 2005/08/26 15:43:36 ivana Exp $
+// $MpId: AliMpNeighboursPadIterator.cxx,v 1.12 2006/05/24 13:58:46 ivana Exp $
 // Category: sector
 //
 // Class AliMpNeighboursPadIterator
 // Included in AliRoot: 2003/05/02
 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
 
-#include <TVector2.h>
-
 #include "AliMpNeighboursPadIterator.h"
 #include "AliMpIntPair.h"
-#include "AliMpSectorSegmentation.h"
+#include "AliMpVSegmentation.h"
 #include "AliMpRow.h"
 #include "AliMpConstants.h"
 
+#include "AliLog.h"
+
+#include <TVector2.h>
+
+/// \cond CLASSIMP
 ClassImp(AliMpNeighboursPadIterator)
+/// \endcond
 
 const UInt_t AliMpNeighboursPadIterator::fgkInvalidIndex = 9999; 
                                                    //never so much neighbours...
@@ -49,12 +53,13 @@ AliMpNeighboursPadIterator::AliMpNeighboursPadIterator()
 
 //______________________________________________________________________________
 AliMpNeighboursPadIterator::AliMpNeighboursPadIterator(
-                                 const AliMpSectorSegmentation* segmentation,
+                                 const AliMpVSegmentation* segmentation,
                                  const AliMpPad& centerPad,
                                  Bool_t includeCenter)
   : AliMpVPadIterator(),
     fkSegmentation(segmentation),
     fCenterPad(centerPad),
+    fPads(),
     fIndex(fgkInvalidIndex)
 {
 /// Standard constructor, set *this to invalid position
@@ -65,7 +70,11 @@ AliMpNeighboursPadIterator::AliMpNeighboursPadIterator(
 //______________________________________________________________________________
 AliMpNeighboursPadIterator::AliMpNeighboursPadIterator(
                                  const AliMpNeighboursPadIterator& right)
-  : AliMpVPadIterator(right)
+  : AliMpVPadIterator(right),
+    fkSegmentation(0),
+    fCenterPad(AliMpPad::Invalid()),
+    fPads(),
+    fIndex(fgkInvalidIndex)
 {
 /// Copy constructor
 
@@ -106,7 +115,7 @@ AliMpNeighboursPadIterator::operator = (const AliMpNeighboursPadIterator& right)
   fIndex         = right.fIndex;
 #endif
 #ifdef WITH_ROOT
-  Fatal("operator=", "Not allowed assignment for TObjArray");
+  AliFatal("Not allowed assignment for TObjArray");
 #endif
 
   return *this;
@@ -117,12 +126,13 @@ AliMpNeighboursPadIterator::operator = (const AliMpNeighboursPadIterator& right)
 //
 
 //______________________________________________________________________________
-Bool_t AliMpNeighboursPadIterator::IsNeighbours(const AliMpPad& pad) const
+Bool_t AliMpNeighboursPadIterator::IsNeighbour(const AliMpPad& pad) const
 {
-/// Return true if the pad located by <padIndice> is a neighbour of those
-/// located at <fCenterPad>
+/// Return true if the pad located by \a pad is a neighbour of those
+/// located at a\ fCenterPad
+
+    if ( !pad.IsValid() ) return kFALSE;    
 
-    
     TVector2 relPos  = pad.Position()   - fCenterPad.Position();
     TVector2 bounds  = pad.Dimensions() + fCenterPad.Dimensions();
     return (TMath::Abs(relPos.X())- bounds.X()<AliMpConstants::LengthTolerance()) && 
@@ -132,25 +142,26 @@ Bool_t AliMpNeighboursPadIterator::IsNeighbours(const AliMpPad& pad) const
 
 #ifdef WITH_STL
 //______________________________________________________________________________
-PadVector AliMpNeighboursPadIterator::PadVectorLine(const AliMpPad& from,
-                                           const AliMpIntPair& direction) const
+AliMpNeighboursPadIterator::PadVector 
+AliMpNeighboursPadIterator::PadVectorLine(const AliMpPad& from,
+                                          const AliMpIntPair& direction) const
 {
 /// Fill  a new vector with all pads which have common
-/// parts with the pad located at <fCenterPad>, in a given line
-/// starting from <from> and moving by <direction>
+/// parts with the pad located at \a fCenterPad, in a given line
+/// starting from \a from and moving by \a direction
 
     AliMpPad current = from;
     PadVector ans;
     Bool_t cont=kTRUE;
     do {
-        if (IsNeighbours(current))
+        if (IsNeighbour(current))
             ans.push_back(current);
         else
             cont=kFALSE;
         TVector2 nextPos = current.Position() + TVector2(
           current.Dimensions().X()*(AliMpConstants::LengthStep()+1.)*direction.GetFirst(),
           current.Dimensions().Y()*(AliMpConstants::LengthStep()+1.)*direction.GetSecond());
-        current = fkSegmentation->PadByPosition(nextPos);
+        current = fkSegmentation->PadByPosition(nextPos, false);
     } while (cont);
     return ans;
 }
@@ -168,25 +179,26 @@ void  AliMpNeighboursPadIterator::UpdateTotalSet(PadSet& setTotal,
 #endif
 #ifdef WITH_ROOT
 //______________________________________________________________________________
-PadVector* AliMpNeighboursPadIterator::PadVectorLine(const AliMpPad& from,
-                                           const AliMpIntPair& direction) const
+AliMpNeighboursPadIterator::PadVector* 
+AliMpNeighboursPadIterator::PadVectorLine(const AliMpPad& from,
+                                          const AliMpIntPair& direction) const
 {
 /// Fill  a new vector with all pads which have common
-/// parts with the pad located at <fCenterPad>, in a given line
-/// starting from <from> and moving by <direction>
+/// parts with the pad located at \a fCenterPad, in a given line
+/// starting from \a from and moving by \a direction
 
     AliMpPad current = from;
     PadVector* ans = new PadVector();
     Bool_t cont=kTRUE;
     do {
-        if (IsNeighbours(current))
+        if (IsNeighbour(current))
             ans->Add(new AliMpPad(current));
         else
             cont=kFALSE;
         TVector2 nextPos = current.Position() + TVector2(
           current.Dimensions().X()*(AliMpConstants::LengthStep()+1.)*direction.GetFirst(),
           current.Dimensions().Y()*(AliMpConstants::LengthStep()+1.)*direction.GetSecond());
-        current = fkSegmentation->PadByPosition(nextPos);
+        current = fkSegmentation->PadByPosition(nextPos, false);
     } while (cont);
     return ans;
 }
@@ -224,7 +236,7 @@ void  AliMpNeighboursPadIterator::UpdateTotalSet(PadSet& setTotal,
 void AliMpNeighboursPadIterator::FillPadsVector(Bool_t includeCenter)
 {
 /// Fill the indices vector with all indices of pads which have common
-/// parts with the pad located at <fCenterPad>
+/// parts with the pad located at \a fCenterPad
 
     if (!fkSegmentation || !fCenterPad.IsValid()) return;
     
@@ -315,7 +327,7 @@ void AliMpNeighboursPadIterator::FillPadsVector(Bool_t includeCenter)
     if (includeCenter) fPads.push_back(fCenterPad);
     //fPads.insert(fPads.end(),setTotal.begin(),setTotal.end());
     
-    PadSetIterator it;
+    PadSetCIterator it;
     for (it = setTotal.begin(); it != setTotal.end(); it++)
       fPads.push_back((*it));
 #endif