Fixing Doxygen warnings
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifPainter.cxx
index 64cfa97..fa865e3 100755 (executable)
 // $Id$
 // $MpId: AliMpMotifPainter.cxx,v 1.9 2006/05/24 13:58:32 ivana Exp $
 // Category: graphics
-//
+
+//-----------------------------------------------------------------------------
 // Class AliMpMotifPainter
 // -----------------------
 // Class for drawing a motif into canvas
 // Included in AliRoot: 2003/05/02
 // Authors: David Guez, IPN Orsay
+//-----------------------------------------------------------------------------
 
 #include "AliMpMotifPainter.h"
 #include "AliMpGraphContext.h"
 #include "AliMpMotifType.h"
 #include "AliMpMotif.h"
 #include "AliMpConnection.h"
-#include "AliMpIntPair.h"
 #include "AliLog.h"
 
 #include <TVirtualX.h>
 #include <TPad.h>
  
+#include <cstdlib>
+
 /// \cond CLASSIMP
 ClassImp(AliMpMotifPainter)
 /// \endcond
@@ -72,9 +75,10 @@ fMotifPos(0x0)
   
   AliMpVMotif* motif = new AliMpMotif(motifType->GetID(),
                                       motifType,
-                                      TVector2(kdx,kdy));
+                                      kdx,kdy);
 
-  fMotifPos = new AliMpMotifPosition(-1,motif,motif->Dimensions());
+  fMotifPos = new AliMpMotifPosition(-1,motif,
+                                     motif->DimensionX(), motif->DimensionY());
 }
 
 //_______________________________________________________________________
@@ -96,7 +100,7 @@ TVector2 AliMpMotifPainter::GetPosition() const
 {
 /// Get the owned object's position
 
-  return fMotifPos->Position();
+  return TVector2(fMotifPos->GetPositionX(), fMotifPos->GetPositionY());
 }
 
 //_______________________________________________________________________
@@ -104,7 +108,7 @@ TVector2 AliMpMotifPainter::GetDimensions() const
 {
 /// Get the owned object's dimensions
 
-  return fMotifPos->Dimensions();
+  return TVector2(fMotifPos->GetDimensionX(), fMotifPos->GetDimensionY());
 }
 
 //_______________________________________________________________________
@@ -137,12 +141,12 @@ void AliMpMotifPainter::Paint(Option_t *option)
         case 'I':{
           switch (option[1]){
             case '+' :
-              str = Form("(%d,%d)",fMotifPos->GetHighIndicesLimit().GetFirst(),
-                         fMotifPos->GetHighIndicesLimit().GetSecond());
+              str = Form("(%d,%d)",fMotifPos->GetHighLimitIx(),
+                         fMotifPos->GetHighLimitIy());
               break;
             default:
-              str = Form("(%d,%d)",fMotifPos->GetLowIndicesLimit().GetFirst(),
-                         fMotifPos->GetLowIndicesLimit().GetSecond());
+              str = Form("(%d,%d)",fMotifPos->GetLowLimitIx(),
+                         fMotifPos->GetLowLimitIy());
          }
         }
           break;
@@ -161,36 +165,39 @@ void AliMpMotifPainter::Paint(Option_t *option)
     {
       //PaintWholeBox(kFALSE);
       AliMpMotifType *motifType = fMotifPos->GetMotif()->GetMotifType();
-//      StdoutToAliDebug(1,motifType->Print("G"););
       for (Int_t j=motifType->GetNofPadsY()-1;j>=0;j--){
         for (Int_t i=0;i<motifType->GetNofPadsX();i++){
-          AliMpIntPair indices(i,j);
           AliMpConnection* connect = 
-            motifType->FindConnectionByLocalIndices(indices);
+            motifType->FindConnectionByLocalIndices(i,j);
           if (connect){
+            Double_t localPosX, localPosY;
+            fMotifPos->GetMotif()->PadPositionLocal(i, j, localPosX, localPosY);
             TVector2 realPadPos = 
-            GetPosition()+fMotifPos->GetMotif()->PadPositionLocal(indices);
+            GetPosition()+TVector2(localPosX, localPosY);
+
+            Double_t dx, dy;
+            fMotifPos->GetMotif()->GetPadDimensionsByIndices(i,j, dx, dy);
+            
             TVector2 padPadPos,padPadDim;
             gr->RealToPad(realPadPos,
-                          fMotifPos->GetMotif()->GetPadDimensions(indices),
+                          TVector2(dx, dy),
                           padPadPos,padPadDim);
             TVector2 bl = padPadPos - padPadDim;
             TVector2 ur = padPadPos + padPadDim;
-            
-            
+
             Style_t sty = gVirtualX->GetFillStyle();
             gVirtualX->SetFillStyle(1);
             gPad->PaintBox(bl.X(),bl.Y(),ur.X(),ur.Y());
             gVirtualX->SetFillStyle(0);
             gPad->PaintBox(bl.X(),bl.Y(),ur.X(),ur.Y());
             gVirtualX->SetFillStyle(sty);
+
             if (option[1]=='T'){
               Float_t textSize =   gVirtualX->GetTextSize();
               gVirtualX->SetTextSize(10);
               gVirtualX->SetTextAlign(22);
-              //                gPad->PaintText(padPadPos.X()-0.01,padPadPos.Y()-0.01,
               gPad->PaintText((bl.X()+ur.X())/2.0,(bl.Y()+ur.Y())/2.0,
-                              Form("%d",connect->GetGassiNum()));
+                              Form("%d",connect->GetManuChannel()));
               
               gVirtualX->SetTextSize(textSize);
                  }
@@ -218,12 +225,14 @@ void AliMpMotifPainter::Paint(Option_t *option)
 //_______________________________________________________________________
 void AliMpMotifPainter::PaintContour(Option_t* option, Bool_t fill)
 {
+/// Drawing real motif (not envelop) the real contour
+
   AliMpGraphContext *gr = AliMpGraphContext::Instance();
   
-  // drawing real motif (not envelop) the real contour
   Float_t xl = 0;
   Float_t yl = 0;
   Int_t manuId = 0;
+  Int_t searchMotif = -1;
   TVector2 bl0 = TVector2(999, 999);
   TVector2 ur0 = TVector2(0,0); 
   TVector2 padPadPos,padPadDim;
@@ -246,62 +255,76 @@ void AliMpMotifPainter::PaintContour(Option_t* option, Bool_t fill)
   }
   
   Width_t lineW = gPad->GetLineWidth();
-  Width_t lw = lineW*4;
-  Double_t xlw = gPad->AbsPixeltoX(lw/2);
+  Width_t lw = lineW*3;
+  Double_t xlw = gPad->PixeltoX(lw/2);
   
+
+  if (option[1] == 'I' && option[2] == ':')
+      searchMotif = atoi(&option[3]);
+
   gVirtualX->SetLineWidth(lw);
     
     for (Int_t i = 0; i < motifType->GetNofPadsX(); i++){
       
       for (Int_t j = 0; j < motifType->GetNofPadsY(); j++){
         
-        AliMpIntPair indices = AliMpIntPair(i,j);
-        AliMpConnection* connect =  motifType->FindConnectionByLocalIndices(indices);
+        AliMpConnection* connect =  motifType->FindConnectionByLocalIndices(i,j);
+
         if (connect){
+          Double_t localPosX, localPosY;
+          fMotifPos->GetMotif()->PadPositionLocal(i, j, localPosX, localPosY);
+
           TVector2 realPadPos = 
-          GetPosition()+fMotifPos->GetMotif()->PadPositionLocal(indices);
-          gr->RealToPad(realPadPos, fMotifPos->GetMotif()->GetPadDimensions(indices),
+          GetPosition()+TVector2(localPosX, localPosY);
+          
+          Double_t dx, dy;
+          fMotifPos->GetMotif()->GetPadDimensionsByIndices(i,j, dx, dy);
+          
+          gr->RealToPad(realPadPos, 
+                        TVector2(dx, dy),
                         padPadPos, padPadDim);
           
           TVector2 bl = padPadPos - padPadDim;
           TVector2 ur = padPadPos + padPadDim;
+
           if (bl0.X() > bl.X())
             bl0 = bl;
           
           if (ur0.Y() < ur.Y())
             ur0 = ur;
           
-          
           if ( fill )
           {
-            Style_t sty = gVirtualX->GetFillStyle();
-            gVirtualX->SetFillStyle(1);
-            gPad->PaintBox(bl.X(),bl.Y(),ur.X(),ur.Y());
-            gVirtualX->SetFillStyle(0);
+           Style_t csty = gVirtualX->GetFillColor();
+           Style_t sty = gVirtualX->GetFillStyle();
+           gVirtualX->SetFillStyle(1);
+           if (manuId == searchMotif) 
+               gVirtualX->SetFillColor(5); // yellow
+           gPad->PaintBox(bl.X(),bl.Y(),ur.X(),ur.Y());
             gVirtualX->SetFillStyle(sty);
-          }
-          
-          if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i,j-1)))
+            gVirtualX->SetFillColor(csty);
+          } 
+
+         if (!motifType->FindConnectionByLocalIndices(i,j-1))
           {
             gPad->PaintLine(bl.X()-xlw, bl.Y(), bl.X()+ padPadDim.X()*2 + xlw, bl.Y());
           }
           
-          if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i,j+1)))
+          if (!motifType->FindConnectionByLocalIndices(i,j+1))
           {
             gPad->PaintLine(bl.X()-xlw, bl.Y() + padPadDim.Y()*2, bl.X()+ padPadDim.X()*2+xlw, bl.Y() +  padPadDim.Y()*2);
           }
-          
-          if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i-1,j)))
+          if (!motifType->FindConnectionByLocalIndices(i-1,j))
           {
             gPad->PaintLine(bl.X(), bl.Y(), bl.X(), bl.Y()+ padPadDim.Y()*2);                  
           }          
 
-          if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i+1,j)))
+          if (!motifType->FindConnectionByLocalIndices(i+1,j))
           {
-            gPad->PaintLine(bl.X()+padPadDim.X()*2, bl.Y(), bl.X()+padPadDim.X()*2, bl.Y()+ padPadDim.Y()*2);                  
-          }          
-          
+            gPad->PaintLine(bl.X()+padPadDim.X()*2, bl.Y(), bl.X()+padPadDim.X()*2, bl.Y()+ padPadDim.Y()*2);  
+          } 
         }
+
       }
     }