+/**************************************************************************
+ * 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: AliMpRowSegmentLSpecial.cxx,v 1.7 2006/05/24 13:58:46 ivana Exp $
// Category: sector
//
// Class AliMpRowSegmentLSpecial
// -----------------------------
// Class describing a special inner row segment composed of the
// pad rows.
-//
+// Included in AliRoot: 2003/05/02
// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-#include <TError.h>
-
#include "AliMpRowSegmentLSpecial.h"
#include "AliMpRow.h"
#include "AliMpPadRow.h"
#include "AliMpMotifPosition.h"
#include "AliMpConstants.h"
+#include "AliLog.h"
+
+#include <Riostream.h>
+
+/// \cond CLASSIMP
ClassImp(AliMpRowSegmentLSpecial)
+/// \endcond
//______________________________________________________________________________
AliMpRowSegmentLSpecial::AliMpRowSegmentLSpecial(AliMpRow* row, Double_t offsetX)
: AliMpVRowSegmentSpecial(row, offsetX)
{
-//
+/// Standard constructor
}
//______________________________________________________________________________
AliMpRowSegmentLSpecial::AliMpRowSegmentLSpecial()
: AliMpVRowSegmentSpecial()
{
-//
+/// Default constructor
}
//______________________________________________________________________________
AliMpRowSegmentLSpecial::~AliMpRowSegmentLSpecial()
{
-//
+/// Destructor
}
//
AliMpVPadRowSegment*
AliMpRowSegmentLSpecial::FindMostRightPadRowSegment(Int_t motifPositionId) const
{
-// Find the most right pad row segment with this motifPositionId.
-// ---
+/// Find the most right pad row segment with this motifPositionId.
AliMpVPadRowSegment* found = 0;
//______________________________________________________________________________
TVector2 AliMpRowSegmentLSpecial::MotifCenterSlow(Int_t motifPositionId) const
{
-// Returns the coordinates of the motif specified with
-// the given position identifier.
-// !! Applicable only for motifs that have their most down pad in
-// this row segment.
-// ---
+/// Return 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.
// Find the first (left, down) pad row segment with this motifPositionId.
AliMpVPadRowSegment* downPadRowSegment
// Check if the motifPositionId is present
if (!downPadRowSegment || !rightPadRowSegment) {
- Error("MotifCenter", "Outside row segment region");
+ AliErrorStream() << "Outside row segment region" << endl;
return 0;
}
// Check if both pad row segments have the same motif
if (downPadRowSegment->GetMotif() != rightPadRowSegment->GetMotif()) {
- Fatal("MotifCenter", "Outside row segment region");
+ AliFatal("Outside row segment region");
return 0;
}
//______________________________________________________________________________
void AliMpRowSegmentLSpecial::UpdatePadsOffset()
{
-// Sets low indices limit to the pad offset calculated
-// from the neighbour normal segment.
-// ---
+/// Set low indices limit to the pad offset calculated
+/// from the neighbour normal segment.
// Get the neighbour row segment
// (the first normal segment)
//______________________________________________________________________________
Double_t AliMpRowSegmentLSpecial::LeftBorderX() const
{
-// Returns the x coordinate of the left row segment border
-// in global coordinate system.
-// ---
+/// Return the x coordinate of the left row segment border
+/// in the global coordinate system.
Double_t leftBorder = DBL_MAX;
for (Int_t i=0; i<GetNofPadRows(); i++) {
//______________________________________________________________________________
Double_t AliMpRowSegmentLSpecial::RightBorderX() const
{
-// Returns the x coordinate of the right row segment border
-// in global coordinate system.
-// ---
+/// Returns the x coordinate of the right row segment border
+/// in the global coordinate system.
Double_t sameBorder = GetOffsetX();
}
if (TMath::Abs(GetOffsetX() - rightBorder) > 1.e-04) {
- Error("RightBorderX", "WrongBorder");
+ AliErrorStream() << "WrongBorder" << endl;
return sameBorder;
}
//______________________________________________________________________________
TVector2 AliMpRowSegmentLSpecial::Position() const
{
-// Returns the position of the row segment centre.
-// The centre is defined as the centre of the rectangular
-// row segment envelope.
-// ---
+/// Return the position of the row segment centre.
+/// The centre is defined as the centre of the rectangular
+/// row segment envelope.
Double_t x = GetOffsetX() - Dimensions().X();
Double_t y = GetRow()->Position().Y();
return TVector2(x, y);
}
+#include <Riostream.h>
//______________________________________________________________________________
Int_t AliMpRowSegmentLSpecial::SetIndicesToMotifPosition(Int_t i,
const AliMpIntPair& indices)
{
-// Sets global indices to i-th motif position and returns next index in x.
-// ---
+/// Set global indices to i-th motif position and returns next index in x.
// Get motif position
AliMpMotifPosition* motifPosition
AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType();
AliMpIntPair high
= motifPosition->GetLowIndicesLimit()
- + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1);
+ + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1);
+
motifPosition->SetHighIndicesLimit(high);
-
+
// Increment index only if last motif position is processed
if (i != GetNofMotifs()-1)
return indices.GetFirst();
return indices.GetFirst() + MaxNofPadsInRow();
//return MaxNofPadsInRow();
}
+//______________________________________________________________________________
+void AliMpRowSegmentLSpecial::SetGlobalIndices(AliMpRow* rowBefore)
+{
+/// Set indices limits
+/// The limits are defined as the limits of the smallest rectangle which
+/// includes all pads of this special row segment.
+
+ // Low ix
+ Int_t ixl = GetLowIndicesLimit().GetFirst() + AliMpConstants::StartPadIndex();
+ // the pads offset was already defined by Reader
+
+ // High ix
+ Int_t ixh = ixl + MaxNofPadsInRow() - 1;
+
+ // Low iy
+ Int_t iyl = AliMpConstants::StartPadIndex();
+ if (rowBefore) {
+ //if (constPadSizeDirection == kY) {
+ iyl = rowBefore->GetHighIndicesLimit().GetSecond()+1;
+ //}
+ /*
+ else {
+ AliMpVRowSegment* seg = rowBefore->FindRowSegment(ixl);
+ AliMpMotifPosition* motPos = rowBefore->FindMotifPosition(seg, ixl);
+ if (!motPos)
+ Fatal("SetGlobalIndices", "Motif position in rowBefore not found.");
+ iyl = motPos->GetHighIndicesLimit().GetSecond()+1;
+ }
+ */
+ }
+
+ // High iy
+ Int_t iyh = iyl + GetNofPadRows() - 1;
+
+ SetLowIndicesLimit(AliMpIntPair(ixl, iyl));
+ SetHighIndicesLimit(AliMpIntPair(ixh, iyh));
+}
+