]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpRow.cxx
updates in Kaon Train
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRow.cxx
index 5ccd38a7ad61908ffb59e6638e443ead8b71cb38..f010c5a5bd20fd1bb5a59de3ed88edb4d8659635 100755 (executable)
 // $Id$
 // $MpId: AliMpRow.cxx,v 1.9 2006/05/24 13:58:46 ivana Exp $
 // Category: sector
-//
+
+//-----------------------------------------------------------------------------
 // Class AliMpRow
 // --------------
 // Class describing a row composed of the row segments.
 // Included in AliRoot: 2003/05/02
 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
+//-----------------------------------------------------------------------------
 
 #include "AliMpRow.h"
 #include "AliMpVRowSegment.h"
 #include "AliMpMotifMap.h"
 #include "AliMpConstants.h"
 
+#include "AliLog.h"
+
 #include <TMath.h>
 #include <Riostream.h>
 
+using std::endl;
 /// \cond CLASSIMP
 ClassImp(AliMpRow)
 /// \endcond
@@ -62,47 +67,14 @@ AliMpRow::AliMpRow()
 /// Default constructor
 }
 
-//_____________________________________________________________________________
-AliMpRow::AliMpRow(const AliMpRow& right) 
-  : AliMpVIndexed(right) 
-{
-/// Protected copy constructor (not provided) 
-
-  Fatal("AliMpRow", "Copy constructor not provided.");
-}
-
 //_____________________________________________________________________________
 AliMpRow::~AliMpRow() 
 {
 /// Destructor 
 
-#ifdef WITH_STL
-  for (Int_t i=0; i<GetNofRowSegments(); i++)
-    delete fSegments[i]; 
-#endif
-
-#ifdef WITH_ROOT
   fSegments.Delete();
-#endif
 }
 
-//
-// operators
-//
-
-//_____________________________________________________________________________
-AliMpRow&  AliMpRow::operator=(const AliMpRow& 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
 //
@@ -116,7 +88,7 @@ AliMpVRowSegment*  AliMpRow::FindRowSegment(Int_t ix) const
     AliMpVRowSegment* segment = GetRowSegment(i);
 
     if (!dynamic_cast<AliMpVRowSegmentSpecial*>(segment) &&
-         segment->GetHighIndicesLimit().GetFirst() >= ix)
+         segment->GetHighLimitIx() >= ix)
         
      return segment;    
   }   
@@ -142,7 +114,7 @@ AliMpRow::FindMotifPosition(AliMpVRowSegment* segment, Int_t ix) const
        return 0;
      }  
      
-     if (motifPosition->GetHighIndicesLimit().GetFirst()>=ix) 
+     if (motifPosition->GetHighLimitIx()>=ix) 
        return motifPosition;
   }
   
@@ -160,8 +132,7 @@ void AliMpRow::SetHighIndicesLimits(Int_t iy)
   for (Int_t j=0; j<GetNofRowSegments(); j++) {
      AliMpVRowSegment* rowSegment = GetRowSegment(j);       
      rowSegment
-       ->SetHighIndicesLimit(
-           AliMpIntPair(rowSegment->GetHighIndicesLimit().GetFirst(),iy));
+       ->SetHighIndicesLimit(rowSegment->GetHighLimitIx(),iy);
 
     for (Int_t k=0; k<rowSegment->GetNofMotifs(); k++) {
 
@@ -170,8 +141,7 @@ void AliMpRow::SetHighIndicesLimits(Int_t iy)
        = GetMotifMap()->FindMotifPosition(motifPositionId);
 
       motifPosition
-       ->SetHighIndicesLimit(
-            AliMpIntPair(motifPosition->GetHighIndicesLimit().GetFirst(), iy));
+       ->SetHighIndicesLimit(motifPosition->GetHighLimitIx(), iy);
      
     }
   }  
@@ -195,13 +165,7 @@ void AliMpRow::AddRowSegment(AliMpVRowSegment* rowSegment)
 {
 /// Add row segment at the end.
 
-#ifdef WITH_STL
-  fSegments.push_back(rowSegment);
-#endif
-
-#ifdef WITH_ROOT
   fSegments.Add(rowSegment);
-#endif
 }  
   
 //_____________________________________________________________________________
@@ -209,13 +173,7 @@ void AliMpRow::AddRowSegmentInFront(AliMpVRowSegment* rowSegment)
 {
 /// Insert row segment in the first vector position.
 
-#ifdef WITH_STL
-  fSegments.insert(fSegments.begin(), rowSegment);
-#endif
-
-#ifdef WITH_ROOT
   fSegments.AddFirst(rowSegment);
-#endif
 }  
   
 //_____________________________________________________________________________
@@ -226,12 +184,7 @@ AliMpVRowSegment* AliMpRow::FindRowSegment(Double_t x) const
 
   for (Int_t i=0; i<GetNofRowSegments(); i++) {
 
-#ifdef WITH_STL
-    AliMpVRowSegment* rs = fSegments[i];
-#endif
-#ifdef WITH_ROOT
     AliMpVRowSegment* rs = (AliMpVRowSegment*)fSegments.At(i);
-#endif
 
     if (x >= rs->LeftBorderX() && x <= rs->RightBorderX())
       return rs;
@@ -286,14 +239,17 @@ void AliMpRow::SetMotifPositions()
         // Get values 
        Int_t motifPositionId = rowSegment->GetMotifPositionId(k);
        AliMpVMotif* motif = rowSegment->GetMotif(k);
-       TVector2 position = rowSegment->MotifCenter(motifPositionId);
+        
+        Double_t posx, posy;
+       rowSegment->MotifCenter(motifPositionId, posx, posy);
        
         AliMpMotifPosition* motifPosition 
-         = new AliMpMotifPosition(motifPositionId, motif, position);
+         = new AliMpMotifPosition(motifPositionId, motif, posx, posy);
+
         // set the initial value to of HighIndicesLimit() Invalid()
         // (this is used for calculation of indices in case of
         // special row segments)
-        motifPosition->SetHighIndicesLimit(AliMpIntPair::Invalid());
+        motifPosition->SetHighIndicesLimit(0, 0, false);
 
         //Bool_t warn = (rowSegment->GetNofMotifs()==1); 
         Bool_t warn = true;
@@ -309,7 +265,7 @@ void AliMpRow::SetMotifPositions()
 }    
 
 //_____________________________________________________________________________
-void AliMpRow::SetGlobalIndices(AliMpDirection constPadSizeDirection, 
+void AliMpRow::SetGlobalIndices(AliMp::Direction constPadSizeDirection, 
                                 AliMpRow* rowBefore)
 {
 /// Set the global indices limits to its row segments, motif positions
@@ -321,29 +277,31 @@ void AliMpRow::SetGlobalIndices(AliMpDirection constPadSizeDirection,
   for (Int_t j=0; j<GetNofRowSegments(); j++) {
      AliMpVRowSegment* rowSegment = GetRowSegment(j);
      
-     ix += rowSegment->GetLowIndicesLimit().GetFirst();
+     ix += rowSegment->GetLowLimitIx();
 
      for (Int_t k=0; k<rowSegment->GetNofMotifs(); k++) {
      
        // Find the y index value of the low edge
        if (rowBefore) {
-         if (constPadSizeDirection == kY) {
-           iy = rowBefore->GetHighIndicesLimit().GetSecond()+1;
+         if (constPadSizeDirection == AliMp::kY) {
+           iy = rowBefore->GetHighLimitIy()+1;
          } 
         else {
            AliMpVRowSegment* seg = rowBefore->FindRowSegment(ix);      
           AliMpMotifPosition* motPos =  FindMotifPosition(seg, ix);
           if (!dynamic_cast<AliMpRowSegmentRSpecial*>(rowSegment)) {
-             if (!motPos) 
+             if (!motPos) {
               Fatal("SetGlobalIndices", "Motif position in rowBefore not found.");
+               return;
+             }  
           
-             iy = motPos->GetHighIndicesLimit().GetSecond()+1;
+             iy = motPos->GetHighLimitIy()+1;
           }  
          }
        } 
 
        // Set (ix, iy) to k-th motif position and update ix
-       ix = rowSegment->SetIndicesToMotifPosition(k, AliMpIntPair(ix, iy));
+       ix = rowSegment->SetIndicesToMotifPosition(k, AliMp::Pair(ix, iy));
     }
     rowSegment->SetGlobalIndices(rowBefore);    
   }
@@ -359,51 +317,59 @@ void AliMpRow::SetGlobalIndices(AliMpDirection constPadSizeDirection,
     
     AliMpVRowSegment* rowSegment = GetRowSegment(i);
     
-    if ( rowSegment->GetLowIndicesLimit().GetFirst() < ixl ) 
-       ixl = rowSegment->GetLowIndicesLimit().GetFirst();
+    if ( rowSegment->GetLowLimitIx() < ixl ) 
+       ixl = rowSegment->GetLowLimitIx();
        
-    if ( rowSegment->GetLowIndicesLimit().GetSecond() < iyl ) 
-       iyl = rowSegment->GetLowIndicesLimit().GetSecond();
+    if ( rowSegment->GetLowLimitIy() < iyl ) 
+       iyl = rowSegment->GetLowLimitIy();
 
-    if ( rowSegment->GetHighIndicesLimit().GetFirst() > ixh ) 
-       ixh = rowSegment->GetHighIndicesLimit().GetFirst();
+    if ( rowSegment->GetHighLimitIx() > ixh ) 
+       ixh = rowSegment->GetHighLimitIx();
        
-    if ( rowSegment->GetHighIndicesLimit().GetSecond() > iyh ) 
-       iyh = rowSegment->GetHighIndicesLimit().GetSecond();
+    if ( rowSegment->GetHighLimitIy() > iyh ) 
+       iyh = rowSegment->GetHighLimitIy();
   }     
 
-  SetLowIndicesLimit(AliMpIntPair(ixl, iyl));
-  SetHighIndicesLimit(AliMpIntPair(ixh, iyh));
+  SetLowIndicesLimit(ixl, iyl);
+  SetHighIndicesLimit(ixh, iyh);
 }
 
 //_____________________________________________________________________________
-TVector2  AliMpRow::Position() const
+Double_t  AliMpRow::GetPositionX() const
 {
 /// Return the position of the row centre.
 
-  Double_t x = (GetRowSegment(0)->LeftBorderX() +
-                GetRowSegment(GetNofRowSegments()-1)->RightBorderX())/2.;
-                   
-  Double_t y = fOffsetY;  
-    
-  return TVector2(x, y);   
+  return ( GetRowSegment(0)->LeftBorderX() +
+           GetRowSegment(GetNofRowSegments()-1)->RightBorderX() )/2.;
+}
+
+//_____________________________________________________________________________
+Double_t  AliMpRow::GetPositionY() const
+{
+/// Return the position of the row centre.
+
+  return fOffsetY;  
 }
 
 //_____________________________________________________________________________
-TVector2  AliMpRow::Dimensions() const
+Double_t  AliMpRow::GetDimensionX() const
 {
 /// Return the maximum halflengths of the row in x, y.
 
-  Double_t x = (GetRowSegment(GetNofRowSegments()-1)->RightBorderX() -
-                GetRowSegment(0)->LeftBorderX())/2.;
-                  
-  Double_t y = GetRowSegment(0)->HalfSizeY();  
-    
-  return TVector2(x, y);   
+  return ( GetRowSegment(GetNofRowSegments()-1)->RightBorderX() -
+           GetRowSegment(0)->LeftBorderX() )/2.;
 }
 
 //_____________________________________________________________________________
-void AliMpRow::SetRowSegmentOffsets(const TVector2& offset)
+Double_t  AliMpRow::GetDimensionY() const
+{
+/// Return the maximum halflengths of the row in x, y.
+
+  return GetRowSegment(0)->HalfSizeY();  
+}
+
+//_____________________________________________________________________________
+void AliMpRow::SetRowSegmentOffsets(Double_t offsetx)
 {
 /// Set the row segments offsets in X .
 
@@ -418,9 +384,9 @@ void AliMpRow::SetRowSegmentOffsets(const TVector2& offset)
      if (previous) 
       offsetX = previous->RightBorderX();
     else
-      offsetX = offset.X();  
+      offsetX = offsetx;  
   
-    rowSegment->SetOffset(TVector2(offsetX, 0.));
+    rowSegment->SetOffset(offsetX, 0.);
     previous = rowSegment;  
   }
 }
@@ -460,13 +426,7 @@ Int_t AliMpRow::GetNofRowSegments() const
 {
 /// Return number of row segments.
 
-#ifdef WITH_STL
-  return fSegments.size();
-#endif
-
-#ifdef WITH_ROOT
   return fSegments.GetSize();
-#endif
 }  
 
 //_____________________________________________________________________________
@@ -479,12 +439,6 @@ AliMpVRowSegment* AliMpRow::GetRowSegment(Int_t i) const
     return 0;
   }
   
-#ifdef WITH_STL
-  return fSegments[i];  
-#endif
-
-#ifdef WITH_ROOT
   return (AliMpVRowSegment*)fSegments.At(i);  
-#endif
 }