]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpSector.cxx
- Adding *.C *.txt *.sh to FILE_PATTERNS
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSector.cxx
index a2f970188aaedcf96d0f431b78b61fdf3c93eff3..91bf9fe733be1b32d072bcbe1aa9cde842502a17 100755 (executable)
@@ -14,7 +14,7 @@
  **************************************************************************/
 
 // $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
@@ -23,9 +23,6 @@
 // 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();
 
@@ -71,15 +80,6 @@ AliMpSector::AliMpSector(const TString& id, Int_t nofZones, Int_t nofRows,
 #endif
 }
 
-//_____________________________________________________________________________
-AliMpSector::AliMpSector(const AliMpSector& right) 
-  : TNamed(right) 
-{
-/// Protected copy constructor (not provided) 
-
-  Fatal("AliMpSector", "Copy constructor not provided.");
-}
-
 //_____________________________________________________________________________
 AliMpSector::AliMpSector() 
   : TNamed(),
@@ -88,10 +88,15 @@ AliMpSector::AliMpSector()
     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;
 }
 
 //_____________________________________________________________________________
@@ -99,6 +104,8 @@ AliMpSector::~AliMpSector()
 {
 /// Destructor 
 
+  AliDebugStream(1) << "this = " << this << endl;
+
   // deletes 
   for (Int_t izone = 0; izone<GetNofZones(); izone++) 
     delete fZones[izone];
@@ -109,23 +116,6 @@ AliMpSector::~AliMpSector()
   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
 //
@@ -192,22 +182,59 @@ void  AliMpSector::SetGlobalIndices()
 }
 
 //_____________________________________________________________________________
-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
 //
@@ -230,7 +257,9 @@ void AliMpSector::Initialize()
   SetRowOffsets();
   SetMotifPositions();
   SetGlobalIndices();
-  SetMinPadDimensions();
+  SetMinMaxPadDimensions();
+  SetMaxPadIndices();
+  SetNofPads();
 }  
 
 //_____________________________________________________________________________
@@ -360,7 +389,7 @@ TVector2  AliMpSector::FindPosition(Int_t motifPositionId) const
   AliMpVRowSegment* segment = FindRowSegment(motifPositionId);
 
   if (!segment) {
-    Warning("FindPosition", "Given motifPositionId not found.");
+    AliWarningStream() << "Given motifPositionId not found." << endl;
     return TVector2();
   }   
 
@@ -442,7 +471,7 @@ AliMpZone* AliMpSector::GetZone(Int_t zoneID) const
 /// Return zone with specified ID.
 
   if (zoneID < 1 || zoneID > GetNofZones()) {
-    Warning("GetZone", "Index outside range");
+    AliWarningStream() << "Index outside range" << endl;
     return 0;
   }
   
@@ -475,7 +504,7 @@ AliMpRow* AliMpSector::GetRow(Int_t rowID) const
 /// Return row with specified ID.
 
   if (rowID < 0 || rowID >= GetNofRows()) {
-    Warning("GetRow", "Index outside range");
+    AliWarningStream() << "Index outside range" << endl;
     return 0;
   }
   
@@ -487,3 +516,31 @@ AliMpRow* AliMpSector::GetRow(Int_t rowID) const
   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);
+}