]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSv11Geometry.cxx
Updated some functions, and removed most all violoations.
[u/mrichter/AliRoot.git] / ITS / AliITSv11Geometry.cxx
index 77f98758ffb9f57b548051d864e9591e9e06be08..71516baef14d4923c266098c09ee91cdd053257d 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
-#include <stdio.h>
-#include <stdlib.h>
-// General Root includes
+/*
+ $Id$ 
+*/
+
+
+////////////////////////////////////////////////////////////////////////
+//  This class is a base class for the ITS geometry version 11. It 
+//  contains common/standard functions used in many places in defining 
+//  the ITS geometry, version 11. Large posions of the ITS geometry, 
+//  version 11, should be derived from this class so as to make maximum 
+//  use of these common functions. This class also defines the proper 
+//  conversion valuse such, to cm and degrees, such that the most usefull 
+//  units, those used in the Engineering drawings, can be used.
+////////////////////////////////////////////////////////////////////////
+
+
 #include <Riostream.h>
 #include <TMath.h>
-#include <float.h>
-#include <TFile.h>    // only required for Tracking function?
-#include <TObjArray.h>
-#include <TClonesArray.h>
-#include <TLorentzVector.h>
-#include <TObjString.h>
-// Root Geometry includes
-#include <TGeoManager.h>
-#include <TGeoVolume.h>
 #include <TGeoPcon.h>
 #include <TGeoCone.h>
 #include <TGeoTube.h> // contaings TGeoTubeSeg
 #include <TGeoArb8.h>
-#include <TGeoCompositeShape.h>
-#include <TGeoMatrix.h>
-#include <TGeoNode.h>
-#include <TGeoMaterial.h>
-#include <TGeoMedium.h>
-#include "AliITSBaseGeometry.h"
+#include <TPolyMarker.h>
+#include <TPolyLine.h>
 #include "AliITSv11Geometry.h"
 
 ClassImp(AliITSv11Geometry)
 //______________________________________________________________________
-Double_t AliITSv11Geometry::RmaxFrom2Points(TGeoPcon *p,Int_t i1,Int_t i2,Double_t z){
+Double_t AliITSv11Geometry::Yfrom2Points(Double_t x0,Double_t y0,
+                                         Double_t x1,Double_t y1,
+                                         Double_t x){
+    // Given the two points (x0,y0) and (x1,y1) and the location x, returns
+    // the value y corresponding to that point x on the line defined by the
+    // two points.
+    // Inputs:
+    //    Double_t  x0  The first x value defining the line
+    //    Double_t  y0  The first y value defining the line
+    //    Double_t  x1  The second x value defining the line
+    //    Double_t  y1  The second y value defining the line
+    //    Double_t   x  The x value for which the y value is wanted.
+    // Outputs:
+    //    none.
+    // Return:
+    //    The value y corresponding to the point x on the line defined by
+    //    the two points (x0,y0) and (x1,y1).
+
+    if(x0==x1 && y0==y1) {
+        printf("Error: AliITSv11Geometry::Yfrom2Ponts The two points are "
+               "the same (%e,%e) and (%e,%e)",x0,y0,x1,y1);
+        return 0.0;
+    } // end if
+    if(x0==x1){
+        printf("Warning: AliITSv11Geometry::Yfrom2Points x0=%e == x1=%e. "
+               "line vertical ""returning mean y",x0,x1);
+        return 0.5*(y0+y1);
+    }// end if x0==x1
+    Double_t m = (y0-y1)/(x0-x1);
+    return m*(x-x0)+y0;
+}
+//______________________________________________________________________
+Double_t AliITSv11Geometry::Xfrom2Points(Double_t x0,Double_t y0,
+                                         Double_t x1,Double_t y1,
+                                         Double_t y){
+    // Given the two points (x0,y0) and (x1,y1) and the location y, returns
+    // the value x corresponding to that point y on the line defined by the
+    // two points.
+    // Inputs:
+    //    Double_t  x0  The first x value defining the line
+    //    Double_t  y0  The first y value defining the line
+    //    Double_t  x1  The second x value defining the line
+    //    Double_t  y1  The second y value defining the line
+    //    Double_t   y  The y value for which the x value is wanted.
+    // Outputs:
+    //    none.
+    // Return:
+    //    The value x corresponding to the point y on the line defined by
+    //    the two points (x0,y0) and (x1,y1).
+
+    if(x0==x1 && y0==y1) {
+        printf("Error: AliITSv11Geometry::Yfrom2Ponts The two points are "
+               "the same (%e,%e) and (%e,%e)",x0,y0,x1,y1);
+        return 0.0;
+    } // end if
+    if(y0==y1){
+        printf("Warrning: AliITSv11Geometry::Yfrom2Points y0=%e == y1=%e. "
+               "line horizontal returning mean x",y0,y1);
+        return 0.5*(x0+x1);
+    }// end if y0==y1
+    Double_t m = (x0-x1)/(y0-y1);
+    return m*(y-y0)+x0;
+}
+//______________________________________________________________________
+Double_t AliITSv11Geometry::RmaxFrom2Points(const TGeoPcon *p,Int_t i1,
+                                            Int_t i2,Double_t z){
     // functions Require at parts of Volume A to be already defined.
     // Retruns the value of Rmax corresponding to point z alone the line
     // defined by the two points p.Rmax(i1),p-GetZ(i1) and p->GetRmax(i2),
     // p->GetZ(i2).
+    // Inputs:
+    //    TGeoPcon *p  The Polycone where the two points come from
+    //    Int_t    i1  Point 1
+    //    Int_t    i2  Point 2
+    //    Double_t  z  The value of z for which Rmax is to be found
+    // Outputs:
+    //    none.
+    // Return:
+    //    Double_t Rmax the value corresponding to z
     Double_t d0,d1,d2,r;
 
     d0 = p->GetRmax(i1)-p->GetRmax(i2);// cout <<"L263: d0="<<d0<<endl;
@@ -56,123 +129,266 @@ Double_t AliITSv11Geometry::RmaxFrom2Points(TGeoPcon *p,Int_t i1,Int_t i2,Double
     return r;
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::RminFrom2Points(TGeoPcon *p,Int_t i1,Int_t i2,Double_t z){
+Double_t AliITSv11Geometry::RminFrom2Points(const TGeoPcon *p,Int_t i1,
+                                            Int_t i2,Double_t z){
     // Retruns the value of Rmin corresponding to point z alone the line
     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and 
     // p->GetRmin(i2),  p->GetZ(i2).
+    // Inputs:
+    //    TGeoPcon *p  The Polycone where the two points come from
+    //    Int_t    i1  Point 1
+    //    Int_t    i2  Point 2
+    //    Double_t  z  The value of z for which Rmax is to be found
+    // Outputs:
+    //    none.
+    // Return:
+    //    Double_t Rmax the value corresponding to z
 
     return p->GetRmin(i2)+(p->GetRmin(i1)-p->GetRmin(i2))*(z-p->GetZ(i2))/
      (p->GetZ(i1)-p->GetZ(i2));
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::RFrom2Points(Double_t *p,Double_t *Z,Int_t i1,
-                                 Int_t i2,Double_t z){
+Double_t AliITSv11Geometry::RFrom2Points(const Double_t *p,const Double_t *az,
+                                         Int_t i1,Int_t i2,Double_t z){
     // Retruns the value of Rmin corresponding to point z alone the line
     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and 
     // p->GetRmin(i2), p->GetZ(i2).
+    // Inputs:
+    //    Double_t az  Array of z values
+    //    Double_t  r  Array of r values
+    //    Int_t    i1  First Point in arrays
+    //    Int_t    i2  Second Point in arrays
+    //    Double_t z   Value z at which r is to be found
+    // Outputs:
+    //    none.
+    // Return:
+    //    The value r corresponding to z and the line defined by the two points
 
-    return p[i2]+(p[i1]-p[i2])*(z-Z[i2])/(Z[i1]-Z[i2]);
+    return p[i2]+(p[i1]-p[i2])*(z-az[i2])/(az[i1]-az[i2]);
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::Zfrom2MinPoints(TGeoPcon *p,Int_t i1,Int_t i2,Double_t r){
+Double_t AliITSv11Geometry::Zfrom2MinPoints(const TGeoPcon *p,Int_t i1,
+                                            Int_t i2,Double_t r){
     // Retruns the value of Z corresponding to point R alone the line
     // defined by the two points p->GetRmin(i1),p->GetZ(i1) and 
     // p->GetRmin(i2),p->GetZ(i2)
+    // Inputs:
+    //    TGeoPcon *p  The Poly cone where the two points come from.
+    //    Int_t    i1  First Point in arrays
+    //    Int_t    i2  Second Point in arrays
+    //    Double_t r   Value r min at which z is to be found
+    // Outputs:
+    //    none.
+    // Return:
+    //    The value z corresponding to r min and the line defined by 
+    //    the two points
 
     return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmin(i2))/
      (p->GetRmin(i1)-p->GetRmin(i2));
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::Zfrom2MaxPoints(TGeoPcon *p,Int_t i1,Int_t i2,Double_t r){
+Double_t AliITSv11Geometry::Zfrom2MaxPoints(const TGeoPcon *p,Int_t i1,
+                                            Int_t i2,Double_t r){
     // Retruns the value of Z corresponding to point R alone the line
     // defined by the two points p->GetRmax(i1),p->GetZ(i1) and 
     // p->GetRmax(i2),p->GetZ(i2)
+    // Inputs:
+    //    TGeoPcon *p  The Poly cone where the two points come from.
+    //    Int_t    i1  First Point in arrays
+    //    Int_t    i2  Second Point in arrays
+    //    Double_t r   Value r max at which z is to be found
+    // Outputs:
+    //    none.
+    // Return:
+    //    The value z corresponding to r max and the line defined by 
+    //    the two points
 
     return p->GetZ(i2)+(p->GetZ(i1)-p->GetZ(i2))*(r-p->GetRmax(i2))/
      (p->GetRmax(i1)-p->GetRmax(i2));
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::Zfrom2Points(Double_t *Z,Double_t *p,Int_t i1,
-                                 Int_t i2,Double_t r){
-    // Retruns the value of Z corresponding to point R alone the line
+Double_t AliITSv11Geometry::Zfrom2Points(const Double_t *z,const Double_t *ar,
+                                         Int_t i1,Int_t i2,Double_t r){
+    // Retruns the value of z corresponding to point R alone the line
     // defined by the two points p->GetRmax(i1),p->GetZ(i1) and 
     // p->GetRmax(i2),p->GetZ(i2)
+    // Inputs:
+    //    Double_t  z  Array of z values
+    //    Double_t ar  Array of r values
+    //    Int_t    i1  First Point in arrays
+    //    Int_t    i2  Second Point in arrays
+    //    Double_t r   Value r at which z is to be found
+    // Outputs:
+    //    none.
+    // Return:
+    //    The value z corresponding to r and the line defined by the two points
 
-    return Z[i2]+(Z[i1]-Z[i2])*(r-p[i2])/(p[i1]-p[i2]);
+    return z[i2]+(z[i1]-z[i2])*(r-ar[i2])/(ar[i1]-ar[i2]);
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::RmaxFromZpCone(TGeoPcon *p,int ip,Double_t tc,Double_t z,
-                                   Double_t th){
-    // General SSD Outer Cone surface equation Rmax.
-    Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
-    Double_t costc = TMath::Cos(tc*TMath::DegToRad());
+Double_t AliITSv11Geometry::RmaxFromZpCone(const TGeoPcon *p,int ip,
+                                           Double_t tc,Double_t z,
+                                           Double_t th){
+    // General Outer Cone surface equation Rmax.
+    // Intputs:
+    //     TGeoPcon  *p   The poly cone where the initial point comes from
+    //     Int_t     ip   The index in p to get the point location
+    //     Double_t  tc   The angle of that part of the cone is at
+    //     Double_t   z   The value of z to compute Rmax from
+    //     Double_t  th   The perpendicular distance the parralell line is
+    //                    from the point ip.
+    // Outputs:
+    //     none.
+    // Return:
+    //     The value Rmax correstponding to the line at angle th, offeset by
+    //     th, and the point p->GetZ/Rmin[ip] at the location z.
+    Double_t tantc = TanD(tc);
+    Double_t costc = CosD(tc);
 
     return -tantc*(z-p->GetZ(ip))+p->GetRmax(ip)+th/costc;
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::RFromZpCone(Double_t *GetRmax,Double_t *GetZ,int ip,
-                                   Double_t tc,Double_t z,Double_t th){
-    // General SSD Outer Cone surface equation Rmax.
-    Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
-    Double_t costc = TMath::Cos(tc*TMath::DegToRad());
+Double_t AliITSv11Geometry::RFromZpCone(const Double_t *ar,
+                                        const Double_t *az,int ip,
+                                        Double_t tc,Double_t z,
+                                        Double_t th){
+    // General Cone surface equation R(z).
+    // Intputs:
+    //     Double_t  ar   The array of R values
+    //     Double_t  az   The array of Z values
+    //     Int_t     ip   The index in p to get the point location
+    //     Double_t  tc   The angle of that part of the cone is at
+    //     Double_t   z   The value of z to compute R from
+    //     Double_t  th   The perpendicular distance the parralell line is
+    //                    from the point ip.
+    // Outputs:
+    //     none.
+    // Return:
+    //     The value R correstponding to the line at angle th, offeset by
+    //     th, and the point p->GetZ/Rmax[ip] at the locatin z.
+    Double_t tantc = TanD(tc);
+    Double_t costc = CosD(tc);
 
-    return -tantc*(z-GetZ[ip])+GetRmax[ip]+th/costc;
+    return -tantc*(z-az[ip])+ar[ip]+th/costc;
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::RminFromZpCone(TGeoPcon *p,Int_t ip,Double_t tc,Double_t z,
-                                   Double_t th){
-    // General SSD Inner Cone surface equation Rmin.
-    Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
-    Double_t costc = TMath::Cos(tc*TMath::DegToRad());
+Double_t AliITSv11Geometry::RminFromZpCone(const TGeoPcon *p,Int_t ip,
+                                           Double_t tc,Double_t z,
+                                           Double_t th){
+    // General Inner Cone surface equation Rmin.
+    // Intputs:
+    //     TGeoPcon  *p   The poly cone where the initial point comes from
+    //     Int_t     ip   The index in p to get the point location
+    //     Double_t  tc   The angle of that part of the cone is at
+    //     Double_t   z   The value of z to compute Rmin from
+    //     Double_t  th   The perpendicular distance the parralell line is
+    //                    from the point ip.
+    // Outputs:
+    //     none.
+    // Return:
+    //     The value Rmin correstponding to the line at angle th, offeset by
+    //     th, and the point p->GetZ/Rmin[ip] at the location z.
+    Double_t tantc = TanD(tc);
+    Double_t costc = CosD(tc);
 
     return -tantc*(z-p->GetZ(ip))+p->GetRmin(ip)+th/costc;
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::ZFromRmaxpCone(TGeoPcon *p,int ip,Double_t tc,Double_t r,
-                                   Double_t th){
-    // General SSD Outer cone Surface equation for z.
-    Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
-    Double_t costc = TMath::Cos(tc*TMath::DegToRad());
+Double_t AliITSv11Geometry::ZFromRmaxpCone(const TGeoPcon *p,int ip,
+                                           Double_t tc,Double_t r,
+                                           Double_t th){
+    // General Outer cone Surface equation for z.
+    // Intputs:
+    //     TGeoPcon  *p   The poly cone where the initial point comes from
+    //     Int_t     ip   The index in p to get the point location
+    //     Double_t  tc   The angle of that part of the cone is at
+    //     Double_t   r   The value of Rmax to compute z from
+    //     Double_t  th   The perpendicular distance the parralell line is
+    //                    from the point ip.
+    // Outputs:
+    //     none.
+    // Return:
+    //     The value Z correstponding to the line at angle th, offeset by
+    //     th, and the point p->GetZ/Rmax[ip] at the location r.
+    Double_t tantc = TanD(tc);
+    Double_t costc = CosD(tc);
 
     return p->GetZ(ip)+(p->GetRmax(ip)+th/costc-r)/tantc;
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::ZFromRmaxpCone(Double_t *GetRmax,Double_t *GetZ,int ip,
-                                   Double_t tc,Double_t r,Double_t th){
-    // General SSD Outer cone Surface equation for z.
-    Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
-    Double_t costc = TMath::Cos(tc*TMath::DegToRad());
+Double_t AliITSv11Geometry::ZFromRmaxpCone(const Double_t *ar,
+                                           const Double_t *az,int ip,
+                                           Double_t tc,Double_t r,
+                                           Double_t th){
+    // General Outer cone Surface equation for z.
+    // Intputs:
+    //     Double_t  ar   The array of R values
+    //     Double_t  az   The array of Z values
+    //     Int_t     ip   The index in p to get the point location
+    //     Double_t  tc   The angle of that part of the cone is at
+    //     Double_t   r   The value of Rmax to compute z from
+    //     Double_t  th   The perpendicular distance the parralell line is
+    //                    from the point ip.
+    // Outputs:
+    //     none.
+    // Return:
+    //     The value Z correstponding to the line at angle th, offeset by
+    //     th, and the point p->GetZ/Rmax[ip] at the locatin r.
+    Double_t tantc = TanD(tc);
+    Double_t costc = CosD(tc);
 
-    return GetZ[ip]+(GetRmax[ip]+th/costc-r)/tantc;
+    return az[ip]+(ar[ip]+th/costc-r)/tantc;
 }
 //______________________________________________________________________
-Double_t AliITSv11Geometry::ZFromRminpCone(TGeoPcon *p,int ip,Double_t tc,Double_t r,
-                                   Double_t th){
-    // General SSD Inner cone Surface equation for z.
-    Double_t tantc = TMath::Tan(tc*TMath::DegToRad());
-    Double_t costc = TMath::Cos(tc*TMath::DegToRad());
+Double_t AliITSv11Geometry::ZFromRminpCone(const TGeoPcon *p,int ip,
+                                           Double_t tc,Double_t r,
+                                           Double_t th){
+    // General Inner cone Surface equation for z.
+    // Intputs:
+    //     TGeoPcon  *p   The poly cone where the initial point comes from
+    //     Int_t     ip   The index in p to get the point location
+    //     Double_t  tc   The angle of that part of the cone is at
+    //     Double_t   r   The value of Rmin to compute z from
+    //     Double_t  th   The perpendicular distance the parralell line is
+    //                    from the point ip.
+    // Outputs:
+    //     none.
+    // Return:
+    //     The value Z correstponding to the line at angle th, offeset by
+    //     th, and the point p->GetZ/Rmin[ip] at the location r.
+    Double_t tantc = TanD(tc);
+    Double_t costc = CosD(tc);
 
     return p->GetZ(ip)+(p->GetRmin(ip)+th/costc-r)/tantc;
 }
 //______________________________________________________________________
-void AliITSv11Geometry::RadiusOfCurvature(Double_t rc,Double_t theta0,Double_t z0,
-                 Double_t r0,Double_t theta1,Double_t &z1,
-                 Double_t &r1){
+void AliITSv11Geometry::RadiusOfCurvature(Double_t rc,Double_t theta0,
+                                          Double_t z0,Double_t r0,
+                                          Double_t theta1,Double_t &z1,
+                                          Double_t &r1){
     // Given a initial point z0,r0, the initial angle theta0, and the radius
     // of curvature, returns the point z1, r1 at the angle theta1. Theta
     // measured from the r axis in the clock wise direction [degrees].
-    Double_t sin0 = TMath::Sin(theta0*TMath::DegToRad());
-    Double_t cos0 = TMath::Cos(theta0*TMath::DegToRad());
-    Double_t sin1 = TMath::Sin(theta1*TMath::DegToRad());
-    Double_t cos1 = TMath::Cos(theta1*TMath::DegToRad());
+    // Inputs:
+    //    Double_t rc     The radius of curvature
+    //    Double_t theta0 The starting angle (degrees)
+    //    Double_t z0     The value of z at theta0
+    //    Double_t r0     The value of r at theta0
+    //    Double_t theta1 The ending angle (degrees)
+    // Outputs:
+    //    Double_t &z1  The value of z at theta1
+    //    Double_t &r1  The value of r at theta1
+    // Return:
+    //    none.
 
-    z1 = rc*(sin1-sin0)+z0;
-    r1 = rc*(cos1-cos0)+r0;
+    z1 = rc*(SinD(theta1)-SinD(theta0))+z0;
+    r1 = rc*(CosD(theta1)-CosD(theta0))+r0;
     return;
 }
 //______________________________________________________________________
-void AliITSv11Geometry::InsidePoint(TGeoPcon *p,Int_t i1,Int_t i2,Int_t i3,
-                            Double_t c,TGeoPcon *q,Int_t j1,Bool_t max){
+void AliITSv11Geometry::InsidePoint(const TGeoPcon *p,Int_t i1,Int_t i2,
+                                    Int_t i3,Double_t c,TGeoPcon *q,Int_t j1,
+                                    Bool_t max){
     // Given two lines defined by the points i1, i2,i3 in the TGeoPcon 
     // class p that intersect at point p->GetZ(i2) return the point z,r 
     // that is Cthick away in the TGeoPcon class q. If points i1=i2
@@ -221,9 +437,10 @@ void AliITSv11Geometry::InsidePoint(TGeoPcon *p,Int_t i1,Int_t i2,Int_t i3,
     return;
 }
 //----------------------------------------------------------------------
-void AliITSv11Geometry::InsidePoint(Double_t x0,Double_t y0,Double_t x1,Double_t y1,
-                            Double_t x2,Double_t y2,Double_t c,
-                            Double_t &x,Double_t &y){
+void AliITSv11Geometry::InsidePoint(Double_t x0,Double_t y0,
+                                    Double_t x1,Double_t y1,
+                                    Double_t x2,Double_t y2,Double_t c,
+                                    Double_t &x,Double_t &y){
     // Given two intersecting lines defined by the points (x0,y0), (x1,y1) and
     // (x1,y1), (x1,y2) {intersecting at (x1,y1)} the point (x,y) a distance
     // c away is returned such that two lines a distance c away from the
@@ -241,13 +458,13 @@ void AliITSv11Geometry::InsidePoint(Double_t x0,Double_t y0,Double_t x1,Double_t
     //    Double_t  y  Y point for the intersecting sets of parellel lines
     // Return:
     //    none.
-    Double_t dx01,dx12,dy01,dy12,R01,R12,m;
+    Double_t dx01,dx12,dy01,dy12,r01,r12,m;
     dx01 = x0-x1; //cout <<"L410 dx01="<<dx01<<endl;
     dx12 = x1-x2; //cout <<"L411 dx12="<<dx12<<endl;
     dy01 = y0-y1; //cout <<"L412 dy01="<<dy01<<endl;
     dy12 = y1-y2; //cout <<"L413 dy12="<<dy12<<endl;
-    R01  = TMath::Sqrt(dy01*dy01+dx01*dx01); //cout <<"L414 R01="<<R01<<endl;
-    R12  = TMath::Sqrt(dy12*dy12+dx12*dx12); //cout <<"L415 R12="<<R12<<endl;
+    r01  = TMath::Sqrt(dy01*dy01+dx01*dx01); //cout <<"L414 r01="<<r01<<endl;
+    r12  = TMath::Sqrt(dy12*dy12+dx12*dx12); //cout <<"L415 r12="<<r12<<endl;
     m = dx12*dy01-dy12*dx01;
     if(m*m<DBL_EPSILON){ // m == n
         if(dy01==0.0){ // line are =
@@ -259,67 +476,179 @@ void AliITSv11Geometry::InsidePoint(Double_t x0,Double_t y0,Double_t x1,Double_t
             y = y1+c;
             return;
         }else{ // dx01!=0 and dy01 !=0.
-            x = x1-0.5*c*R01/dy01; //cout <<"L434 x="<<x<<endl;
-            y = y1+0.5*c*R01/dx01; //cout <<"L435 y="<<y<<endl;
+            x = x1-0.5*c*r01/dy01; //cout <<"L434 x="<<x<<endl;
+            y = y1+0.5*c*r01/dx01; //cout <<"L435 y="<<y<<endl;
         } // end if
         return;
     } //
-    x = x1-c*(dx12*R01-dx01*R12)/m; //cout <<"L442 x="<<x<<endl;
-    y = y1-c*(dy12*R01-dy01*R12)/m; //cout <<"L443 y="<<y<<endl;
+    x = x1-c*(dx12*r01-dx01*r12)/m; //cout <<"L442 x="<<x<<endl;
+    y = y1-c*(dy12*r01-dy01*r12)/m; //cout <<"L443 y="<<y<<endl;
     //cout <<"=============================================="<<endl;
     return;
 }
 //----------------------------------------------------------------------
-void AliITSv11Geometry:: printArb8(TGeoArb8 *A){
+void AliITSv11Geometry:: PrintArb8(const TGeoArb8 *a)const{
+    // Prints out the content of the TGeoArb8. Usefull for debugging.
+    // Inputs:
+    //   TGeoArb8 *a
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+
     if(GetDebug()){
-        cout << A->GetName() << ":";
-        for(Int_t iii=0;iii<8;iii+=2){
-            cout <<"("<<A->GetVertices()[iii]<<","
-                 <<A->GetVertices()[iii+1]<<","<<-A->GetDz()<<")";
-        } // end for iii
-        for(Int_t iii=8;iii<16;iii+=2){
-            cout <<"("<<A->GetVertices()[iii]<<","
-                 <<A->GetVertices()[iii+1]<<","<<A->GetDz()<<")";
-        } // end for iii
-        cout << endl;
+        printf("%s",a->GetName());
+        a->InspectShape();
     } // end if
+    return;
 }
 //----------------------------------------------------------------------
-void AliITSv11Geometry:: printPcon(TGeoPcon *A){  
+void AliITSv11Geometry:: PrintPcon(const TGeoPcon *a)const{
+    // Prints out the content of the TGeoPcon. Usefull for debugging.
+    // Inputs:
+    //   TGeoPcon *a
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+  
     if(GetDebug()) return;
-    cout << A->GetName() << ": N=" << A->GetNz() << " Phi1=" << A->GetPhi1()
-         << ", Dphi=" << A->GetDphi() << endl;
+    cout << a->GetName() << ": N=" << a->GetNz() << " Phi1=" << a->GetPhi1()
+         << ", Dphi=" << a->GetDphi() << endl;
     cout << "i\t   Z   \t  Rmin \t  Rmax" << endl;
-    for(Int_t iii=0;iii<A->GetNz();iii++){
-        cout << iii << "\t" << A->GetZ(iii) << "\t" << A->GetRmin(iii)
-             << "\t" << A->GetRmax(iii) << endl;
+    for(Int_t iii=0;iii<a->GetNz();iii++){
+        cout << iii << "\t" << a->GetZ(iii) << "\t" << a->GetRmin(iii)
+             << "\t" << a->GetRmax(iii) << endl;
     } // end for iii
+    return;
 }
 //----------------------------------------------------------------------
-void AliITSv11Geometry::printTube(TGeoTube *A){
+void AliITSv11Geometry::PrintTube(const TGeoTube *a)const{
+    // Prints out the content of the TGeoTube. Usefull for debugging.
+    // Inputs:
+    //   TGeoTube *a
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+
     if(GetDebug()) return;
-    cout << A->GetName() <<": Rmin="<<A->GetRmin()
-         <<" Rmax=" <<A->GetRmax()<<" Dz="<<A->GetDz()<<endl;
+    cout << a->GetName() <<": Rmin="<<a->GetRmin()
+         <<" Rmax=" <<a->GetRmax()<<" Dz="<<a->GetDz()<<endl;
+    return;
 }
 //----------------------------------------------------------------------
-void AliITSv11Geometry::printTubeSeg(TGeoTubeSeg *A){
+void AliITSv11Geometry::PrintTubeSeg(const TGeoTubeSeg *a)const{
+    // Prints out the content of the TGeoTubeSeg. Usefull for debugging.
+    // Inputs:
+    //   TGeoTubeSeg *a
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+
     if(GetDebug()) return;
-    cout << A->GetName() <<": Phi1="<<A->GetPhi1()<<
-        " Phi2="<<A->GetPhi2()<<" Rmin="<<A->GetRmin()
-         <<" Rmax=" <<A->GetRmax()<<" Dz="<<A->GetDz()<<endl;
+    cout << a->GetName() <<": Phi1="<<a->GetPhi1()<<
+        " Phi2="<<a->GetPhi2()<<" Rmin="<<a->GetRmin()
+         <<" Rmax=" <<a->GetRmax()<<" Dz="<<a->GetDz()<<endl;
+    return;
 }
 //----------------------------------------------------------------------
-void AliITSv11Geometry::printConeSeg(TGeoConeSeg *A){
+void AliITSv11Geometry::PrintConeSeg(const TGeoConeSeg *a)const{
+    // Prints out the content of the TGeoConeSeg. Usefull for debugging.
+    // Inputs:
+    //   TGeoConeSeg *a
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+
     if(GetDebug()) return;
-    cout << A->GetName() <<": Phi1="<<A->GetPhi1()<<
-        " Phi2="<<A->GetPhi2()<<" Rmin1="<<A->GetRmin1()
-         <<" Rmax1=" <<A->GetRmax1()<<" Rmin2="<<A->GetRmin2()
-         <<" Rmax2=" <<A->GetRmax2()<<" Dz="<<A->GetDz()<<endl;
+    cout << a->GetName() <<": Phi1="<<a->GetPhi1()<<
+        " Phi2="<<a->GetPhi2()<<" Rmin1="<<a->GetRmin1()
+         <<" Rmax1=" <<a->GetRmax1()<<" Rmin2="<<a->GetRmin2()
+         <<" Rmax2=" <<a->GetRmax2()<<" Dz="<<a->GetDz()<<endl;
+    return;
 }
 //----------------------------------------------------------------------
-void AliITSv11Geometry::printBBox(TGeoBBox *A){
+void AliITSv11Geometry::PrintBBox(const TGeoBBox *a)const{
+    // Prints out the content of the TGeoBBox. Usefull for debugging.
+    // Inputs:
+    //   TGeoBBox *a
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+
     if(GetDebug()) return;
-    cout << A->GetName() <<": Dx="<<A->GetDX()<<
-        " Dy="<<A->GetDY()<<" Dz="<<A->GetDZ() <<endl;
+    cout << a->GetName() <<": Dx="<<a->GetDX()<<
+        " Dy="<<a->GetDY()<<" Dz="<<a->GetDZ() <<endl;
+    return;
 }
+//---------------------------------------------------------------------
+void AliITSv11Geometry::DrawCrossSection(const TGeoPcon *p,
+                            Int_t fillc,Int_t fills,
+                            Int_t linec,Int_t lines,Int_t linew,
+                            Int_t markc,Int_t marks,Float_t marksize)const{
+    // Draws a cross sectional view of the TGeoPcon, Primarily for debugging.
+    // A TCanvas should exist first.
+    //  Inputs:
+    //    TGeoPcon  *p  The TGeoPcon to be "drawn"
+    //    Int_t  fillc  The fill color to be used
+    //    Int_t  fills  The fill style to be used
+    //    Int_t  linec  The line color to be used
+    //    Int_t  lines  The line style to be used
+    //    Int_t  linew  The line width to be used
+    //    Int_t  markc  The markder color to be used
+    //    Int_t  marks  The markder style to be used
+    //    Float_t marksize The marker size
+    // Outputs:
+    //   none.
+    // Return:
+    //   none.
+    Int_t n=0,m=0,i=0;
+    Double_t *z=0,*r=0;
+    TPolyMarker *pts=0;
+    TPolyLine   *line=0;
 
+    n = p->GetNz();
+    if(n<=0) return;
+    m = 2*n+1;
+    z = new Double_t[m];
+    r = new Double_t[m];
+
+    for(i=0;i<n;i++){
+        z[i] = p->GetZ(i);
+        r[i] = p->GetRmax(i);
+        z[i+n] = p->GetZ(n-1-i);
+        r[i+n] = p->GetRmin(n-1-i);
+    } //  end for i
+    z[n-1] = z[0];
+    r[n-1] = r[0];
+
+    line = new TPolyLine(n,z,r);
+    pts  = new TPolyMarker(n,z,r);
+
+    line->SetFillColor(fillc);
+    line->SetFillStyle(fills);
+    line->SetLineColor(linec);
+    line->SetLineStyle(lines);
+    line->SetLineWidth(linew);
+    pts->SetMarkerColor(markc);
+    pts->SetMarkerStyle(marks);
+    pts->SetMarkerSize(marksize);
+
+    line->Draw("f");
+    line->Draw();
+    pts->Draw();
+
+    delete[] z;
+    delete[] r;
+
+    cout<<"Hit Return to continue"<<endl;
+    cin >> n;
+    delete line;
+    delete pts;
+    return;
+}
+//----------------------------------------------------------------------