X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2Fmapping%2FAliMpSectorAreaHPadIterator.cxx;h=f7fdf51008a1796223e4c334a0c4773edb6fbe8c;hb=ea9867dad7383d8c0ad139134e029f0f40108510;hp=8ff6f6aec276d9712384c9f550f41172cd31c6c6;hpb=139856523defd6c842e24ef6640d45886e722bef;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/mapping/AliMpSectorAreaHPadIterator.cxx b/MUON/mapping/AliMpSectorAreaHPadIterator.cxx index 8ff6f6aec27..f7fdf51008a 100755 --- a/MUON/mapping/AliMpSectorAreaHPadIterator.cxx +++ b/MUON/mapping/AliMpSectorAreaHPadIterator.cxx @@ -16,13 +16,15 @@ // $Id$ // $MpId: AliMpSectorAreaHPadIterator.cxx,v 1.7 2006/05/24 13:58:46 ivana Exp $ // Category: sector -// + +//----------------------------------------------------------------------------- // Class AliMpSectorAreaHPadIterator // --------------------------------- // Class, which defines an iterator over the pads // inside a given area in a sector in horizontal direction. // Included in AliRoot: 2003/05/02 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay +//----------------------------------------------------------------------------- #include "AliMpSectorAreaHPadIterator.h" #include "AliMpSectorSegmentation.h" @@ -50,11 +52,15 @@ AliMpSectorAreaHPadIterator::AliMpSectorAreaHPadIterator( //______________________________________________________________________________ AliMpSectorAreaHPadIterator::AliMpSectorAreaHPadIterator( const AliMpSectorAreaHPadIterator& right) - : AliMpVPadIterator(right) + : AliMpVPadIterator(right), + fkSegmentation(0), + fkArea(AliMpArea()), + fCurrentPad(AliMpPad::Invalid()), + fCurrentRowPosition(0.) { -/// Protected copy constructor (not provided) +/// Copy constructor - Fatal("Copy constructor", "Not implemented"); + *this = right; } //______________________________________________________________________________ @@ -115,15 +121,16 @@ void AliMpSectorAreaHPadIterator::MoveUp() { /// Increase the current row position and searches the first valid pad. - Double_t step = 2.* fkSegmentation->GetMinPadDimensions().Y(); + Double_t dy = fkSegmentation->GetMinPadDimensionY(); - while ( !fCurrentPad.IsValid() && - fCurrentRowPosition + step < fkArea.UpBorder()) + while ( ! fCurrentPad.IsValid() && + fCurrentRowPosition + dy < fkArea.UpBorder() ) { - fCurrentRowPosition += step; - TVector2 position = TVector2(fkArea.LeftBorder(), fCurrentRowPosition); + fCurrentRowPosition += 2.*dy; - fCurrentPad = fkSegmentation->PadByDirection(position, fkArea.RightBorder()); + fCurrentPad + = fkSegmentation->PadByDirection(fkArea.LeftBorder(), fCurrentRowPosition, + fkArea.RightBorder()); } } @@ -137,23 +144,26 @@ void AliMpSectorAreaHPadIterator::First() /// Reset the iterator, so that it points to the first available /// pad in the area - if (!fkSegmentation) { + if ( ! fkSegmentation ) { Fatal("First", "Segmentation is not defined"); return; } // Start position = left down corner of the area // - fCurrentRowPosition = fkArea.DownBorder(); - TVector2 position(fkArea.LeftDownCorner()); - fCurrentPad = fkSegmentation->PadByDirection(position, fkArea.RightBorder()); + fCurrentRowPosition = fkArea.DownBorder(); + + Double_t posx, posy; + fkArea.LeftDownCorner(posx, posy); + + fCurrentPad = fkSegmentation->PadByDirection(posx, posy, fkArea.RightBorder()); MoveUp(); // Set the row position to the center of pad // - if (fCurrentPad.IsValid()) fCurrentRowPosition = fCurrentPad.Position().Y(); + if (fCurrentPad.IsValid()) fCurrentRowPosition = fCurrentPad.GetPositionY(); } //______________________________________________________________________________ @@ -161,17 +171,18 @@ void AliMpSectorAreaHPadIterator::Next() { /// Move the iterator to the next valid pad. - if (!IsValid()) return; + if ( ! IsValid() ) return; // Start position = right board of current pad + little step - // - TVector2 position - = fCurrentPad.Position() - + TVector2(fCurrentPad.Dimensions().X() + AliMpConstants::LengthStep(), 0.); - fCurrentPad = fkSegmentation->PadByDirection(position, fkArea.RightBorder()); + fCurrentPad + = fkSegmentation->PadByDirection( + fCurrentPad.GetPositionX() + fCurrentPad.GetDimensionX() + + AliMpConstants::LengthStep(), + fCurrentPad.GetPositionY(), + fkArea.RightBorder()); - if (fCurrentPad.IsValid()) return; + if ( fCurrentPad.IsValid() ) return; MoveUp(); }