From 5826471a375c349340dbb165898063f921066065 Mon Sep 17 00:00:00 2001
From: Marko Petric <marko.petric@cern.ch>
Date: Wed, 10 Jul 2019 15:12:12 +0200
Subject: [PATCH] Remove shadowing

---
 DDCore/src/plugins/Compact2Objects.cpp |  4 +-
 DDCore/src/plugins/StandardPlugins.cpp | 18 ++++----
 DDG4/src/Geant4Converter.cpp           | 60 +++++++++++++-------------
 3 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index 5793f0eed..9c3010d2a 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -498,8 +498,8 @@ template <> void Converter<Material>::operator()(xml_h e) const {
       xml_elt_t p = properties;
       if ( p.hasAttr(_U(ref)) )   {
         string ref = p.attr<string>(_U(ref));
-        TGDMLMatrix* m = mgr.GetGDMLMatrix(ref.c_str());
-        if ( m )  {
+        TGDMLMatrix* gdmlMat = mgr.GetGDMLMatrix(ref.c_str());
+        if ( gdmlMat )  {
           string prop_nam = p.attr<string>(_U(name));
           mat->AddProperty(prop_nam.c_str(), ref.c_str());
           printout(s_debug.materials ? ALWAYS : DEBUG, "Compact",
diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp
index eef86ca03..866c289d3 100644
--- a/DDCore/src/plugins/StandardPlugins.cpp
+++ b/DDCore/src/plugins/StandardPlugins.cpp
@@ -280,10 +280,10 @@ static long root_dump_gdml_tables(Detector& description, int /* argc */, char**
   TObjArrayIter arr(c);
   printout(INFO,"Dump_GDMLTables","+++ Dumping known GDML tables from TGeoManager.");
   for(TObject* i = arr.Next(); i; i=arr.Next())   {
-    TGDMLMatrix* m = (TGDMLMatrix*)i;
-    num_elements += (m->GetRows()*m->GetCols());
+    TGDMLMatrix* gdmlMat = (TGDMLMatrix*)i;
+    num_elements += (gdmlMat->GetRows()*gdmlMat->GetCols());
     ++num_tables;
-    m->Print();
+    gdmlMat->Print();
   }
 #endif
   printout(INFO,"Dump_GDMLTables",
@@ -310,9 +310,9 @@ static long root_dump_optical_surfaces(Detector& description, int /* argc */, ch
   TObjArrayIter arr(c);
   printout(ALWAYS,"Dump_OpticalSurfaces","+++ Dumping known Optical Surfaces from TGeoManager.");
   for(TObject* i = arr.Next(); i; i=arr.Next())   {
-    TGeoOpticalSurface* m = (TGeoOpticalSurface*)i;
+    TGeoOpticalSurface* optSurt = (TGeoOpticalSurface*)i;
     ++num_surfaces;
-    m->Print();
+    optSurt->Print();
   }
 #endif
   printout(ALWAYS,"Dump_OpticalSurfaces",
@@ -338,9 +338,9 @@ static long root_dump_skin_surfaces(Detector& description, int /* argc */, char*
   TObjArrayIter arr(c);
   printout(ALWAYS,"Dump_SkinSurfaces","+++ Dumping known Skin Surfaces from TGeoManager.");
   for(TObject* i = arr.Next(); i; i=arr.Next())   {
-    TGeoSkinSurface* m = (TGeoSkinSurface*)i;
+    TGeoSkinSurface* skinSurf = (TGeoSkinSurface*)i;
     ++num_surfaces;
-    m->Print();
+    skinSurf->Print();
   }
 #endif
   printout(ALWAYS,"Dump_SkinSurfaces",
@@ -366,9 +366,9 @@ static long root_dump_border_surfaces(Detector& description, int /* argc */, cha
   TObjArrayIter arr(c);
   printout(ALWAYS,"Dump_BorderSurfaces","+++ Dumping known Border Surfaces from TGeoManager.");
   for(TObject* i = arr.Next(); i; i=arr.Next())   {
-    TGeoBorderSurface* m = (TGeoBorderSurface*)i;
+    TGeoBorderSurface* bordSurt = (TGeoBorderSurface*)i;
     ++num_surfaces;
-    m->Print();
+    bordSurt->Print();
   }
 #endif
   printout(ALWAYS,"Dump_BorderSurfaces",
diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp
index 22721f285..f4e09f2dd 100644
--- a/DDG4/src/Geant4Converter.cpp
+++ b/DDG4/src/Geant4Converter.cpp
@@ -1193,24 +1193,24 @@ void Geant4Converter::handleProperties(Detector::Properties& prp) const {
 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,17,0)
 /// Convert the geometry type material into the corresponding Geant4 object(s).
 void* Geant4Converter::handleMaterialProperties(TObject* matrix) const    {
-  TGDMLMatrix* m = (TGDMLMatrix*)matrix;
+  TGDMLMatrix* gdmlMat = (TGDMLMatrix*)matrix;
   Geant4GeometryInfo& info = data();
-  Geant4GeometryInfo::PropertyVector* g4 = info.g4OpticalProperties[m];
+  Geant4GeometryInfo::PropertyVector* g4 = info.g4OpticalProperties[gdmlMat];
   if (!g4) {
     PrintLevel lvl = debugMaterials ? ALWAYS : outputLevel;
     g4 = new Geant4GeometryInfo::PropertyVector();
-    size_t rows = m->GetRows();
-    g4->name    = m->GetName();
-    g4->title   = m->GetTitle();
+    size_t rows = gdmlMat->GetRows();
+    g4->name    = gdmlMat->GetName();
+    g4->title   = gdmlMat->GetTitle();
     g4->bins.reserve(rows);
     g4->values.reserve(rows);
     for(size_t i=0; i<rows; ++i)  {
-      g4->bins.emplace_back(m->Get(i,0)  /*   *CLHEP::eV/units::eV   */);
-      g4->values.emplace_back(m->Get(i,1));
+      g4->bins.emplace_back(gdmlMat->Get(i,0)  /*   *CLHEP::eV/units::eV   */);
+      g4->values.emplace_back(gdmlMat->Get(i,1));
     }
     printout(lvl, "Geant4Converter", "++ Successfully converted material property:%s : %s [%ld rows]",
-             m->GetName(), m->GetTitle(), rows);
-    info.g4OpticalProperties[m] = g4;
+             gdmlMat->GetName(), gdmlMat->GetTitle(), rows);
+    info.g4OpticalProperties[gdmlMat] = g4;
   }
   return g4;
 }
@@ -1289,9 +1289,9 @@ static G4SurfaceType geant4_surface_type(TGeoOpticalSurface::ESurfaceType t)   {
 #undef TO_G4_TYPE
 }
 
-static G4OpticalSurfaceModel geant4_surface_model(TGeoOpticalSurface::ESurfaceModel m)   {
+static G4OpticalSurfaceModel geant4_surface_model(TGeoOpticalSurface::ESurfaceModel surfMod)   {
 #define TO_G4_MODEL(x)  case TGeoOpticalSurface::kM##x : return x;
-  switch(m)   {
+  switch(surfMod)   {
     TO_G4_MODEL(glisur);   // original GEANT3 model
     TO_G4_MODEL(unified);  // UNIFIED model
     TO_G4_MODEL(LUT);      // Look-Up-Table model
@@ -1299,7 +1299,7 @@ static G4OpticalSurfaceModel geant4_surface_model(TGeoOpticalSurface::ESurfaceMo
     TO_G4_MODEL(dichroic); // dichroic filter
   default:
     printout(ERROR,"Geant4Surfaces","++ Unknown surface model: %d [%s]. Assume glisur!",
-             int(m), TGeoOpticalSurface::ModelToString(m));
+             int(surfMod), TGeoOpticalSurface::ModelToString(surfMod));
     return glisur;
   }
 #undef TO_G4_MODEL
@@ -1307,24 +1307,24 @@ static G4OpticalSurfaceModel geant4_surface_model(TGeoOpticalSurface::ESurfaceMo
 
 /// Convert the optical surface to Geant4
 void* Geant4Converter::handleOpticalSurface(TObject* surface) const    {
-  TGeoOpticalSurface* s    = (TGeoOpticalSurface*)surface;
+  TGeoOpticalSurface* optSurf    = (TGeoOpticalSurface*)surface;
   Geant4GeometryInfo& info = data();
-  G4OpticalSurface*   g4   = info.g4OpticalSurfaces[s];
+  G4OpticalSurface*   g4   = info.g4OpticalSurfaces[optSurf];
   if (!g4) {
-    G4SurfaceType          type   = geant4_surface_type(s->GetType());
-    G4OpticalSurfaceModel  model  = geant4_surface_model(s->GetModel());
-    G4OpticalSurfaceFinish finish = geant4_surface_finish(s->GetFinish());
-    g4 = new G4OpticalSurface(s->GetName(), model, finish, type, s->GetValue());
-    g4->SetSigmaAlpha(s->GetSigmaAlpha());
+    G4SurfaceType          type   = geant4_surface_type(optSurf->GetType());
+    G4OpticalSurfaceModel  model  = geant4_surface_model(optSurf->GetModel());
+    G4OpticalSurfaceFinish finish = geant4_surface_finish(optSurf->GetFinish());
+    g4 = new G4OpticalSurface(optSurf->GetName(), model, finish, type, optSurf->GetValue());
+    g4->SetSigmaAlpha(optSurf->GetSigmaAlpha());
     // not implemented: g4->SetPolish(s->GetPolish());
     printout(debugSurfaces ? ALWAYS : DEBUG, "Geant4Converter",
              "++ Created OpticalSurface: %-18s type:%s model:%s finish:%s",
-             s->GetName(),
-             TGeoOpticalSurface::TypeToString(s->GetType()),
-             TGeoOpticalSurface::ModelToString(s->GetModel()),
-             TGeoOpticalSurface::FinishToString(s->GetFinish()));
+             optSurf->GetName(),
+             TGeoOpticalSurface::TypeToString(optSurf->GetType()),
+             TGeoOpticalSurface::ModelToString(optSurf->GetModel()),
+             TGeoOpticalSurface::FinishToString(optSurf->GetFinish()));
     G4MaterialPropertiesTable* tab = 0;
-    TListIter it(&s->GetProperties());
+    TListIter it(&optSurf->GetProperties());
     for(TObject* obj = it.Next(); obj; obj = it.Next())  {
       TNamed* n = (TNamed*)obj;
       TGDMLMatrix *matrix = info.manager->GetGDMLMatrix(n->GetTitle());
@@ -1336,7 +1336,7 @@ void* Geant4Converter::handleOpticalSurface(TObject* surface) const    {
         (Geant4GeometryInfo::PropertyVector*)handleMaterialProperties(matrix);
       if ( !v )  {  // Error!
         except("Geant4OpticalSurface","++ Failed to convert opt.surface %s. Property table %s is not defined!",
-               s->GetName(), n->GetTitle());
+               optSurf->GetName(), n->GetTitle());
       }
       G4MaterialPropertyVector* vec =
         new G4MaterialPropertyVector(&v->bins[0], &v->values[0], v->bins.size());
@@ -1345,7 +1345,7 @@ void* Geant4Converter::handleOpticalSurface(TObject* surface) const    {
                "++       Property: %-20s [%ld x %ld] -->  %s",
                n->GetName(), matrix->GetRows(), matrix->GetCols(), n->GetTitle());
     }
-    info.g4OpticalSurfaces[s] = g4;
+    info.g4OpticalSurfaces[optSurf] = g4;
   }
   return g4;
 }
@@ -1356,9 +1356,9 @@ void* Geant4Converter::handleSkinSurface(TObject* surface) const   {
   Geant4GeometryInfo& info = data();
   G4LogicalSkinSurface* g4 = info.g4SkinSurfaces[surf];
   if (!g4) {
-    G4OpticalSurface* s  = info.g4OpticalSurfaces[OpticalSurface(surf->GetSurface())];
+    G4OpticalSurface* optSurf  = info.g4OpticalSurfaces[OpticalSurface(surf->GetSurface())];
     G4LogicalVolume*  v = info.g4Volumes[surf->GetVolume()];
-    g4 = new G4LogicalSkinSurface(surf->GetName(), v, s);
+    g4 = new G4LogicalSkinSurface(surf->GetName(), v, optSurf);
     printout(debugSurfaces ? ALWAYS : DEBUG, "Geant4Converter",
              "++ Created SkinSurface: %-18s  optical:%s",
              surf->GetName(), surf->GetSurface()->GetName());
@@ -1373,10 +1373,10 @@ void* Geant4Converter::handleBorderSurface(TObject* surface) const   {
   Geant4GeometryInfo&   info = data();
   G4LogicalBorderSurface* g4 = info.g4BorderSurfaces[surf];
   if (!g4) {
-    G4OpticalSurface*  s  = info.g4OpticalSurfaces[OpticalSurface(surf->GetSurface())];
+    G4OpticalSurface*  optSurf = info.g4OpticalSurfaces[OpticalSurface(surf->GetSurface())];
     G4VPhysicalVolume* n1 = info.g4Placements[surf->GetNode1()];
     G4VPhysicalVolume* n2 = info.g4Placements[surf->GetNode2()];
-    g4 = new G4LogicalBorderSurface(surf->GetName(), n1, n2, s);
+    g4 = new G4LogicalBorderSurface(surf->GetName(), n1, n2, optSurf);
     printout(debugSurfaces ? ALWAYS : DEBUG, "Geant4Converter",
              "++ Created BorderSurface: %-18s  optical:%s",
              surf->GetName(), surf->GetSurface()->GetName());
-- 
GitLab