**************************************************************************/
// $Id$
-// $MpId: AliMpSlatSegmentation.cxx,v 1.4 2005/09/19 19:01:31 ivana Exp $
+// $MpId: AliMpSlatSegmentation.cxx,v 1.12 2006/05/24 13:58:50 ivana Exp $
+
+// Caution !!
+// Implementation note.
+// The position(s) used in the interface are supposed to be relative
+// to the slat center (AliMpSlat::Position()), whereas internally
+// the x,y are relative to bottom-left corner.
#include "AliMpSlatSegmentation.h"
#include "AliLog.h"
+#include "AliMpArea.h"
#include "AliMpConnection.h"
#include "AliMpMotif.h"
#include "AliMpMotifPosition.h"
#include "AliMpMotifType.h"
-#include "AliMpPCB.h"
#include "AliMpSlat.h"
#include "AliMpSlatPadIterator.h"
+/// \cond CLASSIMP
ClassImp(AliMpSlatSegmentation)
+/// \endcond
//_____________________________________________________________________________
AliMpSlatSegmentation::AliMpSlatSegmentation()
AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
}
+//______________________________________________________________________________
+AliMpSlatSegmentation::AliMpSlatSegmentation(const AliMpSlatSegmentation& right)
+ : AliMpVSegmentation(right)
+{
+/// Protected copy constructor (not implemented)
+
+ AliFatal("Copy constructor not provided.");
+}
+
//_____________________________________________________________________________
AliMpSlatSegmentation::~AliMpSlatSegmentation()
{
AliDebug(1,Form("this=%p",this));
}
+//______________________________________________________________________________
+AliMpSlatSegmentation&
+AliMpSlatSegmentation::operator=(const AliMpSlatSegmentation& right)
+{
+/// Protected assignement operator (not implemented)
+
+ // check assignement to self
+ if (this == &right) return *this;
+
+ AliFatal("Assignement operator not provided.");
+
+ return *this;
+}
+
//_____________________________________________________________________________
AliMpVPadIterator*
AliMpSlatSegmentation::CreateIterator(const AliMpArea& area) const
//
// Returns an iterator to loop over the pad contained within given area.
//
-
- return new AliMpSlatPadIterator(fkSlat,area);
+ AliMpArea a(area.Position()+fkSlat->Position(),area.Dimensions());
+ AliDebug(3,Form("Converted input area wrt to slat center : "
+ "%7.2f,%7.2f->%7.2f,%7.2f to wrt slat lower-left : "
+ "%7.2f,%7.2f->%7.2f,%7.2f ",
+ area.LeftBorder(),area.DownBorder(),
+ area.RightBorder(),area.UpBorder(),
+ a.LeftBorder(),a.DownBorder(),
+ a.RightBorder(),a.UpBorder()));
+
+ return new AliMpSlatPadIterator(fkSlat,a);
+}
+
+//_____________________________________________________________________________
+TVector2
+AliMpSlatSegmentation::Dimensions() const
+{
+ return Slat()->Dimensions();
+}
+
+//_____________________________________________________________________________
+void
+AliMpSlatSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
+{
+ Slat()->GetAllMotifPositionsIDs(ecn);
}
//_____________________________________________________________________________
const char*
AliMpSlatSegmentation::GetName() const
{
+ // The name of this segmentation is "SlatSegmentation"+slatName
+
TString name("SlatSegmentation");
if ( fkSlat)
{
//_____________________________________________________________________________
Int_t
-AliMpSlatSegmentation::MaxPadIndexX()
+AliMpSlatSegmentation::MaxPadIndexX() const
{
//
// Returns the value of the largest pad index in x-direction.
//
- return fkSlat->GetNofPadsX()-1;
+ return fkSlat->GetMaxPadIndexX();
}
//_____________________________________________________________________________
Int_t
-AliMpSlatSegmentation::MaxPadIndexY()
+AliMpSlatSegmentation::MaxPadIndexY() const
{
//
// Returns the value of the largest pad index in y-direction.
return fkSlat->GetMaxNofPadsY()-1;
}
+//_____________________________________________________________________________
+Int_t
+AliMpSlatSegmentation::NofPads() const
+{
+/// Return number of pads defined in the slat
+
+ return fkSlat->NofPads();
+}
+
//_____________________________________________________________________________
AliMpPad
AliMpSlatSegmentation::PadByLocation(const AliMpIntPair& location,
// AliMpPad::Invalid() is returned if there's no pad at the given location.
//
- AliMpMotifPosition* motifPos = fkSlat->FindMotifPosition(position.X(),position.Y());
+ TVector2 blPos(position+fkSlat->Position()); // position relative to
+ // bottom-left of the slat.
+
+ AliMpMotifPosition* motifPos = fkSlat->FindMotifPosition(blPos.X(),blPos.Y());
if (!motifPos)
{
if (warning)
{
- AliWarning(Form("Slat %s Position (%e,%e) mm outside limits",
- fkSlat->GetID(),position.X(),position.Y()));
+ AliWarning(Form("Slat %s Position (%e,%e)/center (%e,%e)/bottom-left cm "
+ " outside limits",fkSlat->GetID(),
+ position.X(),position.Y(),
+ blPos.X(),blPos.Y()));
}
return AliMpPad::Invalid();
}
AliMpVMotif* motif = motifPos->GetMotif();
AliMpIntPair localIndices
- = motif->PadIndicesLocal(position-motifPos->Position());
+ = motif->PadIndicesLocal(blPos-motifPos->Position());
AliMpConnection* connect =
motif->GetMotifType()->FindConnectionByLocalIndices(localIndices);
motif->GetPadDimensions(localIndices));
}
+//_____________________________________________________________________________
+AliMpPlaneType
+AliMpSlatSegmentation::PlaneType() const
+{
+ return Slat()->PlaneType();
+}
+
+//_____________________________________________________________________________
+void
+AliMpSlatSegmentation::Print(Option_t* opt) const
+{
+ fkSlat->Print(opt);
+}
+
//_____________________________________________________________________________
const AliMpSlat*
AliMpSlatSegmentation::Slat() const