]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegmentationV01.cxx
Logging of Debug, Info and Error Messages follwing AliRoot Standard http://aliweb...
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationV01.cxx
index 4989bac3fcc71b35e70f446b26b190b48212ff9b..9b9186236315dd9ea4ccccf0a8013ea6d7433e90 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.18  2001/04/11 12:33:56  morsch
-Bug in GetPadC in case of staggered planes corrected. (Thanks to J.P. Cussonneau)
-
-Revision 1.17  2001/01/30 12:17:04  morsch
-Remove obolete print-statement.
-
-Revision 1.16  2001/01/30 09:23:14  hristov
-Streamers removed (R.Brun)
-
-Revision 1.15  2001/01/26 21:25:48  morsch
-Empty default constructors and.
-
-Revision 1.14  2000/12/21 22:12:41  morsch
-Clean-up of coding rule violations,
-
-Revision 1.13  2000/12/07 10:41:51  hristov
-fCorr replaced by fCorrA
-
-Revision 1.12  2000/12/06 11:55:41  morsch
-Introduce  SetOffsetY(Float_t off) method as simplified simulation of pad staggering.
-fOffset is the staggering offset in y.
-
-Revision 1.11  2000/11/06 09:20:43  morsch
-AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the
-Draw() method. This avoids code and parameter replication.
-
-Revision 1.10  2000/10/18 11:42:06  morsch
-- AliMUONRawCluster contains z-position.
-- Some clean-up of useless print statements during initialisations.
-
-Revision 1.9  2000/10/18 08:41:32  morsch
-Make NextPad() and MorePads() to iterate until the end.
-
-Revision 1.8  2000/10/03 21:48:07  morsch
-Adopt to const declaration of some of the methods in AliSegmentation.
-
-Revision 1.7  2000/10/02 21:28:09  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.6  2000/10/02 16:58:29  egangler
-Cleaning of the code :
--> coding conventions
--> void Streamers
--> some useless includes removed or replaced by "class" statement
-
-Revision 1.5  2000/07/13 16:19:44  fca
-Mainly coding conventions + some small bug fixes
-
-Revision 1.4  2000/07/03 11:54:57  morsch
-AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
-The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
-
-Revision 1.3  2000/06/29 12:34:09  morsch
-AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
-it usable with any other geometry class. The link to the object to which it belongs is
-established via an index. This assumes that there exists a global geometry manager
-from which the pointer to the parent object can be obtained (in our case gAlice).
-
-Revision 1.2  2000/06/15 07:58:48  morsch
-Code from MUON-dev joined
-
-Revision 1.1.2.1  2000/06/09 21:37:30  morsch
-AliMUONSegmentationV01 code  from  AliMUONSegResV01.cxx
-
-*/
-
+/* $Id$ */
 
 /////////////////////////////////////////////////////
 //  Segmentation and Response classes version 01   //
@@ -92,13 +25,14 @@ AliMUONSegmentationV01 code  from  AliMUONSegResV01.cxx
 #include <TNode.h>  
 #include <TGeometry.h>  
 #include <TF1.h> 
+#include <TVector3.h> 
 #include <TObjArray.h>
-#include <iostream.h>
 
 #include "AliMUONSegmentationV01.h"
 #include "AliMUON.h"
 #include "AliMUONChamber.h"
 #include "AliRun.h"
+#include "AliLog.h"
 
 
 
@@ -106,20 +40,26 @@ AliMUONSegmentationV01 code  from  AliMUONSegResV01.cxx
 ClassImp(AliMUONSegmentationV01)
 
 AliMUONSegmentationV01::AliMUONSegmentationV01(const AliMUONSegmentationV01& segmentation)
+  : AliMUONSegmentationV0(segmentation)
 {
-// Dummy copy constructor
+// Protected copy constructor
+
+  AliFatal("Not implemented.");
 }
 
 AliMUONSegmentationV01::AliMUONSegmentationV01() 
+  : AliMUONSegmentationV0()
 {
 // Default constructor
     fRSec = 0;
     fNDiv = 0;      
     fDpxD = 0;
     fCorrA = 0;
+    fSector = -1;
 }
 
 AliMUONSegmentationV01::AliMUONSegmentationV01(Int_t nsec) 
+  : AliMUONSegmentationV0()
 {
 //  Non default constructor
 
@@ -133,10 +73,11 @@ AliMUONSegmentationV01::AliMUONSegmentationV01(Int_t nsec)
     (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;     
     (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;     
     fCorrA = new TObjArray(3);
-    (*fCorrA)[0]=0;
-    (*fCorrA)[1]=0;
-    (*fCorrA)[2]=0;
+    fCorrA->AddAt(0,0);
+    fCorrA->AddAt(0,1);
+    fCorrA->AddAt(0,2);
     fOffsetY=0;
+    fSector = -1;
 } 
 
 AliMUONSegmentationV01::~AliMUONSegmentationV01() 
@@ -160,7 +101,7 @@ Float_t AliMUONSegmentationV01::Dpx(Int_t isec) const
    return dpx;
 }
 
-Float_t AliMUONSegmentationV01::Dpy(Int_t isec) const
+Float_t AliMUONSegmentationV01::Dpy(Int_t /*isec*/) const
 {
 //
 // Returns y-pad size for given sector isec
@@ -199,6 +140,7 @@ void AliMUONSegmentationV01::Init(Int_t chamber)
 //  vice versa.
 //  This version approximates concentric segmentation zones
 //
+
     Int_t isec;
     //printf("\n Initialise Segmentation V01\n");
 
@@ -251,13 +193,18 @@ void AliMUONSegmentationV01::Init(Int_t chamber)
            }
        } // y-pad loop
     } // sector loop
+
 // reference to chamber
     AliMUON *pMUON  = (AliMUON *) gAlice->GetModule("MUON");
     fChamber=&(pMUON->Chamber(chamber));
+    fRmin=fChamber->RInner();
+    fRmax=fChamber->ROuter();    
+    fCorr=0;
     fZ = fChamber->Z();
     fId=chamber;
 }
 
+//______________________________________________________________________
 Int_t AliMUONSegmentationV01::Sector(Int_t ix, Int_t iy)
 {
 // Returns sector number for given pad position
@@ -274,8 +221,8 @@ Int_t AliMUONSegmentationV01::Sector(Int_t ix, Int_t iy)
     return isec;
 }
 
-void AliMUONSegmentationV01::
-GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
+//______________________________________________________________________
+void AliMUONSegmentationV01::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
 {
 //  Returns pad coordinates (ix,iy) for given real coordinates (x,y)
 //
@@ -307,6 +254,12 @@ GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
     }
     ix = (x>0) ? ix:-ix;
 }
+//________________________________________________________________
+void AliMUONSegmentationV01::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy) 
+{
+  GetPadI(x, y, ix, iy);
+}
+//________________________________________________________________
 
 void AliMUONSegmentationV01::
 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
@@ -330,6 +283,44 @@ GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
     } else {
        x=y=0;
     }
+
+}
+//________________________________________________________________
+
+void AliMUONSegmentationV01::
+GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z)
+{
+//  Returns real coordinates (x,y,z) for given pad coordinates (ix,iy)
+//
+  GetPadC(ix,iy,x,y); 
+    
+  // To be properly interfaced with chamber geometry (AliMUONSt1GeometryBuilderV2) ???
+  TVector3 scale[4];  
+  scale[0] = TVector3( 1,  1,  1);  // quadrant I
+  scale[1] = TVector3(-1,  1, -1);  // quadrant II
+  scale[2] = TVector3(-1, -1,  1);  // quadrant III
+  scale[3] = TVector3( 1, -1, -1);  // quadrant IV
+
+  Int_t iQuadrant;
+  
+  if (ix > 0) {
+    if (iy > 0) {
+      iQuadrant = 0;
+    } else {
+      iQuadrant = 3;
+    }
+  } else {
+    if (iy > 0) {
+      iQuadrant = 1;
+    } else {
+      iQuadrant = 2;
+    }
+  }      
+  if (TMath::Abs(fZ) <  600) {
+    z = fZ + scale[iQuadrant].Z()*6.5/2.; // Station 1
+  } else {
+    z = fZ;  // Station 2
+  }
 }
 
 void AliMUONSegmentationV01::
@@ -342,9 +333,8 @@ SetPad(Int_t ix, Int_t iy)
     fSector=Sector(ix,iy);
 }
 
-
-void AliMUONSegmentationV01::
-FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
+//______________________________________________________________________
+void AliMUONSegmentationV01::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
 {
 // Initialises iteration over pads for charge distribution algorithm
 //
@@ -377,6 +367,11 @@ FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
     fIx=fIxmin;
     fIy=fIymin;
     GetPadC(fIx,fIy,fX,fY);
+
+    // added 
+    if (fSector == -1) {
+      fSector=Sector(fIx,fIy);
+    }
 }
 
 
@@ -429,6 +424,12 @@ Int_t AliMUONSegmentationV01::MorePads()
     }
 */
 }
+//______________________________________________________________________
+void AliMUONSegmentationV01::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy)
+{
+  FirstPad(xhit, yhit, dx, dy);
+}
+
 
 void AliMUONSegmentationV01::
 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
@@ -557,7 +558,7 @@ void AliMUONSegmentationV01::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) co
     y[2]=x[2];
 }
 
-void AliMUONSegmentationV01::Draw(const char* opt) const
+void AliMUONSegmentationV01::Draw(const char* opt)
 {
  
 // Draws the segmentation zones
@@ -661,19 +662,25 @@ void AliMUONSegmentationV01::Draw(const char* opt) const
 void AliMUONSegmentationV01::SetCorrFunc(Int_t isec, TF1* func)
 {
 // Set the correction function
-    (*fCorrA)[isec]=func;
+    fCorrA->AddAt(func,isec);
 }
 
 TF1* AliMUONSegmentationV01::CorrFunc(Int_t isec) const
 { 
 // Get correction function
-    return (TF1*) (*fCorrA)[isec];
+  //PH    return (TF1*) (*fCorrA)[isec];
+    return (TF1*) fCorrA->At(isec);
 }
 
-AliMUONSegmentationV01& AliMUONSegmentationV01::operator 
-=(const AliMUONSegmentationV01 & rhs)
+AliMUONSegmentationV01& 
+AliMUONSegmentationV01::operator =(const AliMUONSegmentationV01 & rhs)
 {
-// Dummy assignment operator
-    return *this;
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  AliFatal("Not implemented.");
+    
+  return *this;  
 }