X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2Fmapping%2FAliMpSectorPadIterator.cxx;h=4d3dc4734615b6fc3ae01ba7cc3ab92f8b500bb1;hb=5bb8775a024e3a8c620bd7756f2aeceedb62b69f;hp=18dcb470ca42e566e833e7d74070db4c1e4fb61b;hpb=dbe945ccce0335c0afec85b4ccca60b4bd595caf;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/mapping/AliMpSectorPadIterator.cxx b/MUON/mapping/AliMpSectorPadIterator.cxx index 18dcb470ca4..4d3dc473461 100755 --- a/MUON/mapping/AliMpSectorPadIterator.cxx +++ b/MUON/mapping/AliMpSectorPadIterator.cxx @@ -1,11 +1,30 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + // $Id$ +// $MpId: AliMpSectorPadIterator.cxx,v 1.6 2006/05/24 13:58:46 ivana Exp $ // Category: sector -// + +//----------------------------------------------------------------------------- // Class AliMpSectorPadIterator // ---------------------------- // Class, which defines an iterator over the pads of a sector // Included in AliRoot: 2003/05/02 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay +//----------------------------------------------------------------------------- + #include "AliMpSectorPadIterator.h" #include "AliMpIntPair.h" @@ -17,39 +36,41 @@ #include "AliMpMotifMap.h" #include "AliMpMotifPosition.h" +/// \cond CLASSIMP ClassImp(AliMpSectorPadIterator) +/// \endcond //______________________________________________________________________________ AliMpSectorPadIterator::AliMpSectorPadIterator() : AliMpVPadIterator(), fkSector(0), - fCurrentRow(0), - fCurrentSeg(0), - fCurrentMotif(0), + fCurrentIndex(0), fMotifPos(0), fIterator() { -// default constructor, set the current position to "invalid" +/// Default constructor, set the current position to "invalid" } //______________________________________________________________________________ AliMpSectorPadIterator::AliMpSectorPadIterator(const AliMpSector* const sector) : AliMpVPadIterator(), fkSector(sector), - fCurrentRow(0), - fCurrentSeg(0), - fCurrentMotif(0), + fCurrentIndex(0), fMotifPos(0), fIterator() { -// normal constructor, set *this to invalid position +/// Standard constructor, set *this to invalid position } //______________________________________________________________________________ AliMpSectorPadIterator::AliMpSectorPadIterator(const AliMpSectorPadIterator& right) - : AliMpVPadIterator(right) + : AliMpVPadIterator(right), + fkSector(0), + fCurrentIndex(0), + fMotifPos(0), + fIterator() { -// copy constructor +/// Copy constructor *this = right; } @@ -57,27 +78,28 @@ AliMpSectorPadIterator::AliMpSectorPadIterator(const AliMpSectorPadIterator& rig //______________________________________________________________________________ AliMpSectorPadIterator::~AliMpSectorPadIterator() { -// destructor +/// Destructor } +// // operators +// //______________________________________________________________________________ AliMpSectorPadIterator& AliMpSectorPadIterator::operator = (const AliMpSectorPadIterator& right) { -// assignement operator +/// Assignment operator - // check assignement to self + // check assignment to self if (this == &right) return *this; - // base class assignement + // base class assignment AliMpVPadIterator::operator=(right); fkSector = right.fkSector; - fCurrentRow = right.fCurrentRow; - fCurrentSeg = right.fCurrentSeg; - fCurrentMotif = right.fCurrentMotif; + fCurrentIndex = right.fCurrentIndex, + fMotifPos = right.fMotifPos; fIterator = right.fIterator; return *this; @@ -88,36 +110,18 @@ AliMpSectorPadIterator::operator = (const AliMpSectorPadIterator& right) //______________________________________________________________________________ AliMpMotifPosition* AliMpSectorPadIterator::ResetToCurrentMotifPosition() { - // Find the AliMpMotifType object associated with the triplet - // (fCurrentRow, fCurrentSeg, fCurrentMotif) - // place it in the private fMotifType member and returns it. - - fMotifPos =0; - - if (fkSector){ - AliMpRow* row; - if ((fCurrentRow >= 0) && (fCurrentRow < fkSector->GetNofRows())){ - row= fkSector->GetRow(fCurrentRow); - - AliMpVRowSegment* seg; - if (fCurrentSegGetNofRowSegments()){ - seg = row->GetRowSegment(fCurrentSeg); - - if (fCurrentMotifGetNofMotifs()){ - fMotifPos = - fkSector->GetMotifMap()->FindMotifPosition( - seg->GetMotifPositionId(fCurrentMotif)); - } - } - } - } - - if (fMotifPos) { - fIterator = AliMpMotifPositionPadIterator(fMotifPos); - fIterator.First(); - } - else +/// Find the AliMpMotifType object associated with the triplet +/// (fCurrentRow, fCurrentSeg, fCurrentMotif), +/// place it in the private fMotifType member and return it. + + if ( fCurrentIndex == fkSector->GetMotifMap()->GetNofMotifPositions() ) { Invalidate(); + return 0; + } + + fMotifPos = fkSector->GetMotifMap()->GetMotifPosition(fCurrentIndex); + fIterator = AliMpMotifPositionPadIterator(fMotifPos); + fIterator.First(); return fMotifPos; } @@ -125,26 +129,26 @@ AliMpMotifPosition* AliMpSectorPadIterator::ResetToCurrentMotifPosition() //______________________________________________________________________________ Bool_t AliMpSectorPadIterator::IsValid() const { -// Is the iterator in a valid position? +/// Is the iterator in a valid position? + return (fkSector!=0) && (fMotifPos!=0); } +// //public methods +// //______________________________________________________________________________ void AliMpSectorPadIterator::First() { -// Reset the iterator, so that it points to the first available -// pad in the sector +/// Reset the iterator, so that it points to the first available +/// pad in the sector if (!fkSector) { Invalidate(); return; } - fCurrentRow =0; - fCurrentSeg=0; - fCurrentMotif=0; - + fCurrentIndex =0; ResetToCurrentMotifPosition(); return; @@ -153,10 +157,8 @@ void AliMpSectorPadIterator::First() //______________________________________________________________________________ void AliMpSectorPadIterator::Next() { -// Move the iterator to the next valid pad. - +/// Move the iterator to the next valid pad. - //if (!IsValid()) return *this; if (!IsValid()) return; fIterator.Next(); @@ -164,23 +166,10 @@ void AliMpSectorPadIterator::Next() if (!fIterator.IsDone()) return; - // Go to ne next motif, in the current segment - ++fCurrentMotif; - if (ResetToCurrentMotifPosition()) return; - - - // if motif number is too big, set it to 0 and pass to the next row segment - fCurrentMotif=0; - ++fCurrentSeg; + // Go to the next motif, in the current segment + ++fCurrentIndex; if (ResetToCurrentMotifPosition()) return; - - // if row segment number is too big, pass to the next row - fCurrentSeg=0; - ++fCurrentRow; - if (ResetToCurrentMotifPosition()) return; - - // if row number is too big, the invalidate the iterator (==End()) Invalidate(); return; @@ -189,28 +178,28 @@ void AliMpSectorPadIterator::Next() //______________________________________________________________________________ Bool_t AliMpSectorPadIterator::IsDone() const { -// - return !IsValid(); +/// Is the iterator in the end? + + return ! IsValid(); } //______________________________________________________________________________ AliMpPad AliMpSectorPadIterator::CurrentItem () const { -// Returns current pad. +/// Return current pad. if (!IsValid()) return AliMpPad::Invalid(); // no more verification, since IsValid() is TRUE here. - return fIterator.CurrentItem(); } //______________________________________________________________________________ void AliMpSectorPadIterator::Invalidate() { -// Let the iterator points to the invalid position +/// Let the iterator point to the invalid position fMotifPos = 0; fIterator.Invalidate(); }