]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpSlatSegmentation.cxx
Updated comments for Doxygen - corrected warnings
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSlatSegmentation.cxx
index 2b079f89dbc3bfb3fa5a9c68ef499abee47ac968..a0d87a809ad6a0edf21d74a996c8627876f17037 100644 (file)
 **************************************************************************/
 
 // $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() 
@@ -51,6 +59,15 @@ fkSlat(slat)
   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()
 {
@@ -61,6 +78,20 @@ 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
@@ -68,14 +99,38 @@ 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) 
   {
@@ -99,18 +154,18 @@ AliMpSlatSegmentation::HasPad(const AliMpIntPair& indices) const
 
 //_____________________________________________________________________________
 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.
@@ -119,6 +174,15 @@ AliMpSlatSegmentation::MaxPadIndexY()
   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, 
@@ -232,21 +296,26 @@ AliMpSlatSegmentation::PadByPosition(const TVector2& position,
   // 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);
@@ -270,6 +339,20 @@ AliMpSlatSegmentation::PadByPosition(const TVector2& position,
                   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