**************************************************************************/
// $Id$
-// $MpId: AliMpSector.cxx,v 1.10 2005/09/26 16:12:23 ivana Exp $
+// $MpId: AliMpSector.cxx,v 1.14 2006/05/24 13:58:46 ivana Exp $
// Category: sector
//
// Class AliMpSector
// Included in AliRoot: 2003/05/02
// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
-#include <TError.h>
-#include <Riostream.h>
-
#include "AliMpSector.h"
#include "AliMpSectorPadIterator.h"
#include "AliMpZone.h"
#include "AliMpIntPair.h"
#include "AliMpConstants.h"
+#include "AliLog.h"
+
+#include <Riostream.h>
+
+/// \cond CLASSIMP
ClassImp(AliMpSector)
+/// \endcond
//_____________________________________________________________________________
AliMpSector::AliMpSector(const TString& id, Int_t nofZones, Int_t nofRows,
- AliMpDirection direction, const TVector2& offset)
+ AliMp::Direction direction, const TVector2& offset)
: TNamed("Sector", ""),
fID(id),
fOffset(offset),
fZones(),
fRows(),
+ fMotifMap(0),
fDirection(direction),
- fMinPadDimensions(TVector2(1.e6, 1.e6))
+ fMinPadDimensions(TVector2(1.e6, 1.e6)),
+ fMaxPadDimensions(),
+ fMaxPadIndices(AliMpIntPair::Invalid()),
+ fNofPads(0)
{
/// Standard constructor
+ AliDebugStream(1) << "this = " << this << endl;
+
fMotifMap = new AliMpMotifMap(true);
//fMotifMap = new AliMpMotifMap();
#endif
}
-//_____________________________________________________________________________
-AliMpSector::AliMpSector(const AliMpSector& right)
- : TNamed(right)
-{
-/// Protected copy constructor (not provided)
-
- Fatal("AliMpSector", "Copy constructor not provided.");
-}
-
//_____________________________________________________________________________
AliMpSector::AliMpSector()
: TNamed(),
fZones(),
fRows(),
fMotifMap(0),
- fDirection(kX),
- fMinPadDimensions(TVector2(0., 0.))
+ fDirection(AliMp::kX),
+ fMinPadDimensions(TVector2(0., 0.)),
+ fMaxPadDimensions(),
+ fMaxPadIndices(AliMpIntPair::Invalid()),
+ fNofPads(0)
{
/// Default constructor
+
+ AliDebugStream(1) << "this = " << this << endl;
}
//_____________________________________________________________________________
{
/// Destructor
+ AliDebugStream(1) << "this = " << this << endl;
+
// deletes
for (Int_t izone = 0; izone<GetNofZones(); izone++)
delete fZones[izone];
delete fMotifMap;
}
-//
-// operators
-//
-
-//_____________________________________________________________________________
-AliMpSector& AliMpSector::operator=(const AliMpSector& 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
//
}
//_____________________________________________________________________________
-void AliMpSector::SetMinPadDimensions()
+void AliMpSector::SetMinMaxPadDimensions()
{
/// Set the minimal pad dimensions.
for (Int_t i=1; i<GetNofZones()+1; i++) {
TVector2 padDimensions = GetZone(i)->GetPadDimensions();
- if ( fDirection == kX &&
+ if ( fDirection == AliMp::kX &&
padDimensions.Y() > 0. && padDimensions.Y() < fMinPadDimensions.Y() ||
- fDirection == kY &&
+ fDirection == AliMp::kY &&
padDimensions.X() > 0. && padDimensions.X() < fMinPadDimensions.X())
fMinPadDimensions = padDimensions;
+
+ if ( fDirection == AliMp::kX &&
+ padDimensions.Y() > 0. && padDimensions.Y() > fMaxPadDimensions.Y() ||
+ fDirection == AliMp::kY &&
+ padDimensions.X() > 0. && padDimensions.X() > fMinPadDimensions.X())
+
+ fMaxPadDimensions = padDimensions;
}
}
+//_____________________________________________________________________________
+void AliMpSector::SetMaxPadIndices()
+{
+/// Set maximum pad indices in x, y
+
+ if ( fMaxPadIndices != AliMpIntPair::Invalid() ) return;
+
+ Int_t maxIndexInX = 0;
+ Int_t maxIndexInY = 0;
+ for (Int_t i=0; i<GetNofRows(); i++) {
+
+ Int_t ixh = GetRow(i)->GetHighIndicesLimit().GetFirst();
+ if ( ixh > maxIndexInX ) maxIndexInX = ixh;
+
+ Int_t iyh = GetRow(i)->GetHighIndicesLimit().GetSecond();
+ if ( iyh > maxIndexInY ) maxIndexInY = iyh;
+ }
+
+ fMaxPadIndices = AliMpIntPair(maxIndexInX, maxIndexInY);
+}
+
+
+//_____________________________________________________________________________
+void AliMpSector::SetNofPads()
+{
+/// Set the total number of pads
+
+ fNofPads = fMotifMap->CalculateNofPads();
+}
+
//
// public methods
//
SetRowOffsets();
SetMotifPositions();
SetGlobalIndices();
- SetMinPadDimensions();
+ SetMinMaxPadDimensions();
+ SetMaxPadIndices();
+ SetNofPads();
}
//_____________________________________________________________________________
AliMpVRowSegment* segment = FindRowSegment(motifPositionId);
if (!segment) {
- Warning("FindPosition", "Given motifPositionId not found.");
+ AliWarningStream() << "Given motifPositionId not found." << endl;
return TVector2();
}
/// Return zone with specified ID.
if (zoneID < 1 || zoneID > GetNofZones()) {
- Warning("GetZone", "Index outside range");
+ AliWarningStream() << "Index outside range" << endl;
return 0;
}
/// Return row with specified ID.
if (rowID < 0 || rowID >= GetNofRows()) {
- Warning("GetRow", "Index outside range");
+ AliWarningStream() << "Index outside range" << endl;
return 0;
}
return (AliMpRow*)fRows[rowID];
#endif
}
+
+//_____________________________________________________________________________
+AliMp::PlaneType
+AliMpSector::GetPlaneType() const
+{
+/// Return the plane type
+
+ return GetDirection()==AliMp::kY ? AliMp::kBendingPlane : AliMp::kNonBendingPlane;
+}
+
+//_____________________________________________________________________________
+void
+AliMpSector::GetAllMotifPositionsIDs(TArrayI& ecn) const
+{
+/// Return the array of all motif positions IDs
+
+ fMotifMap->GetAllMotifPositionsIDs(ecn);
+}
+
+//_____________________________________________________________________________
+void
+AliMpSector::Print(Option_t* opt) const
+{
+/// Print the map of motifs
+
+ cout << "Sector," << PlaneTypeName(GetPlaneType()) << endl;
+ fMotifMap->Print(opt);
+}