]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegmentationSlatModule.cxx
Modifications needed by the HBT analysis (P.Skowronski)
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlatModule.cxx
index 0e4f7a8966b2def5d63006c14dc4c17f64cd4c9c..8039a74eaec79aa6bf5a7ead90cb1c22395861a4 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.2  2000/10/18 11:42:06  morsch
-- AliMUONRawCluster contains z-position.
-- Some clean-up of useless print statements during initialisations.
-
-Revision 1.1  2000/10/06 08:59:03  morsch
-Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
-
-*/
+/* $Id$ */
 
 /////////////////////////////////////////////////////
 //  Segmentation classes for slat modules          //
@@ -31,8 +22,10 @@ Segmentation classes for bending and non bending plane slat modules (A. de Falco
 
 
 #include "AliMUONSegmentationSlatModule.h"
+#include "AliRun.h"
+#include "AliMUON.h"
 #include <TMath.h>
-#include <iostream.h>
+#include <Riostream.h>
 
 #include "AliMUONSegmentationV01.h"
 
@@ -42,13 +35,27 @@ ClassImp(AliMUONSegmentationSlatModule)
 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule() 
 {
 // Default constructor
-    fNsec=4;
+    fNDiv = 0;      
+    fDpxD = 0;  
+}
+
+AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule(Int_t nsec) 
+{
+// Non default constructor
+    fNsec = nsec;
     fNDiv = new TArrayI(fNsec);      
     fDpxD = new TArrayF(fNsec);      
     (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;     
     (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;     
 }
 
+AliMUONSegmentationSlatModule::~AliMUONSegmentationSlatModule() 
+{
+// Destructor
+    if (fNDiv) delete fNDiv;
+    if (fDpxD) delete fDpxD;
+}
+
 void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
 {
 //
@@ -77,7 +84,7 @@ Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
 } 
 
 
-Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
+Float_t AliMUONSegmentationSlatModule::Dpy(Int_t /*isec*/) const
 {
 // Return y-strip width
 
@@ -99,6 +106,7 @@ GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
     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;
        }
     }
@@ -132,7 +140,12 @@ GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
        x=y=0;
     }
 }
-
+//-------------------------------------------------------------------------
+void AliMUONSegmentationSlatModule::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy)
+{
+  GetPadI(x, y, ix, iy);
+}
+//-------------------------------------------------------------------------
 void AliMUONSegmentationSlatModule::
 SetPad(Int_t ix, Int_t iy)
 {
@@ -146,6 +159,8 @@ SetPad(Int_t ix, Int_t iy)
 void AliMUONSegmentationSlatModule::
 SetHit(Float_t x, Float_t y)
 {
+// Set current hit 
+//
     fXhit = x;
     fYhit = y;
     
@@ -157,8 +172,12 @@ SetHit(Float_t x, Float_t y)
 
     
 }
-
-
+//----------------------------------------------------------
+void AliMUONSegmentationSlatModule::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/)
+{
+  SetHit(xhit, yhit);
+}
+//----------------------------------------------------------
 void AliMUONSegmentationSlatModule::
 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
 {
@@ -175,31 +194,37 @@ FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
     Float_t x02=x0a  + dx;
     Float_t y01=yhit - dy;
     Float_t y02=yhit + dy;
-    
     if (x01 < 0) x01 = 0;
     if (y01 < 0) y01 = 0;
+
+    if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
+
     
+
     Int_t isec=-1;
     for (Int_t i=fNsec-1; i > 0; i--) {
        if (x02 >= fCx[i-1]) {
            isec=i;
+           if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
            break;
        }
     }
-   
-    if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
+    y02 += Dpy(isec);
     if (y02 >= fDyPCB) y02 = fDyPCB;
+   
     //
     // find the pads over which the charge distributes
     GetPadI(x01,y01,fIxmin,fIymin);
     GetPadI(x02,y02,fIxmax,fIymax);
+    
     if (fIxmax > fNpx) fIxmax=fNpx;
     if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];    
+
     fXmin=x01;
-    fXmax=x02;
+    fXmax=x02;    
     fYmin=y01;
-    fYmax=y02;
-    
+    fYmax=y02;    
+  
     // 
     // Set current pad to lower left corner
     if (fIxmax < fIxmin) fIxmax=fIxmin;
@@ -209,12 +234,19 @@ FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
     
     GetPadC(fIx,fIy,fX,fY);
     fSector=Sector(fIx,fIy);
-//    printf("\n \n First Pad: %d %d %f %f %d %d %d %f" , 
-//        fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));    
-//    printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
-//        fIymin, fIymax, fYmin, fYmax, fNpy, fId, isec, Dpy(isec));
+/*
+    printf("\n \n First Pad: %d %d %f %f %d %d %d %f" , 
+          fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));    
+    printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
+          fIymin, fIymax, fYmin, fYmax,  fNpyS[isec], fId, isec, Dpy(isec));
+*/
 }
-
+//----------------------------------------------------------------------
+void AliMUONSegmentationSlatModule::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy)
+{
+  FirstPad(xhit, yhit, dx, dy);
+}
+//----------------------------------------------------------------------
 void AliMUONSegmentationSlatModule::NextPad()
 {
 // Stepper for the iteration over pads
@@ -241,10 +273,10 @@ void AliMUONSegmentationSlatModule::NextPad()
 
 
 Int_t AliMUONSegmentationSlatModule::MorePads()
+{
 // Stopping condition for the iterator over pads
 //
 // Are there more pads in the integration region
-{
     
     return  (fIx != -1  || fIy != -1);
 }
@@ -322,7 +354,6 @@ Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
 
 void AliMUONSegmentationSlatModule::Init(Int_t chamber)
 {
-    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
@@ -332,6 +363,8 @@ void AliMUONSegmentationSlatModule::Init(Int_t chamber)
 //  concentric circles as shown below
 //
 //  PCB module size in cm
+  // printf("\n Initialise Segmentation SlatModule \n");
+
     fDxPCB=40;
     fDyPCB=40;
 //
@@ -370,7 +403,6 @@ void AliMUONSegmentationSlatModule::Init(Int_t chamber)
     fNpx=fNpxS[3];
 //
     fId = chamber;
-    
 }