]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpMotifSpecial.cxx
From Cvetan: new macro to load ITS clusters.
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifSpecial.cxx
index 3d90d9fbcf02d9e12aa44197b0cbe5e5e82014d7..64926d0aa965d965f184bbbf5cbc718f4f97bdc8 100755 (executable)
@@ -14,7 +14,7 @@
  **************************************************************************/
 
 // $Id$
-// $MpId: AliMpMotifSpecial.cxx,v 1.8 2005/08/26 15:43:36 ivana Exp $
+// $MpId: AliMpMotifSpecial.cxx,v 1.12 2006/05/24 13:58:41 ivana Exp $
 // Category: motif
 //
 // Class AliMpMotifSpecial
 // Included in AliRoot: 2003/05/02
 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
 
-#include <TString.h>
-
 #include "AliMpMotifSpecial.h"
 #include "AliMpMotifType.h"
 #include "AliMpIntPair.h"
 #include "AliMpConstants.h"
 
+#include "AliLog.h"
+
+#include <TString.h>
+
+/// \cond CLASSIMP
 ClassImp(AliMpMotifSpecial)
+/// \endcond
 
 
 //______________________________________________________________________________
 AliMpMotifSpecial::AliMpMotifSpecial():
   AliMpVMotif(),
+  fDimensions(),
   fPadDimensionsVector(),
   fPadDimensionsVector2()
 {
@@ -48,7 +53,13 @@ AliMpMotifSpecial::AliMpMotifSpecial():
 AliMpMotifSpecial::AliMpMotifSpecial(const TString &id, 
                                      AliMpMotifType *motifType)
   : AliMpVMotif(id,motifType),
+    fDimensions(),
+#ifdef WITH_STL
     fPadDimensionsVector(),
+#endif    
+#ifdef WITH_ROOT
+    fPadDimensionsVector(true),
+#endif    
     fPadDimensionsVector2()
   
 {
@@ -57,20 +68,12 @@ AliMpMotifSpecial::AliMpMotifSpecial(const TString &id,
 #ifdef WITH_STL
   fPadDimensionsVector.resize(motifType->GetNofPadsX()*motifType->GetNofPadsY());
 #endif  
-
-#ifdef WITH_ROOT
-  fPadDimensionsVector.Expand(motifType->GetNofPadsX()*motifType->GetNofPadsY());
-#endif  
 }
 
 //______________________________________________________________________________
 AliMpMotifSpecial::~AliMpMotifSpecial()
 {
   /// Destructor
-
-#ifdef WITH_ROOT
-  fPadDimensionsVector.Delete();
-#endif  
 }
 
 
@@ -91,19 +94,26 @@ Int_t AliMpMotifSpecial::VectorIndex(const AliMpIntPair& indices) const
 // public methods
 //
 
+#include <Riostream.h>
 //______________________________________________________________________________
 TVector2 
 AliMpMotifSpecial::GetPadDimensions(const AliMpIntPair& localIndices) const
 {
 /// Return the dimensions of pad located at the given indices
 
-  if (GetMotifType()->HasPad(localIndices))
+  if (GetMotifType()->HasPad(localIndices)) {
 #ifdef WITH_STL
     return fPadDimensionsVector[VectorIndex(localIndices)];
 #endif  
 #ifdef WITH_ROOT
-    return  *((TVector2*)fPadDimensionsVector[VectorIndex(localIndices)]);
-#endif  
+    if (!fPadDimensionsVector.GetValue(localIndices)) {
+      Warning("GetPadDimensions","Indices outside limits");
+      return TVector2(0.,0.);
+    }
+    else      
+      return  *((TVector2*)fPadDimensionsVector.GetValue(localIndices));
+#endif 
+  } 
   else {
     Warning("GetPadDimensions","Indices outside limits");
     return TVector2(0.,0.);
@@ -130,7 +140,7 @@ TVector2 AliMpMotifSpecial::GetPadDimensions(Int_t i) const
 /// Returns the i-th different pad dimensions 
 
   if (i<0 || i>GetNofPadDimensions()) {
-    Fatal("GetPadDimensions(i)", "Index outside limits.");
+    AliFatal("Index outside limits.");
     return TVector2();
   }  
 
@@ -144,10 +154,9 @@ TVector2 AliMpMotifSpecial::GetPadDimensions(Int_t i) const
 }  
 
 //______________________________________________________________________________
-TVector2 AliMpMotifSpecial::Dimensions() const
+void AliMpMotifSpecial::CalculateDimensions()
 {
-  /// Give the dimension of the motif
-
+  /// Calculate motif dimensions and keep them in fDimensions data
 
   Int_t i,j;
   Double_t sizeY=0.;
@@ -171,7 +180,15 @@ TVector2 AliMpMotifSpecial::Dimensions() const
 
   delete [] tabSizeX;
   
-  return TVector2(sizeX,sizeY);
+  fDimensions = TVector2(sizeX,sizeY);
+}  
+
+//______________________________________________________________________________
+TVector2 AliMpMotifSpecial::Dimensions() const
+{
+  /// Give the dimension of the motif
+
+  return fDimensions;
 }
 
 //______________________________________________________________________________
@@ -253,8 +270,8 @@ AliMpIntPair AliMpMotifSpecial::PadIndicesLocal(const TVector2& localPos) const
 void AliMpMotifSpecial::SetPadDimensions(const AliMpIntPair& localIndices,
                                          const TVector2& dimensions)
 {
-  /// Set the dimensions of the pad located at <localIndices> to the given
-  /// <dimensions>
+  /// Set the dimensions of the pad located at \a localIndices to the given
+  /// \a dimensions
   
   if ( !GetMotifType()->HasPad(localIndices)){
     Warning("SetPadDimensions","Pad indices outside limits");
@@ -278,7 +295,7 @@ void AliMpMotifSpecial::SetPadDimensions(const AliMpIntPair& localIndices,
 
 #ifdef WITH_ROOT
   TVector2* dimensionsObj = new TVector2(dimensions);
-  fPadDimensionsVector[VectorIndex(localIndices)]= dimensionsObj;
+  fPadDimensionsVector.Add(localIndices, dimensionsObj);
 
   // fill the vector of different pad dimensions
   // only if these dimensions are not yet present