]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt12QuadrantSegmentation.cxx
Updated list of MUON libraries
[u/mrichter/AliRoot.git] / MUON / AliMUONSt12QuadrantSegmentation.cxx
index 3979b9ea1dfda1979d2ac7e9ed266921d88f8175..6061bc414ff6fc5810f75baba15fa5b2aff6f7a1 100644 (file)
  
 /* $Id$ */
 
+// -------------------------------------
 // Class AliMUONSt12QuadrantSegmentation
 // -------------------------------------
 // Segmentation for MUON quadrants of stations 1 and 2 using 
 // the mapping package
-//
 // Author: Ivana Hrivnacova, IPN Orsay
-
-#include <TError.h>
-#include <TF1.h>
-#include <TObjArray.h>
-#include <TVector2.h>
+#include "AliMUONSt12QuadrantSegmentation.h"
+#include "AliMUONConstants.h"
 
 #include "AliMpPad.h"
 #include "AliMpArea.h"
-#include "AliMpReader.h"
+#include "AliMpSectorReader.h"
 #include "AliMpSector.h"
 #include "AliMpVPadIterator.h"
 #include "AliMpSectorSegmentation.h"
+#include "AliMpFiles.h"
+#include "AliMpNeighboursPadIterator.h"
 
-#include "AliMUONSt12QuadrantSegmentation.h"
-#include "AliRun.h"
-#include "AliMUON.h"
-#include "AliMUONChamber.h"
 #include "AliLog.h"
 
-ClassImp(AliMUONSt12QuadrantSegmentation)
+#include <TError.h>
+#include <TF1.h>
+#include <TMath.h>
+#include <TObjArray.h>
+#include <TVector2.h>
+#include <TSystem.h>
 
-const Float_t  AliMUONSt12QuadrantSegmentation::fgkWireD = 0.20; 
-const Float_t  AliMUONSt12QuadrantSegmentation::fgkLengthUnit = 0.1; 
+/// \cond CLASSIMP
+ClassImp(AliMUONSt12QuadrantSegmentation)
+/// \endcond
 
 //______________________________________________________________________________
 AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
-                                       AliMpStationType stationType,
-                                      AliMpPlaneType planeType) 
+                                       AliMpVSegmentation* segmentation,
+                                       AliMp::StationType stationType,
+                                      AliMp::PlaneType planeType) 
 : AliMUONVGeometryDESegmentation(),
+  fStationType(stationType),
+  fPlaneType(planeType),
   fSector(0),
   fSectorSegmentation(0),
   fSectorIterator(0),
-  fWireD(fgkWireD),
+  fWireD(0),
   fChamber(0),
   fId(0),
   fRmin(0.),
@@ -73,25 +78,39 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(
   fYt(0.),
   fCorrA(0)
 {
-// Normal constructor
-  
-  AliMpReader r(stationType, planeType);
-  fSector = r.BuildSector();
-  fSectorSegmentation = new AliMpSectorSegmentation(fSector);
+/// Standard constructor
+
+  fSectorSegmentation = dynamic_cast<AliMpSectorSegmentation*>(segmentation);
+  if (fSectorSegmentation)
+    fSector = fSectorSegmentation->GetSector();
+  else 
+    AliFatal("Wrong mapping segmentation type");
+    
+  // Anod pitch
+  if ( stationType == AliMp::kStation1 )  
+    fWireD = AliMUONConstants::PitchSt1();
+  else if ( stationType == AliMp::kStation2 )   
+    fWireD = AliMUONConstants::Pitch();
+  else  
+    AliFatal("Wrong station type");
 
   fCorrA = new TObjArray(3);
   fCorrA->AddAt(0,0);
   fCorrA->AddAt(0,1);
   fCorrA->AddAt(0,2);
+
+  AliDebug(1, Form("ctor this = %p", this) ); 
 }
 
 //______________________________________________________________________________
 AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation() 
 : AliMUONVGeometryDESegmentation(),
+  fStationType(AliMp::kStation1),
+  fPlaneType(AliMp::kBendingPlane),
   fSector(0),
   fSectorSegmentation(0),
   fSectorIterator(0),
-  fWireD(fgkWireD),
+  fWireD(0),
   fChamber(0),
   fId(0),
   fRmin(0.),
@@ -109,45 +128,23 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation()
   fIwt(0),
   fXt(0.),
   fYt(0.),
-  fCorrA(0) {
-// Default Constructor
+  fCorrA(0) 
+{
+/// Default Constructor
+
+  AliDebug(1, Form("default (empty) ctor this = %p", this));
 }
 
 //______________________________________________________________________________
-AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(const AliMUONSt12QuadrantSegmentation& rhs) 
-  : AliMUONVGeometryDESegmentation(rhs)
+AliMUONSt12QuadrantSegmentation::~AliMUONSt12QuadrantSegmentation() 
 {
-// Copy constructor
-  AliFatal("Copy constructor is not implemented.");
-}
+/// Destructor
 
-//______________________________________________________________________________
-AliMUONSt12QuadrantSegmentation::~AliMUONSt12QuadrantSegmentation() {
-// Destructor
+  AliDebug(1, Form("dtor this = %p", this));
 
-  delete fSector;
-  delete fSectorSegmentation;  
   delete fSectorIterator;  
 } 
 
-//
-// operators
-//
-
-//______________________________________________________________________________
-AliMUONSt12QuadrantSegmentation& 
-AliMUONSt12QuadrantSegmentation::operator=(const AliMUONSt12QuadrantSegmentation& rhs)
-{
-// Copy operator 
-
-  // check assignement to self
-  if (this == &rhs) return *this;
-
-  AliFatal("Assignment operator is not implemented.");
-    
-  return *this;  
-}
-
 //
 // private methods
 //
@@ -155,16 +152,16 @@ AliMUONSt12QuadrantSegmentation::operator=(const AliMUONSt12QuadrantSegmentation
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::UpdateCurrentPadValues(const AliMpPad& pad)
 {
-// Updates current pad values.
-// ---
+/// Updates current pad values.
 
   fIx = pad.GetIndices().GetFirst();
   fIy = pad.GetIndices().GetSecond();
-  fX = pad.Position().X() * fgkLengthUnit;
-  fY = pad.Position().Y() * fgkLengthUnit;
+  fX = pad.Position().X();
+  fY = pad.Position().Y();
   fZone = fSectorSegmentation->Zone(pad);
 }  
 
+
 //
 // public methods
 //
@@ -172,8 +169,7 @@ void AliMUONSt12QuadrantSegmentation::UpdateCurrentPadValues(const AliMpPad& pad
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::SetPadSize(Float_t /*p1*/, Float_t /*p2*/)
 {
-// Set pad size Dx*Dy 
-// ---
+/// Set pad size Dx*Dy 
 
   AliFatal("Not uniform pad size.");
 }
@@ -181,19 +177,21 @@ void AliMUONSt12QuadrantSegmentation::SetPadSize(Float_t /*p1*/, Float_t /*p2*/)
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::SetDAnod(Float_t d)
 {
-// Set anod pitch
-// ---
+/// Set anod pitch
 
   fWireD = d;
 }
 
+#include "AliMpMotifMap.h"
 //______________________________________________________________________________
 Bool_t  AliMUONSt12QuadrantSegmentation::HasPad(Float_t x, Float_t y, Float_t /*z*/)
 { 
-// Returns true if a pad exists in the given position
+/// Returns true if a pad exists in the given position
+
+  // fSector->GetMotifMap()->Print();
 
   AliMpPad pad = fSectorSegmentation
-               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false);
+               ->PadByPosition(TVector2(x,y), false);
 
   return pad.IsValid();
 }  
@@ -202,7 +200,7 @@ Bool_t  AliMUONSt12QuadrantSegmentation::HasPad(Float_t x, Float_t y, Float_t /*
 //______________________________________________________________________________
 Bool_t  AliMUONSt12QuadrantSegmentation::HasPad(Int_t ix, Int_t iy)
 {
-// Returns true if a pad with given indices exists
+/// Returns true if a pad with given indices exists
 
   AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), false);
 
@@ -210,13 +208,35 @@ Bool_t  AliMUONSt12QuadrantSegmentation::HasPad(Int_t ix, Int_t iy)
 }  
 
 
+//______________________________________________________________________________
+AliMUONGeometryDirection  AliMUONSt12QuadrantSegmentation::GetDirection()
+{
+/// Returns the direction with a constant pad size  
+/// (Direction or coordinate where the resolution is the best)
+
+  switch ( fSector->GetDirection() ) {
+    case AliMp::kX: return kDirX;
+    case AliMp::kY: return kDirY;
+    default: return kDirUndefined;
+  }  
+}  
+
+//______________________________________________________________________________
+const AliMpVSegmentation*  
+AliMUONSt12QuadrantSegmentation::GetMpSegmentation() const
+{
+/// Returns the mapping segmentation
+/// (provides access to electronics info)
+
+  return fSectorSegmentation;
+}  
+
 //______________________________________________________________________________
 Float_t AliMUONSt12QuadrantSegmentation::GetAnod(Float_t xhit) const
 {
-// Anod wire coordinate closest to xhit
-// Returns for a hit position xhit the position of the nearest anode wire    
-// From AliMUONSegmentationV01.
-// ---
+/// Anod wire coordinate closest to xhit
+/// Returns for a hit position xhit the position of the nearest anode wire    
+/// From AliMUONSegmentationV01.
 
   Float_t wire= (xhit>0) ? Int_t(xhit/fWireD) + 0.5
                          : Int_t(xhit/fWireD) - 0.5;
@@ -228,8 +248,7 @@ Float_t AliMUONSt12QuadrantSegmentation::GetAnod(Float_t xhit) const
 void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y, Float_t /*z*/, 
                                       Int_t& ix, Int_t& iy)
 {                                      
-//  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
-// ---
+///  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
 
   GetPadI(x, y, ix, iy);
 }
@@ -238,12 +257,10 @@ void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y, Float_t /*z
 void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y,
                                       Int_t& ix, Int_t& iy)
 {                                      
-// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
-// If there is no pad, ix = 0, iy = 0 are returned.
-// ---
+/// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
+/// If there is no pad, ix = 0, iy = 0 are returned.
 
-  AliMpPad pad = fSectorSegmentation
-               ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), true);
+  AliMpPad pad = fSectorSegmentation->PadByPosition(TVector2(x,y), true);
 
   ix = pad.GetIndices().GetFirst();
   iy = pad.GetIndices().GetSecond();
@@ -253,8 +270,7 @@ void  AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y,
 void  AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy, 
                                       Float_t& x, Float_t& y, Float_t& z)
 {                                      
-// Transform from pad to real coordinates
-// ---
+/// Transform from pad to real coordinates
 
   z = fZ;
   GetPadC(ix, iy, x , y);
@@ -264,30 +280,26 @@ void  AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy,
 void  AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy, 
                                       Float_t& x, Float_t& y)
 {                                      
-// Transform from pad to real coordinates
-// If there is no pad, x = 0., y = 0. are returned.
-// ---
+/// Transform from pad to real coordinates
+/// If there is no pad, x = 0., y = 0. are returned.
 
   AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), true);
 
-  x = pad.Position().X() * fgkLengthUnit;
-  y = pad.Position().Y() * fgkLengthUnit;
+  x = pad.Position().X();
+  y = pad.Position().Y();
 }
 
 
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::Init(Int_t chamber)
 {
-// Initialize segmentation
-// ---
+/// Initialize segmentation
 
 // find Npx, Npy and save this info
+ // find Npx, Npy and save this info
   
   // reference to chamber
- AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
- fChamber = &(pMUON->Chamber(chamber));
- fRmin=fChamber->RInner();
- fRmax=fChamber->ROuter();  
+ fRmin=AliMUONConstants::Rmin(0);
+ fRmax=AliMUONConstants::Rmax(0);  
  fZ = 0;
  fId=chamber;
 }
@@ -295,8 +307,7 @@ void AliMUONSt12QuadrantSegmentation::Init(Int_t chamber)
 //______________________________________________________________________________
 Float_t AliMUONSt12QuadrantSegmentation::Dpx() const
 {
-// Get pad size in x
-// ---
+/// Get pad size in x
 
   AliFatal( "Not uniform pad size.");
   return 0.;
@@ -305,8 +316,7 @@ Float_t AliMUONSt12QuadrantSegmentation::Dpx() const
 //______________________________________________________________________________
 Float_t AliMUONSt12QuadrantSegmentation::Dpy() const
 {
-// Get pad size in y
-// ---
+/// Get pad size in y
 
   AliFatal("Not uniform pad size.");
   return 0.;
@@ -315,67 +325,44 @@ Float_t AliMUONSt12QuadrantSegmentation::Dpy() const
 //______________________________________________________________________________
 Float_t AliMUONSt12QuadrantSegmentation::Dpx(Int_t isector) const
 {
-// Pad size in x by sector
-// ---
+/// Pad size in x by sector
 
-  return fSectorSegmentation->PadDimensions(isector).X()*2.*fgkLengthUnit;
+  return fSectorSegmentation->PadDimensions(isector).X()*2.0;
 } 
 
 //______________________________________________________________________________
 Float_t AliMUONSt12QuadrantSegmentation::Dpy(Int_t isector) const
 {
-// Pad size in x, y by Sector 
-// ---
+/// Pad size in x, y by Sector 
 
-  return fSectorSegmentation->PadDimensions(isector).Y()*2.*fgkLengthUnit;
+  return fSectorSegmentation->PadDimensions(isector).Y()*2.0;
 }
 
 //______________________________________________________________________________
 Int_t AliMUONSt12QuadrantSegmentation::Npx() const
 {
-// Maximum number of Pads in x
-// hard coded for the time being
-// ---
+/// Maximum number of Pads in x
+/// hard coded for the time being
 
-  //Fatal("Npx", "Not yet implemented.");
-  switch (fSector->GetDirection()) {
-    case kX:
-      return 142;
-    case kY:
-      return 108;
-    default:
-      AliError("Unknown sector direction");
-      return 0;  
-  }      
+  return fSectorSegmentation->MaxPadIndexX();
 }
 
 //______________________________________________________________________________
 Int_t AliMUONSt12QuadrantSegmentation::Npy() const
 {
-// Maximum number of Pads in y
-// hard coded for the time being
-// ---
+/// Maximum number of Pads in y
+/// hard coded for the time being
 
-  //Fatal("Npy", "Not yet implemented.");
-  switch (fSector->GetDirection()) {
-    case kX:
-      return 160;
-    case kY:
-      return 213;
-    default:
-      AliError("Unknown sector direction");
-      return 0;  
-  }    
+  return fSectorSegmentation->MaxPadIndexY();
 }
 
 //______________________________________________________________________________
 void  AliMUONSt12QuadrantSegmentation::SetPad(Int_t ix, Int_t iy)
 {
-// Set pad position.
-// Sets virtual pad coordinates, needed for evaluating pad response 
-// outside the tracking program.
-// From AliMUONSegmentationV01.
-// ---
+/// Set pad position.
+/// Sets virtual pad coordinates, needed for evaluating pad response 
+/// outside the tracking program.
+/// From AliMUONSegmentationV01.
 
   GetPadC(ix, iy, fX, fY);
   fZone = Sector(ix, iy);
@@ -384,10 +371,10 @@ void  AliMUONSt12QuadrantSegmentation::SetPad(Int_t ix, Int_t iy)
 //______________________________________________________________________________
 void  AliMUONSt12QuadrantSegmentation::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
 {
-// Set hit position
-// Sets virtual hit position, needed for evaluating pad response 
-// outside the tracking program 
-// From AliMUONSegmentationV01.
+/// Set hit position
+/// Sets virtual hit position, needed for evaluating pad response 
+/// outside the tracking program 
+/// From AliMUONSegmentationV01.
 
   fXhit = xhit;
   fYhit = yhit;
@@ -397,8 +384,7 @@ void  AliMUONSt12QuadrantSegmentation::SetHit(Float_t xhit, Float_t yhit, Float_
 void  AliMUONSt12QuadrantSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, 
                                        Float_t dx, Float_t dy) 
 {                                       
-// Iterate over pads - initialiser
-// ---
+/// Iterate over pads - initialiser
 
   // Sets the current pad to that located in the hit position
  
@@ -408,11 +394,16 @@ void  AliMUONSt12QuadrantSegmentation::FirstPad(Float_t xhit, Float_t yhit, Floa
   if (dx == 0.)  dx = 0.01;
   if (dy == 0.)  dy = 0.01;
   
+  // Delete previous iterator
+  delete  fSectorIterator;
+  
   fSectorIterator 
     = fSectorSegmentation
-        ->CreateIterator(AliMpArea(TVector2(fXhit/fgkLengthUnit, fYhit/fgkLengthUnit), 
-                                  TVector2(dx/fgkLengthUnit, dy/fgkLengthUnit)));
+        ->CreateIterator(AliMpArea(TVector2(fXhit,fYhit),TVector2(dx,dy)));
 
+  AliDebug(1,Form("CreateIterator area=%e,%e +- %e,%e %s",
+                  fXhit,fYhit,dx,dy,PlaneTypeName(fPlaneType).Data()));
+  
   fSectorIterator->First();            
 
   if (! fSectorIterator->IsDone())
@@ -422,8 +413,7 @@ void  AliMUONSt12QuadrantSegmentation::FirstPad(Float_t xhit, Float_t yhit, Floa
 //______________________________________________________________________________
 void  AliMUONSt12QuadrantSegmentation::NextPad()
 {
-// Iterate over pads - stepper
-// ---
+/// Iterate over pads - stepper
 
   fSectorIterator->Next();                             
 
@@ -434,8 +424,7 @@ void  AliMUONSt12QuadrantSegmentation::NextPad()
 //______________________________________________________________________________
 Int_t AliMUONSt12QuadrantSegmentation::MorePads()
 {
-// Iterate over pads - condition
-// ---
+/// Iterate over pads - condition
 
   if (fSectorIterator->IsDone())
     return 0;
@@ -447,25 +436,23 @@ Int_t AliMUONSt12QuadrantSegmentation::MorePads()
 Float_t AliMUONSt12QuadrantSegmentation::Distance2AndOffset(Int_t iX, Int_t iY, 
                                                   Float_t x, Float_t y, Int_t* /*dummy*/)
 {                                         
-// Returns the square of the distance between 1 pad
-// labelled by its channel numbers and a coordinate
-// ---
+/// Returns the square of the distance between 1 pad
+/// labelled by its channel numbers and a coordinate
 
   AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(iX, iY));
   
   if (!pad.IsValid())
     AliFatal("Cannot locate pad.");
 
-  return (pad.Position()*fgkLengthUnit - TVector2(x, y)).Mod2();
+  return (pad.Position() - TVector2(x, y)).Mod2();
 }
 
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::GetNParallelAndOffset(Int_t /*iX*/, Int_t /*iY*/,
                                                   Int_t* /*Nparallel*/, Int_t* /*Offset*/)
 {                                         
-// Number of pads read in parallel and offset to add to x 
-// (specific to LYON, but mandatory for display)
-// ---
+/// Number of pads read in parallel and offset to add to x 
+/// (specific to LYON, but mandatory for display)
 
   AliFatal( "Not yet implemented.");
 }
@@ -476,31 +463,25 @@ void AliMUONSt12QuadrantSegmentation::Neighbours(Int_t iX, Int_t iY,
                                         Int_t* Nlist, 
                                        Int_t Xlist[10], Int_t Ylist[10])
 {                                        
-// Get next neighbours 
-// ---
+/// Get next neighbours 
 
   AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(iX,iY));
   Int_t &i = *Nlist;
   i=0;
-  AliMpVPadIterator* iter
-    = fSectorSegmentation
-      ->CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1));
+  AliMpNeighboursPadIterator iter(fSectorSegmentation, pad, kFALSE);
 
-  for( iter->First(); !iter->IsDone() && i<10; iter->Next()) {
-    Xlist[i] = iter->CurrentItem().GetIndices().GetFirst();
-    Ylist[i] = iter->CurrentItem().GetIndices().GetSecond();
+  for( iter.First(); !iter.IsDone() && i<10; iter.Next()) {
+    Xlist[i] = iter.CurrentItem().GetIndices().GetFirst();
+    Ylist[i] = iter.CurrentItem().GetIndices().GetSecond();
     i++;
   }
-  
-  delete iter;
 }
-
 //______________________________________________________________________________
 Int_t  AliMUONSt12QuadrantSegmentation::Ix()
 {
-// Current pad cursor during disintegration
-// x, y-coordinate
-// ---
+/// Current pad cursor during disintegration
+/// x, y-coordinate
 
   return fSectorIterator->CurrentItem().GetIndices().GetFirst();
 }
@@ -508,9 +489,8 @@ Int_t  AliMUONSt12QuadrantSegmentation::Ix()
 //______________________________________________________________________________
 Int_t  AliMUONSt12QuadrantSegmentation::Iy()
 {
-// Current pad cursor during disintegration
-// x, y-coordinate
-// ---
+/// Current pad cursor during disintegration
+/// x, y-coordinate
 
   return fSectorIterator->CurrentItem().GetIndices().GetSecond();
 }
@@ -518,8 +498,7 @@ Int_t  AliMUONSt12QuadrantSegmentation::Iy()
 //______________________________________________________________________________
 Int_t  AliMUONSt12QuadrantSegmentation::ISector()
 {
-// Current sector
-// ---
+/// Current sector
 
   return fZone;
 }
@@ -527,8 +506,7 @@ Int_t  AliMUONSt12QuadrantSegmentation::ISector()
 //______________________________________________________________________________
 Int_t AliMUONSt12QuadrantSegmentation::Sector(Int_t ix, Int_t iy)
 {
-// Calculate sector from pad coordinates
-// ---
+/// Calculate sector from pad coordinates
 
   return fSectorSegmentation
            ->Zone(fSectorSegmentation->PadByIndices(AliMpIntPair(ix, iy)));
@@ -537,20 +515,18 @@ Int_t AliMUONSt12QuadrantSegmentation::Sector(Int_t ix, Int_t iy)
 //______________________________________________________________________________
 Int_t AliMUONSt12QuadrantSegmentation::Sector(Float_t x, Float_t y)
 {
-// Calculate sector from pad coordinates
-// ---
+/// Calculate sector from pad coordinates
 
   return fSectorSegmentation
            ->Zone(fSectorSegmentation
-                   ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit)));
+                   ->PadByPosition(TVector2(x,y)));
 }
 
 //______________________________________________________________________________
 void  AliMUONSt12QuadrantSegmentation::IntegrationLimits(Float_t& x1, Float_t& x2,
                                                 Float_t& y1, Float_t& y2)
 {                                                
-// Current integration limits 
-// ---
+/// Current integration limits 
  
   x1 = fXhit - fX - Dpx(fZone)/2.;
   x2 = x1 + Dpx(fZone);
@@ -562,21 +538,21 @@ void  AliMUONSt12QuadrantSegmentation::IntegrationLimits(Float_t& x1, Float_t& x
 //______________________________________________________________________________
 Int_t AliMUONSt12QuadrantSegmentation::SigGenCond(Float_t x, Float_t y, Float_t /*z*/)
 {
-// Signal Generation Condition during Stepping
-//  0: don't generate signal
-//  1: generate signal 
-//  Comments: 
-//
-//  Crossing of pad boundary and mid plane between neighbouring wires is checked.
-//  To correctly simulate the dependence of the spatial resolution on the angle 
-//  of incidence signal must be generated for constant steps on 
-//  the projection of the trajectory along the anode wire.
-//
-//  Signal will be generated if particle crosses pad boundary or
-//  boundary between two wires. 
-//
-// From AliMUONSegmentationV01
-// ---
+/// Signal Generation Condition during Stepping
+/// -  0: don't generate signal
+/// -  1: generate signal 
+///
+///  Comments:                                                                  \n 
+///
+///  Crossing of pad boundary and mid plane between neighbouring wires is checked.
+///  To correctly simulate the dependence of the spatial resolution on the angle 
+///  of incidence signal must be generated for constant steps on 
+///  the projection of the trajectory along the anode wire.
+///
+///  Signal will be generated if particle crosses pad boundary or
+///  boundary between two wires. 
+///
+/// From AliMUONSegmentationV01
 
   Int_t ixt, iyt;
   GetPadI(x, y, ixt, iyt);
@@ -590,14 +566,12 @@ Int_t AliMUONSt12QuadrantSegmentation::SigGenCond(Float_t x, Float_t y, Float_t
   }
 }
 
-
 //______________________________________________________________________________
 void  AliMUONSt12QuadrantSegmentation::SigGenInit(Float_t x, Float_t y, Float_t /*z*/)
 {
-// Initialise signal generation at coord (x,y,z)
-// Initialises pad and wire position during stepping.
-// From AliMUONSegmentationV01
-// ---
+/// Initialise signal generation at coord (x,y,z)
+/// Initialises pad and wire position during stepping.
+/// From AliMUONSegmentationV01
 
   fXt = x;
   fYt = y;
@@ -608,11 +582,10 @@ void  AliMUONSt12QuadrantSegmentation::SigGenInit(Float_t x, Float_t y, Float_t
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::GiveTestPoints(Int_t& n, Float_t* x, Float_t* y) const
 {                                            
-// Test points for auto calibration
-// Returns test point on the pad plane.
-// Used during determination of the segmoid correction of the COG-method
-// From AliMUONSegmentationV01
-// ---
+/// Test points for auto calibration
+/// Returns test point on the pad plane.
+/// Used during determination of the segmoid correction of the COG-method
+/// From AliMUONSegmentationV01
 
   n=1;
   x[0] = (fRmax+fRmin)/2/TMath::Sqrt(2.);
@@ -622,9 +595,8 @@ void AliMUONSt12QuadrantSegmentation::GiveTestPoints(Int_t& n, Float_t* x, Float
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::Draw(const char * /*opt*/)
 {
-// Draw the segmentation zones.
-// (Called from AliMUON::BuildGeometry)
-// ---
+/// Draw the segmentation zones.
+/// (Called from AliMUON::BuildGeometry)
 
   AliWarning("Not yet implemented.");
 }
@@ -632,9 +604,8 @@ void AliMUONSt12QuadrantSegmentation::Draw(const char * /*opt*/)
 //______________________________________________________________________________
 void AliMUONSt12QuadrantSegmentation::SetCorrFunc(Int_t isec, TF1* func)
 {
-// Set the correction function.
-// From AliMUONSegmentationV01
-// ---
+/// Set the correction function.
+/// From AliMUONSegmentationV01
 
   fCorrA->AddAt(func, isec);
 }
@@ -642,10 +613,8 @@ void AliMUONSt12QuadrantSegmentation::SetCorrFunc(Int_t isec, TF1* func)
 //______________________________________________________________________________
 TF1* AliMUONSt12QuadrantSegmentation::CorrFunc(Int_t isec) const
 {
-// Get the correction Function.
-// From AliMUONSegmentationV01
-// ---
+/// Get the correction Function.
+/// From AliMUONSegmentationV01
 
   return (TF1*) fCorrA->At(isec);
 } 
-