From 74aa334378081fd60e5a4029790b0d3622895546 Mon Sep 17 00:00:00 2001
From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch>
Date: Thu, 23 May 2024 23:47:06 +0200
Subject: [PATCH] Fix constness of shape parameters in shape builders

---
 .../GeoModelRead/src/BuildGeoShapes_Para.cpp  | 12 +++++-----
 .../GeoModelRead/src/BuildGeoShapes_Trap.cpp  | 22 +++++++++----------
 .../GeoModelRead/src/BuildGeoShapes_Trd.cpp   | 10 ++++-----
 .../GeoModelRead/src/BuildGeoShapes_Tubs.cpp  | 11 +++++-----
 .../src/BuildGeoShapes_TwistedTrap.cpp        | 22 +++++++++----------
 5 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Para.cpp b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Para.cpp
index 6b07a2c97..d5372870e 100644
--- a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Para.cpp
+++ b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Para.cpp
@@ -24,12 +24,12 @@ void BuildGeoShapes_Para::buildShape(const std::vector<std::variant<int, long, f
   const double shapeVolume = GeoModelHelpers::variantHelper::getFromVariant_Double(row[1], "Para:shapeVolume");
 
   // shape parameters
-  double XHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Para:XHalfLength");
-  double YHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Para:YHalfLength");
-  double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Para:ZHalfLength");
-  double Alpha = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Para:Alpha");
-  double Theta = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Para:Theta");
-  double Phi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[7], "Para:Phi");
+  const double XHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Para:XHalfLength");
+  const double YHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Para:YHalfLength");
+  const double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Para:ZHalfLength");
+  const double Alpha = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Para:Alpha");
+  const double Theta = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Para:Theta");
+  const double Phi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[7], "Para:Phi");
 
   GeoPara *shape = new GeoPara(XHalfLength, YHalfLength, ZHalfLength, Alpha, Theta,
                                Phi);
diff --git a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trap.cpp b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trap.cpp
index 2997d8134..3a7f816ba 100644
--- a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trap.cpp
+++ b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trap.cpp
@@ -23,17 +23,17 @@ void BuildGeoShapes_Trap::buildShape(const std::vector<std::variant<int, long, f
   // shape volume
   const double shapeVolume = GeoModelHelpers::variantHelper::getFromVariant_Double(row[1], "Trap:shapeVolume");
   // shape parameters
-  double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Trap:ZHalfLength");
-  double Theta = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Trap:Theta");
-  double Phi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Trap:Phi");
-  double Dydzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Trap:Dydzn");
-  double Dxdyndzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Trap:Dxdyndzn");
-  double Dxdypdzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[7], "Trap:Dxdypdzn");
-  double Angleydzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[8], "Trap:Angleydzn");
-  double Dydzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[9], "Trap:Dydzp");
-  double Dxdyndzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[10], "Trap:Dxdyndzp");
-  double Dxdypdzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[11], "Trap:Dxdypdzp");
-  double Angleydzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[12], "Trap:Angleydzp");
+  const double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Trap:ZHalfLength");
+  const double Theta = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Trap:Theta");
+  const double Phi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Trap:Phi");
+  const double Dydzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Trap:Dydzn");
+  const double Dxdyndzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Trap:Dxdyndzn");
+  const double Dxdypdzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[7], "Trap:Dxdypdzn");
+  const double Angleydzn = GeoModelHelpers::variantHelper::getFromVariant_Double(row[8], "Trap:Angleydzn");
+  const double Dydzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[9], "Trap:Dydzp");
+  const double Dxdyndzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[10], "Trap:Dxdyndzp");
+  const double Dxdypdzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[11], "Trap:Dxdypdzp");
+  const double Angleydzp = GeoModelHelpers::variantHelper::getFromVariant_Double(row[12], "Trap:Angleydzp");
 
   GeoShape *shape = new GeoTrap(ZHalfLength, Theta, Phi, Dydzn, Dxdyndzn, Dxdypdzn,
                                 Angleydzn, Dydzp, Dxdyndzp, Dxdypdzp, Angleydzp);
diff --git a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trd.cpp b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trd.cpp
index 21454f0de..b001e988d 100644
--- a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trd.cpp
+++ b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Trd.cpp
@@ -23,11 +23,11 @@ void BuildGeoShapes_Trd::buildShape(const std::vector<std::variant<int, long, fl
   // shape volume
   const double shapeVolume = GeoModelHelpers::variantHelper::getFromVariant_Double(row[1], "Trd:shapeVolume");
   // shape parameters
-  double XHalfLength1 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Trd:XHalfLength1");
-  double XHalfLength2 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Trd:XHalfLength2");
-  double YHalfLength1 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Trd:YHalfLength1");
-  double YHalfLength2 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Trd:YHalfLength2");
-  double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Trd:ZHalfLength");
+  const double XHalfLength1 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Trd:XHalfLength1");
+  const double XHalfLength2 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Trd:XHalfLength2");
+  const double YHalfLength1 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Trd:YHalfLength1");
+  const double YHalfLength2 = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Trd:YHalfLength2");
+  const double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Trd:ZHalfLength");
   
   GeoShape *shape = new GeoTrd(XHalfLength1, XHalfLength2, YHalfLength1, YHalfLength2, ZHalfLength);
 
diff --git a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Tubs.cpp b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Tubs.cpp
index c0b654f51..c05bf1710 100644
--- a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Tubs.cpp
+++ b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_Tubs.cpp
@@ -23,11 +23,12 @@ void BuildGeoShapes_Tubs::buildShape(const std::vector<std::variant<int, long, f
   // shape volume
   const double shapeVolume = GeoModelHelpers::variantHelper::getFromVariant_Double(row[1], "Tubs:shapeVolume");
   // shape parameters
-  double RMin = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Tubs:RMin");
-  double RMax = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Tubs:RMax");
-  double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Tubs:ZHalfLength");
-  double SPhi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Tubs:SPhi");
-  double DPhi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Tubs:DPhi");
+  const double RMin = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "Tubs:RMin");
+  const double RMax = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "Tubs:RMax");
+  const double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "Tubs:ZHalfLength");
+  const double SPhi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "Tubs:SPhi");
+  const double DPhi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "Tubs:DPhi");
+  
   GeoShape *shape = new GeoTubs(RMin, RMax, ZHalfLength, SPhi, DPhi);
 
   storeBuiltShape(shapeId, shape);
diff --git a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_TwistedTrap.cpp b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_TwistedTrap.cpp
index 7754b437e..1f778cbba 100644
--- a/GeoModelIO/GeoModelRead/src/BuildGeoShapes_TwistedTrap.cpp
+++ b/GeoModelIO/GeoModelRead/src/BuildGeoShapes_TwistedTrap.cpp
@@ -23,17 +23,17 @@ void BuildGeoShapes_TwistedTrap::buildShape(const std::vector<std::variant<int,
   // shape volume
   const double shapeVolume = GeoModelHelpers::variantHelper::getFromVariant_Double(row[1], "TwistedTrap:shapeVolume");
   // shape parameters
-  double PhiTwist = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "TwistedTrap:PhiTwist");
-  double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "TwistedTrap:ZHalfLength");
-  double Theta = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "TwistedTrap:Theta");
-  double Phi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "TwistedTrap:Phi");
-  double DY1HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "TwistedTrap:DY1HalfLength");
-  double DX1HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[7], "TwistedTrap:DX1HalfLength");
-  double DX2HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[8], "TwistedTrap:DX2HalfLength");
-  double DY2HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[9], "TwistedTrap:DY2HalfLength");
-  double DX3HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[10], "TwistedTrap:DX3HalfLength");
-  double DX4HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[11], "TwistedTrap:DX4HalfLength");
-  double DTiltAngleAlpha = GeoModelHelpers::variantHelper::getFromVariant_Double(row[12], "TwistedTrap:DTiltAngleAlpha");
+  const double PhiTwist = GeoModelHelpers::variantHelper::getFromVariant_Double(row[2], "TwistedTrap:PhiTwist");
+  const double ZHalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[3], "TwistedTrap:ZHalfLength");
+  const double Theta = GeoModelHelpers::variantHelper::getFromVariant_Double(row[4], "TwistedTrap:Theta");
+  const double Phi = GeoModelHelpers::variantHelper::getFromVariant_Double(row[5], "TwistedTrap:Phi");
+  const double DY1HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[6], "TwistedTrap:DY1HalfLength");
+  const double DX1HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[7], "TwistedTrap:DX1HalfLength");
+  const double DX2HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[8], "TwistedTrap:DX2HalfLength");
+  const double DY2HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[9], "TwistedTrap:DY2HalfLength");
+  const double DX3HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[10], "TwistedTrap:DX3HalfLength");
+  const double DX4HalfLength = GeoModelHelpers::variantHelper::getFromVariant_Double(row[11], "TwistedTrap:DX4HalfLength");
+  const double DTiltAngleAlpha = GeoModelHelpers::variantHelper::getFromVariant_Double(row[12], "TwistedTrap:DTiltAngleAlpha");
 
   GeoShape *shape =
       new GeoTwistedTrap(PhiTwist, ZHalfLength, Theta, Phi, DY1HalfLength,
-- 
GitLab