]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update of station 345 segmentations (bending and non bending)
authorcussonno <cussonno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 21 Jan 2005 10:38:35 +0000 (10:38 +0000)
committercussonno <cussonno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 21 Jan 2005 10:38:35 +0000 (10:38 +0000)
MUON/AliMUONSt345SlatSegmentation.cxx
MUON/AliMUONSt345SlatSegmentation.h
MUON/AliMUONTest.cxx
MUON/AliMUONTest.h

index 6a45aeee983094e0cb7e2b97702757e152a94464..dc47c4b19ad5aa02c44bd8130caa0cf15204b9ce 100644 (file)
 ClassImp(AliMUONSt345SlatSegmentation)
 
 
-AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation() 
+AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(Bool_t bending
   : AliMUONVGeometryDESegmentation(),
-    fId(0),
-    fDpx(0),
-    fDpy(0),
-    fNpx(999999),
-    fNpy(999999),
-    fWireD(0.25),
-    fXhit(0.),
-    fYhit(0.),
-    fIx(0),
-    fIy(0),
-    fX(0.),
-    fY(0.),
-    fIxmin(0),
-    fIxmax(0),
-    fIymin(0),
-    fIymax(0)
+       fBending(bending),
+       fId(0),
+       fDpx(0),
+       fDpy(0),
+       fNpx(999999),
+       fNpy(999999),
+       fWireD(0.25),
+       fXhit(0.),
+       fYhit(0.),
+       fIx(0),
+       fIy(0),
+       fX(0.),
+       fY(0.),
+       fIxmin(0),
+       fIxmax(0),
+       fIymin(0),
+       fIymax(0)
 {
-// Non default constructor
+  // Non default constructor
   fNsec = 4;  // 4 sector densities at most per slat 
   fNDiv = new TArrayI(fNsec);      
   fDpxD = new TArrayF(fNsec);      
+  fDpyD = new TArrayF(fNsec);      
   (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;     
   (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;       
+  (*fDpyD)[0]=(*fDpyD)[1]=(*fDpyD)[2]=(*fDpyD)[3]=0;       
 }
 //----------------------------------------------------------------------
 AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(const AliMUONSt345SlatSegmentation& rhs) : AliMUONVGeometryDESegmentation(rhs)
@@ -68,14 +71,15 @@ AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(const AliMUONSt345Sla
 //----------------------------------------------------------------------
 AliMUONSt345SlatSegmentation::~AliMUONSt345SlatSegmentation() 
 {
-// Destructor
-    if (fNDiv) delete fNDiv;
-    if (fDpxD) delete fDpxD;
+  // Destructor
+  if (fNDiv) delete fNDiv;
+  if (fDpxD) delete fDpxD;
+  if (fDpyD) delete fDpyD;
 }
 //----------------------------------------------------------------------
 AliMUONSt345SlatSegmentation& AliMUONSt345SlatSegmentation::operator=(const AliMUONSt345SlatSegmentation& rhs)
 {
-// Protected assignement operator
+  // Protected assignement operator
   if (this == &rhs) return *this;
   AliFatal("Not implemented.");
   return *this;  
@@ -85,8 +89,8 @@ AliMUONSt345SlatSegmentation& AliMUONSt345SlatSegmentation::operator=(const AliM
 //------------------------------------------------------------------------
 Float_t AliMUONSt345SlatSegmentation::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
   Float_t x,y;
   GetPadC(iX,iY,x,y);
   return (x-X)*(x-X) + (y-Y)*(y-Y);
@@ -94,50 +98,26 @@ Float_t AliMUONSt345SlatSegmentation::Distance2AndOffset(Int_t iX, Int_t iY, Flo
 //____________________________________________________________________________
 Float_t AliMUONSt345SlatSegmentation::Dpx(Int_t isec) const
 {
-// Return x-strip width
-    return (*fDpxD)[isec];
+  // Return x-strip width
+  return (*fDpxD)[isec];
 } 
 
 //____________________________________________________________________________
-Float_t AliMUONSt345SlatSegmentation::Dpy(Int_t /*isec*/) const
+Float_t AliMUONSt345SlatSegmentation::Dpy(Int_t  isec) const
 {
   // Return y-strip width
-  return fDpy;
+  return (*fDpyD)[isec];
 }
 //_____________________________________________________________________________
 Float_t AliMUONSt345SlatSegmentation::GetAnod(Float_t xhit) const
 {
-// Returns for a hit position xhit the position of the nearest anode wire    
-    Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
-    return fWireD*wire;
+  // Returns for a hit position xhit the position of the nearest anode wire    
+  Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
+  return fWireD*wire;
 }
-//_____________________________________________________________________________
-void AliMUONSt345SlatSegmentation::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) 
-{
-//  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
-  iy = Int_t((y+fCy)/fDpy)+1; // !!!
-    if (iy >  fNpy) iy= fNpy;
 
-//  Find sector isec    
-    Int_t isec=-1;
-    for (Int_t i=fNsec-1; i > 0; i--) {
-       if (x >= fCx[i-1]) {
-           isec=i;
-           if (fCx[isec] == fCx[isec-1]  && isec > 1) isec--;
-           break;
-       }
-    }
 
-    if (isec>0) {
-       ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
-           +fNpxS[isec-1]+1;
-    } else if (isec == 0) {
-       ix= Int_t(x/(*fDpxD)[isec])+1;
-    } else {
-       ix=0;
-       iy=0;
-    }
-}
+
 //--------------------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) 
 {
@@ -147,18 +127,51 @@ void AliMUONSt345SlatSegmentation::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float
   }
   else { 
     //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
-    y = Float_t(iy*fDpy)-fDpy/2.- fCy;  // !!!  
     //  Find sector isec
     Int_t isec = Sector(ix,iy);
     if (isec == -1) printf("\n PadC %d %d %d  %d \n ", isec, fId, ix, iy);
+    if (iy > fNpyS[isec]) {
+      x=-99999.; y=-99999.;
+      return;
+    }
     if (isec>0) {
       x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
       x = x-(*fDpxD)[isec]/2;
+      y = Float_t(iy*(*fDpyD)[isec])-(*fDpyD)[isec]/2.- fCy;  // !!!  
     } else {
       x=y=0;
     }
   }
 }
+
+
+//_____________________________________________________________________________
+void AliMUONSt345SlatSegmentation::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) 
+{
+//  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
+  
+  //  Find sector isec    
+  Int_t isec=-1;
+  for (Int_t i=fNsec-1; i > 0; i--) {
+    if (x >= fCx[i-1]) {
+      isec=i;
+      if (fCx[isec] == fCx[isec-1]  && isec > 1) isec--;
+      break;
+    }
+  }
+  
+  if (isec>0) {
+    ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
+      +fNpxS[isec-1]+1;
+    iy= Int_t((y+fCy)/(*fDpyD)[isec])+1;
+  } else if (isec == 0) {
+    ix= Int_t(x/(*fDpxD)[isec])+1;
+    iy= Int_t((y+fCy)/(*fDpyD)[isec])+1;
+  } else {
+    ix=0;
+    iy=0;
+  }
+}
 //-------------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy)
 {
@@ -167,53 +180,53 @@ void AliMUONSt345SlatSegmentation::GetPadI(Float_t x, Float_t y , Float_t /*z*/,
 //_______________________________________________________________
 void AliMUONSt345SlatSegmentation::SetPadDivision(Int_t ndiv[4])
 {
-// Defines the pad size perp. to the anode wire (y) for different sectors. 
-// Pad sizes are defined as integral fractions ndiv of a basis pad size
-// fDpx
-// 
-    for (Int_t i=0; i<4; i++) {
-       (*fNDiv)[i]=ndiv[i];
-    }
-    ndiv[0]=ndiv[1];
+  // Defines the pad size perp. to the anode wire (y) for different sectors. 
+  // Pad sizes are defined as integral fractions ndiv of a basis pad size
+  // fDpx
+  // 
+  for (Int_t i=0; i<4; i++) {
+    (*fNDiv)[i]=ndiv[i];
+  }
+  ndiv[0]=ndiv[1];
 }
 //____________________________________________________________________________
 void AliMUONSt345SlatSegmentation::SetPadSize(Float_t p1, Float_t p2)
 {
-//  Sets the padsize 
-    fDpx=p1;
-    fDpy=p2;
+  //  Sets the padsize 
+  fDpx=p1;
+  fDpy=p2;
 }
 //_______________________________________________________________          
 void AliMUONSt345SlatSegmentation::SetPcbBoards(Int_t n[4])
 {
-//
-// Set PcbBoard segmentation zones for each density
-// n[0] PcbBoards for maximum density sector fNDiv[0]
-// n[1] PcbBoards for next density sector fNDiv[1] etc ...
-    for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
+  //
+  // Set PcbBoard segmentation zones for each density
+  // n[0] PcbBoards for maximum density sector fNDiv[0]
+  // n[1] PcbBoards for next density sector fNDiv[1] etc ...
+  for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
 }
 //-------------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::SetPad(Int_t ix, Int_t iy)
 {
-    //
-    // Sets virtual pad coordinates, needed for evaluating pad response 
-    // outside the tracking program 
-    GetPadC(ix,iy,fX,fY);
-    fSector=Sector(ix,iy);
+  //
+  // Sets virtual pad coordinates, needed for evaluating pad response 
+  // outside the tracking program 
+  GetPadC(ix,iy,fX,fY);
+  fSector=Sector(ix,iy);
 }
 //---------------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::SetHit(Float_t x, Float_t y)
 {
-// Set current hit 
-//
-    fXhit = x;
-    fYhit = y;
+  // Set current hit 
+  //
+  fXhit = x;
+  fYhit = y;
     
-    if (x < 0) fXhit = 0;
-    if (y < 0) fYhit = 0;
+  if (x < 0) fXhit = 0;
+  if (y < 0) fYhit = 0;
     
-    if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
-    if (y >= fDyPCB)       fYhit = fDyPCB;
+  if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
+  if (y >= fDyPCB)       fYhit = fDyPCB;
     
 }
 //----------------------------------------------------------------------------
@@ -221,6 +234,7 @@ void AliMUONSt345SlatSegmentation::SetHit(Float_t xhit, Float_t yhit, Float_t /*
 {
   SetHit(xhit, yhit);
 }
+
 //----------------------------------------------------------
 void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
 {
@@ -283,6 +297,9 @@ void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t
           fIymin, fIymax, fYmin, fYmax,  fNpyS[isec], fId, isec, Dpy(isec));
 */
 }
+
+
+
 //----------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy)
 {
@@ -291,154 +308,159 @@ void AliMUONSt345SlatSegmentation::FirstPad(Float_t xhit, Float_t yhit, Float_t
 //----------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::NextPad()
 {
-// Stepper for the iteration over pads
-//
-// Step to next pad in the integration region
-//  step from left to right    
-    if (fIx != fIxmax) {
-       fIx++;
-       GetPadC(fIx,fIy,fX,fY);
-       fSector=Sector(fIx,fIy);
-//  step up 
-    } else if (fIy != fIymax) {
-       fIx=fIxmin;
-       fIy++;
-       GetPadC(fIx,fIy,fX,fY);
-       fSector=Sector(fIx,fIy);
+  // Stepper for the iteration over pads
+  //
+  // Step to next pad in the integration region
+  //  step from left to right    
+  if (fIx != fIxmax) {
+    fIx++;
+    GetPadC(fIx,fIy,fX,fY);
+    fSector=Sector(fIx,fIy);
+    //  step up 
+  } else if (fIy != fIymax) {
+    fIx=fIxmin;
+    fIy++;
+    GetPadC(fIx,fIy,fX,fY);
+    fSector=Sector(fIx,fIy);
 
-    } else {
-       fIx=-1;
-       fIy=-1;
-    }
-//    printf("\n Next Pad %d %d %f %f %d %d %d %d %d ", 
+  } else {
+    fIx=-1;
+    fIy=-1;
+  }
+  //    printf("\n Next Pad %d %d %f %f %d %d %d %d %d ", 
 }
 //-------------------------------------------------------------------------
 Int_t AliMUONSt345SlatSegmentation::MorePads()
 {
-// Stopping condition for the iterator over pads
-//
-// Are there more pads in the integration region
+  // Stopping condition for the iterator over pads
+  //
+  // Are there more pads in the integration region
     
-    return  (fIx != -1  || fIy != -1);
+  return  (fIx != -1  || fIy != -1);
 }
 //--------------------------------------------------------------------------
 Int_t AliMUONSt345SlatSegmentation::Sector(Int_t ix, Int_t iy) 
 {
-//
-// Determine segmentation zone from pad coordinates
-//
-    Int_t isec=-1;
-    for (Int_t i=0; i < fNsec; i++) {
-       if (ix <= fNpxS[i]) {
-           isec=i;
-           break;
-       }
+  //
+  // Determine segmentation zone from pad coordinates
+  //
+  Int_t isec=-1;
+  for (Int_t i=0; i < fNsec; i++) {
+    if (ix <= fNpxS[i]) {
+      isec=i;
+      break;
     }
-    if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
-                          fId, ix, iy,fNpxS[3]);
+  }
+  if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
+                        fId, ix, iy,fNpxS[3]);
 
-    return isec;
+  return isec;
 
 }
 //-----------------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::
 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) 
 {
-//  Returns integration limits for current pad
-//
-    x1=fXhit-fX-Dpx(fSector)/2.;
-    x2=x1+Dpx(fSector);
-    y1=fYhit-fY-Dpy(fSector)/2.;
-    y2=y1+Dpy(fSector);    
-//    printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
+  //  Returns integration limits for current pad
+  //
+  x1=fXhit-fX-Dpx(fSector)/2.;
+  x2=x1+Dpx(fSector);
+  y1=fYhit-fY-Dpy(fSector)/2.;
+  y2=y1+Dpy(fSector);    
+  //    printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
 
 }
 //-----------------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::
 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) 
 {
-// Returns list of next neighbours for given Pad (iX, iY)
-    Int_t i=0;
-//  step right
-    if (iX+1 <= fNpx) {
-       Xlist[i]=iX+1;
-       Ylist[i++]=iY;
-    }
-//  step left    
-    if (iX-1 > 0) {
-       Xlist[i]=iX-1;
-       Ylist[i++]=iY;
-    } 
-//  step up
-    if (iY+1 <= fNpy) {
-       Xlist[i]=iX;
-       Ylist[i++]=iY+1;
-    }
-//  step down    
-    if (iY-1 > 0) {
-       Xlist[i]=iX;
-       Ylist[i++]=iY-1;
-    }
-    *Nlist=i;
+  // Returns list of next neighbours for given Pad (iX, iY)
+  Int_t i=0;
+  //  step right
+  if (iX+1 <= fNpx) {
+    Xlist[i]=iX+1;
+    Ylist[i++]=iY;
+  }
+  //  step left    
+  if (iX-1 > 0) {
+    Xlist[i]=iX-1;
+    Ylist[i++]=iY;
+  } 
+  Int_t sector = Sector(iX,iY);
+  //  step up
+  if (iY+1 <= fNpyS[sector]) {
+    Xlist[i]=iX;
+    Ylist[i++]=iY+1;
+  }
+  //  step down    
+  if (iY-1 > 0) {
+    Xlist[i]=iX;
+    Ylist[i++]=iY-1;
+  }
+  *Nlist=i;
 }
+
 //--------------------------------------------------------------------------
 void AliMUONSt345SlatSegmentation::Init(Int_t detectionElementId)
 {
-//
-//  Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
-//  These arrays help in converting from real to pad co-ordinates and
-//  vice versa
-//   
-//  Segmentation is defined by rectangular modules approximating
-//  concentric circles as shown below
-//
-//  PCB module size in cm
-//  printf("\n Initialise Segmentation SlatModule \n");
+  //
+  //  Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
+  //  These arrays help in converting from real to pad co-ordinates and
+  //  vice versa
+  //   
+  //  Segmentation is defined by rectangular modules approximating
+  //  concentric circles as shown below
+  //
+  //  PCB module size in cm
+  //  printf("\n Initialise Segmentation SlatModule \n");
 
-    fDxPCB=40;
-    fDyPCB=40;
-//
-// number of pad rows per PCB
-//    
-    Int_t nPyPCB=Int_t(fDyPCB/fDpy);
-//
-// maximum number of pad rows    
-    fNpy=nPyPCB;
-//
-//  Calculate padsize along x
-    (*fDpxD)[fNsec-1]=fDpx;
-    if (fNsec > 1) {
-      for (Int_t i=fNsec-1; i>=0; i--){ // fNsec-2
+  
+  printf(" fBending: %d \n",fBending);
+
+  fDxPCB=40;
+  fDyPCB=40;
+
+  //  Calculate padsize along x
+  (*fDpxD)[fNsec-1]=fDpx;
+  (*fDpyD)[fNsec-1]=fDpy;
+  if (fNsec > 1) {
+    for (Int_t i=fNsec-1; i>=0; i--){ // fNsec-2
+      if (!fBending) {
+       (*fDpxD)[i]=fDpx;
+       (*fDpyD)[i]=(*fDpyD)[fNsec-1]/(*fNDiv)[i];
+      } else {
        (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
+       (*fDpyD)[i]=fDpy;
       }
     }
-//
-// fill the arrays defining the pad segmentation boundaries
-//
-//  
-//  Loop over sectors (isec=0 for secto close to the bema pipe)
-    Float_t totalLength = 0;
-    for (Int_t isec=0; isec<4; isec++) totalLength += fPcbBoards[isec]*fDxPCB;  // !!!!
-
-    for (Int_t isec=0; isec<4; isec++) {
-       if (isec==0) {
-           fNpxS[0] = 0;
-           fNpyS[0] = 0;
-           fCx[0]   = -totalLength/2;
-       } else {
-           fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
-           fNpyS[isec]=fNpy;
-           fCx[isec]= fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
-       }
-    } // sectors
-// maximum number of pad rows    
-    fNpy=nPyPCB;
-    fNpx=fNpxS[3];
-    fCy = fDyPCB/2.;
-//
-    fId = detectionElementId;
-}
+  }
+  //
+  // fill the arrays defining the pad segmentation boundaries
+  //
+  //  
+  //  Loop over sectors (isec=0 for secto close to the beam pipe)
+  Float_t totalLength = 0;
+  for (Int_t isec=0; isec<4; isec++) totalLength += fPcbBoards[isec]*fDxPCB;  // !!!!
+
+  fNpy = 0;   // maximum number of pads in y
+  for (Int_t isec=0; isec<4; isec++) {
+    if (isec==0) {
+      fNpxS[0] = 0;
+      fNpyS[0] = 0;
+      fCx[0]   = -totalLength/2;
+    } else {
+      fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]); 
+      fNpyS[isec] = Int_t(fDyPCB/(*fDpyD)[isec]);
+      if (fNpyS[isec] >= fNpy) fNpy = fNpyS[isec]; 
+      fCx[isec]= fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
+    }
+  } // sectors
 
+  fNpx = fNpxS[3];  // maximum number of pads in x
+  fCy = fDyPCB/2.;
+  //
+  fId = detectionElementId;
+}
 
 
 
index 16c37aaa5b40eead2500cb60aa80dc6c7d4c1c5b..d687ef2051efbca496ea69c151a8e5e0a1df6a3d 100644 (file)
@@ -21,7 +21,7 @@ class TArrayI;
 class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation 
 {
  public:
-    AliMUONSt345SlatSegmentation();
+    AliMUONSt345SlatSegmentation(Bool_t bending);
     virtual ~AliMUONSt345SlatSegmentation();
       
     virtual Float_t  Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y, Int_t * dummy);  // Distance between 1 pad and a position
@@ -30,7 +30,6 @@ class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation
     virtual Float_t  Dpx(Int_t isec) const;       // Pad size in x by Sector
     virtual Float_t  Dpy(Int_t isec) const;       // Pad size in y by Sector
     virtual void     Draw(const char */*opt*/ = "") {}  // Not implemented
-   
     virtual void     FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy);  // Initialisation for pad iteration
     virtual void     FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, Float_t dx, Float_t dy);
 
@@ -40,10 +39,9 @@ class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation
     virtual Float_t  GetAnod(Float_t xhit) const;  // Anod wire coordinate closest to xhit
     virtual void     GetPadI(Float_t x ,Float_t y ,Int_t   &ix,Int_t &iy);  // Transform from pad to real coordinates
     virtual void     GetPadI(Float_t x, Float_t y , Float_t z, Int_t &ix, Int_t &iy);
-    virtual void     GetPadC(Int_t   ix,Int_t   iy,Float_t &x ,Float_t &y ); // Transform from real to pad coordinates
+    virtual void     GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y);
     virtual void     GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z) {z=0; GetPadC(ix, iy, x , y);}
  
-    virtual void     Init(Int_t detectionElementId); // Initialisation
  
     virtual void     IntegrationLimits(Float_t& x1, Float_t& x2, Float_t& y1, Float_t& y2); //Current integration limits
     virtual Int_t    ISector()  {return fSector;} // Current Pad during Integration (current sector)
@@ -76,6 +74,7 @@ class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation
     virtual TF1*     CorrFunc(Int_t) const {return 0x0;} // Get the correction Function
     virtual Int_t    Sector(Float_t /*x*/, Float_t /*y*/) {return 1;}
 
+    virtual void     Init(Int_t detectionElementId); // Initialisation
     // Current integration limits
 
  protected:
@@ -84,10 +83,12 @@ class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation
     AliMUONSt345SlatSegmentation& operator=(const AliMUONSt345SlatSegmentation& rhs);
     
     //  Internal geometry of the slat 
+    Bool_t      fBending;        // 0: Bending or 1:Non Bending segmentation
     Int_t       fId;             // Identifier of detection element
-    Int_t       fNsec;           // Number of densitiy sectors (should be 4, if not not warranty about the output
+    Int_t       fNsec;           // Number of density sectors (should be 4, if not not warranty about the output
     TArrayI*    fNDiv;           // Densities (d1, d2, d3, d4). It should be (4, 4, 2, 1) which goes from beam to out-beam
     TArrayF*    fDpxD;           // x pad width per density sector
+    TArrayF*    fDpyD;           // x pad width per density sector
     Float_t     fDpx;            // x pad base width  
     Float_t     fDpy;            // y pad base width
     Int_t       fNpx;            // Number of pads in x
index 61d1934a9fb3e1c687eee86da7680e538eae1b06..f34bb8b9a1be57366e9804958c8fe3a988f1ee2b 100644 (file)
@@ -152,248 +152,401 @@ AliMUONTest::CreateSlatSegmentation(Int_t chamberId, Int_t cathod)
     return 0;
   }  
 
+  AliMUONGeometrySegmentation *chamberSeg = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry());
+
    //Slats Segmentations
-  AliMUONSt345SlatSegmentation *slatseg[20]; // Types of segmentation for St3 in this framework
+  AliMUONSt345SlatSegmentation *slatsegB[14]; // Types of segmentation for St3 in this framework
+  AliMUONSt345SlatSegmentation *slatsegNB[14]; // Types of segmentation for St3 in this framework
+                                               // Bending
   Int_t ndiv[4] ={ 4, 4, 2, 1};  // densities zones 
-  for(Int_t i=0; i<20;i++) {
-    slatseg[i] = new AliMUONSt345SlatSegmentation();
-    slatseg[i]->SetPadSize(10.,0.5);
-    slatseg[i]->SetPadDivision(ndiv);
-    slatseg[i]->SetId(1);
-    slatseg[i]->SetDAnod(0.25);
+  for(Int_t i=0; i<14; i++) {
+    slatsegB[i] = new AliMUONSt345SlatSegmentation(1);
+    slatsegB[i]->SetPadSize(10.,0.5);
+    slatsegB[i]->SetPadDivision(ndiv);
+    slatsegB[i]->SetId(1);
+    slatsegB[i]->SetDAnod(0.25);
+    slatsegNB[i] = new AliMUONSt345SlatSegmentation(0);
+    slatsegNB[i]->SetPadSize(1.,10.); // must be 0.713 !!!
+    slatsegNB[i]->SetPadDivision(ndiv);
+    slatsegNB[i]->SetId(1);
+    slatsegNB[i]->SetDAnod(0.25);
   }
   
+  
   //******************************************************************************************
   // Station 3
   //******************************************************************************************
 
-  // Type 112200 for 500, 501, 508, 509, 510, 517 in Ch5 (similar for Ch6) for the futur official numbering
-  // Type 112200 for 503, 504, 505, 555, 554, 553 in Ch5 (similar for Ch6) actual numbering in the code to be changed in jan05
-  Int_t n0[4] = { 0, 2, 2, 0 };
-  slatseg[0]->SetPcbBoards(n0);
-  slatseg[0]->Init(0);
-  
-  // Type 122200 for 502, 507, 511, 516 (similar in Ch6) for future official numbering of ALICE
-  // Type 122200 for 502, 506, 556, 552 (similiarin Ch6) for actual numbering in muon code to be changed in jan05
-  Int_t n1[4] = { 0, 1, 3, 0 }; 
-  slatseg[1]->SetPcbBoards(n1);
-  slatseg[1]->Init(0); 
+  if (chamberId == 4 || chamberId == 5) {
+    // Type 112200 for 500, 501, 508, 509, 510, 517 in Ch5 (similar for Ch6) for the futur official numbering
+    // Type 112200 for 503, 504, 505, 555, 554, 553 in Ch5 (similar for Ch6) actual numbering in the code to be changed in jan05
+    Int_t n0[4] = { 0, 2, 2, 0 };
+    slatsegB[0]->SetPcbBoards(n0);
+    slatsegB[0]->Init(0);
+    slatsegNB[0]->SetPcbBoards(n0);
+    slatsegNB[0]->Init(0);
+    
+    // Type 122200 for 502, 507, 511, 516 (similar in Ch6) for future official numbering of ALICE
+    // Type 122200 for 502, 506, 556, 552 (similiarin Ch6) for actual numbering in muon code to be changed in jan05
+    Int_t n1[4] = { 0, 1, 3, 0 }; 
+    slatsegB[1]->SetPcbBoards(n1);
+    slatsegB[1]->Init(0); 
+    slatsegNB[1]->SetPcbBoards(n1);
+    slatsegNB[1]->Init(0); 
+    
+    // Type 222000 for 503, 506, 512, 515 (similar in Ch6) for future official numbering of ALICE
+    // Type 222000 for 501, 507, 557, 551 (similiarin Ch6) for actual numbering in muon code to be changed in jan05
+    Int_t n2[4] = { 0, 0, 3, 0 };
+    slatsegB[2]->SetPcbBoards(n2);
+    slatsegB[2]->Init(0);
+    slatsegNB[2]->SetPcbBoards(n2);
+    slatsegNB[2]->Init(0);
+    
+    // Type 220000 for 504, 505, 513, 514 (similar in Ch6) for future official numbering of ALICE
+    // Type 220000 for 500, 508, 558, 550 (similiarin Ch6) for actual numbering in muon code to be changed in jan05
+    Int_t n3[4] = { 0, 0, 2, 0 };
+    slatsegB[3]->SetPcbBoards(n3);
+    slatsegB[3]->Init(0); 
+    slatsegNB[3]->SetPcbBoards(n3);
+    slatsegNB[3]->Init(0); 
+  }
   
-  // Type 222000 for 503, 506, 512, 515 (similar in Ch6) for future official numbering of ALICE
-  // Type 222000 for 501, 507, 557, 551 (similiarin Ch6) for actual numbering in muon code to be changed in jan05
-  Int_t n2[4] = { 0, 0, 3, 0 };
-  slatseg[2]->SetPcbBoards(n2);
-  slatseg[2]->Init(0);
   
-  // Type 220000 for 504, 505, 513, 514 (similar in Ch6) for future official numbering of ALICE
-  // Type 220000 for 500, 508, 558, 550 (similiarin Ch6) for actual numbering in muon code to be changed in jan05
-  Int_t n3[4] = { 0, 0, 2, 0 };
-  slatseg[3]->SetPcbBoards(n3);
-  slatseg[3]->Init(0); 
-
-  //******************************************************************************************
+  //***************************************************************************************
   // Station 4 & 5
   //****************************************************************************************
   
-  // Type 122330 for 700, 713 in Ch7 (similar for Ch8) for the futur official numbering
-  // Type 122330 for 706, 756 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
-  // Type 122330 for 900, 913 in Ch9 (similar for Ch10) for the futur official numbering
-  // Type 122330 for 906, 956 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
-  
-  Int_t n4[4] = { 0, 1, 2, 2 };
-  slatseg[4]->SetPcbBoards(n4);
-  slatseg[4]->Init(0); // 0 detection element id
-
-  // Type 112233 for 701, 712, 714, 725 in Ch7 (similar for Ch8) for the futur official numbering
-  // Type 112233 for 705, 707, 755, 757 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
-  // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 (similar for Ch10) for the futur official numbering
-  // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
-  Int_t n5[4] = { 0, 2, 2, 2 };
-  slatseg[5]->SetPcbBoards(n5);
-  slatseg[5]->Init(0); // 0 detection element id
-
-  // Type 112230 for 702, 711, 715, 724 in Ch7 (similar for Ch8) for the futur official numbering
-  // Type 112230 for 704, 708, 754, 758 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
-  Int_t n6[4] = { 0, 2, 2, 1 };
-  slatseg[6]->SetPcbBoards(n6);
-  slatseg[6]->Init(0); // 0 detection element id
-
-  // Type 222330 for 703, 710, 716, 723 in Ch7 (similar for Ch8) for the futur official numbering
-  // Type 222330 for 703, 709, 753, 759 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
-  Int_t n7[4] = { 0, 0, 3, 2 };
-  slatseg[7]->SetPcbBoards(n7);
-  slatseg[7]->Init(0); // 0 detection element id
-
-  // Type 223300 for 704, 709, 717, 722 in Ch7 (similar for Ch8) for the futur official numbering
-  // Type 223300 for 702, 710, 752, 760 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
-  Int_t n8[4] = { 0, 0, 2, 2 };
-  slatseg[8]->SetPcbBoards(n8);
-  slatseg[8]->Init(0); // 0 detection element id
-
-  // Type 333000 for 705, 708, 718, 721 in Ch7 (similar for Ch8) for the futur official numbering
-  // Type 333000 for 701, 711, 751, 761 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
-  // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) for the futur official numbering
-  // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
-   Int_t n9[4] = { 0, 0, 0, 3 };
-  slatseg[9]->SetPcbBoards(n9);
-  slatseg[9]->Init(0); // 0 detection element id
-
-  // Type 330000 for 706, 707, 719, 720 in Ch7 (similar for Ch8) for the futur official numbering
-  // Type 330000 for 700, 712, 750, 762 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
-  Int_t n10[4] = { 0, 0, 0, 2 };
-  slatseg[10]->SetPcbBoards(n10);
-  slatseg[10]->Init(0); // 0 detection element id
-
-  // Type 222333 for 903, 910, 916, 923 in Ch9 (similar for Ch10) for the futur official numbering
-  // Type 222333 for 903, 909, 953, 959 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
-  Int_t n11[4] = { 0, 0, 3, 3 };
-  slatseg[11]->SetPcbBoards(n11);
-  slatseg[11]->Init(0); // 0 detection element id
-         
-  // Type 223330 for 904, 909, 917, 922 in Ch9 (similar for Ch10) for the futur official numbering
-  // Type 223330 for 902, 910, 952, 960 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
-  Int_t n12[4] = { 0, 0, 2, 3 };
-  slatseg[12]->SetPcbBoards(n12);
-  slatseg[12]->Init(0); // 0 detection element id
-
-  // Type 333300 for 905, 908, 918, 921 in Ch9 (similar for Ch10) for the futur official numbering
-  // Type 333300 for 901, 911, 951, 961 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
-  Int_t n13[4] = { 0, 0, 0, 4 };
-  slatseg[13]->SetPcbBoards(n13);
-  slatseg[13]->Init(0); // 0 detection element id
+  if (chamberId >= 6 && chamberId <= 9) {
+    // Type 122330 for 700, 713 in Ch7 (similar for Ch8) for the futur official numbering
+    // Type 122330 for 706, 756 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
+    // Type 122330 for 900, 913 in Ch9 (similar for Ch10) for the futur official numbering
+    // Type 122330 for 906, 956 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
+    
+    Int_t n4[4] = { 0, 1, 2, 2 };
+    slatsegB[4]->SetPcbBoards(n4);
+    slatsegB[4]->Init(0); // 0 detection element id
+    slatsegNB[4]->SetPcbBoards(n4);
+    slatsegNB[4]->Init(0); // 0 detection element id
+    
+    // Type 112233 for 701, 712, 714, 725 in Ch7 (similar for Ch8) for the futur official numbering
+    // Type 112233 for 705, 707, 755, 757 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
+    // Type 112233 for 901, 902, 911, 912, 914, 915, 924, 925 in Ch9 (similar for Ch10) for the futur official numbering
+    // Type 112233 for 904, 905, 907, 908, 954, 955, 957, 958 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
+    Int_t n5[4] = { 0, 2, 2, 2 };
+    slatsegB[5]->SetPcbBoards(n5);
+    slatsegB[5]->Init(0); // 0 detection element id
+    slatsegNB[5]->SetPcbBoards(n5);
+    slatsegNB[5]->Init(0); // 0 detection element id
+    
+    // Type 112230 for 702, 711, 715, 724 in Ch7 (similar for Ch8) for the futur official numbering
+    // Type 112230 for 704, 708, 754, 758 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
+    Int_t n6[4] = { 0, 2, 2, 1 };
+    slatsegB[6]->SetPcbBoards(n6);
+    slatsegB[6]->Init(0); // 0 detection element id
+    slatsegNB[6]->SetPcbBoards(n6);
+    slatsegNB[6]->Init(0); // 0 detection element id
+    
+    // Type 222330 for 703, 710, 716, 723 in Ch7 (similar for Ch8) for the futur official numbering
+    // Type 222330 for 703, 709, 753, 759 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
+    Int_t n7[4] = { 0, 0, 3, 2 };
+    slatsegB[7]->SetPcbBoards(n7);
+    slatsegB[7]->Init(0); // 0 detection element id
+    slatsegNB[7]->SetPcbBoards(n7);
+    slatsegNB[7]->Init(0); // 0 detection element id
+    
+    // Type 223300 for 704, 709, 717, 722 in Ch7 (similar for Ch8) for the futur official numbering
+    // Type 223300 for 702, 710, 752, 760 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
+    Int_t n8[4] = { 0, 0, 2, 2 };
+    slatsegB[8]->SetPcbBoards(n8);
+    slatsegB[8]->Init(0); // 0 detection element id
+    slatsegNB[8]->SetPcbBoards(n8);
+    slatsegNB[8]->Init(0); // 0 detection element id
+    
+    // Type 333000 for 705, 708, 718, 721 in Ch7 (similar for Ch8) for the futur official numbering
+    // Type 333000 for 701, 711, 751, 761 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
+    // Type 333000 for 906, 907, 919, 920 in Ch9 (similar for Ch10) for the futur official numbering
+    // Type 333000 for 900, 912, 950, 962 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
+    Int_t n9[4] = { 0, 0, 0, 3 };
+    slatsegB[9]->SetPcbBoards(n9);
+    slatsegB[9]->Init(0); // 0 detection element id
+    slatsegNB[9]->SetPcbBoards(n9);
+    slatsegNB[9]->Init(0); // 0 detection element id
+    
+    // Type 330000 for 706, 707, 719, 720 in Ch7 (similar for Ch8) for the futur official numbering
+    // Type 330000 for 700, 712, 750, 762 in Ch7 (similar for Ch8) actual numbering in the code to be changed in jan05
+    Int_t n10[4] = { 0, 0, 0, 2 };
+    slatsegB[10]->SetPcbBoards(n10);
+    slatsegB[10]->Init(0); // 0 detection element id
+    slatsegNB[10]->SetPcbBoards(n10);
+    slatsegNB[10]->Init(0); // 0 detection element id
+    
+    // Type 222333 for 903, 910, 916, 923 in Ch9 (similar for Ch10) for the futur official numbering
+    // Type 222333 for 903, 909, 953, 959 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
+    Int_t n11[4] = { 0, 0, 3, 3 };
+    slatsegB[11]->SetPcbBoards(n11);
+    slatsegB[11]->Init(0); // 0 detection element id
+    slatsegNB[11]->SetPcbBoards(n11);
+    slatsegNB[11]->Init(0); // 0 detection element id
   
-  //Loop for St3 (only segmentation for bending plane)
-  for (Int_t i=0; i<2; i++) {
-    // Create chamber segmentations  
-    Int_t chamber = i+4;
-    AliMUONGeometrySegmentation* 
-      st3seg = new AliMUONGeometrySegmentation(muon->Chamber(chamber).GetGeometry());
+    // Type 223330 for 904, 909, 917, 922 in Ch9 (similar for Ch10) for the futur official numbering
+    // Type 223330 for 902, 910, 952, 960 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
+    Int_t n12[4] = { 0, 0, 2, 3 };
+    slatsegB[12]->SetPcbBoards(n12);
+    slatsegB[12]->Init(0); // 0 detection element id
+    slatsegNB[12]->SetPcbBoards(n12);
+    slatsegNB[12]->Init(0); // 0 detection element id
+    
+    // Type 333300 for 905, 908, 918, 921 in Ch9 (similar for Ch10) for the futur official numbering
+    // Type 333300 for 901, 911, 951, 961 in Ch9 (similar for Ch10) actual numbering in the code to be changed in jan05
+    Int_t n13[4] = { 0, 0, 0, 4 };
+    slatsegB[13]->SetPcbBoards(n13);
+    slatsegB[13]->Init(0); // 0 detection element id
+    slatsegNB[13]->SetPcbBoards(n13);
+    slatsegNB[13]->Init(0); // 0 detection element id
     
-    Int_t id0=(chamber+1)*100;
+  }
+
+  Int_t id0 = 0;
+
+  // For St3 
+  if (chamberId == 4 || chamberId == 5) {
+    // Create chamber segmentations  
+
+    id0=(chamberId+1)*100;
     // type 220000
-    st3seg->Add(id0, slatseg[3]);
-    st3seg->Add(id0+ 8, slatseg[3]);  
-    st3seg->Add(id0+50, slatseg[3]);  
-    st3seg->Add(id0+58, slatseg[3]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0, slatsegB[3]);
+      chamberSeg->Add(id0+ 8, slatsegB[3]);  
+      chamberSeg->Add(id0+50, slatsegB[3]);  
+      chamberSeg->Add(id0+58, slatsegB[3]);
+    } else {
+      chamberSeg->Add(id0, slatsegNB[3]);
+      chamberSeg->Add(id0+ 8, slatsegNB[3]);  
+      chamberSeg->Add(id0+50, slatsegNB[3]);  
+      chamberSeg->Add(id0+58, slatsegNB[3]);
+    }
     // type 222000
-    st3seg->Add(id0+ 1, slatseg[2]);
-    st3seg->Add(id0+ 7, slatseg[2]);  
-    st3seg->Add(id0+51, slatseg[2]);  
-    st3seg->Add(id0+57, slatseg[2]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 1, slatsegB[2]);
+      chamberSeg->Add(id0+ 7, slatsegB[2]);  
+      chamberSeg->Add(id0+51, slatsegB[2]);  
+      chamberSeg->Add(id0+57, slatsegB[2]);
+    } else {
+      chamberSeg->Add(id0+ 1, slatsegNB[2]);
+      chamberSeg->Add(id0+ 7, slatsegNB[2]);  
+      chamberSeg->Add(id0+51, slatsegNB[2]);  
+      chamberSeg->Add(id0+57, slatsegNB[2]);
+    }
     // type 122200
-    st3seg->Add(id0+ 2, slatseg[1]);
-    st3seg->Add(id0+ 6, slatseg[1]);  
-    st3seg->Add(id0+52, slatseg[1]);  
-    st3seg->Add(id0+56, slatseg[1]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 2, slatsegB[1]);
+      chamberSeg->Add(id0+ 6, slatsegB[1]);  
+      chamberSeg->Add(id0+52, slatsegB[1]);  
+      chamberSeg->Add(id0+56, slatsegB[1]);
+    } else {
+      chamberSeg->Add(id0+ 2, slatsegNB[1]);
+      chamberSeg->Add(id0+ 6, slatsegNB[1]);  
+      chamberSeg->Add(id0+52, slatsegNB[1]);  
+      chamberSeg->Add(id0+56, slatsegNB[1]);
+    }
     // type 112200
-    st3seg->Add(id0+ 3, slatseg[0]);
-    st3seg->Add(id0+ 4, slatseg[0]);  
-    st3seg->Add(id0+ 5, slatseg[0]);  
-    st3seg->Add(id0+53, slatseg[0]);
-    st3seg->Add(id0+54, slatseg[0]);     
-    st3seg->Add(id0+55, slatseg[0]);
-    
-//     if (i == 0) DrawSegmentation(chamber,st3seg);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 3, slatsegB[0]);
+      chamberSeg->Add(id0+ 4, slatsegB[0]);  
+      chamberSeg->Add(id0+ 5, slatsegB[0]);  
+      chamberSeg->Add(id0+53, slatsegB[0]);
+      chamberSeg->Add(id0+54, slatsegB[0]);     
+      chamberSeg->Add(id0+55, slatsegB[0]);
+    } else {
+      chamberSeg->Add(id0+ 3, slatsegNB[0]);
+      chamberSeg->Add(id0+ 4, slatsegNB[0]);  
+      chamberSeg->Add(id0+ 5, slatsegNB[0]);  
+      chamberSeg->Add(id0+53, slatsegNB[0]);
+      chamberSeg->Add(id0+54, slatsegNB[0]);     
+      chamberSeg->Add(id0+55, slatsegNB[0]);
+    }
 
-    if (chamberId == chamber) return st3seg;
   }
   
-  //Loop for St4 (only segmentation for bending plane)
-  for (Int_t i=0; i<2; i++) {
+  // For St4 
+  if (chamberId == 6 || chamberId == 7) {
     // Create chamber segmentations  
-    Int_t chamber = i+6;
-    AliMUONGeometrySegmentation* st4seg = new AliMUONGeometrySegmentation(muon->Chamber(chamber).GetGeometry());
-    
-    Int_t id0=(chamber+1)*100;
+    id0=(chamberId+1)*100;
     // type 122330
-    st4seg->Add(id0+ 6, slatseg[4]);
-    st4seg->Add(id0+56, slatseg[4]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 6, slatsegB[4]);
+      chamberSeg->Add(id0+56, slatsegB[4]);
+    } else {
+      chamberSeg->Add(id0+ 6, slatsegNB[4]);
+      chamberSeg->Add(id0+56, slatsegNB[4]);
+    }
     // type 112233
-    st4seg->Add(id0+ 5, slatseg[5]);
-    st4seg->Add(id0+ 7, slatseg[5]);  
-    st4seg->Add(id0+55, slatseg[5]);  
-    st4seg->Add(id0+57, slatseg[5]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 5, slatsegB[5]);
+      chamberSeg->Add(id0+ 7, slatsegB[5]);  
+      chamberSeg->Add(id0+55, slatsegB[5]);  
+      chamberSeg->Add(id0+57, slatsegB[5]);
+    } else {
+      chamberSeg->Add(id0+ 5, slatsegNB[5]);
+      chamberSeg->Add(id0+ 7, slatsegNB[5]);  
+      chamberSeg->Add(id0+55, slatsegNB[5]);  
+      chamberSeg->Add(id0+57, slatsegNB[5]);
+    }
     // type 112230
-    st4seg->Add(id0+ 4, slatseg[6]);
-    st4seg->Add(id0+ 8, slatseg[6]);  
-    st4seg->Add(id0+54, slatseg[6]);  
-    st4seg->Add(id0+58, slatseg[6]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 4, slatsegB[6]);
+      chamberSeg->Add(id0+ 8, slatsegB[6]);  
+      chamberSeg->Add(id0+54, slatsegB[6]);  
+      chamberSeg->Add(id0+58, slatsegB[6]);
+    } else {
+      chamberSeg->Add(id0+ 4, slatsegNB[6]);
+      chamberSeg->Add(id0+ 8, slatsegNB[6]);  
+      chamberSeg->Add(id0+54, slatsegNB[6]);  
+      chamberSeg->Add(id0+58, slatsegNB[6]);
+    }
     // type 222330 
-    st4seg->Add(id0+ 3, slatseg[7]);
-    st4seg->Add(id0+ 9, slatseg[7]);  
-    st4seg->Add(id0+53, slatseg[7]);
-    st4seg->Add(id0+59, slatseg[7]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 3, slatsegB[7]);
+      chamberSeg->Add(id0+ 9, slatsegB[7]);  
+      chamberSeg->Add(id0+53, slatsegB[7]);
+      chamberSeg->Add(id0+59, slatsegB[7]);
+    } else {
+      chamberSeg->Add(id0+ 3, slatsegNB[7]);
+      chamberSeg->Add(id0+ 9, slatsegNB[7]);  
+      chamberSeg->Add(id0+53, slatsegNB[7]);
+      chamberSeg->Add(id0+59, slatsegNB[7]);
+    }
     // type 223300 
-    st4seg->Add(id0+ 2, slatseg[8]);
-    st4seg->Add(id0+10, slatseg[8]);  
-    st4seg->Add(id0+52, slatseg[8]);
-    st4seg->Add(id0+60, slatseg[8]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 2, slatsegB[8]);
+      chamberSeg->Add(id0+10, slatsegB[8]);  
+      chamberSeg->Add(id0+52, slatsegB[8]);
+      chamberSeg->Add(id0+60, slatsegB[8]);
+    } else {
+      chamberSeg->Add(id0+ 2, slatsegNB[8]);
+      chamberSeg->Add(id0+10, slatsegNB[8]);  
+      chamberSeg->Add(id0+52, slatsegNB[8]);
+      chamberSeg->Add(id0+60, slatsegNB[8]);
+    }
     // type 333000 
-    st4seg->Add(id0+ 1, slatseg[9]);
-    st4seg->Add(id0+11, slatseg[9]);  
-    st4seg->Add(id0+51, slatseg[9]);
-    st4seg->Add(id0+61, slatseg[9]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 1, slatsegB[9]);
+      chamberSeg->Add(id0+11, slatsegB[9]);  
+      chamberSeg->Add(id0+51, slatsegB[9]);
+      chamberSeg->Add(id0+61, slatsegB[9]);
+    } else {
+      chamberSeg->Add(id0+ 1, slatsegNB[9]);
+      chamberSeg->Add(id0+11, slatsegNB[9]);  
+      chamberSeg->Add(id0+51, slatsegNB[9]);
+      chamberSeg->Add(id0+61, slatsegNB[9]);
+    }
     // type 330000 
-    st4seg->Add(id0   , slatseg[10]);
-    st4seg->Add(id0+12, slatseg[10]);  
-    st4seg->Add(id0+50, slatseg[10]);
-    st4seg->Add(id0+62, slatseg[10]);
-    
-//     if (i == 0) DrawSegmentation(chamber,st4seg);
-
-    if (chamberId == chamber) return st4seg;
+    if (cathod == 0) {
+      chamberSeg->Add(id0   , slatsegB[10]);
+      chamberSeg->Add(id0+12, slatsegB[10]);  
+      chamberSeg->Add(id0+50, slatsegB[10]);
+      chamberSeg->Add(id0+62, slatsegB[10]);
+    } else {
+      chamberSeg->Add(id0   , slatsegNB[10]);
+      chamberSeg->Add(id0+12, slatsegNB[10]);  
+      chamberSeg->Add(id0+50, slatsegNB[10]);
+      chamberSeg->Add(id0+62, slatsegNB[10]);
+    }
   }
 
-  //Loop for St5 (only segmentation for bending plane)
-  for (Int_t i=0; i<2; i++) {
-    // Create chamber segmentations  
-    Int_t chamber = i+8;
-    AliMUONGeometrySegmentation* st5seg 
-      = new AliMUONGeometrySegmentation(muon->Chamber(chamber).GetGeometry());
-    
-    Int_t id0=(chamber+1)*100;
+  // For St5 
+  if (chamberId == 8 || chamberId == 9) {
+    // Create chamber segmentations      
+    id0=(chamberId+1)*100;
     // type 122330
-    st5seg->Add(id0+ 6, slatseg[4]);
-    st5seg->Add(id0+56, slatseg[4]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 6, slatsegB[4]);
+      chamberSeg->Add(id0+56, slatsegB[4]);
+    } else {
+      chamberSeg->Add(id0+ 6, slatsegNB[4]);
+      chamberSeg->Add(id0+56, slatsegNB[4]);
+    }
     // type 112233
-    st5seg->Add(id0+ 4, slatseg[5]);
-    st5seg->Add(id0+ 5, slatseg[5]);
-    st5seg->Add(id0+ 7, slatseg[5]);  
-    st5seg->Add(id0+ 8, slatseg[5]);  
-    st5seg->Add(id0+54, slatseg[5]);  
-    st5seg->Add(id0+55, slatseg[5]);  
-    st5seg->Add(id0+57, slatseg[5]);
-    st5seg->Add(id0+58, slatseg[5]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 4, slatsegB[5]);
+      chamberSeg->Add(id0+ 5, slatsegB[5]);
+      chamberSeg->Add(id0+ 7, slatsegB[5]);  
+      chamberSeg->Add(id0+ 8, slatsegB[5]);  
+      chamberSeg->Add(id0+54, slatsegB[5]);  
+      chamberSeg->Add(id0+55, slatsegB[5]);  
+      chamberSeg->Add(id0+57, slatsegB[5]);
+      chamberSeg->Add(id0+58, slatsegB[5]);
+    } else {
+      chamberSeg->Add(id0+ 4, slatsegNB[5]);
+      chamberSeg->Add(id0+ 5, slatsegNB[5]);
+      chamberSeg->Add(id0+ 7, slatsegNB[5]);  
+      chamberSeg->Add(id0+ 8, slatsegNB[5]);  
+      chamberSeg->Add(id0+54, slatsegNB[5]);  
+      chamberSeg->Add(id0+55, slatsegNB[5]);  
+      chamberSeg->Add(id0+57, slatsegNB[5]);
+      chamberSeg->Add(id0+58, slatsegNB[5]);
+    }
     // type 222333 
-    st5seg->Add(id0+ 3, slatseg[11]);
-    st5seg->Add(id0+ 9, slatseg[11]);  
-    st5seg->Add(id0+53, slatseg[11]);
-    st5seg->Add(id0+59, slatseg[11]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 3, slatsegB[11]);
+      chamberSeg->Add(id0+ 9, slatsegB[11]);  
+      chamberSeg->Add(id0+53, slatsegB[11]);
+      chamberSeg->Add(id0+59, slatsegB[11]);
+    } else {
+      chamberSeg->Add(id0+ 3, slatsegNB[11]);
+      chamberSeg->Add(id0+ 9, slatsegNB[11]);  
+      chamberSeg->Add(id0+53, slatsegNB[11]);
+      chamberSeg->Add(id0+59, slatsegNB[11]);
+    }
     // type 223330 
-    st5seg->Add(id0+ 2, slatseg[12]);
-    st5seg->Add(id0+10, slatseg[12]);  
-    st5seg->Add(id0+52, slatseg[12]);
-    st5seg->Add(id0+60, slatseg[12]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 2, slatsegB[12]);
+      chamberSeg->Add(id0+10, slatsegB[12]);  
+      chamberSeg->Add(id0+52, slatsegB[12]);
+      chamberSeg->Add(id0+60, slatsegB[12]);
+    } else {
+      chamberSeg->Add(id0+ 2, slatsegNB[12]);
+      chamberSeg->Add(id0+10, slatsegNB[12]);  
+      chamberSeg->Add(id0+52, slatsegNB[12]);
+      chamberSeg->Add(id0+60, slatsegNB[12]);
+    }
     // type 333300 
-    st5seg->Add(id0+ 1, slatseg[13]);
-    st5seg->Add(id0+11, slatseg[13]);  
-    st5seg->Add(id0+51, slatseg[13]);
-    st5seg->Add(id0+61, slatseg[13]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0+ 1, slatsegB[13]);
+      chamberSeg->Add(id0+11, slatsegB[13]);  
+      chamberSeg->Add(id0+51, slatsegB[13]);
+      chamberSeg->Add(id0+61, slatsegB[13]);
+    } else {
+      chamberSeg->Add(id0+ 1, slatsegNB[13]);
+      chamberSeg->Add(id0+11, slatsegNB[13]);  
+      chamberSeg->Add(id0+51, slatsegNB[13]);
+      chamberSeg->Add(id0+61, slatsegNB[13]);
+    }
     // type 333000 
-    st5seg->Add(id0   , slatseg[9]);
-    st5seg->Add(id0+12, slatseg[9]);  
-    st5seg->Add(id0+50, slatseg[9]);
-    st5seg->Add(id0+62, slatseg[9]);
+    if (cathod == 0) {
+      chamberSeg->Add(id0   , slatsegB[9]);
+      chamberSeg->Add(id0+12, slatsegB[9]);  
+      chamberSeg->Add(id0+50, slatsegB[9]);
+      chamberSeg->Add(id0+62, slatsegB[9]);
+    } else {
+      chamberSeg->Add(id0   , slatsegNB[9]);
+      chamberSeg->Add(id0+12, slatsegNB[9]);  
+      chamberSeg->Add(id0+50, slatsegNB[9]);
+      chamberSeg->Add(id0+62, slatsegNB[9]);
+    }
+  }  
+  
+  if (!id0) {
+    AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",
+                   chamberId, cathod));
+    return 0;
     
-    // if (i == 0) DrawSegmentation(chamber,st5seg);
-
-    if (chamberId == chamber) return st5seg;
   }
-
-  AliWarning(Form("Segmentation for chamber %d , cathod %d is not yet defined",
-              chamberId, cathod));
-  return 0;
+  
+  DrawSegmentation(chamberSeg);
+  return chamberSeg;
+  
 } 
 
 //
@@ -729,7 +882,7 @@ void AliMUONTest::DrawPad(Int_t& counter,
 } 
    
 //______________________________________________________________________________
-void AliMUONTest::DrawSegmentation(Int_t chamber, AliMUONGeometrySegmentation *seg)
+void AliMUONTest::DrawSegmentation(AliMUONGeometrySegmentation *seg)
 {
 // TBR
 
@@ -738,8 +891,8 @@ void AliMUONTest::DrawSegmentation(Int_t chamber, AliMUONGeometrySegmentation *s
   Float_t x, y, z;
   Float_t dpx, dpy;
 //   TH2F * frame = new TH2F(" "," ",10,-10.,245.,10, -5., 45.);
-  TH2F * frame = new TH2F(" "," ",10,-300.,300.,10, -300., 300.);
-//   TH2F * frame = new TH2F(" "," ",10,-300.,300.,10, -25., 25.);
+//   TH2F * frame = new TH2F(" "," ",10,-300.,300.,10, -300., 300.);
+  TH2F * frame = new TH2F(" "," ",10,-200.,200.,10, -200., 200.);
   frame->Draw();
 //   (new TPave(  0.,  0., 40., 40.,2))->Draw();
 //   (new TPave( 40.,  0., 80., 40.,2))->Draw();
@@ -748,30 +901,32 @@ void AliMUONTest::DrawSegmentation(Int_t chamber, AliMUONGeometrySegmentation *s
 //   (new TPave(160.,  0.,200., 40.,2))->Draw();
 //   (new TPave(200.,  0.,240., 40.,2))->Draw();
   
-  for (Int_t iDE = 0; iDE < 13; iDE++) {
+  // Loop over detection elements
+  //
+  AliMUONGeometryStore* detElements 
+    = seg->GetGeometry()->GetDetElementStore();
+    
+  for (Int_t iDE=0; iDE<detElements->GetNofEntries(); iDE++) {
     
-    for (Int_t side = 0; side < 2; side++) {
-      if (side == 0)
-       deId = (chamber+1)*100+iDE;
-      else 
-       deId = (chamber+1)*100+50+iDE;
+    deId = detElements->GetEntry(iDE)->GetUniqueID();       
+    cout << "Detection element id: " << deId << endl;
+    
+    
+    //   for ( seg->FirstPad(detElementId,  0., 0., 0., 100., 100.);
+    //         seg->MorePads(detElementId); 
+    //         seg->NextPad(detElementId) ) {
+    for(ix=1; ix<=seg->Npx(deId); ix++) {
+      for(iy=1; iy<=seg->Npy(deId); iy++) {
        
-      
-      //   for ( seg->FirstPad(detElementId,  0., 0., 0., 100., 100.);
-      //       seg->MorePads(detElementId); 
-      //       seg->NextPad(detElementId) ) {
-      for(ix=1; ix<=seg->Npx(deId); ix++) {
-       for(iy=1; iy<=seg->Npy(deId); iy++) {
+       seg->GetPadC(deId, ix, iy, x, y, z);
+       Int_t sector = seg->Sector(deId, ix, iy);
+       dpx = seg->Dpx(deId,sector);
+       dpy = seg->Dpy(deId,sector);
        
-         seg->GetPadC(deId, ix, iy, x, y, z);
-         Int_t sector = seg->Sector(deId, ix, iy);
-         dpx = seg->Dpx(deId,sector);
-         dpy = seg->Dpy(deId,sector);
-
-                //printf(" ***** Pad position is ix: %d iy: %d x: %f y: %f sector: %d dpx: %f dpy: %f \n",ix, iy, x, y, sector, dpx, dpy);
-         (new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1))->Draw();
-       }
+       //printf(" ***** Pad position is ix: %d iy: %d x: %f y: %f sector: %d dpx: %f dpy: %f \n",ix, iy, x, y, sector, dpx, dpy);
+       (new TPave(x-dpx/2., y-dpy/2., x+dpx/2., y+dpy/2., 1))->Draw();
       }
+      
     }
   }
 }
index a2bd15c94dde52334e25369ada9a94ca81c83b9a..db742b412ed82a0ab2e2bc4cd12be66cc23b80db 100644 (file)
@@ -62,8 +62,7 @@ class AliMUONTest : public  TObject
                   AliMUONGeometrySegmentation* segmentation);
  
 
-    void DrawSegmentation(Int_t chamber, 
-                          AliMUONGeometrySegmentation *seg);
+    void DrawSegmentation(AliMUONGeometrySegmentation *seg);
              // TBR