]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegmentationV01.cxx
Some B mesons added
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationV01.cxx
index b4164b20330646d9b1b2b26c0aa7cd8300a25326..602afbfcb2ed46a6b6aa7b4ed293fd5367b2bf73 100644 (file)
 
 /*
 $Log$
+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.
@@ -83,22 +103,49 @@ AliMUONSegmentationV01::AliMUONSegmentationV01(const AliMUONSegmentationV01& seg
 {
 // Dummy copy constructor
 }
+
 AliMUONSegmentationV01::AliMUONSegmentationV01() 
 {
 // Default constructor
-    fNsec=4;
+    fRSec = 0;
+    fNDiv = 0;      
+    fDpxD = 0;
+    fCorrA = 0;
+}
+
+AliMUONSegmentationV01::AliMUONSegmentationV01(Int_t nsec) 
+{
+//  Non default constructor
+
+    fNsec = nsec;
     fRSec = new TArrayF(fNsec);
     fNDiv = new TArrayI(fNsec);      
     fDpxD = new TArrayF(fNsec);      
+
+
     (*fRSec)[0]=(*fRSec)[1]=(*fRSec)[2]=(*fRSec)[3]=0;     
     (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;     
     (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;     
-    fCorr = new TObjArray(3);
-    (*fCorr)[0]=0;
-    (*fCorr)[1]=0;
-    (*fCorr)[2]=0;
+    fCorrA = new TObjArray(3);
+    (*fCorrA)[0]=0;
+    (*fCorrA)[1]=0;
+    (*fCorrA)[2]=0;
+    fOffsetY=0;
+} 
+
+AliMUONSegmentationV01::~AliMUONSegmentationV01() 
+{
+// Destructor
+    if (fRSec) delete fRSec;
+    if (fNDiv) delete fNDiv;
+    if (fDpxD) delete fDpxD;
+    if (fCorrA) {
+       fCorrA->Delete();
+       delete fCorrA;
+    }
 } 
 
+
 Float_t AliMUONSegmentationV01::Dpx(Int_t isec) const
 {
 //
@@ -148,6 +195,8 @@ void AliMUONSegmentationV01::Init(Int_t chamber)
 //
     Int_t isec;
     printf("\n Initialise Segmentation V01\n");
+
+
     fNpy=Int_t((*fRSec)[fNsec-1]/fDpy)+1;
 
     (*fDpxD)[fNsec-1]=fDpx;
@@ -224,7 +273,11 @@ 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 = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1;
+    iy = (y-fOffsetY >0)? 
+      Int_t((y-fOffsetY)/fDpy)+1 
+      : 
+      Int_t((y-fOffsetY)/fDpy)-1;
+  
     if (iy >  fNpy) iy= fNpy;
     if (iy < -fNpy) iy=-fNpy;
 //
@@ -254,7 +307,10 @@ GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
 {
 //  Returns real coordinates (x,y) for given pad coordinates (ix,iy)
 //
-    y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.;
+    y = (iy>0) ? 
+      Float_t(iy*fDpy)-fDpy/2.+fOffsetY 
+      : 
+      Float_t(iy*fDpy)+fDpy/2.-fOffsetY;
 //
 //  Find sector isec
     Int_t isec=AliMUONSegmentationV01::Sector(ix,iy);
@@ -352,10 +408,11 @@ void AliMUONSegmentationV01::NextPad()
 }
 
 Int_t AliMUONSegmentationV01::MorePads()
+
+{
 // Stopping condition for the iterator over pads
 //
 // Are there more pads in the integration region
-{
     return  (fIx != -1  || fIy != -1);
 /*
     if ((fX >= fXmax  && fIy >= fIymax) || fY==0) {
@@ -596,12 +653,14 @@ void AliMUONSegmentationV01::Draw(const char* opt) const
 }
 void AliMUONSegmentationV01::SetCorrFunc(Int_t isec, TF1* func)
 {
-    (*fCorr)[isec]=func;
+// Set the correction function
+    (*fCorrA)[isec]=func;
 }
 
 TF1* AliMUONSegmentationV01::CorrFunc(Int_t isec) const
 { 
-    return (TF1*) (*fCorr)[isec];
+// Get correction function
+    return (TF1*) (*fCorrA)[isec];
 }
 
 AliMUONSegmentationV01& AliMUONSegmentationV01::operator 
@@ -610,3 +669,4 @@ AliMUONSegmentationV01& AliMUONSegmentationV01::operator
 // Dummy assignment operator
     return *this;
 }
+