**************************************************************************/
// $Id$
-// $MpId: AliMpRowSegmentRSpecial.cxx,v 1.5 2005/08/26 15:43:36 ivana Exp $
+// $MpId: AliMpRowSegmentRSpecial.cxx,v 1.7 2006/05/24 13:58:46 ivana Exp $
// Category: sector
-//
+
+//-----------------------------------------------------------------------------
// Class AliMpRowSegmentRSpecial
// -----------------------------
// Class describing a special outer row segment composed of the
// pad rows.
// Included in AliRoot: 2003/05/02
// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include <TError.h>
-#include <Riostream.h>
+//-----------------------------------------------------------------------------
#include "AliMpRowSegmentRSpecial.h"
#include "AliMpRow.h"
#include "AliMpMotifPosition.h"
#include "AliMpConstants.h"
+#include "AliLog.h"
+
+#include <Riostream.h>
+#include <TMath.h>
+
+/// \cond CLASSIMP
ClassImp(AliMpRowSegmentRSpecial)
+/// \endcond
//______________________________________________________________________________
AliMpRowSegmentRSpecial::AliMpRowSegmentRSpecial(AliMpRow* row, Double_t offsetX)
// Set low indices limit to continue indices of the
// preceding row segment
- Int_t ix = rowSegment->GetHighIndicesLimit().GetFirst() + 1;
- Int_t iy = rowSegment->GetLowIndicesLimit().GetSecond();
+ Int_t ix = rowSegment->GetHighLimitIx() + 1;
+ Int_t iy = rowSegment->GetLowLimitIy();
- SetLowIndicesLimit(AliMpIntPair(ix, iy));
+ SetLowIndicesLimit(ix, iy);
}
//
//
//______________________________________________________________________________
-TVector2 AliMpRowSegmentRSpecial::MotifCenterSlow(Int_t motifPositionId) const
+void AliMpRowSegmentRSpecial::MotifCenterSlow(Int_t motifPositionId,
+ Double_t& x, Double_t& y) const
{
-/// Return the coordinates of the motif specified with
+/// Fill the coordinates of the motif specified with
/// the given position identifier. \n
/// !! Applicable only for motifs that have their most down pad in
/// this row segment.
// Check if the motifPositionId is present
if (!downPadRowSegment || !leftPadRowSegment) {
- Error("MotifCenter", "Outside row segment region");
- return 0;
+ AliErrorStream() << "Outside row segment region" << endl;
+ return;
}
// Check if both pad row segments have the same motif
if (downPadRowSegment->GetMotif() != leftPadRowSegment->GetMotif()) {
- Fatal("MotifCenter", "Outside row segment region");
- return 0;
+ AliFatal("Outside row segment region");
+ return;
}
// Get position of found row segment
- Double_t x = leftPadRowSegment->LeftBorderX();
- Double_t y = GetRow()->LowBorderY() ;
+ x = leftPadRowSegment->LeftBorderX();
+ y = GetRow()->LowBorderY() ;
for (Int_t i=0; i<downPadRowSegment->GetPadRow()->GetID(); i++)
y += GetPadRow(i)->HalfSizeY()*2.;
// Add motifs dimensions
- x += downPadRowSegment->GetMotif()->Dimensions().X();
- y += downPadRowSegment->GetMotif()->Dimensions().Y();
-
- return TVector2(x, y);
+ x += downPadRowSegment->GetMotif()->DimensionX();
+ y += downPadRowSegment->GetMotif()->DimensionY();
}
//
}
if (TMath::Abs(sameBorder - leftBorder) > 1.e-04) {
- Error("LeftBorderX", "WrongBorder");
+ AliErrorStream() << "WrongBorder" << endl;;
return sameBorder;
}
}
//______________________________________________________________________________
-TVector2 AliMpRowSegmentRSpecial::Position() const
+Double_t AliMpRowSegmentRSpecial::GetPositionX() const
{
-/// Return the position of the row segment centre.
+/// Return the x position of the row segment centre.
/// The centre is defined as the centre of the rectangular
/// row segment envelope.
// The right edge of the last normal segment
- Double_t x = GetOffsetX() + Dimensions().X();
- Double_t y = GetRow()->Position().Y();
-
- return TVector2(x, y);
+ return GetOffsetX() + GetDimensionX();
+}
+
+//______________________________________________________________________________
+Double_t AliMpRowSegmentRSpecial::GetPositionY() const
+{
+/// Return the y position of the row segment centre.
+/// The centre is defined as the centre of the rectangular
+/// row segment envelope.
+
+ // The right edge of the last normal segment
+ return GetRow()->GetPositionY();
}
//______________________________________________________________________________
-Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i,
- const AliMpIntPair& indices)
+Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, MpPair_t indices)
{
/// Set global indices to i-th motif position and returns next index in x.
SetGlobalIndicesLow();
// Check for consistence
- if (GetLowIndicesLimit().GetFirst() != indices.GetFirst())
- Fatal("SetIndicesToMotifPosition", "Inconsistent indices");
+ if ( GetLowLimitIx() != AliMp::PairFirst(indices) )
+ AliFatal("Inconsistent indices");
// Get motif position
AliMpMotifPosition* motifPosition
= GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(i));
// Set limits only once
- if ( motifPosition->GetHighIndicesLimit().IsValid() )
- return indices.GetFirst();;
+ if ( motifPosition->IsHighLimitValid() )
+ return AliMp::PairFirst(indices);
// Low limit
//
- Int_t ixl = GetLowIndicesLimit().GetFirst();
- Int_t iyl = GetLowIndicesLimit().GetSecond();
+ Int_t ixl = GetLowLimitIx();
+ Int_t iyl = GetLowLimitIy();
// Find the most down pad row segment with this motifPositionId.
AliMpVPadRowSegment* padRowSegment = FindPadRowSegment(GetMotifPositionId(i));
iyl += padRowID;
// Add pads offset of this motif position in the row segment
- for (Int_t im=0; im<i; im++) {
+ for ( Int_t im=0; im<i; im++ ) {
AliMpVPadRowSegment* rs = GetPadRow(padRowID)->GetPadRowSegment(im);
if ( rs->GetMotifPositionId() == GetMotifPositionId(i) ) break;
ixl += rs->GetNofPads();
}
- motifPosition->SetLowIndicesLimit(AliMpIntPair(ixl, iyl));
+ motifPosition->SetLowIndicesLimit(ixl, iyl);
// High limit
//
AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType();
- AliMpIntPair high
+ MpPair_t high
= motifPosition->GetLowIndicesLimit()
- + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1);
+ + AliMp::Pair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1);
motifPosition->SetHighIndicesLimit(high);
// No increment index needed (this is always the last element)
- return indices.GetFirst();
+ return AliMp::PairFirst(indices);
}
//______________________________________________________________________________
= GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(0));
// Low ix
- Int_t ixl = firstMotifPosition->GetLowIndicesLimit().GetFirst();
+ Int_t ixl = firstMotifPosition->GetLowLimitIx();
// We have to take the motif position limit
// as it can overlap over more rows and the indices
// of the right border of the precedent normal segment
Int_t iyl = AliMpConstants::StartPadIndex();
if (rowBefore) {
//if (constPadSizeDirection == kY) {
- iyl = rowBefore->GetHighIndicesLimit().GetSecond()+1;
+ iyl = rowBefore->GetHighLimitIy()+1;
//}
/*
else {
AliMpMotifPosition* motPos = rowBefore->FindMotifPosition(seg, ixl);
if (!motPos)
Fatal("SetGlobalIndices", "Motif position in rowBefore not found.");
- iyl = motPos->GetHighIndicesLimit().GetSecond()+1;
+ iyl = motPos->GetHighLimitIy()+1;
}
*/
}
// High iy
Int_t iyh = iyl + GetNofPadRows() - 1;
- SetLowIndicesLimit(AliMpIntPair(ixl, iyl));
- SetHighIndicesLimit(AliMpIntPair(ixh, iyh));
+ SetLowIndicesLimit(ixl, iyl);
+ SetHighIndicesLimit(ixh, iyh);
}