]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpRowSegmentRSpecial.cxx
Fix for the problem during PbPb run of Nov 2010 (Indra)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpRowSegmentRSpecial.cxx
index 00a62824eb14c59abdb2a147506027ab508bc11a..d37026919c5a048d71b6ca29151dddc567937264 100644 (file)
 // $Id$
 // $MpId: AliMpRowSegmentRSpecial.cxx,v 1.7 2006/05/24 13:58:46 ivana Exp $
 // Category: sector
-//
+
+//-----------------------------------------------------------------------------
 // Class AliMpRowSegmentRSpecial
 // -----------------------------
 // Class describing a special outer row segment composed of the 
 // pad rows.
 // Included in AliRoot: 2003/05/02
 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
+//-----------------------------------------------------------------------------
 
 #include "AliMpRowSegmentRSpecial.h"
 #include "AliMpRow.h"
 #include "AliMpMotifPosition.h"
 #include "AliMpConstants.h"
 
+#include "AliLog.h"
+
 #include <Riostream.h>
+#include <TMath.h>
 
 /// \cond CLASSIMP
 ClassImp(AliMpRowSegmentRSpecial)
@@ -100,10 +105,10 @@ void AliMpRowSegmentRSpecial::SetGlobalIndicesLow()
     
   // Set low indices limit to continue indices of the
   // preceding row segment  
-  Int_t ix = rowSegment->GetHighIndicesLimit().GetFirst() + 1;
-  Int_t iy = rowSegment->GetLowIndicesLimit().GetSecond();
+  Int_t ix = rowSegment->GetHighLimitIx() + 1;
+  Int_t iy = rowSegment->GetLowLimitIy();
   
-  SetLowIndicesLimit(AliMpIntPair(ix, iy));
+  SetLowIndicesLimit(ix, iy);
 }
 
 //
@@ -111,9 +116,10 @@ void AliMpRowSegmentRSpecial::SetGlobalIndicesLow()
 //
 
 //______________________________________________________________________________
-TVector2 AliMpRowSegmentRSpecial::MotifCenterSlow(Int_t motifPositionId) const
+void AliMpRowSegmentRSpecial::MotifCenterSlow(Int_t motifPositionId,
+                                              Double_t& x, Double_t& y) const
 {
-/// Return the coordinates of the motif specified with
+/// Fill the coordinates of the motif specified with
 /// the given position identifier.                                           \n
 /// !! Applicable only for motifs that have their most down pad in
 /// this row segment.
@@ -127,27 +133,25 @@ TVector2 AliMpRowSegmentRSpecial::MotifCenterSlow(Int_t motifPositionId) const
   // Check if the motifPositionId is present 
   if (!downPadRowSegment || !leftPadRowSegment) {
     AliErrorStream() << "Outside row segment region" << endl;
-    return 0;
+    return;
   }
 
   // Check if both pad row segments have the same motif 
   if (downPadRowSegment->GetMotif() != leftPadRowSegment->GetMotif()) {
     AliFatal("Outside row segment region");
-    return 0;
+    return;
   }
 
   // Get position of found row segment
-  Double_t x = leftPadRowSegment->LeftBorderX();       
-  Double_t y = GetRow()->LowBorderY()  ;   
+  x = leftPadRowSegment->LeftBorderX();       
+  y = GetRow()->LowBorderY()  ;   
   
   for (Int_t i=0; i<downPadRowSegment->GetPadRow()->GetID(); i++)
     y += GetPadRow(i)->HalfSizeY()*2.;
     
   // Add motifs dimensions
-  x += downPadRowSegment->GetMotif()->Dimensions().X();
-  y += downPadRowSegment->GetMotif()->Dimensions().Y();
-  
-  return TVector2(x, y);
+  x += downPadRowSegment->GetMotif()->DimensionX();
+  y += downPadRowSegment->GetMotif()->DimensionY();
 }
 
 //
@@ -200,22 +204,29 @@ Double_t  AliMpRowSegmentRSpecial::RightBorderX() const
 }
 
 //______________________________________________________________________________
-TVector2 AliMpRowSegmentRSpecial::Position() const
+Double_t AliMpRowSegmentRSpecial::GetPositionX() const
 {
-/// Return the position of the row segment centre.
+/// Return the position of the row segment centre.
 /// The centre is defined as the centre of the rectangular
 /// row segment envelope.
 
   // The right edge of the last normal segment
-  Double_t x = GetOffsetX()  + Dimensions().X();
-  Double_t y = GetRow()->Position().Y();  
-    
-  return TVector2(x, y);   
+  return GetOffsetX()  + GetDimensionX();
+}
+
+//______________________________________________________________________________
+Double_t AliMpRowSegmentRSpecial::GetPositionY() const
+{
+/// Return the y position of the row segment centre.
+/// The centre is defined as the centre of the rectangular
+/// row segment envelope.
+
+  // The right edge of the last normal segment
+  return GetRow()->GetPositionY();  
 }
 
 //______________________________________________________________________________
-Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, 
-                                         const AliMpIntPair& indices)
+Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, MpPair_t indices)
 {
 /// Set global indices to i-th motif position and returns next index in x.
 
@@ -223,21 +234,21 @@ Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i,
   SetGlobalIndicesLow();
 
   // Check for consistence
-  if (GetLowIndicesLimit().GetFirst() != indices.GetFirst()
-    Fatal("SetIndicesToMotifPosition", "Inconsistent indices");
+  if ( GetLowLimitIx() != AliMp::PairFirst(indices) 
+    AliFatal("Inconsistent indices");
 
   // Get motif position
   AliMpMotifPosition* motifPosition
     = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(i));
     
   // Set limits only once
-  if ( motifPosition->GetHighIndicesLimit().IsValid() ) 
-    return indices.GetFirst();
+  if ( motifPosition->IsHighLimitValid() ) 
+    return AliMp::PairFirst(indices)
 
   // Low limit
   //
-  Int_t ixl = GetLowIndicesLimit().GetFirst();
-  Int_t iyl = GetLowIndicesLimit().GetSecond();
+  Int_t ixl = GetLowLimitIx();
+  Int_t iyl = GetLowLimitIy();
 
   // Find the most down pad row segment with this motifPositionId.
   AliMpVPadRowSegment* padRowSegment = FindPadRowSegment(GetMotifPositionId(i));
@@ -245,23 +256,23 @@ Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i,
   iyl += padRowID; 
 
   // Add pads offset of this motif position in the row segment
-  for (Int_t im=0; im<i; im++) {
+  for ( Int_t im=0; im<i; im++ ) {
     AliMpVPadRowSegment* rs = GetPadRow(padRowID)->GetPadRowSegment(im);
     if ( rs->GetMotifPositionId() == GetMotifPositionId(i) ) break; 
     ixl += rs->GetNofPads();
   }  
-  motifPosition->SetLowIndicesLimit(AliMpIntPair(ixl, iyl));
+  motifPosition->SetLowIndicesLimit(ixl, iyl);
 
   // High limit        
   //     
   AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType();  
-  AliMpIntPair high 
+  MpPair_t high 
     = motifPosition->GetLowIndicesLimit()
-      + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1);            
+      + AliMp::Pair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1);            
   motifPosition->SetHighIndicesLimit(high);
 
   // No increment index needed (this is always the last element)
-  return indices.GetFirst();
+  return AliMp::PairFirst(indices);
 }
 
 //______________________________________________________________________________
@@ -276,7 +287,7 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore)
     = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(0));
     
   // Low ix
-  Int_t ixl = firstMotifPosition->GetLowIndicesLimit().GetFirst();
+  Int_t ixl = firstMotifPosition->GetLowLimitIx();
               // We have to take the motif position limit
              // as it can overlap over more rows and the indices
              // of the right border of the precedent normal segment
@@ -289,7 +300,7 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore)
   Int_t iyl = AliMpConstants::StartPadIndex();
   if (rowBefore) {
     //if (constPadSizeDirection == kY) {
-      iyl = rowBefore->GetHighIndicesLimit().GetSecond()+1;
+      iyl = rowBefore->GetHighLimitIy()+1;
     //} 
     /*
     else {
@@ -297,7 +308,7 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore)
       AliMpMotifPosition* motPos =  rowBefore->FindMotifPosition(seg, ixl);
       if (!motPos) 
         Fatal("SetGlobalIndices", "Motif position in rowBefore not found.");
-      iyl = motPos->GetHighIndicesLimit().GetSecond()+1;
+      iyl = motPos->GetHighLimitIy()+1;
     }
     */
   }  
@@ -305,8 +316,8 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore)
   // High iy
   Int_t iyh = iyl + GetNofPadRows() - 1;
   
-  SetLowIndicesLimit(AliMpIntPair(ixl, iyl));
-  SetHighIndicesLimit(AliMpIntPair(ixh, iyh));
+  SetLowIndicesLimit(ixl, iyl);
+  SetHighIndicesLimit(ixh, iyh);
 }