diff --git a/geom/inc/TGeoArb8.h b/geom/inc/TGeoArb8.h
index abed42dd3542f1dfecd7f27597b6fabc133e1359..a16ef6e78e477fdfd738aa67efa116cc5f07318e 100644
--- a/geom/inc/TGeoArb8.h
+++ b/geom/inc/TGeoArb8.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoArb8.h,v 1.4 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoArb8.h,v 1.5 2002/09/27 16:16:05 brun Exp $
 // Author: Andrei Gheata   24/10/01
 
 /*************************************************************************
@@ -76,7 +76,7 @@ public:
    virtual void          GetBoundingCylinder(Double_t *param) const;
    virtual Int_t         GetByteCount() const {return 100;}
    Double_t              GetDz() const {return fDz;}
-   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother) const {return 0;}
+   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/) const {return 0;}
    Double_t             *GetVertices() {return &fXY[0][0];}
    virtual Bool_t        IsCylType() const {return kFALSE;}
    virtual void          InspectShape() const;
diff --git a/geom/inc/TGeoBoolNode.h b/geom/inc/TGeoBoolNode.h
index 17b239ef2194d8def520aa4003a5ee6251416844..f24f6d64a21bb06e907aeb0d9e4274ce8d7029bf 100644
--- a/geom/inc/TGeoBoolNode.h
+++ b/geom/inc/TGeoBoolNode.h
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: $
+// @(#):$Name:  $:$Id: TGeoBoolNode.h,v 1.1 2002/09/28 06:39:05 brun Exp $
 // Author: Andrei Gheata   30/05/02
 
 /*************************************************************************
@@ -54,7 +54,7 @@ public:
    virtual Double_t  DistToIn(Double_t *point, Double_t *dir, Int_t iact=1,
                                Double_t step=0, Double_t *safe=0) const = 0;
    virtual Int_t     GetNpoints() const = 0;
-   virtual void      Paint(Option_t *option) {;}
+   virtual void      Paint(Option_t * /*option*/) {;}
    virtual void      PaintNext(TGeoHMatrix *glmat, Option_t *option);
    virtual void      SetPoints(Double_t *buff) const = 0;
    virtual void      SetPoints(Float_t *buff)  const = 0;
diff --git a/geom/inc/TGeoCache.h b/geom/inc/TGeoCache.h
index 3c36f291bd8f614a63114aee9f7cf87611316e76..4dca3b8bde2355d7be8de39c5f34f93f8c846ad6 100644
--- a/geom/inc/TGeoCache.h
+++ b/geom/inc/TGeoCache.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoCache.h,v 1.5 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoCache.h,v 1.6 2002/09/27 16:16:05 brun Exp $
 // Author: Andrei Gheata   18/03/02
 
 /*************************************************************************
@@ -203,8 +203,8 @@ public:
    virtual void         CdTop() {fLevel=0; fNode=fTop; fMatrix=fMatrixBranch[0];}
    virtual void         CdUp();
    virtual void         CleanCache() {;}
-   virtual void         ClearDaughter(Int_t index) {;}
-   virtual void         ClearNode(Int_t nindex) {;}
+   virtual void         ClearDaughter(Int_t /*index*/) {;}
+   virtual void         ClearNode(Int_t /*nindex*/) {;}
    virtual void         Compact() {;}
    virtual void         DeleteCaches() {;}
    virtual Bool_t       DumpNodes() {return kFALSE;}
@@ -220,7 +220,7 @@ public:
    virtual Int_t        GetNused() const       {return 0;}
    virtual const char  *GetPath(); 
    virtual Int_t        GetUsageCount() const {return 0;}
-   virtual void         IncreasePool(Int_t size) {;}
+   virtual void         IncreasePool(Int_t /*size*/) {;}
    virtual void         IncrementUsageCount() {;}
    virtual void         LocalToMaster(Double_t *local, Double_t *master) const;
    virtual void         MasterToLocal(Double_t *master, Double_t *local) const;
@@ -473,8 +473,8 @@ public:
    TGeoMatHandlerId() {}
    virtual ~TGeoMatHandlerId() {}
    
-   virtual void         AddMatrix(Double_t *to, TGeoMatrix *matrix) {;}
-   virtual void         GetMatrix(Double_t *from, TGeoHMatrix *matrix) {;}
+   virtual void         AddMatrix(Double_t * /*to*/, TGeoMatrix * /*matrix*/) {;}
+   virtual void         GetMatrix(Double_t * /*from*/, TGeoHMatrix * /*matrix*/) {;}
    virtual void         LocalToMaster(Double_t *local, Double_t *master) const 
                            {memcpy(master, local, 3*sizeof(Double_t));}
    virtual void         LocalToMasterVect(Double_t *local, Double_t *master) const 
@@ -740,12 +740,12 @@ public:
    
    virtual void         AddMatrix(Double_t *to, TGeoMatrix *matrix);
    virtual void         GetMatrix(Double_t *from, TGeoHMatrix *matrix);
-   virtual void         LocalToMaster(Double_t *local, Double_t *master) const {;}
-   virtual void         LocalToMasterVect(Double_t *local, Double_t *master) const {;}
-   virtual void         MasterToLocal(Double_t *master, Double_t *local) const {;}   
-   virtual void         MasterToLocalVect(Double_t *master, Double_t *local) const {;}   
-   virtual void         LocalToMasterBomb(Double_t *local, Double_t *master) const {;}
-   virtual void         MasterToLocalBomb(Double_t *master, Double_t *local) const {;}   
+   virtual void         LocalToMaster(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         LocalToMasterVect(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         MasterToLocal(Double_t * /*master*/, Double_t * /*local*/) const {;}   
+   virtual void         MasterToLocalVect(Double_t * /*master*/, Double_t * /*local*/) const {;}   
+   virtual void         LocalToMasterBomb(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         MasterToLocalBomb(Double_t * /*master*/, Double_t * /*local*/) const {;}   
    
   ClassDef(TGeoMatHandlerScl,0)      // global matrix cache handler scale
 };
@@ -764,12 +764,12 @@ public:
    
    virtual void         AddMatrix(Double_t *to, TGeoMatrix *matrix);
    virtual void         GetMatrix(Double_t *from, TGeoHMatrix *matrix);
-   virtual void         LocalToMaster(Double_t *local, Double_t *master) const {;}
-   virtual void         LocalToMasterVect(Double_t *local, Double_t *master) const {;}
-   virtual void         MasterToLocal(Double_t *master, Double_t *local) const {;}   
-   virtual void         MasterToLocalVect(Double_t *master, Double_t *local) const {;}   
-   virtual void         LocalToMasterBomb(Double_t *local, Double_t *master) const {;}
-   virtual void         MasterToLocalBomb(Double_t *master, Double_t *local) const {;}   
+   virtual void         LocalToMaster(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         LocalToMasterVect(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         MasterToLocal(Double_t * /*master*/, Double_t * /*local*/) const {;}   
+   virtual void         MasterToLocalVect(Double_t * /*master*/, Double_t * /*local*/) const {;}   
+   virtual void         LocalToMasterBomb(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         MasterToLocalBomb(Double_t * /*master*/, Double_t * /*local*/) const {;}   
    
   ClassDef(TGeoMatHandlerTrScl,0)      // global matrix cache handler tr-scale
 };
@@ -812,12 +812,12 @@ public:
    
    virtual void         AddMatrix(Double_t *to, TGeoMatrix *matrix);
    virtual void         GetMatrix(Double_t *from, TGeoHMatrix *matrix);
-   virtual void         LocalToMaster(Double_t *local, Double_t *master) const {;}
-   virtual void         LocalToMasterVect(Double_t *local, Double_t *master) const {;}
-   virtual void         MasterToLocal(Double_t *master, Double_t *local) const {;} 
-   virtual void         MasterToLocalVect(Double_t *master, Double_t *local) const {;}   
-   virtual void         LocalToMasterBomb(Double_t *local, Double_t *master) const {;}
-   virtual void         MasterToLocalBomb(Double_t *master, Double_t *local) const {;}   
+   virtual void         LocalToMaster(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         LocalToMasterVect(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         MasterToLocal(Double_t * /*master*/, Double_t * /*local*/) const {;} 
+   virtual void         MasterToLocalVect(Double_t * /*master*/, Double_t * /*local*/) const {;}   
+   virtual void         LocalToMasterBomb(Double_t * /*local*/, Double_t * /*master*/) const {;}
+   virtual void         MasterToLocalBomb(Double_t * /*master*/, Double_t * /*local*/) const {;}   
    
   ClassDef(TGeoMatHandlerRotTrScl,0)      // global matrix cache handler rot-tr-scale
 };
diff --git a/geom/inc/TGeoCompositeShape.h b/geom/inc/TGeoCompositeShape.h
index 6f2be861c0d1cabf4fb95369968b2e0d6ba3825d..d282bfa01bbcda8bd230829d7d4d6b5e7eb897b1 100644
--- a/geom/inc/TGeoCompositeShape.h
+++ b/geom/inc/TGeoCompositeShape.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoCompositeShape.h,v 1.3 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoCompositeShape.h,v 1.4 2002/09/27 16:16:05 brun Exp $
 // Author: Andrei Gheata   31/01/02
 
 /*************************************************************************
@@ -47,11 +47,11 @@ public:
    virtual Double_t      DistToIn(Double_t *point, Double_t *dir, Int_t iact=1, 
                                    Double_t step=0, Double_t *safe=0) const;
    virtual Double_t      DistToSurf(Double_t *point, Double_t *dir) const;
-   virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
-                                Double_t start, Double_t step) {return voldiv;}
+   virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/, 
+                                Double_t /*start*/, Double_t /*step*/) {return voldiv;}
    virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step);
-   virtual void          GetBoundingCylinder(Double_t *param) const {;}
-   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother) const {return 0;}
+   virtual void          GetBoundingCylinder(Double_t * /*param*/) const {;}
+   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/) const {return 0;}
    virtual void          InspectShape() const;
    virtual Bool_t        IsCylType() const {return kFALSE;}
    void                  MakeNode(const char *expression);
@@ -59,7 +59,7 @@ public:
    virtual void          Paint(Option_t *option);
    virtual void          PaintNext(TGeoHMatrix *glmat, Option_t *option);
    virtual Double_t      Safety(Double_t *point, Double_t *spoint, Option_t *option) const;
-   virtual void          SetDimensions(Double_t *param) {}
+   virtual void          SetDimensions(Double_t * /*param*/) {;}
    virtual void          SetPoints(Double_t *buff) const;
    virtual void          SetPoints(Float_t *buff) const;
    virtual void          Sizeof3D() const;
diff --git a/geom/inc/TGeoCone.h b/geom/inc/TGeoCone.h
index e9285eb27d050329f0cf8d0a5aa7bb030ad8d700..16f5593fecaaa5b573ea450f65a998fe26210ef9 100644
--- a/geom/inc/TGeoCone.h
+++ b/geom/inc/TGeoCone.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoCone.h,v 1.3 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoCone.h,v 1.4 2002/09/27 16:16:05 brun Exp $
 // Author: Andrei Gheata   31/01/02
 
 /*************************************************************************
@@ -53,13 +53,18 @@ public:
    virtual void          ComputeBBox();
    virtual Bool_t        Contains(Double_t *point) const;
    virtual Int_t         DistancetoPrimitive(Int_t px, Int_t py);
+   static  Double_t      DistToCone(Double_t *point, Double_t *dir, Double_t r1, Double_t z1, Double_t r2, Double_t z2);   
+//   static  Double_t      DistToOutS(Double_t *point, Double_t *dir, Int_t iact,Double_t step, Double_t *safe,
+//                                    Double_t dz,Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2);
    static  Double_t      DistToOutS(Double_t *point, Double_t *dir, Int_t iact,Double_t step, Double_t *safe,
-                                    Double_t dz,Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2);
+                                    Double_t rmin1, Double_t rmax1, Double_t z1, Double_t rmin2, Double_t rmax2, Double_t z2);
    virtual Double_t      DistToOut(Double_t *point, Double_t *dir, Int_t iact=1, 
                                    Double_t step=0, Double_t *safe=0) const;
-   static  Double_t      DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1,Double_t rmin2, Double_t rmax2, 
-                                   Double_t dz, Double_t ro1, Double_t tg1, Double_t cr1, Double_t zv1,
-                                   Double_t ro2, Double_t tg2, Double_t cr2, Double_t zv2, Double_t r2, Double_t rin, Double_t rout);
+//   static  Double_t      DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1,Double_t rmin2, Double_t rmax2, 
+//                                   Double_t dz, Double_t ro1, Double_t tg1, Double_t cr1, Double_t zv1,
+//                                   Double_t ro2, Double_t tg2, Double_t cr2, Double_t zv2, Double_t r2, Double_t rin, Double_t rout);
+   static  Double_t      DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1,Double_t z1, Double_t rmin2, Double_t rmax2, 
+                                   Double_t z2);
    virtual Double_t      DistToIn(Double_t *point, Double_t *dir, Int_t iact=1, 
                                    Double_t step=0, Double_t *safe=0) const;
    virtual Double_t      DistToSurf(Double_t *point, Double_t *dir) const;
@@ -126,15 +131,20 @@ public:
 
    
    virtual Int_t         DistancetoPrimitive(Int_t px, Int_t py);
+   static  Double_t      DistToCons(Double_t *point, Double_t *dir, Double_t r1, Double_t z1, Double_t r2, Double_t z2, Double_t phi1, Double_t phi2);
+//   static  Double_t      DistToOutS(Double_t *point, Double_t *dir, Int_t iact,Double_t step, Double_t *safe,
+//                                    Double_t dz,Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2,
+//                                    Double_t phi1, Double_t phi2);
    static  Double_t      DistToOutS(Double_t *point, Double_t *dir, Int_t iact,Double_t step, Double_t *safe,
-                                    Double_t dz,Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2,
-                                    Double_t phi1, Double_t phi2);
+                                    Double_t rmin1, Double_t rmax1, Double_t z1, Double_t rmin2, Double_t rmax2, Double_t z2, Double_t phi1, Double_t phi2);
    virtual Double_t      DistToOut(Double_t *point, Double_t *dir, Int_t iact=1, 
                                    Double_t step=0, Double_t *safe=0) const;
-   static  Double_t      DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1,Double_t rmin2, Double_t rmax2, 
-                                   Double_t dz, Double_t ro1, Double_t tg1, Double_t cr1, Double_t zv1,
-                                   Double_t ro2, Double_t tg2, Double_t cr2, Double_t zv2, Double_t r2, Double_t rin, Double_t rout,
-                                   Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cfio, Double_t sfio, Double_t cdfi);
+//   static  Double_t      DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, 
+//                                   Double_t dz, Double_t ro1, Double_t tg1, Double_t cr1, Double_t zv1,
+//                                   Double_t ro2, Double_t tg2, Double_t cr2, Double_t zv2, Double_t r2, Double_t rin, Double_t rout,
+//                                   Double_t c1, Double_t s1, Double_t c2, Double_t s2, Double_t cfio, Double_t sfio, Double_t cdfi, Double_t phi1=0, Double_t phi2=0);
+   static  Double_t      DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1, Double_t z1, Double_t rmin2, Double_t rmax2, 
+                                   Double_t z2, Double_t phi1, Double_t phi2);   
    virtual Double_t      DistToIn(Double_t *point, Double_t *dir, Int_t iact=1, 
                                    Double_t step=0, Double_t *safe=0) const;
    virtual Double_t      DistToSurf(Double_t *point, Double_t *dir) const;
diff --git a/geom/inc/TGeoPatternFinder.h b/geom/inc/TGeoPatternFinder.h
index d7764dfb0109e4bec5ba3acf3ad9818f4189e8e0..010fb39289632893e4efa33dab0cfa501a2bc0f6 100644
--- a/geom/inc/TGeoPatternFinder.h
+++ b/geom/inc/TGeoPatternFinder.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoPatternFinder.h,v 1.5 2002/10/05 09:28:57 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoPatternFinder.h,v 1.6 2002/10/08 16:17:48 brun Exp $
 // Author: Andrei Gheata   30/10/01
 
 /*************************************************************************
@@ -51,7 +51,7 @@ public:
    // destructor
    virtual ~TGeoPatternFinder();
    // methods
-   virtual void        cd(Int_t idiv) {}
+   virtual void        cd(Int_t /*idiv*/) {}
    TGeoVolume         *GetBasicVolume() const;
    virtual Int_t       GetByteCount() const {return 36;}
    Int_t               GetCurrent()  {return fCurrent;}
@@ -60,7 +60,7 @@ public:
    Int_t               GetNdiv()     {return fNdivisions;}
    TGeoNode           *GetNodeOffset(Int_t idiv) {return fVolume->GetNode(fDivIndex+idiv);}  
    TGeoVolume         *GetVolume() const {return fVolume;}
-   virtual TGeoNode   *FindNode(Double_t *point) {return 0;} 
+   virtual TGeoNode   *FindNode(Double_t * /*point*/) {return 0;} 
    virtual void        SetBasicVolume(TGeoVolume *vol) {fBasicCell = vol;}
    void                SetDivIndex(Int_t index) {fDivIndex = index;}
    void                SetVolume(TGeoVolume *vol) {fVolume = vol;}
diff --git a/geom/inc/TGeoPcon.h b/geom/inc/TGeoPcon.h
index 1b9a0bfd4d524deea638553438faaabfead634b1..a6fba0eec1cc01fc6a3612d62197381b17f761e5 100644
--- a/geom/inc/TGeoPcon.h
+++ b/geom/inc/TGeoPcon.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoPcon.h,v 1.3 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoPcon.h,v 1.4 2002/09/27 16:16:05 brun Exp $
 // Author: Andrei Gheata   24/10/01
 
 /*************************************************************************
@@ -69,7 +69,7 @@ public:
    Double_t             *GetRmin() const {return fRmin;}
    Double_t             *GetRmax() const {return fRmax;}
    Double_t             *GetZ() const    {return fZ;}
-   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother) const {return 0;}
+   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/) const {return 0;}
    virtual void          InspectShape() const;
    virtual Bool_t        IsCylType() const {return kTRUE;}
    virtual void          NextCrossing(TGeoParamCurve *c, Double_t *point) const;
diff --git a/geom/inc/TGeoPgon.h b/geom/inc/TGeoPgon.h
index 3d764372b918edae8502e5346fe6beed3867f061..a24a8112b2f0a1e8a005f2830f973f6f4b3e0231 100644
--- a/geom/inc/TGeoPgon.h
+++ b/geom/inc/TGeoPgon.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoPgon.h,v 1.3 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoPgon.h,v 1.4 2002/09/27 16:16:06 brun Exp $
 // Author: Andrei Gheata   31/01/02
 
 /*************************************************************************
@@ -59,7 +59,7 @@ public:
    virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step);
    virtual void          GetBoundingCylinder(Double_t *param) const;
    virtual Int_t         GetByteCount() const {return 64+12*fNz;}
-   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother) const {return 0;}
+   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/) const {return 0;}
    Int_t                 GetNedges() const   {return fNedges;}
    virtual Int_t         GetNsegments() const {return fNedges;}     
    virtual void          InspectShape() const;
diff --git a/geom/inc/TGeoSphere.h b/geom/inc/TGeoSphere.h
index 52a7b3375433f9347de69daf1aa901de0f75c9bb..39025b376f7c3b30ec1b5b330c3838498e3db023 100644
--- a/geom/inc/TGeoSphere.h
+++ b/geom/inc/TGeoSphere.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoSphere.h,v 1.3 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoSphere.h,v 1.4 2002/09/27 16:16:06 brun Exp $
 // Author: Andrei Gheata   31/01/02
 
 /*************************************************************************
@@ -58,12 +58,12 @@ public:
    virtual Double_t      DistToIn(Double_t *point, Double_t *dir, Int_t iact=1, 
                                    Double_t step=0, Double_t *safe=0) const;
    virtual Double_t      DistToSurf(Double_t *point, Double_t *dir) const;
-   virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
-                                Double_t start, Double_t step) {return voldiv;}
+   virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/, 
+                                Double_t /*start*/, Double_t /*step*/) {return voldiv;}
    virtual TGeoVolume   *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step);
    virtual void          GetBoundingCylinder(Double_t *param) const;
    virtual Int_t         GetByteCount() const {return 42;}
-   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape *mother) const {return 0;}
+   virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/) const {return 0;}
    Int_t                 GetNumberOfDivisions() const {return fNseg;}
    Int_t                 GetNz() const   {return fNz;}
    virtual Double_t      GetRmin() const {return fRmin;}
diff --git a/geom/inc/TGeoVolume.h b/geom/inc/TGeoVolume.h
index 5d3a0b3886123732c542bb8455e85c516ef1eb74..b3e66e479c11a0a5148f9272b5f86d8fb913aa57 100644
--- a/geom/inc/TGeoVolume.h
+++ b/geom/inc/TGeoVolume.h
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoVolume.h,v 1.10 2002/10/21 15:21:13 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoVolume.h,v 1.11 2002/11/20 08:55:10 brun Exp $
 // Author: Andrei Gheata   30/05/02
 
 /*************************************************************************
@@ -144,7 +144,7 @@ public:
    Option_t       *GetOption() const { return fOption.Data(); }
    TGeoShape      *GetShape() const                  {return fShape;}
    void            GrabFocus(); // *MENU*
-   void            Gsord(Int_t iaxis)                {;}
+   void            Gsord(Int_t /*iaxis*/)                {;}
    Bool_t          IsStyleDefault() const;
    void            InspectMaterial() const; // *MENU*
    void            InspectShape() const {fShape->InspectShape();} // *MENU*
@@ -199,12 +199,12 @@ public:
    TGeoVolume     *GetVolume(Int_t id) const {return (TGeoVolume*)fVolumes->At(id);}
    virtual void    AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat, Option_t *option="");       // most general case
    virtual void    AddNodeOverlap(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat, Option_t *option="");
-   virtual TGeoVolume *Divide(const char *divname, Int_t ndiv, Option_t *option="") { return 0;}
-   virtual TGeoVolume *Divide(const char *divname, Int_t ndiv, Double_t start, Double_t step, Option_t *option="") {return 0;}
-   virtual TGeoVolume *Divide(const char *divname, Double_t start, Double_t end, Double_t step, Option_t *option="") {return 0;}
+   virtual TGeoVolume *Divide(const char *, Int_t, Option_t *) { return 0;}
+   virtual TGeoVolume *Divide(const char *, Int_t ndiv, Double_t, Double_t, Option_t *) {return 0;}
+   virtual TGeoVolume *Divide(const char *, Double_t, Double_t, Double_t, Option_t *) {return 0;}
    virtual TGeoVolume *Divide(const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step);
-   virtual TGeoVolume *Divide(const char *divname, Int_t iaxis, Double_t step) {return 0;}
-   virtual TGeoVolume *Divide(const char *divname, TObject *userdiv, Double_t *params, Option_t *option="") {return 0;}
+   virtual TGeoVolume *Divide(const char *, Int_t, Double_t) {return 0;}
+   virtual TGeoVolume *Divide(const char *, TObject *, Double_t *, Option_t *) {return 0;}
    TGeoShape      *GetLastShape() const {return GetVolume(fVolumes->GetEntriesFast()-1)->GetShape();} 
    virtual void    SetLineColor(Color_t lcolor);
    virtual void    SetLineStyle(Style_t lstyle);
diff --git a/geom/src/TGeoArb8.cxx b/geom/src/TGeoArb8.cxx
index dfba8ae79d3d8db8c1d8d5056d744a27b2680238..95925f3c62b06b61dc05d772a6d59165d9624188 100644
--- a/geom/src/TGeoArb8.cxx
+++ b/geom/src/TGeoArb8.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoArb8.cxx,v 1.9 2002/10/08 16:17:48 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoArb8.cxx,v 1.10 2002/10/21 15:21:13 brun Exp $
 // Author: Andrei Gheata   31/01/02
 
 /*************************************************************************
@@ -358,7 +358,7 @@ Double_t TGeoArb8::DistToPlane(Double_t *point, Double_t *dir, Int_t ipl, Bool_t
 }      
       
 //-----------------------------------------------------------------------------
-Double_t TGeoArb8::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
+Double_t TGeoArb8::DistToIn(Double_t *point, Double_t *dir, Int_t /*iact*/, Double_t /*step*/, Double_t * /*safe*/) const
 {
 // compute distance from outside point to surface of the arb8
    Double_t snxt=kBig;
@@ -395,7 +395,7 @@ Double_t TGeoArb8::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return dist[TMath::LocMin(5, &dist[0])];
 }   
 //-----------------------------------------------------------------------------
-Double_t TGeoArb8::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
+Double_t TGeoArb8::DistToOut(Double_t *point, Double_t *dir, Int_t /*iact*/, Double_t /*step*/, Double_t * /*safe*/) const
 {
 // compute distance from outside point to surface of the arb8
    Double_t dist[6];
@@ -412,21 +412,21 @@ Double_t TGeoArb8::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_
    return dist[TMath::LocMin(6, &dist[0])];   
 }   
 //-----------------------------------------------------------------------------
-Double_t TGeoArb8::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoArb8::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
    return kBig;
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoArb8::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
-                             Double_t start, Double_t step) 
+TGeoVolume *TGeoArb8::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/, 
+                             Double_t /*start*/, Double_t /*step*/) 
 {
    Error("Divide", "Division of an arbitrary trapezoid not implemented");
    return voldiv;
 }      
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoArb8::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoArb8::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -462,12 +462,12 @@ void TGeoArb8::InspectShape() const
    TGeoBBox::InspectShape();
 }
 //-----------------------------------------------------------------------------
-void TGeoArb8::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoArb8::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoArb8::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoArb8::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
@@ -689,7 +689,7 @@ TGeoVolume *TGeoTrap::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxi
    return voldiv;
 }   
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoTrap::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoTrap::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
diff --git a/geom/src/TGeoAtt.cxx b/geom/src/TGeoAtt.cxx
index f83402f2baca744a6588432f95d09e5df05503a6..1a4499fd07bbf0c504af3d99fd74d7fd4f3bc6bd 100644
--- a/geom/src/TGeoAtt.cxx
+++ b/geom/src/TGeoAtt.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:$:$Id:$
+// @(#)root/geom:$Name:  $:$Id: TGeoAtt.cxx,v 1.2 2002/07/10 19:24:16 brun Exp $
 // Author: Andrei Gheata   01/11/01
 
 /*************************************************************************
@@ -32,7 +32,7 @@ TGeoAtt::TGeoAtt()
    SetVisTouched(kFALSE);
 }
 //-----------------------------------------------------------------------------
-TGeoAtt::TGeoAtt(Option_t *vis_opt, Option_t *activity_opt, Option_t *optimization_opt)
+TGeoAtt::TGeoAtt(Option_t * /*vis_opt*/, Option_t * /*activity_opt*/, Option_t * /*optimization_opt*/)
 {
 // constructor
    fGeoAtt = 0;
@@ -77,12 +77,12 @@ void TGeoAtt::SetVisTouched(Bool_t vis)
    else      ResetBit(kVisTouched);
 }
 //-----------------------------------------------------------------------------
-void TGeoAtt::SetActivity(Option_t *option)
+void TGeoAtt::SetActivity(Option_t * /*option*/)
 {
 // set activity flags 
 }
 //-----------------------------------------------------------------------------
-void TGeoAtt::SetOptimization(Option_t *option)
+void TGeoAtt::SetOptimization(Option_t * /*option*/)
 {
 // set optimization flags 
 }
diff --git a/geom/src/TGeoBBox.cxx b/geom/src/TGeoBBox.cxx
index 8a5f64397addece4d88ac5089b7cf59ac722db0d..e6ab058d29ce46474413255a009394b92bd5259d 100644
--- a/geom/src/TGeoBBox.cxx
+++ b/geom/src/TGeoBBox.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoBBox.cxx,v 1.7 2002/10/22 08:32:43 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoBBox.cxx,v 1.8 2002/11/20 08:55:10 brun Exp $
 // Author: Andrei Gheata   24/10/01
 
 // Contains() and DistToIn/Out() implemented by Mihaela Gheata
@@ -312,11 +312,11 @@ Double_t TGeoBBox::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return kBig;       
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoBBox::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoBBox::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the box along a ray
 // starting from given point to the given direction.
-   return 0.0;
+   return kBig;
 }
 //-----------------------------------------------------------------------------
 void TGeoBBox::GetBoundingCylinder(Double_t *param) const
@@ -358,7 +358,7 @@ void TGeoBBox::InspectShape() const
    printf("    origin: x=%11.5f y=%11.5f z=%11.5f\n", fOrigin[0], fOrigin[1], fOrigin[2]);
 }
 //-----------------------------------------------------------------------------
-void TGeoBBox::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoBBox::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
@@ -381,7 +381,7 @@ void TGeoBBox::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintBox(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoBBox::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoBBox::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoBoolNode.cxx b/geom/src/TGeoBoolNode.cxx
index 1618f2348133e57f294a2843d3a90e5b81cbfcc4..a09dc007ed85dbf6e8ae53f96aa97313c6a243b2 100644
--- a/geom/src/TGeoBoolNode.cxx
+++ b/geom/src/TGeoBoolNode.cxx
@@ -1,4 +1,4 @@
-// @(#):$Name:  $:$Id: TGeoBoolNode.cxx,v 1.1 2002/09/28 06:39:05 brun Exp $
+// @(#):$Name:  $:$Id: TGeoBoolNode.cxx,v 1.2 2002/10/22 07:43:12 brun Exp $
 // Author: Andrei Gheata   30/05/02
 // TGeoBoolNode::Contains and parser implemented by Mihaela Gheata
 
@@ -208,7 +208,7 @@ Bool_t TGeoUnion::Contains(Double_t *point) const
    return inside;
 }
 //-----------------------------------------------------------------------------
-Int_t TGeoUnion::DistanceToPrimitive(Int_t px, Int_t py)
+Int_t TGeoUnion::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
 {
 // Compute minimum distance to shape vertices
    return 9999;
@@ -285,12 +285,12 @@ Int_t TGeoUnion::GetNpoints() const
    return 0;
 }
 //-----------------------------------------------------------------------------
-void TGeoUnion::SetPoints(Double_t *buff) const
+void TGeoUnion::SetPoints(Double_t * /*buff*/) const
 {
 // Fill buffer with shape vertices.
 }
 //-----------------------------------------------------------------------------
-void TGeoUnion::SetPoints(Float_t *buff) const
+void TGeoUnion::SetPoints(Float_t * /*buff*/) const
 {
 // Fill buffer with shape vertices.
 }
@@ -363,7 +363,7 @@ Bool_t TGeoSubtraction::Contains(Double_t *point) const
    return inside;
 }
 //-----------------------------------------------------------------------------
-Int_t TGeoSubtraction::DistanceToPrimitive(Int_t px, Int_t py)
+Int_t TGeoSubtraction::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
 {
 // Compute minimum distance to shape vertices
    return 9999;
@@ -442,12 +442,12 @@ Int_t TGeoSubtraction::GetNpoints() const
    return 0;
 }
 //-----------------------------------------------------------------------------
-void TGeoSubtraction::SetPoints(Double_t *buff) const
+void TGeoSubtraction::SetPoints(Double_t * /*buff*/) const
 {
 // Fill buffer with shape vertices.
 }
 //-----------------------------------------------------------------------------
-void TGeoSubtraction::SetPoints(Float_t *buff) const
+void TGeoSubtraction::SetPoints(Float_t * /*buff*/) const
 {
 // Fill buffer with shape vertices.
 }
@@ -567,7 +567,7 @@ Bool_t TGeoIntersection::Contains(Double_t *point) const
    return inside;
 }
 //-----------------------------------------------------------------------------
-Int_t TGeoIntersection::DistanceToPrimitive(Int_t px, Int_t py)
+Int_t TGeoIntersection::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
 {
 // Compute minimum distance to shape vertices
    return 9999;
@@ -636,12 +636,12 @@ Int_t TGeoIntersection::GetNpoints() const
    return 0;
 }
 //-----------------------------------------------------------------------------
-void TGeoIntersection::SetPoints(Double_t *buff) const
+void TGeoIntersection::SetPoints(Double_t * /*buff*/) const
 {
 // Fill buffer with shape vertices.
 }
 //-----------------------------------------------------------------------------
-void TGeoIntersection::SetPoints(Float_t *buff) const
+void TGeoIntersection::SetPoints(Float_t * /*buff*/) const
 {
 // Fill buffer with shape vertices.
 }
diff --git a/geom/src/TGeoCache.cxx b/geom/src/TGeoCache.cxx
index e11a7a827570b08686b297f1dd2a29ab06dd694b..f8aee5b5e95d714fcc5f445bc7e13e672dff732f 100644
--- a/geom/src/TGeoCache.cxx
+++ b/geom/src/TGeoCache.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoCache.cxx,v 1.7 2002/07/17 13:27:58 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoCache.cxx,v 1.8 2002/10/11 16:41:53 brun Exp $
 // Author: Andrei Gheata   18/03/02
 
 /*************************************************************************
@@ -67,7 +67,7 @@ TGeoNodeCache::TGeoNodeCache()
    fMatrixPool  = 0;
 }
 //-----------------------------------------------------------------------------
-TGeoNodeCache::TGeoNodeCache(Int_t size)
+TGeoNodeCache::TGeoNodeCache(Int_t /*size*/)
 {
 // constructor
    fGeoCacheMaxDaughters = 128;
@@ -467,7 +467,7 @@ TGeoCacheDummy::~TGeoCacheDummy()
    }   
 }   
 //-----------------------------------------------------------------------------
-Bool_t TGeoCacheDummy::CdDown(Int_t index, Bool_t make)
+Bool_t TGeoCacheDummy::CdDown(Int_t index, Bool_t /*make*/)
 {
    TGeoNode *newnode = fNode->GetDaughter(index);
    if (!newnode) return kFALSE;
@@ -1224,7 +1224,7 @@ TGeoCacheState::TGeoCacheState()
    fPoint = 0;
 }
 //-----------------------------------------------------------------------------
-TGeoCacheState::TGeoCacheState(Int_t capacity)
+TGeoCacheState::TGeoCacheState(Int_t /*capacity*/)
 {
 //--- ctor
    fLevel = 0;
@@ -1279,7 +1279,7 @@ TGeoCacheStateDummy::TGeoCacheStateDummy()
    fMatrixBranch = 0;
 }
 //-----------------------------------------------------------------------------
-TGeoCacheStateDummy::TGeoCacheStateDummy(Int_t capacity)
+TGeoCacheStateDummy::TGeoCacheStateDummy(Int_t /*capacity*/)
 {
 //--- ctor
    fNodeBranch = new TGeoNode *[30];
diff --git a/geom/src/TGeoCompositeShape.cxx b/geom/src/TGeoCompositeShape.cxx
index a0f928b967c1b2abf6ab0745cec9ab0d9866f6e3..661be4fde3da03da56c8f4ee6e0820bd38c1b5ea 100644
--- a/geom/src/TGeoCompositeShape.cxx
+++ b/geom/src/TGeoCompositeShape.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoCompositeShape.cxx,v 1.6 2002/10/13 15:45:24 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoCompositeShape.cxx,v 1.7 2002/10/21 15:21:13 brun Exp $
 // Author: Andrei Gheata   31/01/02
 
 /*************************************************************************
@@ -102,14 +102,14 @@ Double_t TGeoCompositeShape::DistToOut(Double_t *point, Double_t *dir, Int_t iac
    return kBig;
 }   
 //-----------------------------------------------------------------------------
-Double_t TGeoCompositeShape::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoCompositeShape::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
    return kBig;
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoCompositeShape::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoCompositeShape::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Composite shapes cannot be divided");
@@ -156,7 +156,7 @@ void TGeoCompositeShape::MakeNode(const char *expression)
    }
 }               
 //-----------------------------------------------------------------------------
-void TGeoCompositeShape::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoCompositeShape::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
@@ -176,7 +176,7 @@ void TGeoCompositeShape::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    if (fNode) fNode->PaintNext(glmat, option);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoCompositeShape::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoCompositeShape::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoCone.cxx b/geom/src/TGeoCone.cxx
index 80cd8e8d60a04b1b89769c0ded1e7a977bdbcd93..7ceceb1c823fcfd5dd1a3221e2f1b532bcfa06ea 100644
--- a/geom/src/TGeoCone.cxx
+++ b/geom/src/TGeoCone.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoCone.cxx,v 1.4 2002/09/27 16:16:06 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoCone.cxx,v 1.5 2002/10/08 16:17:48 brun Exp $
 // Author: Andrei Gheata   31/01/02
 // TGeoCone::Contains() and DistToOut() implemented by Mihaela Gheata
 
@@ -125,26 +125,27 @@ Bool_t TGeoCone::Contains(Double_t *point) const
 }
 //-----------------------------------------------------------------------------
 Double_t TGeoCone::DistToOutS(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe,
-                              Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2)
+                              Double_t rmin1, Double_t rmax1, Double_t z1, Double_t rmin2, Double_t rmax2, Double_t z2)
 {
 // compute distance from inside point to surface of the cone (static)
-   Double_t saf[3];
-   Double_t ro1 = 0.5*(rmin1+rmin2);
-   Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
-   Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
-   Double_t ro2 = 0.5*(rmax1+rmax2);
-   Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
-   Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
-   
-   Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
-   Double_t rin = tg1*point[2]+ro1;
-   Double_t rout = tg2*point[2]+ro2;
-   
+   Double_t dz = 0.5*(z2-z1);
+   if (dz<=0) return kBig;
    if (iact<3 && safe) {
-      if (ro1>1E-10) saf[0] = (r-rin)*cr1;
+      Double_t saf[3];
+      Double_t ro1 = 0.5*(rmin1+rmin2);
+      Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
+      Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
+      Double_t ro2 = 0.5*(rmax1+rmax2);
+      Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
+      Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
+   
+      Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
+      Double_t rin = tg1*point[2]+ro1;
+      Double_t rout = tg2*point[2]+ro2;
+      if (ro1>0) saf[0] = (r-rin)*cr1;
       else saf[0] = kBig;
       saf[1] = (rout-r)*cr2;
-      saf[2] = dz-TMath::Abs(point[2]);
+      saf[2] = TMath::Min(point[2]-z1, z2-point[2]); 
       *safe = TMath::Min(saf[0], TMath::Min(saf[1],saf[2]));
       if (iact==0) return kBig;
       if ((iact==1) && (*safe>step)) return step;
@@ -152,68 +153,35 @@ Double_t TGeoCone::DistToOutS(Double_t *point, Double_t *dir, Int_t iact, Double
    // compute distance to surface 
    // Do Z
    Double_t sz = kBig;
-   if (dir[2]>1E-20) 
-      sz = (dz-point[2])/dir[2];
+   if (dir[2]>0) 
+      sz = (z2-point[2])/dir[2];
    else
-      if (dir[2]<-1E-20) sz = -(dz+point[2])/dir[2];
+      if (dir[2]<0) sz = (z1-point[2])/dir[2];
    // Do Rmin
-   Double_t t1=dir[0]*dir[0]+dir[1]*dir[1];  
-   Double_t t2=point[0]*dir[0]+point[1]*dir[1];  
-   Double_t t3=point[0]*point[0]+point[1]*point[1]; 
-   Double_t sr1 = kBig;
-   Double_t ds=0;
-   Double_t b=0, c=0, d=0;
-   Double_t u=0, v=0, w=0;
-   if (ro1>0) {
-      u=t1-tg1*tg1*dir[2]*dir[2];
-      v=t2-tg1*dir[1]*rin;
-      w=t3-rin*rin;
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            ds = TMath::Sqrt(d);
-            if (ds>=TMath::Abs(b)) sr1=ds-b;
-            else if (b<=0)         sr1=-ds-b;
-         }
-      } else if (v<0) sr1=-0.5*w/v;
-   } 
-   // Do Rmax
-   Double_t sr2=kBig;
-   u=t1-tg2*tg2*dir[2]*dir[2];
-   v=t2-tg2*dir[2]*rout;
-   w=t3-rout*rout;
-   if (u!=0) {
-      b=v/u;
-      c=w/u;
-      d=b*b-c;
-      if (d>=0) {
-         ds = TMath::Sqrt(d);
-         if (ds>=TMath::Abs(b)) sr2=ds-b;
-         else if (b<=0) sr2 = -ds-b;
-      }
-   } else if (v>0) sr2=-0.5*w/v;
+   Double_t sr1 = TGeoCone::DistToCone(point, dir, rmin1, z1, rmin2, z2);
+   Double_t sr2 = TGeoCone::DistToCone(point, dir, rmax1, z1, rmax2, z2);
+   
    return TMath::Min(TMath::Min(sr1, sr2), sz);                   
 }
+
 //-----------------------------------------------------------------------------
 Double_t TGeoCone::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
 {
 // compute distance from inside point to surface of the cone
-   Double_t saf[3];
-   Double_t ro1 = 0.5*(fRmin1+fRmin2);
-   Double_t tg1 = 0.5*(fRmin2-fRmin1)/fDz;
-   Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
-   Double_t ro2 = 0.5*(fRmax1+fRmax2);
-   Double_t tg2 = 0.5*(fRmax2-fRmax1)/fDz;
-   Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
-   
-   Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
-   Double_t rin = tg1*point[2]+ro1;
-   Double_t rout = tg2*point[2]+ro2;
    
    if (iact<3 && safe) {
-      if (ro1>1E-10) saf[0] = (r-rin)*cr1;
+      Double_t saf[3];
+      Double_t ro1 = 0.5*(fRmin1+fRmin2);
+      Double_t tg1 = 0.5*(fRmin2-fRmin1)/fDz;
+      Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
+      Double_t ro2 = 0.5*(fRmax1+fRmax2);
+      Double_t tg2 = 0.5*(fRmax2-fRmax1)/fDz;
+      Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
+   
+      Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
+      Double_t rin = tg1*point[2]+ro1;
+      Double_t rout = tg2*point[2]+ro2;
+      if (ro1>0) saf[0] = (r-rin)*cr1;
       else saf[0] = kBig;
       saf[1] = (rout-r)*cr2;
       saf[2] = fDz-TMath::Abs(point[2]);
@@ -227,199 +195,98 @@ Double_t TGeoCone::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_
    if (dir[2]>1E-20) 
       sz = (fDz-point[2])/dir[2];
    else
-      if (dir[2]<-1E-20) sz = -(fDz+point[2])/dir[2];
+      if (dir[2]<0) sz = -(fDz+point[2])/dir[2];
    // Do Rmin
-   Double_t t1=dir[0]*dir[0]+dir[1]*dir[1];  
-   Double_t t2=point[0]*dir[0]+point[1]*dir[1];  
-   Double_t t3=point[0]*point[0]+point[1]*point[1]; 
-   Double_t sr1 = kBig;
-   Double_t ds=0;
-   Double_t b=0, c=0, d=0;
-   Double_t u=0, v=0, w=0;
-   if (ro1>0) {
-      u=t1-tg1*tg1*dir[2]*dir[2];
-      v=t2-tg1*dir[1]*rin;
-      w=t3-rin*rin;
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            ds = TMath::Sqrt(d);
-            if (ds>=TMath::Abs(b)) sr1=ds-b;
-            else if (b<=0)         sr1=-ds-b;
-         }
-      } else if (v<0) sr1=-0.5*w/v;
-   } 
-   // Do Rmax
-   Double_t sr2=kBig;
-   u=t1-tg2*tg2*dir[2]*dir[2];
-   v=t2-tg2*dir[2]*rout;
-   w=t3-rout*rout;
-   if (u!=0) {
-      b=v/u;
-      c=w/u;
-      d=b*b-c;
-      if (d>=0) {
-         ds = TMath::Sqrt(d);
-         if (ds>=TMath::Abs(b)) sr2=ds-b;
-         else if (b<=0) sr2 = -ds-b;
-      }
-   } else if (v>0) sr2=-0.5*w/v;
+   Double_t sr1 = TGeoCone::DistToCone(point, dir, fRmin1, -fDz, fRmin2, fDz);
+   Double_t sr2 = TGeoCone::DistToCone(point, dir, fRmax1, -fDz, fRmax2, fDz);
+   
    return TMath::Min(TMath::Min(sr1, sr2), sz);                   
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoCone::DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2,
-                             Double_t dz, Double_t ro1, Double_t tg1, Double_t cr1, Double_t zv1,
-                             Double_t ro2, Double_t tg2, Double_t cr2, Double_t zv2,
-                             Double_t r2, Double_t rin, Double_t rout)
+Double_t TGeoCone::DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1, Double_t z1, Double_t rmin2, Double_t rmax2, Double_t z2)
 {
-// compute distance to arbitrary cone from outside point
-   Double_t snxt=kBig;
-   // intersection with Z planes
-   Double_t s, xi, yi, zi, riq, r1q, r2q;
-   Double_t *norm=gGeoManager->GetNormalChecked();
-   if (TMath::Abs(point[2])>dz) {
-      if ((point[2]*dir[2])<0) {
-         s=(TMath::Abs(point[2])-dz)/TMath::Abs(dir[2]);
-         xi=point[0]+s*dir[0];
-         yi=point[1]+s*dir[1];
-         riq=xi*xi+yi*yi;
-         norm[0]=norm[1]=0;
-         if (point[2]<0) {
-            r1q=rmin1*rmin1;
-            r2q=rmax1*rmax1;
-            norm[2]=-1;
-         } else {
-            r1q=rmin2*rmin2;
-            r2q=rmax2*rmax2;
-            norm[2]=1;
-         }      
-         if ((r1q<=riq) && (riq<=r2q)) return s;
-      }   
-   }
-   // intersection with cones
-   Double_t t1=dir[0]*dir[0]+dir[1]*dir[1];
-   Double_t t2=point[0]*dir[0]+point[1]*dir[1];
-   Double_t t3=r2;
-   // outer cone
-   Double_t u,v,w,b,c,d,fn;
-   if ((zv2*point[2]>zv2*zv2) || (r2>rout*rout)) {
-      u=t1-(tg2*tg2*dir[2]*dir[2]);
-      v=t2-tg2*dir[2]*(tg2*point[2]+ro2);
-      w=t3-rout*rout;
-      // track parallel to cone ?
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            s=-b-TMath::Sqrt(d);
-            if (s>=0) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=-cr1*tg1;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=xi/fn;
-                  norm[1]=yi/fn;
-                  snxt=s;
-               }
-            }
-            if (snxt>(-b)) {
-               s=-b+TMath::Sqrt(d);
-               if (s>=0) {
-                  zi=point[2]+s*dir[2];
-                  if (TMath::Abs(zi)<dz) {
-                     xi=point[0]+s*dir[0];
-                     yi=point[1]+s*dir[1];
-                     norm[2]=-cr1*tg1;
-                     fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                     norm[0]=xi/fn;
-                     norm[1]=yi/fn;
-                     snxt=s;
-                  }
-               }
-            }
-         }   
-      } else {
-         if (v!=0) {
-            s=-0.5*w/v;
-            if (s>=0) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<=dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=-cr1*tg1;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=xi/fn;
-                  norm[1]=yi/fn;
-                  snxt = s;
-               }
-            }
-         }
-      }
-   }     
-   // test inner cone
-   if (ro1>0) {
-      u=t1-(tg1*tg1*dir[2]*dir[2]);
-      v=t2-tg1*dir[2]*(tg1*point[2]+ro1);
-      w=t3-rin*rin;
-      // track parallel to cone ?
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            s=-b-TMath::Sqrt(d);
-            if ((s>=0) && (s<snxt)) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=cr2*tg2;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=-xi/fn;
-                  norm[1]=-yi/fn;
-                  return s;
-               }
-            }
-            s=-b+TMath::Sqrt(d);
-            if ((s>=0) && (s<snxt)) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=cr2*tg2;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=-xi/fn;
-                  norm[1]=-yi/fn;
-                  return s;
-               }
-            }
-         }
-      } else {
-         if (v!=0) {
-            s=-0.5*w/v;
-            if ((s>=0) && (s<snxt)) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<=dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=cr2*tg2;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=-xi/fn;
-                  norm[1]=-yi/fn;
-                  return s;
-               }
-            }
-         }
+// compute distance from outside point to surface of the tube
+   // compute distance to Z planes
+   Double_t dz = 0.5*(z2-z1);
+   if (dz<=0) return kBig;
+   Double_t snxt = kBig;
+   Double_t ro2=0.5*(rmax1+rmax2);
+   Double_t tg2=0.5*(rmax2-rmax1)/dz;
+   Double_t r2=point[0]*point[0]+point[1]*point[1];
+   Double_t r=TMath::Sqrt(r2);
+   Double_t rout=tg2*point[2]+ro2;
+   Double_t xp, yp;
+   
+   if ((point[2]<z1) && (dir[2]>0)) {
+      snxt = (z1-point[2])/dir[2];
+      xp = point[0]+snxt*dir[0];
+      yp = point[1]+snxt*dir[1];
+      r2 = xp*xp+yp*yp;
+      if ((r2>=rmin2*rmin2) && (r2<=rmax2*rmax2)) return snxt;
+   } else {
+      if ((point[2]>z2) && (dir[2]<0)) {
+         snxt = (z2-point[2])/dir[2];    
+         xp = point[0]+snxt*dir[0];
+         yp = point[1]+snxt*dir[1];
+         r2 = xp*xp+yp*yp;
+         if ((r2>=rmin1*rmin1) && (r2<=rmax1*rmax1)) return snxt;
       }
-   }     
-   return snxt;               
+   }           
+   
+   // compute distance to inner cone
+   Double_t din=kBig, dout=kBig;
+   snxt = kBig;
+//   printf("r=%f rin=%f rout=%f\n", r, rin, rout);
+   din = TGeoCone::DistToCone(point, dir, rmin1, z1, rmin2, z2);
+   if (r>rout) {
+      dout = TGeoCone::DistToCone(point, dir, rmax1, z1, rmax2, z2);
+   }
+//   printf("din=%f  dout=%f\n", din, dout);
+   snxt = TMath::Min(din, dout);
+   return snxt;
+}
+
+//-----------------------------------------------------------------------------
+Double_t TGeoCone::DistToCone(Double_t *point, Double_t *dir, Double_t r1, Double_t z1, Double_t r2, Double_t z2)
+{
+   // Static method to compute distance to a conical surface with : 
+   // - r1, z1 - radius and Z position of lower base
+   // - r2, z2 - radius and Z position of upper base
+   Double_t dz = z2-z1;
+   if (dz<=0) {
+      return kBig;
+   }      
+   Double_t ro0 = 0.5*(r1+r2);
+   Double_t fz  = (r2-r1)/dz;
+   Double_t r0sq = point[0]*point[0] + point[1]*point[1];
+   Double_t rc = ro0 + fz*(point[2]-0.5*(z1+z2));
+   
+   Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - fz*fz*dir[2]*dir[2];
+   Double_t b = point[0]*dir[0] + point[1]*dir[1] - fz*rc*dir[2];
+   Double_t c = r0sq - rc*rc;
+   
+   if (a==0) return kBig;
+   a = 1./a;
+   b *= a;
+   c *= a;
+   Double_t delta = b*b - c;
+   if (delta<0) return kBig;
+   delta = TMath::Sqrt(delta);
+   
+   Double_t snxt = -b-delta;
+   Double_t znew;
+   if (snxt>0) {
+      znew = point[2] + snxt*dir[2];
+      if (((znew-z1)*(znew-z2)) < 0) return snxt;
+   }
+   snxt = -b+delta;       
+   if (snxt>0) {
+      znew = point[2] + snxt*dir[2];
+      if (((znew-z1)*(znew-z2)) < 0) return snxt;
+   }
+   return kBig;
 }
-                             
+
 //-----------------------------------------------------------------------------
 Double_t TGeoCone::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
 {
@@ -428,18 +295,18 @@ Double_t TGeoCone::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    Double_t ro1=0.5*(fRmin1+fRmin2);
    Double_t tg1=0.5*(fRmin2-fRmin1)/fDz;
    Double_t cr1=1./TMath::Sqrt(1.0+tg1*tg1);
-   Double_t zv1=kBig;
-   if (fRmin1!=fRmin2) zv1=-ro1/tg1;
+//   Double_t zv1=kBig;
+//   if (fRmin1!=fRmin2) zv1=-ro1/tg1;
    Double_t ro2=0.5*(fRmax1+fRmax2);
    Double_t tg2=0.5*(fRmax2-fRmax1)/fDz;
    Double_t cr2=1./TMath::Sqrt(1.0+tg2*tg2);
-   Double_t zv2=kBig;
-   if (fRmax1!=fRmax2) zv2=-ro2/tg2;
+//   Double_t zv2=kBig;
+//   if (fRmax1!=fRmax2) zv2=-ro2/tg2;
    
    Double_t r2=point[0]*point[0]+point[1]*point[1];
    Double_t r=TMath::Sqrt(r2);
-   Double_t rin=TMath::Abs(tg1*point[2]+ro1);
-   Double_t rout=TMath::Abs(tg2*point[2]+ro2);
+   Double_t rin=tg1*point[2]+ro1;
+   Double_t rout=tg2*point[2]+ro2;
    // conmpute safe radius
    if (iact<3 && safe) {
       saf[0]=(rin-r)*cr1;
@@ -449,9 +316,41 @@ Double_t TGeoCone::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
       if (iact==0) return kBig;
       if ((iact==1) && (*safe>step)) return step;
    }
-   return TGeoCone::DistToInS(point, dir,fRmin1,fRmax1,fRmin2,fRmax2,fDz,
-                              ro1,tg1,cr1,zv1,ro2,tg2,cr2,zv2,r2,rin,rout);
+//   return TGeoCone::DistToInS(point, dir,fRmin1,fRmax1,fRmin2,fRmax2,fDz,
+//                              ro1,tg1,cr1,zv1,ro2,tg2,cr2,zv2,r2,rin,rout);
+   // compute distance to Z planes
+   Double_t snxt = kBig;
+   Double_t xp, yp;
+   if (TMath::Abs(point[2]) > fDz) {
+      if ((point[2]*dir[2])<0) {
+         if (point[2]>0) {
+	    snxt = (fDz-point[2])/dir[2];
+	    xp = point[0]+snxt*dir[0];
+	    yp = point[1]+snxt*dir[1];
+	    r2 = xp*xp+yp*yp;
+	    if ((r2>=fRmin2*fRmin2) && (r2<=fRmax2*fRmax2)) return snxt;
+	 } else {
+	    snxt = -(fDz+point[2])/dir[2];    
+	    xp = point[0]+snxt*dir[0];
+	    yp = point[1]+snxt*dir[1];
+	    r2 = xp*xp+yp*yp;
+	    if ((r2>=fRmin1*fRmin1) && (r2<=fRmax1*fRmax1)) return snxt;
+	 }    
+      }
+   }
+   // compute distance to inner cone
+   Double_t din=kBig, dout=kBig;
+   snxt = kBig;
+//   printf("r=%f rin=%f rout=%f\n", r, rin, rout);
+   din = TGeoCone::DistToCone(point, dir, fRmin1, -fDz, fRmin2, fDz);
+   if (r>rout) {
+      dout = TGeoCone::DistToCone(point, dir, fRmax1, -fDz, fRmax2, fDz);
+   }
+//   printf("din=%f  dout=%f\n", din, dout);
+   snxt = TMath::Min(din, dout);
+   return snxt;
 }
+
 //-----------------------------------------------------------------------------
 Int_t TGeoCone::DistancetoPrimitive(Int_t px, Int_t py)
 {
@@ -461,7 +360,7 @@ Int_t TGeoCone::DistancetoPrimitive(Int_t px, Int_t py)
    return ShapeDistancetoPrimitive(numPoints, px, py);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoCone::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoCone::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
@@ -528,7 +427,7 @@ TGeoVolume *TGeoCone::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxi
    }
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoCone::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoCone::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -587,7 +486,7 @@ void TGeoCone::InspectShape() const
    TGeoBBox::InspectShape();
 }
 //-----------------------------------------------------------------------------
-void TGeoCone::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoCone::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
@@ -610,7 +509,7 @@ void TGeoCone::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintTube(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoCone::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoCone::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
@@ -886,6 +785,75 @@ Bool_t TGeoConeSeg::Contains(Double_t *point) const
    return kTRUE;
 }
 //-----------------------------------------------------------------------------
+Double_t TGeoConeSeg::DistToCons(Double_t *point, Double_t *dir, Double_t r1, Double_t z1, Double_t r2, Double_t z2, Double_t phi1, Double_t phi2)
+{
+   // Static method to compute distance to a conical surface with : 
+   // - r1, z1 - radius and Z position of lower base
+   // - r2, z2 - radius and Z position of upper base
+   // - phi1, phi2 - phi limits
+   Double_t dz = z2-z1;
+   if (dz<=0) {
+      return kBig;
+   }      
+
+   Double_t dphi = phi2 - phi1;
+   if (dphi < 0) dphi+=360.;
+//   printf("phi1=%f phi2=%f dphi=%f\n", phi1, phi2, dphi);
+
+   Double_t ro0 = 0.5*(r1+r2);
+   Double_t fz  = (r2-r1)/dz;
+   Double_t r0sq = point[0]*point[0] + point[1]*point[1];
+   Double_t rc = ro0 + fz*(point[2]-0.5*(z1+z2));
+   
+   Double_t a = dir[0]*dir[0] + dir[1]*dir[1] - fz*fz*dir[2]*dir[2];
+   Double_t b = point[0]*dir[0] + point[1]*dir[1] - fz*rc*dir[2];
+   Double_t c = r0sq - rc*rc;
+   
+   if (a==0) return kBig;
+   a = 1./a;
+   b *= a;
+   c *= a;
+   Double_t delta = b*b - c;
+   if (delta<0) return kBig;
+   delta = TMath::Sqrt(delta);
+   
+   Double_t snxt = -b-delta;
+   Double_t ptnew[3];
+   Double_t ddp, phi;
+   if (snxt>0) {
+      // check Z range
+      ptnew[2] = point[2] + snxt*dir[2];
+      if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
+      // check phi range
+         ptnew[0] = point[0] + snxt*dir[0];
+         ptnew[1] = point[1] + snxt*dir[1];
+         phi = TMath::ATan2(ptnew[1], ptnew[0]) * kRadDeg;
+         if (phi < 0 ) phi+=360.;
+         ddp = phi-phi1;
+         if (ddp < 0) ddp+=360.; 
+//	 printf("snxt1=%f phi=%f ddp=%f\n", snxt, phi, ddp);
+	 if (ddp<=dphi) return snxt;
+      }	 
+   }
+   snxt = -b+delta;       
+   if (snxt>0) {
+      // check Z range	
+      ptnew[2] = point[2] + snxt*dir[2];
+      if (((ptnew[2]-z1)*(ptnew[2]-z2)) < 0) {
+      // check phi range
+         ptnew[0] = point[0] + snxt*dir[0];
+         ptnew[1] = point[1] + snxt*dir[1];
+         phi = TMath::ATan2(ptnew[1], ptnew[0]) * kRadDeg;
+         if (phi < 0 ) phi+=360.;
+         ddp = phi-phi1;
+         if (ddp < 0) ddp+=360.; 
+//	 printf("snxt2=%f phi=%f ddp=%f\n", snxt, phi, ddp);
+	 if (ddp<=dphi) return snxt;
+      }	 
+   }
+   return kBig;
+}
+//-----------------------------------------------------------------------------
 Double_t TGeoConeSeg::DistToPhiMin(Double_t *point, Double_t *dir, Double_t s1, Double_t c1,
                                    Double_t s2, Double_t c2, Double_t sm, Double_t cm)
 {
@@ -911,37 +879,39 @@ Double_t TGeoConeSeg::DistToPhiMin(Double_t *point, Double_t *dir, Double_t s1,
 }
 //-----------------------------------------------------------------------------
 Double_t TGeoConeSeg::DistToOutS(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe,
-               Double_t dz, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t phi1, Double_t phi2)
+                                 Double_t rmin1, Double_t rmax1, Double_t z1, Double_t rmin2, Double_t rmax2, Double_t z2, Double_t phi1, Double_t phi2)
 {
-// compute distance from inside point to surface of the cone segment (static)
+// compute distance from inside point to surface of the tube segment
    Double_t saf[4];
+   Double_t dz=0.5*(z2-z1);
+   if (dz<=0) return kBig;
+   
    Double_t ph1 = phi1*kDegRad;
    Double_t ph2 = phi2*kDegRad;
    if (ph2<ph1) ph2+=2.*TMath::Pi();
    Double_t phim = 0.5*(ph1+ph2);
+   Double_t cm = TMath::Cos(phim);
+   Double_t sm = TMath::Sin(phim);
    Double_t c1 = TMath::Cos(ph1);
    Double_t c2 = TMath::Cos(ph2);
    Double_t s1 = TMath::Sin(ph1);
    Double_t s2 = TMath::Sin(ph2);
-   Double_t cm = TMath::Cos(phim);
-   Double_t sm = TMath::Sin(phim);
-
-   Double_t ro1 = 0.5*(rmin1+rmin2);
-   Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
-   Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
-   Double_t ro2 = 0.5*(rmax1+rmax2);
-   Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
-   Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
-   
-   Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
-   Double_t rin = tg1*point[2]+ro1;
-   Double_t rout = tg2*point[2]+ro2;
    
    if (iact<3 && safe) {
+      Double_t ro1 = 0.5*(rmin1+rmin2);
+      Double_t tg1 = 0.5*(rmin2-rmin1)/dz;
+      Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
+      Double_t ro2 = 0.5*(rmax1+rmax2);
+      Double_t tg2 = 0.5*(rmax2-rmax1)/dz;
+      Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
+   
+      Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
+      Double_t rin = tg1*point[2]+ro1;
+      Double_t rout = tg2*point[2]+ro2;
       if (ro1>1E-10) saf[0] = (r-rin)*cr1;
       else saf[0] = kBig;
       saf[1] = (rout-r)*cr2;
-      saf[2] = dz-TMath::Abs(point[2]);
+      saf[2] = TMath::Min(point[2]-z1, z2-point[2]);
       if ((point[1]*cm-point[0]*sm)<=0) saf[3]=TMath::Abs(point[0]*s1-point[1]*c1);
       else                              saf[3]=TMath::Abs(point[0]*s2-point[1]*c2);
       *safe = saf[TMath::LocMin(4, &saf[0])];
@@ -951,84 +921,50 @@ Double_t TGeoConeSeg::DistToOutS(Double_t *point, Double_t *dir, Int_t iact, Dou
    // compute distance to surface 
    // Do Z
    Double_t sz = kBig;
-   if (dir[2]>1E-20) 
-      sz = (dz-point[2])/dir[2];
-   else
-      if (dir[2]<-1E-20) sz = -(dz+point[2])/dir[2];
-   // Do Rmin
-   Double_t t1=dir[0]*dir[0]+dir[1]*dir[1];  
-   Double_t t2=point[0]*dir[0]+point[1]*dir[1];  
-   Double_t t3=point[0]*point[0]+point[1]*point[1]; 
-   Double_t sr1 = kBig;
-   Double_t b=0, c=0, d=0;
-   Double_t u=0, v=0, w=0;
-   Double_t ds=0;
-   if (ro1>0) {
-      u=t1-tg1*tg1*dir[2]*dir[2];
-      v=t2-tg1*dir[2]*rin;
-      w=t3-rin*rin;
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            ds = TMath::Sqrt(d);
-            if (ds>=TMath::Abs(b)) sr1=ds-b;
-            else if (b<=0)         sr1=-ds-b;
-         }
-      } else if (v<0) sr1=-0.5*w/v;
-   } 
-   // Do Rmax
-   Double_t sr2=kBig;
-   u=t1-tg2*tg2*dir[2]*dir[2];
-   v=t2-tg2*dir[2]*rout;
-   w=t3-rout*rout;
-   if (u!=0) {
-      b=v/u;
-      c=w/u;
-      d=b*b-c;
-      if (d>=0) {
-         ds = TMath::Sqrt(d);
-         if (ds>=TMath::Abs(b)) sr2=ds-b;
-         else if (b<=0) sr2 = -ds-b;
-      }
-   } else if (v>0) sr2=-0.5*w/v;
-
+   if (dir[2]>0) {
+      sz = (z2-point[2])/dir[2];
+   } else {
+      if (dir[2]<0) 
+         sz = (z1-point[2])/dir[2];
+   }
+   // check conical surfaces
+   Double_t sr1 = TGeoConeSeg::DistToCons(point, dir, rmin1, z1, rmin2, z2, phi1, phi2);
+   Double_t sr2 = TGeoConeSeg::DistToCons(point, dir, rmax1, z1, rmax2, z2, phi1, phi2);
    Double_t sr = TMath::Min(sr1, sr2);
-
    // phi planes
 
-   Double_t sfmin=TGeoConeSeg::DistToPhiMin(point, dir, s1, c1, s2, c2, sm, cm);
+   Double_t sfmin=DistToPhiMin(point, dir, s1, c1, s2, c2, sm, cm);
    return TMath::Min(TMath::Min(sz,sr), sfmin);      
 }
+
 //-----------------------------------------------------------------------------
 Double_t TGeoConeSeg::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
 {
 // compute distance from inside point to surface of the tube segment
    Double_t saf[4];
+
    Double_t phi1 = fPhi1*kDegRad;
    Double_t phi2 = fPhi2*kDegRad;
    if (phi2<phi1) phi2+=2.*TMath::Pi();
    Double_t phim = 0.5*(phi1+phi2);
+   Double_t cm = TMath::Cos(phim);
+   Double_t sm = TMath::Sin(phim);
    Double_t c1 = TMath::Cos(phi1);
    Double_t c2 = TMath::Cos(phi2);
    Double_t s1 = TMath::Sin(phi1);
    Double_t s2 = TMath::Sin(phi2);
-   Double_t cm = TMath::Cos(phim);
-   Double_t sm = TMath::Sin(phim);
-
-   Double_t ro1 = 0.5*(fRmin1+fRmin2);
-   Double_t tg1 = 0.5*(fRmin2-fRmin1)/fDz;
-   Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
-   Double_t ro2 = 0.5*(fRmax1+fRmax2);
-   Double_t tg2 = 0.5*(fRmax2-fRmax1)/fDz;
-   Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
-   
-   Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
-   Double_t rin = tg1*point[2]+ro1;
-   Double_t rout = tg2*point[2]+ro2;
    
    if (iact<3 && safe) {
+      Double_t ro1 = 0.5*(fRmin1+fRmin2);
+      Double_t tg1 = 0.5*(fRmin2-fRmin1)/fDz;
+      Double_t cr1 = 1./TMath::Sqrt(1.+tg1*tg1);
+      Double_t ro2 = 0.5*(fRmax1+fRmax2);
+      Double_t tg2 = 0.5*(fRmax2-fRmax1)/fDz;
+      Double_t cr2 = 1./TMath::Sqrt(1.+tg2*tg2);
+   
+      Double_t r=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
+      Double_t rin = tg1*point[2]+ro1;
+      Double_t rout = tg2*point[2]+ro2;
       if (ro1>1E-10) saf[0] = (r-rin)*cr1;
       else saf[0] = kBig;
       saf[1] = (rout-r)*cr2;
@@ -1042,67 +978,51 @@ Double_t TGeoConeSeg::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Doub
    // compute distance to surface 
    // Do Z
    Double_t sz = kBig;
-   if (dir[2]>1E-20) 
+   if (dir[2]>0) {
       sz = (fDz-point[2])/dir[2];
-   else
-      if (dir[2]<-1E-20) sz = -(fDz+point[2])/dir[2];
-   // Do Rmin
-   Double_t t1=dir[0]*dir[0]+dir[1]*dir[1];  
-   Double_t t2=point[0]*dir[0]+point[1]*dir[1];  
-   Double_t t3=point[0]*point[0]+point[1]*point[1]; 
-   Double_t sr1 = kBig;
-   Double_t b=0, c=0, d=0;
-   Double_t u=0, v=0, w=0;
-   Double_t ds=0;
-   if (ro1>0) {
-      u=t1-tg1*tg1*dir[2]*dir[2];
-      v=t2-tg1*dir[2]*rin;
-      w=t3-rin*rin;
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            ds = TMath::Sqrt(d);
-            if (ds>=TMath::Abs(b)) sr1=ds-b;
-            else if (b<=0)         sr1=-ds-b;
-         }
-      } else if (v<0) sr1=-0.5*w/v;
-   } 
-   // Do Rmax
-   Double_t sr2=kBig;
-   u=t1-tg2*tg2*dir[2]*dir[2];
-   v=t2-tg2*dir[2]*rout;
-   w=t3-rout*rout;
-   if (u!=0) {
-      b=v/u;
-      c=w/u;
-      d=b*b-c;
-      if (d>=0) {
-         ds = TMath::Sqrt(d);
-         if (ds>=TMath::Abs(b)) sr2=ds-b;
-         else if (b<=0) sr2 = -ds-b;
-      }
-   } else if (v>0) sr2=-0.5*w/v;
+   } else {
+      if (dir[2]<0) 
+         sz = -(fDz+point[2])/dir[2];
+   }
+   // check conical surfaces
+   Double_t sr1 = TGeoConeSeg::DistToCons(point, dir, fRmin1, -fDz, fRmin2, fDz, fPhi1, fPhi2);
+   Double_t sr2 = TGeoConeSeg::DistToCons(point, dir, fRmax1, -fDz, fRmax2, fDz, fPhi1, fPhi2);
    Double_t sr = TMath::Min(sr1, sr2);
    // phi planes
 
    Double_t sfmin=DistToPhiMin(point, dir, s1, c1, s2, c2, sm, cm);
    return TMath::Min(TMath::Min(sz,sr), sfmin);      
 }
+
 //-----------------------------------------------------------------------------
-Double_t TGeoConeSeg::DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2,
-                             Double_t dz, Double_t ro1, Double_t tg1, Double_t cr1, Double_t zv1,
-                             Double_t ro2, Double_t tg2, Double_t cr2, Double_t zv2,
-                             Double_t r2, Double_t rin, Double_t rout, Double_t c1, Double_t s1,
-                             Double_t c2, Double_t s2, Double_t cfio, Double_t sfio, Double_t cdfi)
+Double_t TGeoConeSeg::DistToInS(Double_t *point, Double_t *dir, Double_t rmin1, Double_t rmax1, Double_t z1, Double_t rmin2, Double_t rmax2,
+                             Double_t z2, Double_t phi1, Double_t phi2)
 {
 // compute distance from outside point to surface of arbitrary tube
    Double_t snxt=kBig;
-   Double_t cpsi=kBig;
-   if (r2>0) cpsi=(point[0]*cfio-point[1]*sfio)/TMath::Sqrt(r2);
+   Double_t dz = 0.5*(z2-z1);
+   if (dz<=0) return kBig;
+   Double_t ro1=0.5*(rmin1+rmin2);
+   Double_t tg1=0.5*(rmin2-rmin1)/dz;
+   Double_t ro2=0.5*(rmax1+rmax2);
+   Double_t tg2=0.5*(rmax2-rmax1)/dz;
+
+   Double_t ph1 = phi1*kDegRad;
+   Double_t ph2 = phi2*kDegRad;
+   if (ph2<ph1) ph2+=2.*TMath::Pi();
+   Double_t c1 = TMath::Cos(ph1);
+   Double_t s1 = TMath::Sin(ph1);
+   Double_t c2 = TMath::Cos(ph2);
+   Double_t s2 = TMath::Sin(ph2);
+   Double_t fio = 0.5*(ph1+ph2);
+   Double_t cfio = TMath::Cos(fio);
+   Double_t sfio = TMath::Sin(fio);
+   Double_t dfi = 0.5*(ph2-ph1);
+   Double_t cdfi = TMath::Cos(dfi);
+   Double_t cpsi;
+   
    // intersection with Z planes
-   Double_t s, xi, yi, zi, riq, r1q, r2q, ri;
+   Double_t s, xi, yi, zi, riq, r1q, r2q;
    Double_t *norm=gGeoManager->GetNormalChecked();
    if (TMath::Abs(point[2])>dz) {
       if ((point[2]*dir[2])<0) {
@@ -1128,155 +1048,9 @@ Double_t TGeoConeSeg::DistToInS(Double_t *point, Double_t *dir, Double_t rmin1,
       }   
    }
    // intersection with cones
-   Double_t t1=dir[0]*dir[0]+dir[1]*dir[1];
-   Double_t t2=point[0]*dir[0]+point[1]*dir[1];
-   Double_t t3=r2;
-   // outer cone
-   Double_t u,v,w,b,c,d,fn;
-   if ((zv2*point[2]>zv2*zv2) || (r2>rout*rout)) {
-      u=t1-(tg2*tg2*dir[2]*dir[2]);
-      v=t2-tg2*dir[2]*(tg2*point[2]+ro2);
-      w=t3-rout*rout;
-      // track parallel to cone ?
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            s=-b-TMath::Sqrt(d);
-            if (s>=0) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=-cr1*tg1;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=xi/fn;
-                  norm[1]=yi/fn;
-                  if (zi==zv2) snxt=s;
-                  else {
-                     ri=tg2*zi+ro2;
-                     cpsi=(xi*cfio+yi*sfio)/ri;
-                     if (cpsi>=cdfi) snxt=s;
-                  }   
-               }
-            }
-            if (snxt>(-b)) {
-               s=-b+TMath::Sqrt(d);
-               if (s>=0) {
-                  zi=point[2]+s*dir[2];
-                  if (TMath::Abs(zi)<dz) {
-                     xi=point[0]+s*dir[0];
-                     yi=point[1]+s*dir[1];
-                     norm[2]=-cr1*tg1;
-                     fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                     norm[0]=xi/fn;
-                     norm[1]=yi/fn;
-                     if (zi==zv2) snxt=s;
-                     else {
-                        ri=tg2*zi+ro2;
-                        cpsi=(xi*cfio+yi*sfio)/ri;
-                        if (cpsi>=cdfi) snxt=s;
-                     }   
-                  }
-               }
-            }
-         }   
-      } else {
-         if (v!=0) {
-            s=-0.5*w/v;
-            if (s>=0) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<=dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=-cr1*tg1;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=xi/fn;
-                  norm[1]=yi/fn;
-                  if (zi==zv2) snxt=s;
-                  else {
-                     ri=tg2*zi+ro2;
-                     cpsi=(xi*cfio+yi*sfio)/ri;
-                     if (cpsi>=cdfi) snxt=s;
-                  }   
-               }
-            }
-         }
-      }
-   }     
-   // test inner cone
-   if (ro1>0) {
-      u=t1-(tg1*tg1*dir[2]*dir[2]);
-      v=t2-tg1*dir[2]*(tg1*point[2]+ro1);
-      w=t3-rin*rin;
-      // track parallel to cone ?
-      if (u!=0) {
-         b=v/u;
-         c=w/u;
-         d=b*b-c;
-         if (d>=0) {
-            s=-b-TMath::Sqrt(d);
-            if ((s>=0) && (s<snxt)) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=cr2*tg2;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=-xi/fn;
-                  norm[1]=-yi/fn;
-                  if (zi==zv1) snxt=s;
-                  else {
-                     ri=tg1*zi+ro1;
-                     cpsi=(xi*cfio+yi*sfio)/ri;
-                     if (cpsi>=cdfi) snxt=s;
-                  }   
-               }
-            }
-            s=-b+TMath::Sqrt(d);
-            if ((s>=0) && (s<snxt)) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=cr2*tg2;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=-xi/fn;
-                  norm[1]=-yi/fn;
-                  if (zi==zv1) snxt=s;
-                  else {
-                     ri=tg1*zi+ro1;
-                     cpsi=(xi*cfio+yi*sfio)/ri;
-                     if (cpsi>=cdfi) snxt=s;
-                  }   
-               }
-            }
-         }
-      } else {
-         if (v!=0) {
-            s=-0.5*w/v;
-            if ((s>=0) && (s<snxt)) {
-               zi=point[2]+s*dir[2];
-               if (TMath::Abs(zi)<=dz) {
-                  xi=point[0]+s*dir[0];
-                  yi=point[1]+s*dir[1];
-                  norm[2]=cr2*tg2;
-                  fn=TMath::Sqrt((xi*xi+yi*yi)/(1.0-norm[2]*norm[2]));
-                  norm[0]=-xi/fn;
-                  norm[1]=-yi/fn;
-                  if (zi==zv1) snxt=s;
-                  else {
-                     ri=tg1*zi+ro1;
-                     cpsi=(xi*cfio+yi*sfio)/ri;
-                     if (cpsi>=cdfi) snxt=s;
-                  }   
-               }
-            }
-         }
-      }
-   }     
-
+   Double_t sr1 = TGeoConeSeg::DistToCons(point, dir, rmin1, z1, rmin2, z2, phi1, phi2);
+   Double_t sr2 = TGeoConeSeg::DistToCons(point, dir, rmax1, z1, rmax2, z2, phi1, phi2);
+   snxt = TMath::Min(sr1, sr2);
    // check phi planes
    Double_t un;
    un=dir[0]*s1-dir[1]*c1;
@@ -1322,45 +1096,47 @@ Double_t TGeoConeSeg::DistToInS(Double_t *point, Double_t *dir, Double_t rmin1,
             }
          }
       }
-   }               
+   }    
+              
    return snxt;               
 }
+
 //-----------------------------------------------------------------------------
 Double_t TGeoConeSeg::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
 {
 // compute distance from outside point to surface of the tube
    Double_t saf[4];
-   Double_t ro1=0.5*(fRmin1+fRmin2);
-   Double_t tg1=0.5*(fRmin2-fRmin1)/fDz;
-   Double_t cr1=1./TMath::Sqrt(1.0+tg1*tg1);
-   Double_t zv1=kBig;
-   if (fRmin1!=fRmin2) zv1=-ro1/tg1;
-   Double_t ro2=0.5*(fRmax1+fRmax2);
-   Double_t tg2=0.5*(fRmax2-fRmax1)/fDz;
-   Double_t cr2=1./TMath::Sqrt(1.0+tg2*tg2);
-   Double_t zv2=kBig;
-   if (fRmax1!=fRmax2) zv2=-ro2/tg2;
-
-   Double_t phi1 = fPhi1*kDegRad;
-   Double_t phi2 = fPhi2*kDegRad;
-   if (phi2<phi1) phi2+=2.*TMath::Pi();
-   Double_t c1 = TMath::Cos(phi1);
-   Double_t s1 = TMath::Sin(phi1);
-   Double_t c2 = TMath::Cos(phi2);
-   Double_t s2 = TMath::Sin(phi2);
-   Double_t fio = 0.5*(phi1+phi2);
-   Double_t cfio = TMath::Cos(fio);
-   Double_t sfio = TMath::Sin(fio);
-   Double_t dfi = 0.5*(phi2-phi1);
-   Double_t cdfi = TMath::Cos(dfi);
-   Double_t cpsi;
-
-   Double_t r2=point[0]*point[0]+point[1]*point[1];
-   Double_t r=TMath::Sqrt(r2);
-   Double_t rin=TMath::Abs(tg1*point[2]+ro1);
-   Double_t rout=TMath::Abs(tg2*point[2]+ro2);
    // compute safe radius
    if (iact<3 && safe) {
+      Double_t ro1=0.5*(fRmin1+fRmin2);
+      Double_t tg1=0.5*(fRmin2-fRmin1)/fDz;
+      Double_t cr1=1./TMath::Sqrt(1.0+tg1*tg1);
+      Double_t zv1=kBig;
+      if (fRmin1!=fRmin2) zv1=-ro1/tg1;
+      Double_t ro2=0.5*(fRmax1+fRmax2);
+      Double_t tg2=0.5*(fRmax2-fRmax1)/fDz;
+      Double_t cr2=1./TMath::Sqrt(1.0+tg2*tg2);
+      Double_t zv2=kBig;
+      if (fRmax1!=fRmax2) zv2=-ro2/tg2;
+
+      Double_t phi1 = fPhi1*kDegRad;
+      Double_t phi2 = fPhi2*kDegRad;
+      if (phi2<phi1) phi2+=2.*TMath::Pi();
+      Double_t c1 = TMath::Cos(phi1);
+      Double_t s1 = TMath::Sin(phi1);
+      Double_t c2 = TMath::Cos(phi2);
+      Double_t s2 = TMath::Sin(phi2);
+      Double_t fio = 0.5*(phi1+phi2);
+      Double_t cfio = TMath::Cos(fio);
+      Double_t sfio = TMath::Sin(fio);
+      Double_t dfi = 0.5*(phi2-phi1);
+      Double_t cdfi = TMath::Cos(dfi);
+      Double_t cpsi;
+
+      Double_t r2=point[0]*point[0]+point[1]*point[1];
+      Double_t r=TMath::Sqrt(r2);
+      Double_t rin=TMath::Abs(tg1*point[2]+ro1);
+      Double_t rout=TMath::Abs(tg2*point[2]+ro2);
       saf[0]=(rin-r)*cr1;
       saf[1]=(r-rout)*cr2;
       saf[2]=TMath::Abs(point[2])-fDz;
@@ -1374,8 +1150,7 @@ Double_t TGeoConeSeg::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Doubl
       if (iact==0) return kBig;
       if ((iact==1) && (*safe>step)) return step;
    }
-   return TGeoConeSeg::DistToInS(point, dir,fRmin1,fRmax1,fRmin2,fRmax2,fDz,
-                              ro1,tg1,cr1,zv1,ro2,tg2,cr2,zv2,r2,rin,rout,c1,s1,c2,s2,cfio,sfio,cdfi);
+   return TGeoConeSeg::DistToInS(point, dir,fRmin1,fRmax1,-fDz, fRmin2,fRmax2,fDz, fPhi1, fPhi2);
 }
 //-----------------------------------------------------------------------------
 Int_t TGeoConeSeg::DistancetoPrimitive(Int_t px, Int_t py)
@@ -1386,7 +1161,7 @@ Int_t TGeoConeSeg::DistancetoPrimitive(Int_t px, Int_t py)
    return ShapeDistancetoPrimitive(numPoints, px, py);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoConeSeg::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoConeSeg::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
@@ -1456,7 +1231,7 @@ TGeoVolume *TGeoConeSeg::Divide(TGeoVolume *voldiv, const char *divname, Int_t i
    }
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoConeSeg::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoConeSeg::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -1536,12 +1311,12 @@ void TGeoConeSeg::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintTubs(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-void TGeoConeSeg::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoConeSeg::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoConeSeg::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoConeSeg::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoEltu.cxx b/geom/src/TGeoEltu.cxx
index b5de162fe796a2a31a03eb364691ae881059b9aa..dd8511e8236e29332abe0532e6208e927452ee22 100644
--- a/geom/src/TGeoEltu.cxx
+++ b/geom/src/TGeoEltu.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoEltu.cxx,v 1.3 2002/07/15 15:32:25 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoEltu.cxx,v 1.4 2002/09/27 16:16:06 brun Exp $
 // Author: Mihaela Gheata   05/06/02
 
 /*************************************************************************
@@ -238,21 +238,21 @@ Double_t TGeoEltu::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return snxt;   
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoEltu::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoEltu::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
-   return 0.0;
+   return kBig;
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoEltu::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
-                             Double_t start, Double_t step) 
+TGeoVolume *TGeoEltu::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/, 
+                             Double_t /*start*/, Double_t /*step*/) 
 {
    Error("Divide", "Elliptical tubes divisions not implemenetd");
    return voldiv;
 }   
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoEltu::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoEltu::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -302,12 +302,12 @@ void TGeoEltu::InspectShape() const
    TGeoBBox::InspectShape();
 }
 //-----------------------------------------------------------------------------
-void TGeoEltu::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoEltu::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoEltu::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoEltu::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoManager.cxx b/geom/src/TGeoManager.cxx
index a7a54cb82053407bb5b2e32b0e6ce9e5939da418..49224ad3370a4d592a1adb519177c3d925bef88e 100644
--- a/geom/src/TGeoManager.cxx
+++ b/geom/src/TGeoManager.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoManager.cxx,v 1.22 2002/10/22 07:43:12 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoManager.cxx,v 1.23 2002/11/15 14:41:19 rdm Exp $
 // Author: Andrei Gheata   25/10/01
 
 /*************************************************************************
@@ -1649,7 +1649,7 @@ const char *TGeoManager::GetPath() const
    return fCache->GetPath();
 }
 //-----------------------------------------------------------------------------
-Int_t TGeoManager::GetByteCount(Option_t *option)
+Int_t TGeoManager::GetByteCount(Option_t * /*option*/)
 {
 // Get total size of geometry in bytes.
    Int_t count = 0;
@@ -2141,7 +2141,7 @@ TGeoNode *TGeoManager::Step(Bool_t is_geom, Bool_t cross)
    Double_t epsil = 0;
    if (fStep<1E-6) {
       fIsNullStep=kTRUE;
-      fStep = 0.;
+      if (fStep<0) fStep = 0.;
    } else {
       fIsNullStep=kFALSE;
    }
@@ -2245,7 +2245,7 @@ void TGeoManager::CheckPoint(Double_t x, Double_t y, Double_t z, Option_t *optio
 }
 
 //-----------------------------------------------------------------------------
-void TGeoManager::CheckGeometry(Option_t *option)
+void TGeoManager::CheckGeometry(Option_t * /*option*/)
 {
 // Instanciate a TGeoChecker object and investigates the geometry according to
 // option. Not implemented yet.
@@ -2254,14 +2254,14 @@ void TGeoManager::CheckGeometry(Option_t *option)
 }
 
 //-----------------------------------------------------------------------------
-void TGeoManager::UpdateCurrentPosition(Double_t *nextpoint)
+void TGeoManager::UpdateCurrentPosition(Double_t * /*nextpoint*/)
 {
 // Computes and changes the current node according to the new position.
 // Not implemented.
 }
 
 //-----------------------------------------------------------------------------
-ULong_t TGeoManager::SizeOf(TGeoNode *node, Option_t *option)
+ULong_t TGeoManager::SizeOf(TGeoNode * /*node*/, Option_t * /*option*/)
 {
 // computes the total size in bytes of the branch starting with node.
 // The option can specify if all the branch has to be parsed or only the node
@@ -2306,7 +2306,7 @@ Int_t TGeoManager::Export(const char *filename, const char *name, Option_t *opti
 
 
 //______________________________________________________________________________
-TGeoManager *TGeoManager::Import(const char *filename, const char *name, Option_t *option)
+TGeoManager *TGeoManager::Import(const char *filename, const char *name, Option_t * /*option*/)
 {
    //static function
    //Import in memory from filename the geometry with key=name.
diff --git a/geom/src/TGeoMaterial.cxx b/geom/src/TGeoMaterial.cxx
index cf0fb70014d4a96ea6698727b28f163460644aab..182c0a53f0e1a7414cea0fdd3f10640dc548e45f 100644
--- a/geom/src/TGeoMaterial.cxx
+++ b/geom/src/TGeoMaterial.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoMaterial.cxx,v 1.3 2002/10/09 12:57:40 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoMaterial.cxx,v 1.4 2002/10/09 14:03:09 brun Exp $
 // Author: Andrei Gheata   25/10/01
 
 /*************************************************************************
@@ -121,7 +121,7 @@ Bool_t TGeoMaterial::IsEq(TGeoMaterial *other)
    return kTRUE;
 }
 //-----------------------------------------------------------------------------
-void TGeoMaterial::Print(const Option_t *option) const
+void TGeoMaterial::Print(const Option_t * /*option*/) const
 {
 // print characteristics of this material
    printf("%s   %s   Media=%d A=%6.2f Z=%6.0f rho=%6.2f\n", GetName(), GetTitle(),
@@ -224,7 +224,7 @@ Bool_t TGeoMixture::IsEq(TGeoMaterial *other)
    return kTRUE;
 }
 //-----------------------------------------------------------------------------
-void TGeoMixture::Print(const Option_t *option) const
+void TGeoMixture::Print(const Option_t * /*option*/) const
 {
 // print characteristics of this material
    printf("%s   %s   Media=%d\n", GetName(), GetTitle(), fId);
diff --git a/geom/src/TGeoNode.cxx b/geom/src/TGeoNode.cxx
index 0884ccf9df018d4f6cd9a84425fa26bfcf515415..91ccf1ddd303ca4a780909b08504669c985382d2 100644
--- a/geom/src/TGeoNode.cxx
+++ b/geom/src/TGeoNode.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoNode.cxx,v 1.10 2002/10/11 16:41:53 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoNode.cxx,v 1.11 2002/10/21 15:21:13 brun Exp $
 // Author: Andrei Gheata   24/10/01
 
 /*************************************************************************
@@ -290,7 +290,7 @@ void TGeoNode::LocalToMasterVect(const Double_t *local, Double_t *master) const
    GetMatrix()->LocalToMasterVect(local, master);
 }
 //-----------------------------------------------------------------------------
-void TGeoNode::ls(Option_t *option) const
+void TGeoNode::ls(Option_t * /*option*/) const
 {
 // Print the path (A/B/C/...) to this node on stdout
 }
diff --git a/geom/src/TGeoPara.cxx b/geom/src/TGeoPara.cxx
index 8aaf194021060c513676991a03f006839d83a528..658ba994fed1bce481e6b5975a39f6ab399a2dd3 100644
--- a/geom/src/TGeoPara.cxx
+++ b/geom/src/TGeoPara.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoPara.cxx,v 1.4 2002/09/27 16:16:06 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoPara.cxx,v 1.5 2002/10/08 16:17:48 brun Exp $
 // Author: Andrei Gheata   31/01/02
 // TGeoPara::Contains() implemented by Mihaela Gheata
 
@@ -280,11 +280,11 @@ Double_t TGeoPara::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return smin;
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPara::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoPara::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
-   return 0.0;
+   return 0;
 }
 //-----------------------------------------------------------------------------
 TGeoVolume *TGeoPara::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
@@ -345,7 +345,7 @@ TGeoVolume *TGeoPara::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxi
    return vol;
 }   
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoPara::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoPara::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -391,12 +391,12 @@ void TGeoPara::InspectShape() const
    TGeoBBox::InspectShape();
 }
 //-----------------------------------------------------------------------------
-void TGeoPara::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoPara::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPara::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoPara::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoPatternFinder.cxx b/geom/src/TGeoPatternFinder.cxx
index b4afb939e8d26f88640dcfe5774664d9307dc397..25747f1d3fd3f61fcee11b61697f8390ba6ec03f 100644
--- a/geom/src/TGeoPatternFinder.cxx
+++ b/geom/src/TGeoPatternFinder.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoPatternFinder.cxx,v 1.4 2002/10/03 13:19:09 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoPatternFinder.cxx,v 1.5 2002/10/08 16:17:48 brun Exp $
 // Author: Andrei Gheata   30/10/01
 
 /*************************************************************************
@@ -745,7 +745,7 @@ TGeoPatternSphR::~TGeoPatternSphR()
 // Destructor
 }
 //-----------------------------------------------------------------------------
-TGeoNode *TGeoPatternSphR::FindNode(Double_t *point)
+TGeoNode *TGeoPatternSphR::FindNode(Double_t * /*point*/)
 {
 // find the node containing the query point
    return 0;
@@ -794,7 +794,7 @@ TGeoPatternSphTheta::~TGeoPatternSphTheta()
 // Destructor
 }
 //-----------------------------------------------------------------------------
-TGeoNode *TGeoPatternSphTheta::FindNode(Double_t *point)
+TGeoNode *TGeoPatternSphTheta::FindNode(Double_t * /*point*/)
 {
 // find the node containing the query point
    return 0;
@@ -843,7 +843,7 @@ TGeoPatternSphPhi::~TGeoPatternSphPhi()
 // Destructor
 }
 //-----------------------------------------------------------------------------
-TGeoNode *TGeoPatternSphPhi::FindNode(Double_t *point)
+TGeoNode *TGeoPatternSphPhi::FindNode(Double_t * /*point*/)
 {
 // find the node containing the query point
    return 0;
@@ -879,7 +879,7 @@ TGeoPatternHoneycomb::~TGeoPatternHoneycomb()
 // destructor
 }
 //-----------------------------------------------------------------------------
-TGeoNode *TGeoPatternHoneycomb::FindNode(Double_t *point)
+TGeoNode *TGeoPatternHoneycomb::FindNode(Double_t * /*point*/)
 {
 // find the node containing the query point
    return 0;
diff --git a/geom/src/TGeoPcon.cxx b/geom/src/TGeoPcon.cxx
index 936d5544289ddb8d27b870351e29699c063dc204..285d99ab08d6a425b82791d3e118e1ed359cafe7 100644
--- a/geom/src/TGeoPcon.cxx
+++ b/geom/src/TGeoPcon.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoPcon.cxx,v 1.5 2002/10/08 16:17:49 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoPcon.cxx,v 1.6 2002/11/20 08:55:10 brun Exp $
 // Author: Andrei Gheata   24/10/01
 // TGeoPcon::Contains() implemented by Mihaela Gheata
 
@@ -215,11 +215,7 @@ Double_t TGeoPcon::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_
    saf[0] = TMath::Min(safz1, safz2);
    // determine which z segment contains the point
    Int_t ipl = TMath::BinarySearch(fNz, fZ, point[2]);
-   if (ipl==(fNz-1)) {
-      // point on end z plane
-      if (safe) *safe=0;
-      return 0;
-   }
+   if (ipl==(fNz-1)) ipl--;
    Double_t dz = 0.5*(fZ[ipl+1]-fZ[ipl]);
    // determine if the current segment is a tube or a cone
    Bool_t intub = kTRUE;
@@ -234,16 +230,17 @@ Double_t TGeoPcon::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_
    point_new[2] = point[2]-0.5*(fZ[ipl]+fZ[ipl+1]);
    
    Double_t phi1 = fPhi1;
-   Double_t phi2 = fPhi1+fDphi;
+   if (phi1<0) phi1+=360.;
+   Double_t phi2 = phi1+fDphi;
    if (intub) {
       if (inphi) snxt=TGeoTubeSeg::DistToOutS(&point_new[0], dir, iact, step, &saf[1], 
                                               fRmin[ipl], fRmax[ipl],dz, phi1, phi2); 
       else snxt=TGeoTube::DistToOutS(&point_new[0], dir, iact, step, &saf[1], fRmin[ipl], fRmax[ipl],dz);
    } else {
       if (inphi) snxt=TGeoConeSeg::DistToOutS(&point_new[0], dir, iact, step, &saf[1],
-                                 dz, fRmin[ipl], fRmax[ipl], fRmin[ipl+1], fRmax[ipl+1], phi1,phi2);
+                                 fRmin[ipl], fRmax[ipl], -dz, fRmin[ipl+1], fRmax[ipl+1], dz, phi1,phi2);
       else snxt=TGeoCone::DistToOutS(&point_new[0], dir, iact, step, &saf[1],
-                                 dz, fRmin[ipl], fRmax[ipl], fRmin[ipl+1], fRmax[ipl+1]);
+                                 fRmin[ipl], fRmax[ipl], -dz, fRmin[ipl+1], fRmax[ipl+1], dz);
    }                              
 
    if (iact<3 && safe) {
@@ -281,29 +278,17 @@ Double_t TGeoPcon::DistToSegZ(Double_t *point, Double_t *dir, Int_t &iz, Double_
    Double_t rmin2=fRmin[iz+1];
    Double_t rmax2=fRmax[iz+1];
    Bool_t is_seg=(fDphi==360)?kFALSE:kTRUE;
-   Double_t r2=point[0]*point[0]+point[1]*point[1];
    
+   Double_t phi1 = fPhi1;
+   if (phi1<0) phi1+=360.;
+   Double_t phi2 = phi1+fDphi;
+
    if ((rmin1==rmin2) && (rmax1==rmax2)) {
       if (!is_seg) snxt=TGeoTube::DistToInS(&local[0], dir, rmin1, rmax1, dz);
       else snxt=TGeoTubeSeg::DistToInS(&local[0], dir, rmin1, rmax1, dz, c1, s1, c2, s2, cfio, sfio, cdfi);
    } else {  
-      Double_t ro1=0.5*(rmin1+rmin2);
-      Double_t tg1=0.5*(rmin2-rmin1)/dz;
-      Double_t cr1=1./TMath::Sqrt(1.0+tg1*tg1);
-      Double_t zv1=kBig;
-      if (rmin1!=rmin2) zv1=-ro1/tg1;
-      Double_t ro2=0.5*(rmax1+rmax2);
-      Double_t tg2=0.5*(rmax2-rmax1)/dz;
-      Double_t cr2=1./TMath::Sqrt(1.0+tg2*tg2);
-      Double_t zv2=kBig;
-      if (rmax1!=rmax2) zv2=-ro2/tg2;
-      Double_t rin=TMath::Abs(tg1*local[2]+ro1);
-      Double_t rout=TMath::Abs(tg2*local[2]+ro2);
-   
-      if (!is_seg) snxt=TGeoCone::DistToInS(&local[0],dir,rmin1, rmax1, rmin2, rmax2, dz,
-                                              ro1,tg1,cr1,zv1,ro2,tg2,cr2,zv2,r2,rin,rout);
-      else snxt=TGeoConeSeg::DistToInS(&local[0],dir,rmin1, rmax1, rmin2, rmax2, dz,
-                           ro1,tg1,cr1,zv1,ro2,tg2,cr2,zv2,r2,rin,rout,c1, s1, c2, s2, cfio,sfio,cdfi);
+      if (!is_seg) snxt=TGeoCone::DistToInS(&local[0],dir,rmin1, rmax1, -dz, rmin2, rmax2, dz);
+      else snxt=TGeoConeSeg::DistToInS(&local[0],dir,rmin1, rmax1, -dz, rmin2, rmax2, dz, phi1, phi2);
    }
    if (snxt<1E20) return snxt;
    // check next segment
@@ -424,7 +409,7 @@ Double_t TGeoPcon::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return DistToSegZ(point,dir,ifirst, c1,s1,c2,s2,cfio,sfio,cdfi);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPcon::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoPcon::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
@@ -522,7 +507,7 @@ TGeoVolume *TGeoPcon::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxi
    }
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoPcon::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoPcon::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -580,12 +565,12 @@ void TGeoPcon::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintPcon(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-void TGeoPcon::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoPcon::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPcon::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoPcon::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoPgon.cxx b/geom/src/TGeoPgon.cxx
index ee5c54460a21d23047cbf5ce11b52c838b5ab9ec..cc2f35a86f342c27f4f49dd77794f1b1e0ad33f2 100644
--- a/geom/src/TGeoPgon.cxx
+++ b/geom/src/TGeoPgon.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoPgon.cxx,v 1.6 2002/10/11 16:41:53 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoPgon.cxx,v 1.7 2002/10/13 15:45:24 brun Exp $
 // Author: Andrei Gheata   31/01/02
 // TGeoPgon::Contains() implemented by Mihaela Gheata
 
@@ -446,7 +446,7 @@ Double_t TGeoPgon::DistToOutSect(Double_t *point, Double_t *dir, Int_t &iz, Int_
 //   if (imin==0)
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPgon::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_t step, Double_t *safe) const
+Double_t TGeoPgon::DistToOut(Double_t *point, Double_t *dir, Int_t /*iact*/, Double_t /*step*/, Double_t * /*safe*/) const
 {
 // compute distance from inside point to surface of the polygone
    // first find out in which Z section the point is in
@@ -659,7 +659,7 @@ Double_t TGeoPgon::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
 
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPgon::DistToInSect(Double_t *point, Double_t *dir, Int_t &iz, Int_t &ipsec, 
+Double_t TGeoPgon::DistToInSect(Double_t *point, Double_t *dir, Int_t &iz, Int_t & /*ipsec*/, 
                                 UChar_t &bits, Double_t *saf) const 
 {
    // propagate to next Z plane
@@ -799,7 +799,7 @@ Int_t TGeoPgon::DistancetoPrimitive(Int_t px, Int_t py)
    return ShapeDistancetoPrimitive(numPoints, px, py);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPgon::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoPgon::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
@@ -886,7 +886,7 @@ TGeoVolume *TGeoPgon::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxi
    }
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoPgon::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoPgon::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -941,16 +941,16 @@ void TGeoPgon::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintPcon(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-void TGeoPgon::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoPgon::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoPgon::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoPgon::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
-   return 0.0;
+   return kBig;
 }
 //-----------------------------------------------------------------------------
 void TGeoPgon::SetDimensions(Double_t *param)
diff --git a/geom/src/TGeoSphere.cxx b/geom/src/TGeoSphere.cxx
index 606416e830438d3e37fe31f507f15b5aa8cd4192..45f2adc4e291bd3b859fbae92d55792932a6279b 100644
--- a/geom/src/TGeoSphere.cxx
+++ b/geom/src/TGeoSphere.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoSphere.cxx,v 1.4 2002/09/27 16:16:06 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoSphere.cxx,v 1.5 2002/10/08 16:17:49 brun Exp $
 // Author: Andrei Gheata   31/01/02
 // TGeoSphere::Contains() DistToOut() implemented by Mihaela Gheata
 
@@ -71,7 +71,7 @@ TGeoSphere::TGeoSphere(const char *name, Double_t rmin, Double_t rmax, Double_t
    SetNumberOfDivisions(20);
 }
 //-----------------------------------------------------------------------------
-TGeoSphere::TGeoSphere(Double_t *param, Int_t nparam)
+TGeoSphere::TGeoSphere(Double_t *param, Int_t /*nparam*/)
            :TGeoBBox(0, 0, 0)
 {
 // Default constructor specifying minimum and maximum radius
@@ -186,11 +186,11 @@ Bool_t TGeoSphere::Contains(Double_t *point) const
    return kTRUE;
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoSphere::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoSphere::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
-   return kBig;;
+   return kBig;
 }
 //-----------------------------------------------------------------------------
 Int_t TGeoSphere::DistancetoPrimitive(Int_t px, Int_t py)
@@ -328,7 +328,7 @@ Double_t TGeoSphere::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Doubl
    return kBig;            
 }   
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoSphere::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoSphere::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -391,12 +391,12 @@ void TGeoSphere::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintSphere(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-void TGeoSphere::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoSphere::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoSphere::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoSphere::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoTrd1.cxx b/geom/src/TGeoTrd1.cxx
index c1f5a01cd88c7d356e67d23d138b5b9c24489270..9b9762b9488a0f808e5db400c641cb16a701cb89 100644
--- a/geom/src/TGeoTrd1.cxx
+++ b/geom/src/TGeoTrd1.cxx
@@ -236,7 +236,7 @@ void TGeoTrd1::GetVisibleCorner(Double_t *point, Double_t *vertex, Double_t *nor
    SetVertex(vertex);
 }
 //-----------------------------------------------------------------------------
-void TGeoTrd1::GetOppositeCorner(Double_t *point, Int_t inorm, Double_t *vertex, Double_t *normals) const
+void TGeoTrd1::GetOppositeCorner(Double_t * /*point*/, Int_t inorm, Double_t *vertex, Double_t *normals) const
 {
 // get the opposite corner of the intersected face
    TGeoTrd1 *trd1 = (TGeoTrd1*)this;
@@ -417,7 +417,7 @@ Double_t TGeoTrd1::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return kBig;
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTrd1::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoTrd1::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
@@ -487,7 +487,7 @@ TGeoVolume *TGeoTrd1::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxi
    }
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoTrd1::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoTrd1::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -534,16 +534,16 @@ void TGeoTrd1::InspectShape() const
    TGeoBBox::InspectShape();
 }
 //-----------------------------------------------------------------------------
-void TGeoTrd1::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoTrd1::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTrd1::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoTrd1::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
-   return 0.0;
+   return kBig;
 }
 //-----------------------------------------------------------------------------
 void TGeoTrd1::SetDimensions(Double_t *param)
diff --git a/geom/src/TGeoTrd2.cxx b/geom/src/TGeoTrd2.cxx
index d65fdee85bf5e00c0f9e51eb4347a668099a24fb..ededb95e93dcf7a4d46e01907af5c946a8e0a37b 100644
--- a/geom/src/TGeoTrd2.cxx
+++ b/geom/src/TGeoTrd2.cxx
@@ -373,11 +373,11 @@ Double_t TGeoTrd2::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return kBig;
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTrd2::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoTrd2::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
-   return 0.0;
+   return kBig;
 }
 //-----------------------------------------------------------------------------
 void TGeoTrd2::GetVisibleCorner(Double_t *point, Double_t *vertex, Double_t *normals) const
@@ -425,7 +425,7 @@ void TGeoTrd2::GetVisibleCorner(Double_t *point, Double_t *vertex, Double_t *nor
    SetVertex(vertex);
 }
 //-----------------------------------------------------------------------------
-void TGeoTrd2::GetOppositeCorner(Double_t *point, Int_t inorm, Double_t *vertex, Double_t *normals) const
+void TGeoTrd2::GetOppositeCorner(Double_t * /*point*/, Int_t inorm, Double_t *vertex, Double_t *normals) const
 {
 // get the opposite corner of the intersected face
    TGeoTrd2 *trd2 = (TGeoTrd2*)this;
@@ -497,7 +497,7 @@ TGeoVolume *TGeoTrd2::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxi
    }
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoTrd2::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoTrd2::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -547,12 +547,12 @@ void TGeoTrd2::InspectShape() const
    TGeoBBox::InspectShape();
 }
 //-----------------------------------------------------------------------------
-void TGeoTrd2::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoTrd2::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTrd2::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoTrd2::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoTube.cxx b/geom/src/TGeoTube.cxx
index 95c2e2eabf93029ed4f8d7d9e1acbb02a455bee2..61c05e7b80233def3ebcab7e1abd5ff572041489 100644
--- a/geom/src/TGeoTube.cxx
+++ b/geom/src/TGeoTube.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoTube.cxx,v 1.5 2002/09/27 16:16:06 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoTube.cxx,v 1.6 2002/10/08 16:17:49 brun Exp $
 // Author: Andrei Gheata   24/10/01
 // TGeoTube::Contains() and DistToOut/In() implemented by Mihaela Gheata
 
@@ -321,11 +321,11 @@ Double_t TGeoTube::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Double_t
    return DistToInS(point, dir, fRmin, fRmax, fDz);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTube::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoTube::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
-   return 0.0;
+   return kBig;
 }
 //-----------------------------------------------------------------------------
 TGeoVolume *TGeoTube::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
@@ -495,12 +495,12 @@ void TGeoTube::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintTube(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-void TGeoTube::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoTube::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTube::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoTube::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
@@ -1073,7 +1073,7 @@ Double_t TGeoTubeSeg::DistToIn(Double_t *point, Double_t *dir, Int_t iact, Doubl
    return TGeoTubeSeg::DistToInS(point, dir, fRmin, fRmax, fDz, c1, s1, c2, s2, cfio, sfio, cdfi);
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTubeSeg::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoTubeSeg::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
@@ -1254,12 +1254,12 @@ void TGeoTubeSeg::PaintNext(TGeoHMatrix *glmat, Option_t *option)
    painter->PaintTubs(this, option, glmat);
 }
 //-----------------------------------------------------------------------------
-void TGeoTubeSeg::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoTubeSeg::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoTubeSeg::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoTubeSeg::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
@@ -1855,21 +1855,21 @@ Double_t TGeoCtub::DistToOut(Double_t *point, Double_t *dir, Int_t iact, Double_
    return TMath::Min(TMath::Min(sz,sr), sfmin);      
 }   
 //-----------------------------------------------------------------------------
-Double_t TGeoCtub::DistToSurf(Double_t *point, Double_t *dir) const
+Double_t TGeoCtub::DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
 {
 // computes the distance to next surface of the sphere along a ray
 // starting from given point to the given direction.
    return kBig;
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoCtub::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, 
-                             Double_t start, Double_t step) 
+TGeoVolume *TGeoCtub::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Int_t /*ndiv*/, 
+                             Double_t /*start*/, Double_t /*step*/) 
 {
    Warning("Divide", "Division of a cut tube not implemented");
    return voldiv;
 }   
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoCtub::Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Double_t step) 
+TGeoVolume *TGeoCtub::Divide(TGeoVolume *voldiv, const char * /*divname*/, Int_t /*iaxis*/, Double_t /*step*/) 
 {
 // Divide all range of iaxis in range/step cells 
    Error("Divide", "Division in all range not implemented");
@@ -1912,12 +1912,12 @@ void TGeoCtub::InspectShape() const
    TGeoTubeSeg::InspectShape();
 }
 //-----------------------------------------------------------------------------
-void TGeoCtub::NextCrossing(TGeoParamCurve *c, Double_t *point) const
+void TGeoCtub::NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
 {
 // computes next intersection point of curve c with this shape
 }
 //-----------------------------------------------------------------------------
-Double_t TGeoCtub::Safety(Double_t *point, Double_t *spoint, Option_t *option) const
+Double_t TGeoCtub::Safety(Double_t * /*point*/, Double_t * /*spoint*/, Option_t * /*option*/) const
 {
 // computes the closest distance from given point to this shape, according
 // to option. The matching point on the shape is stored in spoint.
diff --git a/geom/src/TGeoVolume.cxx b/geom/src/TGeoVolume.cxx
index b6c14a3bcb95379acd52bdb77b4f9ddf3d592763..cb2fc1f8fdf47eda2efa26850a5ebd168246336e 100644
--- a/geom/src/TGeoVolume.cxx
+++ b/geom/src/TGeoVolume.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoVolume.cxx,v 1.11 2002/10/21 15:21:13 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoVolume.cxx,v 1.12 2002/11/20 08:55:10 brun Exp $
 // Author: Andrei Gheata   30/05/02
 // Divide() implemented by Mihaela Gheata
 
@@ -161,7 +161,7 @@ void TGeoVolume::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Do
    TGeoVolume *old_vol = gGeoManager->GetTopVolume();
    if (old_vol!=this) gGeoManager->SetTopVolume((TGeoVolume*)this);
    else old_vol=0;
-   gGeoManager->GetTopVolume()->DrawOnly();
+   gGeoManager->GetTopVolume()->Draw();
    TVirtualGeoPainter *painter = gGeoManager->GetGeomPainter();
    if (!painter) {
       Error("CheckGeometry", "Could not instanciate painter");
@@ -294,7 +294,7 @@ void TGeoVolume::AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat, Option
    node->SetName(name);
 }
 //-----------------------------------------------------------------------------
-void TGeoVolume::AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset, Option_t *option)
+void TGeoVolume::AddNodeOffset(TGeoVolume *vol, Int_t copy_no, Double_t offset, Option_t * /*option*/)
 {
 // Add a division node to the list of nodes. The method is called by
 // TGeoVolume::Divide() for creating the division nodes.
@@ -333,27 +333,27 @@ void TGeoVolume::AddNodeOverlap(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat,
    }        
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoVolume::Divide(const char *divname, Int_t ndiv, Option_t *option)
+TGeoVolume *TGeoVolume::Divide(const char * /*divname*/, Int_t /*ndiv*/, Option_t * /*option*/)
 {
    Error("Divide", "This type of division not implemenetd");
    return this; 
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoVolume::Divide(const char *divname, Int_t ndiv, Double_t start, Double_t step, Option_t *option)
+TGeoVolume *TGeoVolume::Divide(const char * /*divname*/, Int_t /*ndiv*/, Double_t /*start*/, Double_t /*step*/, Option_t * /*option*/)
 {
 // divide this volume in ndiv pieces from start, with given step
    Error("Divide", "This type of division not implemenetd");
    return this; 
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoVolume::Divide(const char *divname, Double_t start, Double_t end, Double_t step, Option_t *option)
+TGeoVolume *TGeoVolume::Divide(const char * /*divname*/, Double_t /*start*/, Double_t /*end*/, Double_t /*step*/, Option_t * /*option*/)
 {
 // divide this volume from start to end in pieces of length step
    Error("Divide", "This type of division not implemenetd");
    return this; 
 }
 //-----------------------------------------------------------------------------
-TGeoVolume *TGeoVolume::Divide(const char *divname, TObject *userdiv, Double_t *params, Option_t *)
+TGeoVolume *TGeoVolume::Divide(const char * /*divname*/, TObject * /*userdiv*/, Double_t * /*params*/, Option_t *)
 {
 // divide this volume according to userdiv
    Error("Divide", "This type of division not implemenetd");
@@ -722,7 +722,7 @@ void TGeoVolume::Streamer(TBuffer &R__b)
 }
 
 //-----------------------------------------------------------------------------
-void TGeoVolume::SetOption(const char *option)
+void TGeoVolume::SetOption(const char * /*option*/)
 {
 // set the current options  
 }
diff --git a/geom/src/TGeoVoxelFinder.cxx b/geom/src/TGeoVoxelFinder.cxx
index 6cfbb3e741dfb80607fb55c97c6f8b6134ec83b7..3ae156d0e9bb270d091cdbde9fe3f2c78c6a5aa3 100644
--- a/geom/src/TGeoVoxelFinder.cxx
+++ b/geom/src/TGeoVoxelFinder.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoVoxelFinder.cxx,v 1.9 2002/10/11 16:41:54 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoVoxelFinder.cxx,v 1.10 2002/10/22 07:43:12 brun Exp $
 // Author: Andrei Gheata   04/02/02
 
 /*************************************************************************
@@ -490,7 +490,7 @@ Bool_t TGeoVoxelFinder::GetNextIndices(Double_t *point, Double_t *dir)
 }
 
 //-----------------------------------------------------------------------------
-void TGeoVoxelFinder::SortCrossedVoxels(Double_t *point, Double_t *dir)
+void TGeoVoxelFinder::SortCrossedVoxels(Double_t *point, Double_t * /*dir*/)
 {
 // get the list in the next voxel crossed by a ray
    fCurrentVoxel = 0;
@@ -1526,7 +1526,7 @@ void TGeoVoxelFinder::PrintVoxelLimits(Double_t *point) const
    }
 }
 //-----------------------------------------------------------------------------
-void TGeoVoxelFinder::Voxelize(Option_t *option)
+void TGeoVoxelFinder::Voxelize(Option_t * /*option*/)
 {
 // Voxelize attached volume according to option
    BuildVoxelLimits();
@@ -1908,7 +1908,7 @@ Int_t *TGeoCylVoxels::GetCheckList(Double_t *point, Int_t &nelem)
    return TGeoVoxelFinder::GetCheckList(&ptcyl[0], nelem);
 }
 //-----------------------------------------------------------------------------
-Bool_t TGeoCylVoxels::GetNextIndices(Double_t *point, Double_t *dir)
+Bool_t TGeoCylVoxels::GetNextIndices(Double_t * /*point*/, Double_t * /*dir*/)
 {
 // Get indices for next voxel
    return kFALSE;
@@ -2071,7 +2071,7 @@ Bool_t TGeoCylVoxels::GetNextIndices(Double_t *point, Double_t *dir)
 }
 
 //-----------------------------------------------------------------------------
-Int_t *TGeoCylVoxels::GetNextVoxel(Double_t *point, Double_t *dir, Int_t &ncheck)
+Int_t *TGeoCylVoxels::GetNextVoxel(Double_t * /*point*/, Double_t * /*dir*/, Int_t & /*ncheck*/)
 {
 //--- Get the list of nodes possibly crossed by a given ray.
    return 0;
diff --git a/geompainter/src/TGeoChecker.cxx b/geompainter/src/TGeoChecker.cxx
index 26d473c2851baa00226681613f92f8ca5fbcd9af..d4b6e11b736f9ca1da3c7e4d4a4e194a456cd0dc 100644
--- a/geompainter/src/TGeoChecker.cxx
+++ b/geompainter/src/TGeoChecker.cxx
@@ -1,4 +1,4 @@
-// @(#)root/geom:$Name:  $:$Id: TGeoChecker.cxx,v 1.11 2002/11/20 08:55:10 brun Exp $
+// @(#)root/geom:$Name:  $:$Id: TGeoChecker.cxx,v 1.12 2002/11/28 08:06:57 brun Exp $
 // Author: Andrei Gheata   01/11/01
 // TGeoChecker::CheckGeometry() by Mihaela Gheata
 
@@ -57,7 +57,7 @@ TGeoChecker::TGeoChecker(TGeoManager *geom)
    fTreePts = 0;
 }
 //-----------------------------------------------------------------------------
-TGeoChecker::TGeoChecker(const char *treename, const char *filename)
+TGeoChecker::TGeoChecker(const char * /*treename*/, const char * /*filename*/)
 {
 // constructor
    fGeom = gGeoManager;
@@ -108,7 +108,7 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
    Double_t theta,phi;
    Double_t dw, dwmin, dx, dy, dz;
    Int_t ist1, ist2, ifound;
-   //TGeoNode *node;
+   TGeoNode *node;
    for (i=0; i<nrays; i++) {
       if (n10) {
          if ((i%n10) == 0) printf("%i percent\n", Int_t(100*i/nrays));
@@ -120,10 +120,10 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
       dir[2]=TMath::Cos(theta);
       // shoot direct ray
       nelem1=nelem2=0;
+//      printf("DIRECT %i\n", i);
       ShootRay(&start[0], dir[0], dir[1], dir[2], array1, nelem1, dim1);
       if (!nelem1) continue;
-//      printf("DIRECT\n");
-//      for (j=0; j<nelem1; j++) printf("%i : %g %g %g\n", j, array1[3*j], array1[3*j+1], array1[3*j+2]);
+//      for (j=0; j<nelem1; j++) printf("%i : %f %f %f\n", j, array1[3*j], array1[3*j+1], array1[3*j+2]);
       memcpy(&end[0], &array1[3*(nelem1-1)], 3*sizeof(Double_t));
       // shoot ray backwards
       ShootRay(&end[0], -dir[0], -dir[1], -dir[2], array2, nelem2, dim2, &start[0]);
@@ -142,8 +142,7 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
          memcpy(&array2[3*j], &array2[3*(nelem2-1-j)], 3*sizeof(Double_t));
          memcpy(&array2[3*(nelem2-1-j)], &dummy[0], 3*sizeof(Double_t));
       }
-//      for (j=0; j<nelem2; j++)
-//         printf("%i : %g ,%g ,%g   \n", j, array2[3*j], array2[3*j+1], array2[3*j+2]);	 
+//      for (j=0; j<nelem2; j++) printf("%i : %f ,%f ,%f   \n", j, array2[3*j], array2[3*j+1], array2[3*j+2]);	 
       if (nelem1!=nelem2) printf("nelem1=%i nelem2=%i\n", nelem1, nelem2);
       ist1 = ist2 = 0;
       // check first match
@@ -153,7 +152,7 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
       dz = array1[3*ist1+2]-array2[3*ist2+2];
       dw = dx*dir[0]+dy*dir[1]+dz*dir[2];
       fGeom->SetCurrentPoint(&array1[3*ist1]);
-      fGeom->FindNode();
+      node = fGeom->FindNode();
 //      printf("%i : %s (%g, %g, %g)\n", ist1, fGeom->GetPath(), 
 //             array1[3*ist1], array1[3*ist1+1], array1[3*ist1+2]);
       if (TMath::Abs(dw)<1E-4) {
@@ -161,8 +160,8 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
          ist2++;
       } else {
          printf("   NOT matching %i (%g, %g, %g)\n", ist2, array2[3*ist2], array2[3*ist2+1], array2[3*ist2+2]);
-	 pm = (TPolyMarker3D*)pma->At(0);
-	 pm->SetNextPoint(array2[3*ist2], array2[3*ist2+1], array2[3*ist2+2]);
+	       pm = (TPolyMarker3D*)pma->At(0);
+	       pm->SetNextPoint(array2[3*ist2], array2[3*ist2+1], array2[3*ist2+2]);
          printf("   DCLOSE=%f\n", dw);
          if (dw<0) {
             // first boundary missed on way back
@@ -174,7 +173,7 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
       
       while ((ist1<nelem1-1) && (ist2<nelem2)) {
          fGeom->SetCurrentPoint(&array1[3*ist1+3]);
-         fGeom->FindNode();
+         node = fGeom->FindNode();
 //         printf("%i : %s (%g, %g, %g)\n", ist1+1, fGeom->GetPath(), 
 //                array1[3*ist1+3], array1[3*ist1+4], array1[3*ist1+5]);
          
@@ -207,7 +206,7 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
                } else {
                // extra boundary found on way back   
                   fGeom->SetCurrentPoint(&array2[3*ist2]);
-                  fGeom->FindNode();
+                  node = fGeom->FindNode();
      	          pm = (TPolyMarker3D*)pma->At(2);
 	          pm->SetNextPoint(array2[3*ist2], array2[3*ist2+1], array2[3*ist2+2]);
                   printf("   extra boundary %i :  %s found at DCLOSE=%f\n", ist2, fGeom->GetPath(), dw);
@@ -218,7 +217,7 @@ void TGeoChecker::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, D
                if (!ifound) {
                   // point ist1+1 not found on way back
                   fGeom->SetCurrentPoint(&array1[3*ist1+3]);
-                  fGeom->FindNode();
+                  node = fGeom->FindNode();
 	          pm = (TPolyMarker3D*)pma->At(1);
 	          pm->SetNextPoint(array2[3*ist1+3], array2[3*ist1+4], array2[3*ist1+5]);
                   printf("boundary missed on way back\n");
@@ -297,7 +296,7 @@ void TGeoChecker::CheckPoint(Double_t x, Double_t y, Double_t z, Option_t *)
 //-----------------------------------------------------------------------------
 TH2F *TGeoChecker::LegoPlot(Int_t ntheta, Double_t themin, Double_t themax,
                             Int_t nphi,   Double_t phimin, Double_t phimax,
-                            Double_t rmin, Double_t rmax, Option_t *option)
+                            Double_t /*rmin*/, Double_t /*rmax*/, Option_t *option)
 {
 // Generate a lego plot fot the top volume, according to option.
    TH2F *hist = new TH2F("lego", option, nphi, phimin, phimax, ntheta, themin, themax);
@@ -711,8 +710,7 @@ void TGeoChecker::ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double
    }   
 //   fGeom->CdTop();
    Double_t *point = fGeom->GetCurrentPoint();
-   //TGeoNode *startnode, *endnode, *node;
-   TGeoNode *endnode;
+   TGeoNode *startnode, *endnode, *node;
    Bool_t is_entering;
    Double_t step, forward;
    Double_t dir[3];
@@ -720,11 +718,11 @@ void TGeoChecker::ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double
    dir[1] = diry;
    dir[2] = dirz;
    fGeom->InitTrack(start, &dir[0]);
-   fGeom->GetCurrentNode();
-   //if (fGeom->IsOutside()) startnode=0;
-//   if (startnode) printf("Startnode : %s\n", startnode->GetName());
-//   else printf("Startnode : OUTSIDE\n");
-   fGeom->FindNextBoundary();
+   startnode = fGeom->GetCurrentNode();
+   if (fGeom->IsOutside()) startnode=0;
+//   if (startnode) printf("Startnode : %s (%f,%f,%f)\n", startnode->GetName(), point[0], point[1], point[2]);
+//   else printf("Startnode : OUTSIDE (%f,%f,%f)\n", point[0], point[1], point[2]);
+   node = fGeom->FindNextBoundary();
    step = fGeom->GetStep();
 //   if (node) printf("---next : %s at step=%f\n", node->GetName(), step);
 //   else      printf("---next : OUTSIDE at step=%f\n", step);
@@ -734,8 +732,8 @@ void TGeoChecker::ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double
    while (step<1E10) {
       if (endpoint) {
          forward = dirx*(endpoint[0]-point[0])+diry*(endpoint[1]-point[1])+dirz*(endpoint[2]-point[2]);
-         if (forward<0) {
-	//    printf("exit : Passed start point. nelem=%i\n", nelem); 
+         if (forward<1E-3) {
+//	    printf("exit : Passed start point. nelem=%i\n", nelem); 
 	    return;
 	 }
       }
@@ -748,25 +746,30 @@ void TGeoChecker::ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double
 	          dim += 20;
          }
          memcpy(&array[3*nelem], point, 3*sizeof(Double_t)); 
-	//       if (endnode) printf("%i (%g, %g, %g) : %s\n", nelem, point[0], point[1], point[2], endnode->GetName());
-	//       else printf("%i (%g, %g, %g) : OUTSIDE\n", nelem, point[0], point[1], point[2]);
+//         if (endnode) printf("%i (%f, %f, %f) step=%f: %s\n", nelem, point[0], point[1], point[2], step, endnode->GetName());
+//         else printf("%i (%f, %f, %f) : OUTSIDE step=%f\n", nelem, point[0], point[1], point[2], step);
          nelem++; 
       } else {
          if (endnode==0 && step>1E10) {
-	//    printf("exit : NULL endnode. nelem=%i\n", nelem); 
+//	    printf("exit : NULL endnode. nelem=%i\n", nelem); 
 	    return;
 	 }    
-	       if (!fGeom->IsEntering()) {
-	//          if (startnode) printf("stepping from (%g, %g, %g) inside %s...\n", point[0], point[1], point[2], startnode->GetName());
-        //    else printf("stepping from (%g, %g, %g) OUTSIDE...\n", point[0], point[1], point[2]);
-	          istep = 0;
-	       }    
+         if (!fGeom->IsEntering()) {
+//            if (startnode) printf("stepping %f from (%f, %f, %f) inside %s...\n", step,point[0], point[1], point[2], startnode->GetName());
+//            else printf("stepping %f from (%f, %f, %f) OUTSIDE...\n", step,point[0], point[1], point[2]);
+            istep = 0;
+         }    
          while (!fGeom->IsEntering()) {
-	          istep++;
+            istep++;
+	    if (istep>1E3) {
+	       Error("ShootRay", "more than 1000 steps. Step was %f", step);
+	       nelem = 0;
+	       return;
+	    }   
             fGeom->SetStep(1E-5);
             endnode = fGeom->Step();
          }
-         if (istep>10) printf("%i steps\n", istep);   
+         if (istep>0) printf("%i steps\n", istep);   
          if (nelem>=dim) {
             Double_t *temparray = new Double_t[3*(dim+20)];
             memcpy(temparray, array, 3*dim*sizeof(Double_t));
@@ -775,20 +778,20 @@ void TGeoChecker::ShootRay(Double_t *start, Double_t dirx, Double_t diry, Double
 	          dim += 20;
          }
          memcpy(&array[3*nelem], point, 3*sizeof(Double_t)); 
-	//       if (endnode) printf("%i (%g, %g, %g) : %s\n", nelem, point[0], point[1], point[2], endnode->GetName());
-	//       else printf("%i (%g, %g, %g) : OUTSIDE\n", nelem, point[0], point[1], point[2]);
+//         if (endnode) printf("%i (%f, %f, %f) step=%f : %s\n", nelem, point[0], point[1], point[2], step, endnode->GetName());
+//         else printf("%i (%f, %f, %f) step=%f : OUTSIDE\n", nelem, point[0], point[1], point[2], step);
          nelem++;   
          is_entering = kTRUE;
       }
-      //startnode = endnode;    
-      fGeom->FindNextBoundary();
+      startnode = endnode;    
+      node = fGeom->FindNextBoundary();
       step = fGeom->GetStep();
-    //  if (node) printf("---next : %s at step=%f\n", node->GetName(), step);
-    //  else      printf("---next : OUTSIDE at step=%f\n", step);
+//      if (node) printf("---next : %s at step=%f\n", node->GetName(), step);
+//      else      printf("---next : OUTSIDE at step=%f\n", step);
       endnode = fGeom->Step();
       is_entering = fGeom->IsEntering();
    }
-   //printf("exit : INFINITE step. nelem=%i\n", nelem);
+//   printf("exit : INFINITE step. nelem=%i\n", nelem);
 }
 //-----------------------------------------------------------------------------
 void TGeoChecker::Test(Int_t npoints, Option_t *option)
@@ -1058,7 +1061,7 @@ Bool_t TGeoChecker::TestVoxels(TGeoVolume *vol, Int_t npoints)
    return kTRUE;      
 }
 //-----------------------------------------------------------------------------
-void TGeoChecker::CreateTree(const char *treename, const char *filename)
+void TGeoChecker::CreateTree(const char * /*treename*/, const char * /*filename*/)
 {
 // These points are stored in a tree and can be directly visualized within ROOT.
 //Begin_Html
@@ -1068,7 +1071,7 @@ void TGeoChecker::CreateTree(const char *treename, const char *filename)
 //End_Html
 }
 //-----------------------------------------------------------------------------
-void TGeoChecker::Generate(UInt_t npoint)
+void TGeoChecker::Generate(UInt_t /*npoint*/)
 {
 // Points are randomly generated inside the 
 // bounding  box of a node. For each point the distance to the nearest surface
@@ -1080,7 +1083,7 @@ void TGeoChecker::Generate(UInt_t npoint)
 //End_Html
 }
 //-----------------------------------------------------------------------------
-void TGeoChecker::Raytrace(Double_t *startpoint, UInt_t npoints)
+void TGeoChecker::Raytrace(Double_t * /*startpoint*/, UInt_t /*npoints*/)
 {
 // A second algoritm is shooting multiple rays from a given point to a geometry
 // branch and storing the intersection points with surfaces in same tree. 
@@ -1093,7 +1096,7 @@ void TGeoChecker::Raytrace(Double_t *startpoint, UInt_t npoints)
 //End_Html
 }
 //-----------------------------------------------------------------------------
-void TGeoChecker::ShowPoints(Option_t *option)
+void TGeoChecker::ShowPoints(Option_t * /*option*/)
 {
 // 
 //Begin_Html
diff --git a/geompainter/src/TGeoPainter.cxx b/geompainter/src/TGeoPainter.cxx
index 50c6f4ebc4ddbf84147880c9b8664945e4128334..0371dbc55c45b5d15c30fa84a821cb7086a626f3 100644
--- a/geompainter/src/TGeoPainter.cxx
+++ b/geompainter/src/TGeoPainter.cxx
@@ -350,7 +350,7 @@ void TGeoPainter::DrawPath(const char *path)
    fGeom->GetTopVolume()->Draw();   
 }
 //______________________________________________________________________________
-void TGeoPainter::ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py)
+void TGeoPainter::ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t /*px*/, Int_t /*py*/)
 {
 // Execute mouse actions on a given volume.
    if (!gPad) return;
@@ -376,7 +376,7 @@ void TGeoPainter::ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px,
    }
 }
 //______________________________________________________________________________
-char *TGeoPainter::GetVolumeInfo(TGeoVolume *volume, Int_t px, Int_t py) const
+char *TGeoPainter::GetVolumeInfo(TGeoVolume *volume, Int_t /*px*/, Int_t /*py*/) const
 {
    const char *snull = "";
    if (!gPad) return (char*)snull;