]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegmentationV1.cxx
Code revision:
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationV1.cxx
index f9d08d492f84059b0ffd1ac3b632215aa5913365..b9c67664c448bb5fb3c3d5cdb6bcf96cde0636d3 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.1.2.2  2000/06/12 07:57:43  morsch
-include TMath.cxx
-
-Revision 1.1.2.1  2000/06/09 21:41:29  morsch
-AliMUONSegmentationV1 code  from  AliMUONSegResV1.cxx
-
-*/
-
+/* $Id$ */
 
 /////////////////////////////////////////////////////////
 //  Manager and hits classes for set:MUON version LYON //
 /////////////////////////////////////////////////////////
 
 #include <TMath.h>
+
 #include "AliMUONChamber.h"
 #include "AliMUONSegmentationV1.h"
+#include "AliRun.h"
+#include "AliMUON.h"
+#include "AliMUONChamber.h"
 
 //___________________________________________
 ClassImp(AliMUONSegmentationV1)
 
 AliMUONSegmentationV1::AliMUONSegmentationV1(const AliMUONSegmentationV1& segmentation)
+  : AliSegmentation(segmentation)
 {
-// Dummy copy constructor
+// Protected copy constructor
+
+  Fatal("AliMUONSegmentationV1", "Not implemented.");
 }
 
 
 AliMUONSegmentationV1::AliMUONSegmentationV1()
-
+  : AliSegmentation()
 {
   // initizalize the class with default settings
     fNzone=1;
@@ -51,20 +49,27 @@ AliMUONSegmentationV1::AliMUONSegmentationV1()
     fDpx=0.0; // forces crash if not initialized by user
     fNZoneCut[0]=0;
     fSensOffset=0;
+    fCorr = 0;
 }
 
 
-void AliMUONSegmentationV1::Init(AliMUONChamber* Chamber)
+void AliMUONSegmentationV1::Init(Int_t chamber)
 {
     // valid only for T5/6
     // beware : frMin is SENSITIVE radius by definition.
-    frSensMin2 = (Chamber->RInner())*(Chamber->RInner());
-    frSensMax2 = (Chamber->ROuter())*(Chamber->ROuter());
-    fNpx=(Int_t) (Chamber->ROuter()/fDpx) + 1;
-    fNpy=(Int_t) (Chamber->ROuter()/fDpy) + 1;
+    AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
+    AliMUONChamber* iChamber=&(pMUON->Chamber(chamber));
+
+    frSensMin2 = (iChamber->RInner())*(iChamber->RInner());
+    frSensMax2 = (iChamber->ROuter())*(iChamber->ROuter());
+    fNpx=(Int_t) (iChamber->ROuter()/fDpx) + 1;
+    fNpy=(Int_t) (iChamber->ROuter()/fDpy) + 1;
     //    fNwire=3;
     DefaultCut();
     fCorr=0;
+
+    fZ = iChamber->Z();
+
 }
 
 void AliMUONSegmentationV1::DefaultCut(void)
@@ -92,7 +97,7 @@ Int_t AliMUONSegmentationV1::GetiAnod(Float_t xhit)
     return (xhit>0) ? kwire : -kwire ;
 }
 
-Float_t AliMUONSegmentationV1::GetAnod(Float_t xhit)
+Float_t AliMUONSegmentationV1::GetAnod(Float_t xhit) const
 {
 // Get anode position
     Int_t kwire=Int_t((TMath::Abs(xhit)-fSensOffset)/fDAnod)+1; // to be compatible ...
@@ -108,7 +113,7 @@ void AliMUONSegmentationV1::SetPadSize(Float_t p1, Float_t p2)
 }
 
 void AliMUONSegmentationV1::
-GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
+GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
 {
 //  returns pad coordinates (ix,iy) for given real coordinates (x,y)
 //
@@ -117,7 +122,7 @@ GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
 }
 
 void AliMUONSegmentationV1::
-GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
+GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
 {
 //  returns real coordinates (x,y) for given pad coordinates (ix,iy)
 //
@@ -140,7 +145,7 @@ Int_t AliMUONSegmentationV1::GetZone(Float_t X, Float_t Y)
 {
 // Get segmentation zone
     Int_t iX, iY;
-    GetPadIxy(X,Y,iX,iY);
+    GetPadI(X,Y,iX,iY);
     return GetZone( iX , iY );
 }
 
@@ -166,24 +171,24 @@ void AliMUONSegmentationV1::
 SetHit(Float_t xhit, Float_t yhit)
 {
 // Find the wire position (center of charge distribution)
-    fxhit=xhit;
-    fyhit=yhit;
+    fXhit=xhit;
+    fYhit=yhit;
 }
 
 void AliMUONSegmentationV1::
 SetPad(Int_t ix, Int_t iy)
 {
 // Set current pad position
-    GetPadCxy(ix,iy,fx,fy);
+    GetPadC(ix,iy,fX,fY);
 }
 
 
 void AliMUONSegmentationV1::SetPadCoord(Int_t iX, Int_t iY)
 {    
 // Set current pad coordinates
-GetPadCxy(iX,iY,fx,fy);
+GetPadC(iX,iY,fX,fY);
  Float_t radius2;
- if ( ( (radius2=fx*fx+fy*fy) > frSensMax2 || radius2 < frSensMin2 ) 
+ if ( ( (radius2=fX*fX+fY*fY) > frSensMax2 || radius2 < frSensMin2 ) 
       && MorePads() )
      NextPad();
 }
@@ -193,8 +198,8 @@ void AliMUONSegmentationV1::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Flo
     //
     // Find the wire position (center of charge distribution)
     Float_t x0a=GetAnod(xhit);
-    fxhit=x0a;
-    fyhit=yhit;
+    fXhit=x0a;
+    fYhit=yhit;
     //
     // and take fNsigma*sigma around this center
     Float_t x01=x0a  - dx;
@@ -213,27 +218,27 @@ void AliMUONSegmentationV1::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Flo
       y02 = TMath::Sign(fSensOffset, yhit);
     //
     // find the pads over which the charge distributes
-    GetPadIxy(x01,y01,fixmin,fiymin);
-    GetPadIxy(x02,y02,fixmax,fiymax);
+    GetPadI(x01,y01,fIxmin,fIymin);
+    GetPadI(x02,y02,fIxmax,fIymax);
     // 
     // Set current pad to lower left corner
-    fix=fixmin;
-    fiy=fiymin;
-    SetPadCoord(fix,fiy);
+    fIx=fIxmin;
+    fIy=fIymin;
+    SetPadCoord(fIx,fIy);
 }
 
 void AliMUONSegmentationV1::NextPad()
 {
   // 
   // Step to next pad in integration region
-    if (fix != fixmax) {
-       fix++;
-    } else if (fiy != fiymax) {
-       fix=fixmin;
-       fiy++;
+    if (fIx != fIxmax) {
+       fIx++;
+    } else if (fIy != fIymax) {
+       fIx=fIxmin;
+       fIy++;
     } else 
        printf("\n Error: Stepping outside integration region\n ");
-    SetPadCoord(fix,fiy);
+    SetPadCoord(fIx,fIy);
 }
 
 Int_t AliMUONSegmentationV1::MorePads()
@@ -241,14 +246,14 @@ Int_t AliMUONSegmentationV1::MorePads()
 //
 // Are there more pads in the integration region
 
-    if (fix == fixmax && fiy == fiymax) {
+    if (fIx == fIxmax && fIy == fIymax) {
        return 0;
     } else {
        return 1;       
     }
 }
 
-Int_t AliMUONSegmentationV1::IsParallel2(Int_t iX, Int_t iY)
+Int_t AliMUONSegmentationV1::IsParallel2(Int_t iX, Int_t iY) const
 {
 // test if the pad is read in parallel for zone 2
 // iX and iY are assumed to be positive and starting at 0 numbering (cF. iX)
@@ -265,7 +270,7 @@ Int_t AliMUONSegmentationV1::IsParallel2(Int_t iX, Int_t iY)
     return (iX%6)/3+1;
 }
 
-Int_t AliMUONSegmentationV1::IsParallel3(Int_t iX, Int_t iY)
+Int_t AliMUONSegmentationV1::IsParallel3(Int_t iX, Int_t iY) const
 {
 // test if the pad is read in parallel for zone 3
 // iX and iY are assumed to be positive and starting at 0 numbering (cF. iX)
@@ -282,7 +287,7 @@ Int_t AliMUONSegmentationV1::IsParallel3(Int_t iX, Int_t iY)
     return (iX%9)/3+1 - (iY%3==2 && iX%3==0);
 }
 
-Int_t AliMUONSegmentationV1::NParallel2(Int_t iX, Int_t iY)
+Int_t AliMUONSegmentationV1::NParallel2(Int_t /*iX*/, Int_t iY) const
 {
 // returns the number of pads connected in parallel for zone 2
 // iX and iY are assumed to be positive and starting at 0 numbering (cF. iX)
@@ -297,7 +302,7 @@ Int_t AliMUONSegmentationV1::NParallel2(Int_t iX, Int_t iY)
     return 2;
 }
 
-Int_t AliMUONSegmentationV1::NParallel3(Int_t iX, Int_t iY)
+Int_t AliMUONSegmentationV1::NParallel3(Int_t iX, Int_t iY) const
 {
 // test if the pad is read in parallel for zone 3
 // iX and iY are assumed to be positive and starting at 0 numbering (cF. iX)
@@ -341,41 +346,41 @@ Int_t AliMUONSegmentationV1::Ix(Int_t trueX, Int_t trueY)
     return -1;
 }
 
-Int_t AliMUONSegmentationV1::Ix()
+Int_t AliMUONSegmentationV1::Ix() 
 {
 // returns the X number of pad which has to increment charge
 // due to parallel read-out
-return Ix(fix,fiy);
+    return Ix(fIx,fIy);
 }
 
-Int_t AliMUONSegmentationV1::ISector()
+Int_t AliMUONSegmentationV1::ISector() 
 {
 // This function is of no use for this kind of segmentation.
-    return GetZone(fix,fiy);
+    return GetZone(fIx,fIy);
 }
 
-void AliMUONSegmentationV1::SigGenInit(Float_t x,Float_t y,Float_t z)
+void AliMUONSegmentationV1::SigGenInit(Float_t x,Float_t y,Float_t /*z*/)
 {
 //
 //  Initialises pad and wire position during stepping
-    fxt =x;
-    fyt =y;
-    GetPadIxy(x,y,fixt,fiyt);
-    fiwt= GetiAnod(x);
+    fXt =x;
+    fYt =y;
+    GetPadI(x,y,fIxt,fIyt);
+    fIwt= GetiAnod(x);
 
 }
 
-Int_t AliMUONSegmentationV1::SigGenCond(Float_t x,Float_t y,Float_t z)
+Int_t AliMUONSegmentationV1::SigGenCond(Float_t x,Float_t y,Float_t /*z*/)
 {
 //
 //  Signal will be generated if particle crosses pad boundary or
 //  boundary between two wires. 
     Int_t ixt;
     Int_t iyt;
-    GetPadIxy(x,y,ixt,iyt);
+    GetPadI(x,y,ixt,iyt);
     Int_t iwt= GetiAnod(x);
     
-    if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) {
+    if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
        return 1;
     } else {
        return 0;
@@ -386,9 +391,9 @@ void AliMUONSegmentationV1::
 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
 {
 // Get integration limits
-    x1=fxhit-fx-fDpx/2.;
+    x1=fXhit-fX-fDpx/2.;
     x2=x1+fDpx;
-    y1=fyhit-fy-fDpy/2.;
+    y1=fYhit-fY-fDpy/2.;
     y2=y1+fDpy;    
 }
 
@@ -432,7 +437,7 @@ Float_t AliMUONSegmentationV1::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X,
     for (Int_t i=0;i<nPara; i++)
     {
        Float_t x,y;
-       GetPadCxy(iX+i*offset,iY,x,y);
+       GetPadC(iX+i*offset,iY,x,y);
        Float_t d2=(x-X)*(x-X) + (y-Y)*(y-Y);
        if ( d2min > d2)
        {
@@ -530,7 +535,7 @@ NeighboursDiag(iX,iY,Nlist,Xlist,Ylist);
 }
 
 
-void AliMUONSegmentationV1::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y)
+void AliMUONSegmentationV1::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
 {
 // Return a test point
     n=1;
@@ -538,8 +543,14 @@ void AliMUONSegmentationV1::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y)
     y[0]=x[0];
 }
 
-AliMUONSegmentationV1& AliMUONSegmentationV1::operator =(const AliMUONSegmentationV1 & rhs)
+AliMUONSegmentationV1& 
+AliMUONSegmentationV1::operator =(const AliMUONSegmentationV1 & rhs)
 {
-// Dummy assignment operator
-    return *this;
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  Fatal("operator=", "Not implemented.");
+    
+  return *this;  
 }