**************************************************************************/
// $Id$
-// $MpId: AliMpRow.cxx,v 1.7 2005/08/26 15:43:36 ivana Exp $
+// $MpId: AliMpRow.cxx,v 1.9 2006/05/24 13:58:46 ivana Exp $
// Category: sector
-//
+
+//-----------------------------------------------------------------------------
// Class AliMpRow
// --------------
// Class describing a row composed of the row segments.
// Included in AliRoot: 2003/05/02
// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-
-#include <Riostream.h>
-#include <TError.h>
-#include <TMath.h>
+//-----------------------------------------------------------------------------
#include "AliMpRow.h"
#include "AliMpVRowSegment.h"
#include "AliMpMotifMap.h"
#include "AliMpConstants.h"
+#include "AliLog.h"
+
+#include <TMath.h>
+#include <Riostream.h>
+
+using std::endl;
+/// \cond CLASSIMP
ClassImp(AliMpRow)
+/// \endcond
//_____________________________________________________________________________
AliMpRow::AliMpRow(Int_t id, AliMpMotifMap* motifMap)
/// Default constructor
}
-//_____________________________________________________________________________
-AliMpRow::AliMpRow(const AliMpRow& right)
- : AliMpVIndexed(right)
-{
-/// Protected copy constructor (not provided)
-
- Fatal("AliMpRow", "Copy constructor not provided.");
-}
-
//_____________________________________________________________________________
AliMpRow::~AliMpRow()
{
/// Destructor
-#ifdef WITH_STL
- for (Int_t i=0; i<GetNofRowSegments(); i++)
- delete fSegments[i];
-#endif
-
-#ifdef WITH_ROOT
fSegments.Delete();
-#endif
}
-//
-// operators
-//
-
-//_____________________________________________________________________________
-AliMpRow& AliMpRow::operator=(const AliMpRow& right)
-{
-/// Protected assignment operator (not provided)
-
- // check assignment to self
- if (this == &right) return *this;
-
- Fatal("operator =", "Assignment operator not provided.");
-
- return *this;
-}
-
//
// private methods
//
AliMpVRowSegment* segment = GetRowSegment(i);
if (!dynamic_cast<AliMpVRowSegmentSpecial*>(segment) &&
- segment->GetHighIndicesLimit().GetFirst() >= ix)
+ segment->GetHighLimitIx() >= ix)
return segment;
}
return 0;
}
- if (motifPosition->GetHighIndicesLimit().GetFirst()>=ix)
+ if (motifPosition->GetHighLimitIx()>=ix)
return motifPosition;
}
for (Int_t j=0; j<GetNofRowSegments(); j++) {
AliMpVRowSegment* rowSegment = GetRowSegment(j);
rowSegment
- ->SetHighIndicesLimit(
- AliMpIntPair(rowSegment->GetHighIndicesLimit().GetFirst(),iy));
+ ->SetHighIndicesLimit(rowSegment->GetHighLimitIx(),iy);
for (Int_t k=0; k<rowSegment->GetNofMotifs(); k++) {
= GetMotifMap()->FindMotifPosition(motifPositionId);
motifPosition
- ->SetHighIndicesLimit(
- AliMpIntPair(motifPosition->GetHighIndicesLimit().GetFirst(), iy));
+ ->SetHighIndicesLimit(motifPosition->GetHighLimitIx(), iy);
}
}
{
/// Add row segment at the end.
-#ifdef WITH_STL
- fSegments.push_back(rowSegment);
-#endif
-
-#ifdef WITH_ROOT
fSegments.Add(rowSegment);
-#endif
}
//_____________________________________________________________________________
{
/// Insert row segment in the first vector position.
-#ifdef WITH_STL
- fSegments.insert(fSegments.begin(), rowSegment);
-#endif
-
-#ifdef WITH_ROOT
fSegments.AddFirst(rowSegment);
-#endif
}
//_____________________________________________________________________________
for (Int_t i=0; i<GetNofRowSegments(); i++) {
-#ifdef WITH_STL
- AliMpVRowSegment* rs = fSegments[i];
-#endif
-#ifdef WITH_ROOT
AliMpVRowSegment* rs = (AliMpVRowSegment*)fSegments.At(i);
-#endif
if (x >= rs->LeftBorderX() && x <= rs->RightBorderX())
return rs;
// Get values
Int_t motifPositionId = rowSegment->GetMotifPositionId(k);
AliMpVMotif* motif = rowSegment->GetMotif(k);
- TVector2 position = rowSegment->MotifCenter(motifPositionId);
+
+ Double_t posx, posy;
+ rowSegment->MotifCenter(motifPositionId, posx, posy);
AliMpMotifPosition* motifPosition
- = new AliMpMotifPosition(motifPositionId, motif, position);
+ = new AliMpMotifPosition(motifPositionId, motif, posx, posy);
+
// set the initial value to of HighIndicesLimit() Invalid()
// (this is used for calculation of indices in case of
// special row segments)
- motifPosition->SetHighIndicesLimit(AliMpIntPair::Invalid());
+ motifPosition->SetHighIndicesLimit(0, 0, false);
//Bool_t warn = (rowSegment->GetNofMotifs()==1);
Bool_t warn = true;
}
//_____________________________________________________________________________
-void AliMpRow::SetGlobalIndices(AliMpDirection constPadSizeDirection,
+void AliMpRow::SetGlobalIndices(AliMp::Direction constPadSizeDirection,
AliMpRow* rowBefore)
{
/// Set the global indices limits to its row segments, motif positions
for (Int_t j=0; j<GetNofRowSegments(); j++) {
AliMpVRowSegment* rowSegment = GetRowSegment(j);
- ix += rowSegment->GetLowIndicesLimit().GetFirst();
+ ix += rowSegment->GetLowLimitIx();
for (Int_t k=0; k<rowSegment->GetNofMotifs(); k++) {
// Find the y index value of the low edge
if (rowBefore) {
- if (constPadSizeDirection == kY) {
- iy = rowBefore->GetHighIndicesLimit().GetSecond()+1;
+ if (constPadSizeDirection == AliMp::kY) {
+ iy = rowBefore->GetHighLimitIy()+1;
}
else {
AliMpVRowSegment* seg = rowBefore->FindRowSegment(ix);
AliMpMotifPosition* motPos = FindMotifPosition(seg, ix);
if (!dynamic_cast<AliMpRowSegmentRSpecial*>(rowSegment)) {
- if (!motPos)
+ if (!motPos) {
Fatal("SetGlobalIndices", "Motif position in rowBefore not found.");
+ return;
+ }
- iy = motPos->GetHighIndicesLimit().GetSecond()+1;
+ iy = motPos->GetHighLimitIy()+1;
}
}
}
// Set (ix, iy) to k-th motif position and update ix
- ix = rowSegment->SetIndicesToMotifPosition(k, AliMpIntPair(ix, iy));
+ ix = rowSegment->SetIndicesToMotifPosition(k, AliMp::Pair(ix, iy));
}
rowSegment->SetGlobalIndices(rowBefore);
}
AliMpVRowSegment* rowSegment = GetRowSegment(i);
- if ( rowSegment->GetLowIndicesLimit().GetFirst() < ixl )
- ixl = rowSegment->GetLowIndicesLimit().GetFirst();
+ if ( rowSegment->GetLowLimitIx() < ixl )
+ ixl = rowSegment->GetLowLimitIx();
- if ( rowSegment->GetLowIndicesLimit().GetSecond() < iyl )
- iyl = rowSegment->GetLowIndicesLimit().GetSecond();
+ if ( rowSegment->GetLowLimitIy() < iyl )
+ iyl = rowSegment->GetLowLimitIy();
- if ( rowSegment->GetHighIndicesLimit().GetFirst() > ixh )
- ixh = rowSegment->GetHighIndicesLimit().GetFirst();
+ if ( rowSegment->GetHighLimitIx() > ixh )
+ ixh = rowSegment->GetHighLimitIx();
- if ( rowSegment->GetHighIndicesLimit().GetSecond() > iyh )
- iyh = rowSegment->GetHighIndicesLimit().GetSecond();
+ if ( rowSegment->GetHighLimitIy() > iyh )
+ iyh = rowSegment->GetHighLimitIy();
}
- SetLowIndicesLimit(AliMpIntPair(ixl, iyl));
- SetHighIndicesLimit(AliMpIntPair(ixh, iyh));
+ SetLowIndicesLimit(ixl, iyl);
+ SetHighIndicesLimit(ixh, iyh);
}
//_____________________________________________________________________________
-TVector2 AliMpRow::Position() const
+Double_t AliMpRow::GetPositionX() const
{
/// Return the position of the row centre.
- Double_t x = (GetRowSegment(0)->LeftBorderX() +
- GetRowSegment(GetNofRowSegments()-1)->RightBorderX())/2.;
-
- Double_t y = fOffsetY;
-
- return TVector2(x, y);
+ return ( GetRowSegment(0)->LeftBorderX() +
+ GetRowSegment(GetNofRowSegments()-1)->RightBorderX() )/2.;
+}
+
+//_____________________________________________________________________________
+Double_t AliMpRow::GetPositionY() const
+{
+/// Return the position of the row centre.
+
+ return fOffsetY;
}
//_____________________________________________________________________________
-TVector2 AliMpRow::Dimensions() const
+Double_t AliMpRow::GetDimensionX() const
{
/// Return the maximum halflengths of the row in x, y.
- Double_t x = (GetRowSegment(GetNofRowSegments()-1)->RightBorderX() -
- GetRowSegment(0)->LeftBorderX())/2.;
-
- Double_t y = GetRowSegment(0)->HalfSizeY();
-
- return TVector2(x, y);
+ return ( GetRowSegment(GetNofRowSegments()-1)->RightBorderX() -
+ GetRowSegment(0)->LeftBorderX() )/2.;
}
//_____________________________________________________________________________
-void AliMpRow::SetRowSegmentOffsets(const TVector2& offset)
+Double_t AliMpRow::GetDimensionY() const
+{
+/// Return the maximum halflengths of the row in x, y.
+
+ return GetRowSegment(0)->HalfSizeY();
+}
+
+//_____________________________________________________________________________
+void AliMpRow::SetRowSegmentOffsets(Double_t offsetx)
{
/// Set the row segments offsets in X .
if (previous)
offsetX = previous->RightBorderX();
else
- offsetX = offset.X();
+ offsetX = offsetx;
- rowSegment->SetOffset(TVector2(offsetX, 0.));
+ rowSegment->SetOffset(offsetX, 0.);
previous = rowSegment;
}
}
Double_t sizeY = GetRowSegment(i)->HalfSizeY();
if (TMath::Abs(sizeY - rowSizeY) >= AliMpConstants::LengthTolerance()) {
- //cout << GetID() << "th row " << i << "th segment "
- // << sizeY << " " << rowSizeY << endl;
Fatal("SetOffsetY", "Motif with different Y size in one row");
return 0.;
}
{
/// Return number of row segments.
-#ifdef WITH_STL
- return fSegments.size();
-#endif
-
-#ifdef WITH_ROOT
return fSegments.GetSize();
-#endif
}
//_____________________________________________________________________________
/// Return i-th row segment.
if (i<0 || i>=GetNofRowSegments()) {
- Warning("GetRowSegment", "Index outside range");
+ AliWarningStream() << "Index outside range" << endl;
return 0;
}
-#ifdef WITH_STL
- return fSegments[i];
-#endif
-
-#ifdef WITH_ROOT
return (AliMpVRowSegment*)fSegments.At(i);
-#endif
}