**************************************************************************/
// $Id$
-// $MpId: AliMpNeighboursPadIterator.cxx,v 1.9 2005/09/26 16:12:23 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...
//______________________________________________________________________________
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
//______________________________________________________________________________
AliMpNeighboursPadIterator::AliMpNeighboursPadIterator(
const AliMpNeighboursPadIterator& right)
- : AliMpVPadIterator(right)
+ : AliMpVPadIterator(right),
+ fkSegmentation(0),
+ fCenterPad(AliMpPad::Invalid()),
+ fPads(),
+ fIndex(fgkInvalidIndex)
{
/// Copy constructor
fIndex = right.fIndex;
#endif
#ifdef WITH_ROOT
- Fatal("operator=", "Not allowed assignment for TObjArray");
+ AliFatal("Not allowed assignment for TObjArray");
#endif
return *this;
//
//______________________________________________________________________________
-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()) &&
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;
}
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;
}
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;