From 5537c3b3d410a5e54452b8be51ef64b63e02d889 Mon Sep 17 00:00:00 2001
From: Fons Rademakers <Fons.Rademakers@cern.ch>
Date: Mon, 26 Nov 2012 13:57:55 +0000
Subject: [PATCH] From Cinzia Luzzi: cleanup of the class names for the Open
 Cascade/Geom geocad interface.

git-svn-id: http://root.cern.ch/svn/root/trunk@47628 27541ba8-7e3a-0410-8455-c3a389f83636
---
 geom/geocad/Module.mk                         |   4 +-
 geom/geocad/inc/LinkDef.h                     |   2 +-
 geom/geocad/inc/{RootOCC.h => TGeoToOCC.h}    |  10 +-
 geom/geocad/inc/{TRootStep.h => TGeoToStep.h} |  18 +--
 geom/geocad/inc/{OCCStep.h => TOCCToStep.h}   |  14 +-
 .../geocad/src/{RootOCC.cxx => TGeoToOCC.cxx} | 128 +++++++++---------
 .../src/{TRootStep.cxx => TGeoToStep.cxx}     |  74 +++++-----
 .../src/{OCCStep.cxx => TOCCToStep.cxx}       |  40 +++---
 8 files changed, 140 insertions(+), 150 deletions(-)
 rename geom/geocad/inc/{RootOCC.h => TGeoToOCC.h} (96%)
 mode change 100755 => 100644
 rename geom/geocad/inc/{TRootStep.h => TGeoToStep.h} (74%)
 mode change 100755 => 100644
 rename geom/geocad/inc/{OCCStep.h => TOCCToStep.h} (91%)
 rename geom/geocad/src/{RootOCC.cxx => TGeoToOCC.cxx} (90%)
 rename geom/geocad/src/{TRootStep.cxx => TGeoToStep.cxx} (66%)
 mode change 100755 => 100644
 rename geom/geocad/src/{OCCStep.cxx => TOCCToStep.cxx} (88%)

diff --git a/geom/geocad/Module.mk b/geom/geocad/Module.mk
index 4073e5f818f..eb4e53754e6 100755
--- a/geom/geocad/Module.mk
+++ b/geom/geocad/Module.mk
@@ -18,8 +18,8 @@ GEOCADDS     := $(call stripsrc,$(MODDIRS)/G__GeoCad.cxx)
 GEOCADDO     := $(GEOCADDS:.cxx=.o)
 GEOCADDH     := $(GEOCADDS:.cxx=.h)
 
-GEOCADH1     := RootOCC.h OCCStep.h
-GEOCADH2     := TRootStep.h
+GEOCADH1     := TGeoToOCC.h TOCCToStep.h
+GEOCADH2     := TGeoToStep.h
 GEOCADH1     := $(patsubst %,$(MODDIRI)/%,$(GEOCADH1))
 GEOCADH2     := $(patsubst %,$(MODDIRI)/%,$(GEOCADH2))
 GEOCADH      := $(GEOCADH1) $(GEOCADH2)
diff --git a/geom/geocad/inc/LinkDef.h b/geom/geocad/inc/LinkDef.h
index 4af9a5f9416..c976f26c834 100755
--- a/geom/geocad/inc/LinkDef.h
+++ b/geom/geocad/inc/LinkDef.h
@@ -14,6 +14,6 @@
 #pragma link off all classes;
 #pragma link off all functions;
 
-#pragma link C++ class TRootStep+;
+#pragma link C++ class TGeoToStep+;
 
 #endif
diff --git a/geom/geocad/inc/RootOCC.h b/geom/geocad/inc/TGeoToOCC.h
old mode 100755
new mode 100644
similarity index 96%
rename from geom/geocad/inc/RootOCC.h
rename to geom/geocad/inc/TGeoToOCC.h
index 7f553975e0e..892f225811b
--- a/geom/geocad/inc/RootOCC.h
+++ b/geom/geocad/inc/TGeoToOCC.h
@@ -9,8 +9,8 @@
  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
  *************************************************************************/
 
-#ifndef ROOT_RootOCC
-#define ROOT_RootOCC
+#ifndef ROOT_TGeoToOCC
+#define ROOT_TGeoToOCC
 
 //Cascade
 #include <TopoDS_Shape.hxx>
@@ -27,7 +27,7 @@
 #include <fstream>
 
 
-class RootOCC
+class TGeoToOCC
 {
 private:
    void OCCDocCreation(); 
@@ -51,8 +51,8 @@ private:
    TopoDS_Shape fOccShape;
 
 public:
-   RootOCC(); 
-   virtual ~RootOCC();
+   TGeoToOCC(); 
+   virtual ~TGeoToOCC();
    TopoDS_Shape OCC_SimpleShape(TGeoShape *TG_Shape);
    TopoDS_Shape OCC_CompositeShape(TGeoCompositeShape *cs, TGeoHMatrix matrix);
    TopoDS_Shape Reverse(TopoDS_Shape Shape);
diff --git a/geom/geocad/inc/TRootStep.h b/geom/geocad/inc/TGeoToStep.h
old mode 100755
new mode 100644
similarity index 74%
rename from geom/geocad/inc/TRootStep.h
rename to geom/geocad/inc/TGeoToStep.h
index 896a89ef22e..785c59ebc14
--- a/geom/geocad/inc/TRootStep.h
+++ b/geom/geocad/inc/TGeoToStep.h
@@ -9,30 +9,30 @@
  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
  *************************************************************************/
 
-#ifndef ROOT_TRootStep
-#define ROOT_TRootStep
+#ifndef ROOT_TGeoToStep
+#define ROOT_TGeoToStep
 
 #ifndef ROOT_TObject
 #include "TObject.h"
 #endif
 
 class TGeoManager;
-class OCCStep;
+class TOCCToStep;
 
 
-class TRootStep: public TObject {
+class TGeoToStep: public TObject {
 
 protected:
    TGeoManager *fGeometry; //ROOT geometry pointer
-   OCCStep *fCreate;       //OCC geometry build based on Root one
+   TOCCToStep *fCreate;       //OCC geometry build based on Root one
 
 public:
-   TRootStep(); 
-   TRootStep(TGeoManager *geom);
-   ~TRootStep();
+   TGeoToStep(); 
+   TGeoToStep(TGeoManager *geom);
+   ~TGeoToStep();
    void *CreateGeometry();
 
-   ClassDef(TRootStep,0)
+   ClassDef(TGeoToStep,0)
 };
 
 #endif
diff --git a/geom/geocad/inc/OCCStep.h b/geom/geocad/inc/TOCCToStep.h
similarity index 91%
rename from geom/geocad/inc/OCCStep.h
rename to geom/geocad/inc/TOCCToStep.h
index 5a016278b39..1d5c3b2c5ec 100644
--- a/geom/geocad/inc/OCCStep.h
+++ b/geom/geocad/inc/TOCCToStep.h
@@ -9,8 +9,8 @@
  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
  *************************************************************************/
  
-#ifndef ROOT_OCCStep
-#define ROOT_OCCStep
+#ifndef ROOT_TOCCToStep
+#define ROOT_TOCCToStep
 
 #ifndef ROOT_TGeoNode
 #include "TGeoNode.h"
@@ -18,8 +18,8 @@
 #ifndef ROOT_TGeoMatrix
 #include "TGeoMatrix.h"
 #endif
-#ifndef ROOT_RootOCC
-#include "RootOCC.h"
+#ifndef ROOT_TGeoToOCC
+#include "TGeoToOCC.h"
 #endif
 
 #include <TDF_Label.hxx>
@@ -30,7 +30,7 @@
 #include <TopoDS_Shape.hxx>
 
 
-class OCCStep {
+class TOCCToStep {
 
 private:
    typedef std::map <TGeoVolume *, TDF_Label> LabelMap_t;
@@ -39,7 +39,7 @@ private:
    Handle(TDocStd_Document) fDoc;    //the step document element
    LabelMap_t               fTree;   //tree of Label's volumes
    TDF_Label                fLabel;  //label of the OCC shape elemet
-   RootOCC                  fRootShape;
+   TGeoToOCC                  fRootShape;
    TopoDS_Shape             fShape;  //OCC shape (translated root shape)
 
    void            OCCDocCreation();
@@ -50,7 +50,7 @@ private:
    TopLoc_Location CalcLocation(TGeoHMatrix matrix);
 
 public:
-   OCCStep();
+   TOCCToStep();
    void      PrintAssembly();
    TDF_Label OCCShapeCreation(TGeoManager *m);
    void      OCCTreeCreation(TGeoManager *m);
diff --git a/geom/geocad/src/RootOCC.cxx b/geom/geocad/src/TGeoToOCC.cxx
similarity index 90%
rename from geom/geocad/src/RootOCC.cxx
rename to geom/geocad/src/TGeoToOCC.cxx
index 6af2ba797a7..6fdd545170a 100644
--- a/geom/geocad/src/RootOCC.cxx
+++ b/geom/geocad/src/TGeoToOCC.cxx
@@ -10,7 +10,7 @@
  *************************************************************************/
 
 ////////////////////////////////////////////////////////////////////////////////
-// RootOCC Class                                                              //
+// TGeoToOCC Class                                                              //
 // --------------------                                                       //
 //                                                                            //
 //   This class contains implementation of converting ROOT's                  //
@@ -44,7 +44,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 
-#include "RootOCC.h"
+#include "TGeoToOCC.h"
+
 
 //Cascade
 
@@ -96,6 +97,7 @@
 #include "TString.h"
 #include "TClass.h"
 #include "TGeoBoolNode.h"
+#include "TGeoShapeAssembly.h"
 #include "TGeoTrd1.h"
 #include "TGeoTrd2.h"
 #include "TGeoArb8.h"
@@ -112,103 +114,104 @@
 #include "TGeoMatrix.h"
 
 
-RootOCC::RootOCC():fOccShape()
+
+TGeoToOCC::TGeoToOCC():fOccShape()
 {	
 
 }
 
-RootOCC::~RootOCC()
+TGeoToOCC::~TGeoToOCC()
 {
 	
 }
 
-TopoDS_Shape RootOCC::OCC_SimpleShape(TGeoShape *TG_Shape)
+TopoDS_Shape TGeoToOCC::OCC_SimpleShape(TGeoShape *TG_Shape)
 {
    TString type = TG_Shape->IsA()->GetName();
    out.open("/tmp/TGeoCad.log",ios::app);
    out<<"Translating: "<<type<<endl;
    out.close();
-   if(type=="TGeoTube") {
+   if(TG_Shape->IsA()==TGeoTube::Class()) {
       TGeoTube* TG_Tube=(TGeoTube*)TG_Shape;
       return OCC_Tube(TG_Tube->GetRmin(), TG_Tube->GetRmax(),TG_Tube->GetDz(),0, 0);
-   } else if(type=="TGeoTubeSeg") {
+   } else if(TG_Shape->IsA()==TGeoTubeSeg::Class()) {
       TGeoTubeSeg* TG_TubeSeg=(TGeoTubeSeg*)TG_Shape;
       Double_t r = (TG_TubeSeg->GetPhi2()-TG_TubeSeg->GetPhi1());
-      return OCC_Tube(TG_TubeSeg->GetRmin(), TG_TubeSeg->GetRmax(),TG_TubeSeg->GetDz(),(TG_TubeSeg->GetPhi1())*PI/180., r*PI/180.);
-   } else if(type=="TGeoEltu") {
+      return OCC_Tube(TG_TubeSeg->GetRmin(), TG_TubeSeg->GetRmax(),TG_TubeSeg->GetDz(),(TG_TubeSeg->GetPhi1())*M_PI/180., r*M_PI/180.);
+   } else if(TG_Shape->IsA()==TGeoEltu::Class()) {
       TGeoEltu* TG_Eltu=(TGeoEltu*)TG_Shape;
       return OCC_EllTube(TG_Eltu->GetA(),TG_Eltu->GetB() , TG_Eltu->GetDz());
-   } else if(type=="TGeoCtub") {
+   } else if(TG_Shape->IsA()==TGeoCtub::Class()) {
       TGeoCtub* TG_Ctub=(TGeoCtub*)TG_Shape;
       Double_t r = (TG_Ctub->GetPhi2()-TG_Ctub->GetPhi1());
       return OCC_Cuttub(TG_Ctub->GetRmin(), TG_Ctub->GetRmax(),  TG_Ctub->GetDz(),
-      TG_Ctub->GetPhi1()*PI/180.,r*PI/180.,TG_Ctub->GetNlow(),TG_Ctub->GetNhigh());
-   } else if(type=="TGeoCone") {
+      TG_Ctub->GetPhi1()*M_PI/180.,r*M_PI/180.,TG_Ctub->GetNlow(),TG_Ctub->GetNhigh());
+   } else if(TG_Shape->IsA()==TGeoCone::Class()) {
       TGeoCone* TG_Cone=(TGeoCone*)TG_Shape;
-      return OCC_Cones(TG_Cone->GetRmin1(),TG_Cone->GetRmax1(),TG_Cone->GetRmin2(), TG_Cone->GetRmax2(),TG_Cone->GetDz(), 0, 2*PI);
-   } else if(type=="TGeoConeSeg") {
+      return OCC_Cones(TG_Cone->GetRmin1(),TG_Cone->GetRmax1(),TG_Cone->GetRmin2(), TG_Cone->GetRmax2(),TG_Cone->GetDz(), 0, 2*M_PI);
+   } else if(TG_Shape->IsA()==TGeoConeSeg::Class()) {
       TGeoConeSeg* TG_ConeSeg=(TGeoConeSeg*)TG_Shape;
       Double_t r  = (TG_ConeSeg->GetPhi2()-TG_ConeSeg->GetPhi1());
       return OCC_Cones(TG_ConeSeg->GetRmin1(), TG_ConeSeg->GetRmax1(),TG_ConeSeg->GetRmin2(), TG_ConeSeg->GetRmax2(), 
-      TG_ConeSeg->GetDz(), (TG_ConeSeg->GetPhi1())*PI/180., r*PI/180.);
-   } else if(type=="TGeoTorus") {
+      TG_ConeSeg->GetDz(), (TG_ConeSeg->GetPhi1())*M_PI/180., r*M_PI/180.);
+   } else if(TG_Shape->IsA()==TGeoTorus::Class()) {
       TGeoTorus* TG_Torus=(TGeoTorus*)TG_Shape;
       Double_t DPhi=(Double_t)TG_Torus->GetDphi()-TG_Torus->GetPhi1();
       if (DPhi<0)
       DPhi=(Double_t)TG_Torus->GetPhi1()-TG_Torus->GetDphi();
       Double_t Phi1= (Double_t)TG_Torus->GetPhi1();
       return OCC_Torus((Double_t)TG_Torus->GetRmin(),(Double_t)TG_Torus->GetRmax(),(Double_t)TG_Torus->GetR(), 
-      Phi1*PI/180., DPhi*PI/180.);
-   } else if(type=="TGeoSphere") {
+      Phi1*M_PI/180., DPhi*M_PI/180.);
+   } else if(TG_Shape->IsA()==TGeoSphere::Class()) {
       TGeoSphere* TG_Sphere=(TGeoSphere*)TG_Shape;
       Double_t DPhi = (TG_Sphere->GetPhi2()-TG_Sphere->GetPhi1());
       Double_t DTheta = (TG_Sphere->GetTheta2()-TG_Sphere->GetTheta1());
-      return OCC_Sphere(TG_Sphere->GetRmin(), TG_Sphere->GetRmax(),(TG_Sphere->GetPhi1())*PI/180., DPhi*PI/180.,
-      TG_Sphere->GetTheta1()*PI/180., DTheta*PI/180.);
-   } else if(type=="TGeoPcon") {
+      return OCC_Sphere(TG_Sphere->GetRmin(), TG_Sphere->GetRmax(),(TG_Sphere->GetPhi1())*M_PI/180., DPhi*M_PI/180.,
+      TG_Sphere->GetTheta1()*M_PI/180., DTheta*M_PI/180.);
+   } else if(TG_Shape->IsA()==TGeoPcon::Class()) {
       TGeoPcon* TG_Pcon=(TGeoPcon*)TG_Shape;
-      return OCC_Pcon((TG_Pcon->GetPhi1())*PI/180.,
-      (TG_Pcon->GetDphi())*PI/180.,TG_Pcon->GetNz(),TG_Pcon->GetRmin(),TG_Pcon->GetRmax(),TG_Pcon->GetZ());
-   } else if(type=="TGeoPgon") {
+      return OCC_Pcon((TG_Pcon->GetPhi1())*M_PI/180.,
+      (TG_Pcon->GetDphi())*M_PI/180.,TG_Pcon->GetNz(),TG_Pcon->GetRmin(),TG_Pcon->GetRmax(),TG_Pcon->GetZ());
+   } else if(TG_Shape->IsA()==TGeoPgon::Class()) {
       TGeoPgon* TG_Pgon=(TGeoPgon*)TG_Shape;
       Int_t numpoints=TG_Pgon->GetNmeshVertices();
       Double_t *p = new Double_t[3*numpoints];
       TG_Pgon->SetPoints(p); 
       return OCC_Pgon(TG_Pgon->GetNsegments(),TG_Pgon->GetNz(),p,TG_Pgon->GetPhi1(),TG_Pgon->GetDphi(),numpoints*3);
-   } else if(type=="TGeoHype") {
+   } else if(TG_Shape->IsA()==TGeoHype::Class()) {
       TGeoHype* TG_Hype=(TGeoHype*)TG_Shape;
       return OCC_Hype(TG_Hype->GetRmin(), TG_Hype->GetRmax(), TG_Hype->GetStIn(), TG_Hype->GetStOut(),TG_Hype->GetDz());
-   } else if(type=="TGeoXtru") {
+   } else if(TG_Shape->IsA()==TGeoXtru::Class()) {
       return OCC_Xtru((TGeoXtru*)TG_Shape);
-   } else if (type=="TGeoBBox") { 
+   } else if (TG_Shape->IsA()==TGeoBBox::Class()) { 
       TGeoBBox * TG_Box=(TGeoBBox*)TG_Shape;
       const Double_t * Origin = TG_Box->GetOrigin();
       return OCC_Box(TG_Box->GetDX(),TG_Box->GetDY(),TG_Box->GetDZ(),Origin[0],Origin[1],Origin[2]);
-   } else if (type=="TGeoTrd1") {
+   } else if (TG_Shape->IsA()==TGeoTrd1::Class()) {
       TGeoTrd1 * TG_Trd1=(TGeoTrd1*)TG_Shape;
       return OCC_Trd(TG_Trd1->GetDx1(),TG_Trd1->GetDx2(),TG_Trd1->GetDy(),TG_Trd1->GetDy(),TG_Trd1->GetDz());
-   } else if (type=="TGeoTrd2") {
+   } else if (TG_Shape->IsA()==TGeoTrd2::Class()) {
       TGeoTrd2 * TG_Trd2=(TGeoTrd2*)TG_Shape;
       return OCC_Trd(TG_Trd2->GetDx1(),TG_Trd2->GetDx2(),TG_Trd2->GetDy1(),TG_Trd2->GetDy2(),TG_Trd2->GetDz());
-   } else if (type=="TGeoArb8") {
+   } else if (TG_Shape->IsA()==TGeoArb8::Class()) {
       TGeoArb8 * TG_Arb8=(TGeoArb8*)TG_Shape;
      Double_t vertex[24];
       TG_Shape->SetPoints(vertex);
       return OCC_Arb8(TG_Arb8->GetDz(),TG_Arb8->GetVertices(),vertex);
-   } else if (type=="TGeoShapeAssembly") {
+   } else if (TG_Shape->IsA()==TGeoShapeAssembly::Class()) {
       TGeoBBox * TG_Ass=(TGeoBBox*)TG_Shape;
       return OCC_Box(TG_Ass->GetDX(),TG_Ass->GetDY(),TG_Ass->GetDZ(),0,0,0);
-   } else if (type=="TGeoPara") {
+   } else if (TG_Shape->IsA()==TGeoPara::Class()) {
       TGeoPara * TG_Para=(TGeoPara*)TG_Shape; 
       Double_t vertex[24];
       TG_Shape->SetPoints(vertex);
       return OCC_ParaTrap(vertex);
-   }  else if (type=="TGeoTrap") {
+   }  else if (TG_Shape->IsA()==TGeoTrap::Class()) {
       TGeoTrap * TG_Trap=(TGeoTrap*)TG_Shape; 
       Double_t vertex[24];
       TG_Shape->SetPoints(vertex);
       return OCC_ParaTrap(vertex);
-   } else if (type=="TGeoGtra") {
+   } else if (TG_Shape->IsA()==TGeoGtra::Class()) {
       TGeoGtra * TG_Tra=(TGeoGtra*)TG_Shape; 
       Double_t vertex[24];
       TG_Shape->SetPoints(vertex);
@@ -217,7 +220,7 @@ TopoDS_Shape RootOCC::OCC_SimpleShape(TGeoShape *TG_Shape)
       cout<<"Error, unknown form"<<endl;
 }
 
-TopoDS_Shape RootOCC::OCC_CompositeShape(TGeoCompositeShape *comp, TGeoHMatrix m)
+TopoDS_Shape TGeoToOCC::OCC_CompositeShape(TGeoCompositeShape *comp, TGeoHMatrix m)
 {
    Double_t const *t;
    Double_t const *r;
@@ -306,7 +309,7 @@ TopoDS_Shape RootOCC::OCC_CompositeShape(TGeoCompositeShape *comp, TGeoHMatrix m
    }
 }
 
-TopoDS_Shape RootOCC::OCC_EllTube(Double_t a, Double_t b, Double_t dz)
+TopoDS_Shape TGeoToOCC::OCC_EllTube(Double_t a, Double_t b, Double_t dz)
 {
    gp_Pnt p (0.,0.,-dz);
    gp_Dir d (0,0,1);
@@ -324,14 +327,14 @@ TopoDS_Shape RootOCC::OCC_EllTube(Double_t a, Double_t b, Double_t dz)
    fOccShape = BRepPrimAPI_MakePrism(f , v);
    if(a<b) {
       gp_Trsf t;
-      t.SetRotation(gp::OZ(), PI/2.);
+      t.SetRotation(gp::OZ(), M_PI/2.);
       BRepBuilderAPI_Transform brepT(fOccShape , t);
       fOccShape = brepT.Shape();
    }
    return Reverse(fOccShape);
 }
 
-TopoDS_Shape RootOCC::OCC_Torus(Double_t Rmin, Double_t Rmax, Double_t Rtor,
+TopoDS_Shape TGeoToOCC::OCC_Torus(Double_t Rmin, Double_t Rmax, Double_t Rtor,
                             Double_t SPhi, Double_t DPhi)
 {
    TopoDS_Solid torMin;
@@ -358,7 +361,7 @@ TopoDS_Shape RootOCC::OCC_Torus(Double_t Rmin, Double_t Rmax, Double_t Rtor,
 }
 
 
-TopoDS_Shape RootOCC::OCC_Sphere(Double_t rmin, Double_t rmax, 
+TopoDS_Shape TGeoToOCC::OCC_Sphere(Double_t rmin, Double_t rmax, 
                                     Double_t phi1, Double_t Dphi, 
                                     Double_t theta1, Double_t Dtheta)
 {
@@ -368,8 +371,9 @@ TopoDS_Shape RootOCC::OCC_Sphere(Double_t rmin, Double_t rmax,
    TopoDS_Edge eI;
    TopoDS_Face f;
    TopoDS_Wire w;
+   
 
-   if(rmin==0&&phi1==0&&Dphi==2*PI&&theta1==0&&Dtheta==PI) {
+   if(rmin==0&&phi1==0&&Dphi==2*M_PI&&theta1==0&&Dtheta==M_PI) {
       TopoDS_Solid s= BRepPrimAPI_MakeSphere(rmax);
       return s;
    }
@@ -405,7 +409,7 @@ TopoDS_Shape RootOCC::OCC_Sphere(Double_t rmin, Double_t rmax,
    return Reverse(fOccShape);
 }
 
-TopoDS_Shape RootOCC::OCC_Tube(Double_t rmin, Double_t rmax, 
+TopoDS_Shape TGeoToOCC::OCC_Tube(Double_t rmin, Double_t rmax, 
                            Double_t dz, Double_t phi1, 
                            Double_t phi2)
 {
@@ -415,8 +419,8 @@ TopoDS_Shape RootOCC::OCC_Tube(Double_t rmin, Double_t rmax,
    TopoDS_Shape  tubsT;
    gp_Trsf TT;
    gp_Trsf TR;
-   if (rmin==0) rmin=rmin+0.000001;
-   if (rmax==0)rmax=rmax+0.000001;
+   if (rmin==0) rmin=rmin+0.00001;
+   if (rmax==0) rmax=rmax+0.00001;
    if (phi1==0&&phi2==0) { 
      innerCyl = BRepPrimAPI_MakeCylinder(rmin,dz*2);
      outerCyl = BRepPrimAPI_MakeCylinder(rmax,dz*2);
@@ -443,7 +447,7 @@ TopoDS_Shape RootOCC::OCC_Tube(Double_t rmin, Double_t rmax,
    return  Reverse(fOccShape);
 }
 
-TopoDS_Shape RootOCC::OCC_Cones(Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t dz, Double_t phi1, Double_t phi2)
+TopoDS_Shape TGeoToOCC::OCC_Cones(Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t dz, Double_t phi1, Double_t phi2)
 {
    TopoDS_Solid innerCon;
    TopoDS_Solid  outerCon;
@@ -474,7 +478,7 @@ TopoDS_Shape RootOCC::OCC_Cones(Double_t rmin1, Double_t rmax1, Double_t rmin2,
    return Reverse(fOccShape);
 }
 
-TopoDS_Shape RootOCC::OCC_Cuttub(Double_t rmin, Double_t rmax, Double_t dz, 
+TopoDS_Shape TGeoToOCC::OCC_Cuttub(Double_t rmin, Double_t rmax, Double_t dz, 
                            Double_t phi1, Double_t Dphi,const Double_t * Nlow,const Double_t * Nhigh)
 {
    out.open("/tmp/TGeoCad.log",ios::app);
@@ -497,7 +501,6 @@ TopoDS_Shape RootOCC::OCC_Cuttub(Double_t rmin, Double_t rmax, Double_t dz,
    BRepAlgoAPI_Cut cutResult(rmaxCyl, rminCyl);
    cutResult.Build();
    tubs=cutResult.Shape();
-   //cout<<"dopo la prima cut"<<cutResult.ErrorStatus()<<endl;
    TopExp_Explorer anExp2 (tubs, TopAbs_SOLID);
    if (anExp2.More()) {
       TopoDS_Shape aTmpShape = anExp2.Current();
@@ -572,7 +575,7 @@ TopoDS_Shape RootOCC::OCC_Cuttub(Double_t rmin, Double_t rmax, Double_t dz,
 }
 
 
-TopoDS_Shape RootOCC::OCC_Xtru(TGeoXtru * TG_Xtru)
+TopoDS_Shape TGeoToOCC::OCC_Xtru(TGeoXtru * TG_Xtru)
 {
    Int_t vert=TG_Xtru->GetNvert();
    Int_t nz=TG_Xtru->GetNz();
@@ -588,7 +591,7 @@ TopoDS_Shape RootOCC::OCC_Xtru(TGeoXtru * TG_Xtru)
          y[pp]=TG_Xtru->GetYOffset(i)+(TG_Xtru->GetScale(i)*TG_Xtru->GetY(pp));
       }
       z[i]=TG_Xtru->GetZ(i);
-      w=RootOCC::Polygon(x,y,z[i],vert);
+      w=TGeoToOCC::Polygon(x,y,z[i],vert);
       sect.AddWire(w);	
    }
    sect.Build();
@@ -597,7 +600,7 @@ TopoDS_Shape RootOCC::OCC_Xtru(TGeoXtru * TG_Xtru)
 }
 
 
-TopoDS_Shape RootOCC::OCC_Hype(Double_t rmin, Double_t  rmax,Double_t  stin, Double_t stout, Double_t  dz )
+TopoDS_Shape TGeoToOCC::OCC_Hype(Double_t rmin, Double_t  rmax,Double_t  stin, Double_t stout, Double_t  dz )
 {	
    gp_Pnt p(0, 0, 0);
    gp_Dir d(0, 0, 1);
@@ -646,15 +649,15 @@ TopoDS_Shape RootOCC::OCC_Hype(Double_t rmin, Double_t  rmax,Double_t  stin, Dou
    hyW=WIRE.Wire();
    BRepBuilderAPI_MakeFace face(hyW);
    hyF=face.Face();
-   t.SetRotation(gp::OX(), PI/2.);
+   t.SetRotation(gp::OX(), M_PI/2.);
    BRepBuilderAPI_Transform TF(t);
    TF.Perform(hyF,Standard_True);
    hyF = TopoDS::Face(TF.Shape());
-   fOccShape = BRepPrimAPI_MakeRevol (hyF,gp::OZ(),2*PI);
+   fOccShape = BRepPrimAPI_MakeRevol (hyF,gp::OZ(),2*M_PI);
    return  Reverse(fOccShape);
 }
 
-TopoDS_Shape RootOCC::OCC_ParaTrap (Double_t *vertex)
+TopoDS_Shape TGeoToOCC::OCC_ParaTrap (Double_t *vertex)
 {
    BRepOffsetAPI_ThruSections sect(true,true); 
    TopoDS_Wire w;
@@ -688,7 +691,7 @@ TopoDS_Shape RootOCC::OCC_ParaTrap (Double_t *vertex)
 }
 
 
-TopoDS_Shape RootOCC::OCC_Arb8(Double_t dz, Double_t * ivert, Double_t *points)
+TopoDS_Shape TGeoToOCC::OCC_Arb8(Double_t dz, Double_t * ivert, Double_t *points)
 {
    out.open("/tmp/TGeoCad.log",ios::app);
    TopoDS_Shell newShell;
@@ -704,8 +707,6 @@ TopoDS_Shape RootOCC::OCC_Arb8(Double_t dz, Double_t * ivert, Double_t *points)
    BRepBuilderAPI_MakePolygon poly1,poly2,poly3,poly4,poly5,poly6;
    Int_t x=0,y=0,z=0;
    gp_Pnt point;
-   for (Int_t i=0;i<16;i++) 
-    out<<"ivert["<<i<<"]="<<ivert[i]<<endl;
    for (Int_t i=0;i<8;i++) {
      
       x=count++;y=count++;z=count++;
@@ -821,7 +822,7 @@ TopoDS_Shape RootOCC::OCC_Arb8(Double_t dz, Double_t * ivert, Double_t *points)
 
 
 
-TopoDS_Shape RootOCC::OCC_Box(Double_t dx, Double_t dy, Double_t dz, Double_t OX, Double_t OY, Double_t OZ )
+TopoDS_Shape TGeoToOCC::OCC_Box(Double_t dx, Double_t dy, Double_t dz, Double_t OX, Double_t OY, Double_t OZ )
 {
    TopoDS_Solid box;
    if (dz==0)dz=0.1;
@@ -831,7 +832,7 @@ TopoDS_Shape RootOCC::OCC_Box(Double_t dx, Double_t dy, Double_t dz, Double_t OX
 }
 
 
-TopoDS_Shape RootOCC::OCC_Trd(Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
+TopoDS_Shape TGeoToOCC::OCC_Trd(Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
 {
    TopoDS_Wire wire;
    BRepOffsetAPI_ThruSections sect(true,true); 
@@ -871,7 +872,7 @@ TopoDS_Shape RootOCC::OCC_Trd(Double_t dx1, Double_t dx2, Double_t dy1, Double_t
    return fOccShape;
 }
 
-TopoDS_Wire RootOCC::Polygon(Double_t *x, Double_t *y, Double_t z, Int_t num )
+TopoDS_Wire TGeoToOCC::Polygon(Double_t *x, Double_t *y, Double_t z, Int_t num )
 {
    BRepBuilderAPI_MakePolygon poly;
    TopoDS_Wire w ;
@@ -886,7 +887,7 @@ TopoDS_Wire RootOCC::Polygon(Double_t *x, Double_t *y, Double_t z, Int_t num )
 }
 
 
-TopoDS_Shape RootOCC::OCC_Pcon(Double_t startPhi, Double_t deltaPhi, 
+TopoDS_Shape TGeoToOCC::OCC_Pcon(Double_t startPhi, Double_t deltaPhi, 
                           Int_t zNum, Double_t *rMin, Double_t *rMax, Double_t *z)
 {
    
@@ -922,7 +923,7 @@ TopoDS_Shape RootOCC::OCC_Pcon(Double_t startPhi, Double_t deltaPhi,
 }
 
  
-TopoDS_Shape RootOCC::OCC_Pgon(Int_t np, Int_t nz, Double_t * p, Double_t phi1, Double_t DPhi, Int_t numpoint)
+TopoDS_Shape TGeoToOCC::OCC_Pgon(Int_t np, Int_t nz, Double_t * p, Double_t phi1, Double_t DPhi, Int_t numpoint)
 {  
    BRepOffsetAPI_ThruSections sectInner(true,true); 
    BRepOffsetAPI_ThruSections sectOuter(true,true);
@@ -959,7 +960,6 @@ TopoDS_Shape RootOCC::OCC_Pgon(Int_t np, Int_t nz, Double_t * p, Double_t phi1,
          for (Int_t h=0;h<nzvert;h++){
             xx=p[ind++];yy=p[ind++];zz=p[ind++]; 
             point=gp_Pnt(xx,yy,zz);
-            //cout<<"x"<<xx<<"y"<<yy<<"z"<<zz<<endl;
             aPoly.Add(point);
          }
          aPoly.Close();
@@ -1003,8 +1003,8 @@ TopoDS_Shape RootOCC::OCC_Pgon(Int_t np, Int_t nz, Double_t * p, Double_t phi1,
       fOccShape=Result.Shape();
       return Reverse(fOccShape);
    } else {
-      myCut=BRepPrimAPI_MakeCylinder (max+1,2*Zmax,(360.-DPhi)*PI/180.); 
-      TT.SetRotation(gp_Ax1(gp_Pnt(0.,0.,0.), gp_Vec(0., 0., 1.)), (-90.0+phi1)*PI/180.0);
+      myCut=BRepPrimAPI_MakeCylinder (max+1,2*Zmax,(360.-DPhi)*M_PI/180.); 
+      TT.SetRotation(gp_Ax1(gp_Pnt(0.,0.,0.), gp_Vec(0., 0., 1.)), (-90.0+phi1)*M_PI/180.0);
       BRepBuilderAPI_Transform theTT(TT);
       theTT.Perform(myCut, Standard_True);
       fOccShape=theTT.Shape();
@@ -1021,7 +1021,7 @@ TopoDS_Shape RootOCC::OCC_Pgon(Int_t np, Int_t nz, Double_t * p, Double_t phi1,
 }
 
 
-TopoDS_Shape RootOCC::Reverse(TopoDS_Shape Shape)
+TopoDS_Shape TGeoToOCC::Reverse(TopoDS_Shape Shape)
 {
    BRepClass3d_SolidClassifier * setPrecision= new BRepClass3d_SolidClassifier (Shape);
    setPrecision->PerformInfinitePoint(Precision::Confusion());
diff --git a/geom/geocad/src/TRootStep.cxx b/geom/geocad/src/TGeoToStep.cxx
old mode 100755
new mode 100644
similarity index 66%
rename from geom/geocad/src/TRootStep.cxx
rename to geom/geocad/src/TGeoToStep.cxx
index 8831f1e9fec..5303caa8876
--- a/geom/geocad/src/TRootStep.cxx
+++ b/geom/geocad/src/TGeoToStep.cxx
@@ -9,73 +9,67 @@
  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
  *************************************************************************/
 
-//////////////////////////////////////////////////////////////////////////////
-// TRootStep Class                                                          //
-// --------------------                                                     //
-//                                                                          //
-// This class is an interface to convert ROOT's geometry file               //
-// to STEP file. The TRootStep Class takes a gGeoManager pointer and gives  //
-// back a STEP file. gGeoManager is the instance of TGeoManager class       //
-// containing tree of geometries creating resulting geometry.               //
+////////////////////////////////////////////////////////////////////////////////
+// TGeoToStep Class                                                           //
+// --------------------                                                       //
+//                                                                            //
+// This class is an interface to convert ROOT's geometry file                 //
+// to STEP file. The TGeoToStep Class takes a gGeoManager pointer and gives   //
+// back a STEP file. gGeoManager is the instance of TGeoManager class         //
+// containing tree of geometries creating resulting geometry.                 //
 // Standard for the Exchange of Product model data (STEP) is an international //
 // standard for the exchange of industrial product data. It is typically used //
-// to exchange data between various CAD, CAM and CAE applications.          // 
-// TRootStep Class is using RootOCC class to translate the root geometry    //
-// in the corresponding OpenCascade geometry and  and OCCStep to write the  //
-// OpenCascade geometry to the step File.                                   //
-// OpenCascade Technology (OCC) is a software development platform freely   //
-// available in open source. It includes C++ components for 3D surface and  //
-// solid modeling,visualization, data exchange and rapid application        //
+// to exchange data between various CAD, CAM and CAE applications.            // 
+// TGeoToStep Class is using RootOCC class to translate the root geometry     //
+// in the corresponding OpenCascade geometry and  and TOCCToStep to write the //
+// OpenCascade geometry to the step File.                                     //
+// OpenCascade Technology (OCC) is a software development platform freely     //
+// available in open source. It includes C++ components for 3D surface and    //
+// solid modeling,visualization, data exchange and rapid application          //
 // development. For more information about OCC see http://www.opencascade.org //
-// Each object in ROOT is represented by an OCC TopoDS_Shape                //
-//                                                                          //
-//   This class is needed to be instanciated and can be used calling the    //
-//   CreateGeometry method:                                                 //
-//   TRootStep * mygeom= new TRootStep(gGeoManager);                        //
-//   mygeom->CreateGeometry();                                              //
-//                                                                          //
-// The resuling STEP file will be saved in the current directory and called //
-// geometry.stp                                                             //
-// To compile the TGeoCad module on ROOT, OpenCascade must be installed!    //
-//////////////////////////////////////////////////////////////////////////////
+// Each object in ROOT is represented by an OCC TopoDS_Shape                  //
+//                                                                            //
+//   This class is needed to be instanciated and can be used calling the      //
+//   CreateGeometry method:                                                   //
+//   TGeoToStep * mygeom= new TGeoToStep(gGeoManager);                        //
+//   mygeom->CreateGeometry();                                                //
+//                                                                            //
+// The resuling STEP file will be saved in the current directory and called   //
+// geometry.stp                                                               //
+// To compile the TGeoCad module on ROOT, OpenCascade must be installed!      //
+////////////////////////////////////////////////////////////////////////////////
 
 #include "TGeoManager.h"
-#include "OCCStep.h"
-#include "TRootStep.h"
+#include "TOCCToStep.h"
+#include "TGeoToStep.h"
 #include "TString.h"
 #include "TClass.h"
 
-ClassImp(TRootStep)
+ClassImp(TGeoToStep)
 
-TRootStep::TRootStep():TObject(), fGeometry(0)
+TGeoToStep::TGeoToStep():TObject(), fGeometry(0)
 {
 
 }
 
-TRootStep::TRootStep(TGeoManager *geom):TObject(), fGeometry(geom)
+TGeoToStep::TGeoToStep(TGeoManager *geom):TObject(), fGeometry(geom)
 {
 
 }
 
-TRootStep::~TRootStep()
+TGeoToStep::~TGeoToStep()
 {
    if (fGeometry) delete fGeometry;
 }
 
-void * TRootStep::CreateGeometry()
+void * TGeoToStep::CreateGeometry()
 {	
    //ROOT CAD CONVERSION
-   fCreate = new OCCStep();
-   //cout<<"logical tree created"<<endl;
+   fCreate = new TOCCToStep();
    fCreate->OCCShapeCreation(fGeometry);
    fCreate->OCCTreeCreation(fGeometry);
    fCreate->OCCWriteStep("geometry.stp");
    //fCreate->PrintAssembly();
-
-   // CAD ROOT CONVERSION
-   //CadDDLConverter * myConverter = new CadDDLConverter("buildxxx.stp", "Root_Test.root","Materials.dat", "Replacement.dat", true);
-   //myConverter->ImportStep();
-   //myConverter->WriteOutputFile("ROOT");
    delete(fCreate);
    return NULL;
 }
diff --git a/geom/geocad/src/OCCStep.cxx b/geom/geocad/src/TOCCToStep.cxx
similarity index 88%
rename from geom/geocad/src/OCCStep.cxx
rename to geom/geocad/src/TOCCToStep.cxx
index 74b6b39ce0b..1ba7f843693 100644
--- a/geom/geocad/src/OCCStep.cxx
+++ b/geom/geocad/src/TOCCToStep.cxx
@@ -10,7 +10,7 @@
  *************************************************************************/
 
 //////////////////////////////////////////////////////////////////////////
-// OCCStep Class                                                        //
+// TOCCToStep Class                                                     //
 //                                                                      //
 // This class contains implementation of writing OpenCascade's          //
 // geometry shapes to the STEP file reproducing the originary ROOT      //
@@ -27,8 +27,8 @@
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
 
-#include "OCCStep.h"
-#include "RootOCC.h"
+#include "TOCCToStep.h"
+#include "TGeoToOCC.h"
 
 #include "TGeoVolume.h"
 #include "TString.h"
@@ -48,24 +48,24 @@ using namespace std;
 
 
 //______________________________________________________________________________
-OCCStep::OCCStep() 
+TOCCToStep::TOCCToStep() 
 {
    OCCDocCreation();
 }
 
 //______________________________________________________________________________
-void OCCStep::OCCDocCreation()
+void TOCCToStep::OCCDocCreation()
 {
    Handle (XCAFApp_Application)A = XCAFApp_Application::GetApplication();
    if (!A.IsNull()) {
       A->NewDocument ("MDTV-XCAF", fDoc);
    }
    else
-      ::Error("OCCStep::OCCDocCreation", "creating OCC application");
+      ::Error("TOCCToStep::OCCDocCreation", "creating OCC application");
 }
 
 //______________________________________________________________________________
-TDF_Label OCCStep::OCCShapeCreation(TGeoManager *m)
+TDF_Label TOCCToStep::OCCShapeCreation(TGeoManager *m)
 {
    // Logical fTree creation.
 
@@ -73,13 +73,11 @@ TDF_Label OCCStep::OCCShapeCreation(TGeoManager *m)
    TGeoVolume * currentVolume;
    TGeoVolume * motherVol;
    TGeoVolume * Top;
-   TString type;
    TString path;
    Int_t num = 0;
    Int_t level = 0;
    TIter next(m->GetListOfVolumes());
    fLabel = XCAFDoc_DocumentTool::ShapeTool(fDoc->Main())->NewShape();
-   type = m->GetTopVolume()->GetShape()->IsA()->GetName();
    fShape = fRootShape.OCC_SimpleShape(m->GetTopVolume()->GetShape());
    XCAFDoc_DocumentTool::ShapeTool(fDoc->Main())->SetShape(fLabel, fShape);
    TDataStd_Name::Set(fLabel, m->GetTopVolume()->GetName());
@@ -88,10 +86,9 @@ TDF_Label OCCStep::OCCShapeCreation(TGeoManager *m)
    fTree[Top] = fLabel;
    while ((currentVolume = (TGeoVolume *)next())) {
       if (GetLabelOfVolume(currentVolume).IsNull()) {
-         type = currentVolume->GetShape()->IsA()->GetName();
          num = currentVolume->GetNdaughters();
          if ((GetLabelOfVolume(currentVolume).IsNull())) {
-            if (type == "TGeoCompositeShape") {
+            if (currentVolume->GetShape()->IsA()==TGeoCompositeShape::Class()) {
                fShape = fRootShape.OCC_CompositeShape((TGeoCompositeShape*)currentVolume->GetShape(), TGeoIdentity());
             } else {
                fShape = fRootShape.OCC_SimpleShape(currentVolume->GetShape());
@@ -116,9 +113,8 @@ TDF_Label OCCStep::OCCShapeCreation(TGeoManager *m)
                } else {
                   TGeoNode * grandMother = nextNode.GetNode(level);
                   motherVol = grandMother->GetVolume();
-                  TString type2 = motherVol->GetShape()->IsA()->GetName();
                   TopoDS_Shape Mothershape;
-                  if (type2 == "TGeoCompositeShape") {
+                  if (motherVol->GetShape()->IsA()==TGeoCompositeShape::Class()) {
                      Mothershape = fRootShape.OCC_CompositeShape((TGeoCompositeShape*)motherVol->GetShape(), TGeoIdentity());
                   } else {
                      Mothershape = fRootShape.OCC_SimpleShape(motherVol->GetShape());
@@ -143,21 +139,21 @@ TDF_Label OCCStep::OCCShapeCreation(TGeoManager *m)
 }
 
 //______________________________________________________________________________
-void OCCStep::OCCWriteStep(const char *fname)
+void TOCCToStep::OCCWriteStep(const char *fname)
 {
    STEPControl_StepModelType mode = STEPControl_AsIs;
    fWriter.SetNameMode(Standard_True);
    if (!Interface_Static::SetIVal("write.step.assembly", 1)) { //assembly mode
-      Error("OCCStep::OCCWriteStep", "failed to set assembly mode for step data");
+      Error("TOCCToStep::OCCWriteStep", "failed to set assembly mode for step data");
    }
    if (!fWriter.Transfer(fDoc, mode)) {
-      ::Error("OCCStep::OCCWriteStep", "error translating document");
+      ::Error("TOCCToStep::OCCWriteStep", "error translating document");
    }
    IFSelect_ReturnStatus stat = fWriter.Write(fname);
 }
 
 //______________________________________________________________________________
-TDF_Label OCCStep::GetLabelOfVolume(TGeoVolume * v)
+TDF_Label TOCCToStep::GetLabelOfVolume(TGeoVolume * v)
 {
    TDF_Label null;
    if (fTree.find(v) != fTree.end())
@@ -167,7 +163,7 @@ TDF_Label OCCStep::GetLabelOfVolume(TGeoVolume * v)
 }
 
 //______________________________________________________________________________
-TGeoVolume * OCCStep::GetVolumeOfLabel(TDF_Label fLabel)
+TGeoVolume * TOCCToStep::GetVolumeOfLabel(TDF_Label fLabel)
 {
    map <TGeoVolume *,TDF_Label>::iterator it;
    for(it = fTree.begin(); it != fTree.end(); it++) 
@@ -176,14 +172,14 @@ TGeoVolume * OCCStep::GetVolumeOfLabel(TDF_Label fLabel)
 }
 
 //______________________________________________________________________________
-void OCCStep::AddChildLabel(TDF_Label mother, TDF_Label child, TopLoc_Location loc)
+void TOCCToStep::AddChildLabel(TDF_Label mother, TDF_Label child, TopLoc_Location loc)
 {
    TDF_Label newL=XCAFDoc_DocumentTool::ShapeTool(mother)->AddComponent(mother, child,loc);
    XCAFDoc_DocumentTool::ShapeTool(mother)->UpdateAssembly(mother);
 }
 
 //______________________________________________________________________________
-TopLoc_Location OCCStep::CalcLocation (TGeoHMatrix matrix)
+TopLoc_Location TOCCToStep::CalcLocation (TGeoHMatrix matrix)
 { 
    gp_Trsf TR,TR1;
    TopLoc_Location locA;
@@ -200,7 +196,7 @@ TopLoc_Location OCCStep::CalcLocation (TGeoHMatrix matrix)
 }
 
 //______________________________________________________________________________
-void OCCStep::OCCTreeCreation(TGeoManager * m)
+void TOCCToStep::OCCTreeCreation(TGeoManager * m)
 {
    TGeoIterator nextNode(m->GetTopVolume());
    TGeoNode *currentNode = 0;
@@ -238,7 +234,7 @@ void OCCStep::OCCTreeCreation(TGeoManager * m)
 }
 
 //______________________________________________________________________________
-void OCCStep::PrintAssembly()
+void TOCCToStep::PrintAssembly()
 {
    XCAFDoc_DocumentTool::ShapeTool(fDoc->Main())->Dump();
 }
-- 
GitLab