From 3aa790ad0108ef2b135ad1b44c6072e2867b8029 Mon Sep 17 00:00:00 2001 From: Vakho Tsulaia <vakhtang.tsulaia@cern.ch> Date: Fri, 15 Oct 2021 16:49:31 -0700 Subject: [PATCH] Synch-ed GeoModelXml with the latest updates in the Athena repository See the [merge request](https://gitlab.cern.ch/atlas/athena/-/merge_requests/47262) by Scott for more details --- .../GeoModelXml/GeoModelXml/Element2GeoItem.h | 8 +-- .../GeoModelXml/GeoModelXml/GeoNodeList.h | 3 +- .../GeoModelXml/GeoModelXml/MakeElement.h | 4 +- .../GeoModelXml/GeoModelXml/MakeMaterial.h | 4 +- .../GeoModelXml/MakeTransformation.h | 4 +- .../GeoModelXml/MakeTransformationref.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakeBox.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakeCons.h | 4 +- .../GeoModelXml/shape/MakeEllipticalTube.h | 2 +- .../GeoModelXml/shape/MakeGenericTrap.h | 4 +- .../GeoModelXml/shape/MakeIntersection.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakePara.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakePcon.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakePgon.h | 4 +- .../GeoModelXml/shape/MakeShaperef.h | 5 +- .../GeoModelXml/shape/MakeSimplePolygonBrep.h | 4 +- .../GeoModelXml/shape/MakeSubtraction.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakeTorus.h | 2 +- .../GeoModelXml/GeoModelXml/shape/MakeTrap.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakeTrd.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakeTube.h | 4 +- .../GeoModelXml/GeoModelXml/shape/MakeTubs.h | 4 +- .../GeoModelXml/shape/MakeTwistedTrap.h | 2 +- .../GeoModelXml/GeoModelXml/shape/MakeUnion.h | 4 +- .../GeoModelXml/src/AssemblyrefProcessor.cxx | 2 +- .../GeoModelXml/src/Element2GeoItem.cxx | 12 ++-- .../GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx | 4 +- .../GeoModelXml/src/GmxInterface.cxx | 9 +-- .../GeoModelXML/GeoModelXml/src/GmxUtil.cxx | 4 +- .../GeoModelXml/src/LogvolProcessor.cxx | 31 +++++----- .../GeoModelXml/src/LogvolrefProcessor.cxx | 2 +- .../GeoModelXML/GeoModelXml/src/MakeBox.cxx | 4 +- .../GeoModelXML/GeoModelXml/src/MakeCons.cxx | 4 +- .../GeoModelXml/src/MakeElement.cxx | 6 +- .../GeoModelXml/src/MakeEllipticalTube.cxx | 2 +- .../GeoModelXml/src/MakeGenericTrap.cxx | 4 +- .../GeoModelXml/src/MakeIntersection.cxx | 60 ++++++++++--------- .../GeoModelXml/src/MakeMaterial.cxx | 31 +++++----- .../GeoModelXML/GeoModelXml/src/MakePara.cxx | 4 +- .../GeoModelXML/GeoModelXml/src/MakePcon.cxx | 4 +- .../GeoModelXML/GeoModelXml/src/MakePgon.cxx | 4 +- .../GeoModelXml/src/MakeShaperef.cxx | 4 +- .../GeoModelXml/src/MakeSimplePolygonBrep.cxx | 4 +- .../GeoModelXml/src/MakeSubtraction.cxx | 60 ++++++++++--------- .../GeoModelXML/GeoModelXml/src/MakeTorus.cxx | 2 +- .../GeoModelXml/src/MakeTransformation.cxx | 6 +- .../GeoModelXml/src/MakeTransformationref.cxx | 4 +- .../GeoModelXML/GeoModelXml/src/MakeTrap.cxx | 4 +- .../GeoModelXML/GeoModelXml/src/MakeTrd.cxx | 4 +- .../GeoModelXML/GeoModelXml/src/MakeTube.cxx | 4 +- .../GeoModelXML/GeoModelXml/src/MakeTubs.cxx | 4 +- .../GeoModelXml/src/MakeTwistedTrap.cxx | 2 +- .../GeoModelXML/GeoModelXml/src/MakeUnion.cxx | 60 ++++++++++--------- .../GeoModelXml/src/MulticopyProcessor.cxx | 22 +++---- .../GeoModelXml/src/PositionIndex.cxx | 4 +- .../GeoModelXml/src/TransformProcessor.cxx | 4 +- .../GeoModelXml/src/TransformrefProcessor.cxx | 4 +- .../GeoModelXml/src/decompress.cxx | 5 +- 58 files changed, 244 insertions(+), 234 deletions(-) diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItem.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItem.h index 01e8562de..8b084f856 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItem.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItem.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -28,9 +28,9 @@ class Element2GeoItem { public: Element2GeoItem(); virtual ~Element2GeoItem(); - const RCBase * process(const xercesc::DOMElement *element, GmxUtil &gmxUtil); - virtual const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + RCBase * process(const xercesc::DOMElement *element, GmxUtil &gmxUtil); + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; protected: - std::map<std::string, const RCBase *> m_map; + std::map<std::string, RCBase *> m_map; }; #endif // ELEMENT2GEO_ITEM_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GeoNodeList.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GeoNodeList.h index eac3c942d..22287c7fd 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GeoNodeList.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GeoNodeList.h @@ -1,8 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include <vector> #include "GeoModelKernel/GeoGraphNode.h" typedef std::vector<GeoGraphNode *> GeoNodeList; + diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeElement.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeElement.h index f1494499f..ac31a7bb0 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeElement.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeElement.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -14,7 +14,7 @@ class MakeElement: public Element2GeoItem { public: MakeElement(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // MAKE_ELEMENT_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeMaterial.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeMaterial.h index 8d95e8622..e2219f27f 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeMaterial.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeMaterial.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -14,7 +14,7 @@ class MakeMaterial: public Element2GeoItem { public: MakeMaterial(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // MAKE_MATERIAL_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformation.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformation.h index c80e05c88..0cf6b79f0 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformation.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformation.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -14,7 +14,7 @@ class MakeTransformation: public Element2GeoItem { public: MakeTransformation(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // MAKE_TRANSFORMATION_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformationref.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformationref.h index 5c345f736..caca40cb2 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformationref.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/MakeTransformationref.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -13,7 +13,7 @@ class MakeTransformationref: public Element2GeoItem { public: - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // MAKE_TRANSFORMATIONREF_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeBox.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeBox.h index 599abebce..968bc4806 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeBox.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeBox.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeBox: public Element2GeoItem { public: MakeBox(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_BOX_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeCons.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeCons.h index 9283cfc20..7de87d2d0 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeCons.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeCons.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeCons: public Element2GeoItem { public: MakeCons(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_CONS_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeEllipticalTube.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeEllipticalTube.h index 0db151718..11d894ca7 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeEllipticalTube.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeEllipticalTube.h @@ -11,7 +11,7 @@ class MakeEllipticalTube: public Element2GeoItem { public: MakeEllipticalTube(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_ELLIPTICAL_TUBE_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeGenericTrap.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeGenericTrap.h index 0eed6fe11..83b011534 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeGenericTrap.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeGenericTrap.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeGenericTrap: public Element2GeoItem { public: MakeGenericTrap(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_GENERICTRAP_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeIntersection.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeIntersection.h index 483a11e51..c8d7b71d9 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeIntersection.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeIntersection.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeIntersection: public Element2GeoItem { public: MakeIntersection(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_INTERSECTION_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePara.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePara.h index b354c9865..c340ca705 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePara.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePara.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakePara: public Element2GeoItem { public: MakePara(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_PARA_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePcon.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePcon.h index aab86ab53..190badf08 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePcon.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePcon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakePcon: public Element2GeoItem { public: MakePcon(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_PCON_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePgon.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePgon.h index df9fded68..cc48599aa 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePgon.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakePgon.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakePgon: public Element2GeoItem { public: MakePgon(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_PGON_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeShaperef.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeShaperef.h index 905e5fe2c..92be5c0da 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeShaperef.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeShaperef.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -14,8 +14,7 @@ class MakeShaperef: public Element2GeoItem { public: -// MakeShaperef() {}; - const RCBase * process(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + RCBase * process(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; }; #endif // GEO_MODEL_XML_MAKE_SHAPEREF_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSimplePolygonBrep.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSimplePolygonBrep.h index 5ec995fb3..92382bef9 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSimplePolygonBrep.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSimplePolygonBrep.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include <xercesc/util/XercesDefs.hpp> // @@ -14,7 +14,7 @@ class MakeSimplePolygonBrep: public Element2GeoItem { public: MakeSimplePolygonBrep(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_SIMPLEPOLYGONBREP_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSubtraction.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSubtraction.h index 5dcd32865..359b43037 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSubtraction.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeSubtraction.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeSubtraction: public Element2GeoItem { public: MakeSubtraction(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_SUBTRACTION_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTorus.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTorus.h index 7ad6b07ef..5d269cb7e 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTorus.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTorus.h @@ -12,7 +12,7 @@ class MakeTorus: public Element2GeoItem { public: MakeTorus(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_TORUS_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrap.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrap.h index 3e8794c8c..283281459 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrap.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrap.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeTrap: public Element2GeoItem { public: MakeTrap(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_TRAP_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrd.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrd.h index 85ec542af..ae05777cd 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrd.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTrd.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeTrd: public Element2GeoItem { public: MakeTrd(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_TRD_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTube.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTube.h index 8c6f45deb..bdf81d3c2 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTube.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTube.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeTube: public Element2GeoItem { public: MakeTube(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_TUBE_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTubs.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTubs.h index c414908e5..a75b17263 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTubs.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTubs.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeTubs: public Element2GeoItem { public: MakeTubs(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_TUBS_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTwistedTrap.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTwistedTrap.h index 2d41e7e3e..984ae165a 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTwistedTrap.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeTwistedTrap.h @@ -11,7 +11,7 @@ class MakeTwistedTrap: public Element2GeoItem { public: MakeTwistedTrap(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_TWISTED_TRAP_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeUnion.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeUnion.h index e1a762fda..cb5f32fc1 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeUnion.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/shape/MakeUnion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -15,7 +15,7 @@ class MakeUnion: public Element2GeoItem { public: MakeUnion(); - const RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const; + virtual RCBase * make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const override; }; #endif // GEO_MODEL_XML_MAKE_UNION_H diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/AssemblyrefProcessor.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/AssemblyrefProcessor.cxx index fbb0885aa..fa940e063 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/AssemblyrefProcessor.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/AssemblyrefProcessor.cxx @@ -38,7 +38,7 @@ char *toRelease; if (nodeName != string("assembly")) { msglog << MSG::FATAL << "Error in xml/gmx file: assemblyref " << XMLString::transcode(idref) << " referenced a " << nodeName << " instead of an assembly.\n"; - exit(999); // Should do better... + std::abort(); } // // Process it diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItem.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItem.cxx index 5dcef9ae1..7ed20e61b 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItem.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItem.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include <string> @@ -20,7 +20,7 @@ Element2GeoItem::Element2GeoItem() {} Element2GeoItem::~Element2GeoItem() {} -const RCBase * Element2GeoItem::process(const xercesc::DOMElement *element, GmxUtil &gmxUtil) { +RCBase * Element2GeoItem::process(const xercesc::DOMElement *element, GmxUtil &gmxUtil) { char *name2release; XMLCh * name_tmp = XMLString::transcode("name"); @@ -30,8 +30,8 @@ const RCBase * Element2GeoItem::process(const xercesc::DOMElement *element, GmxU XMLString::release(&name2release); XMLString::release(&name_tmp); - const RCBase *item; - map<string, const RCBase *>::iterator entry; + RCBase *item; + map<string, RCBase *>::iterator entry; if (name == "") { // Unnamed item; cannot store in the map; make a new one item = make(element, gmxUtil); } @@ -46,10 +46,10 @@ const RCBase * Element2GeoItem::process(const xercesc::DOMElement *element, GmxU return item; } -const RCBase * Element2GeoItem::make(const xercesc::DOMElement *element, GmxUtil & /* gmxUtil */) const { +RCBase * Element2GeoItem::make(const xercesc::DOMElement *element, GmxUtil & /* gmxUtil */) const { char *name2release = XMLString::transcode(element->getNodeName()); msglog << MSG::FATAL << "Oh oh: called base class make() method of Element2GeoType object; tag " << name2release << endmsg; XMLString::release(&name2release); - exit(999); // Should improve on this + std::abort(); } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx index 2e03038f5..7dec26ff9 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx @@ -43,7 +43,7 @@ Gmx2Geo::Gmx2Geo(const string xmlFile, GeoPhysVol *addHere, GmxInterface &gmxInt if (!doc) {// Parsed badly XMLPlatformUtils::Terminate(); msglog << MSG::FATAL << "Error in xml file " << xmlFile << ". Exiting athena." << endmsg; - exit(0); + std::abort(); } // // Set up the CLHEP evaluator and the xml-tag processors, and store the GmxInterface: @@ -215,7 +215,7 @@ const DOMElement *element; msglog << val << endl; msglog << string(eval.error_position(), '-') << '^' << '\n'; msglog << "Exiting program." << endmsg; - exit(999); // Should do better... + std::abort(); } eval.setVariable(name, evaluated); msglog << name << "\t\t" << val << " = " << setprecision(10) << evaluated << endl; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx index 2f2372875..0869d8257 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx @@ -13,16 +13,17 @@ #include "GeoModelKernel/Query.h" #include "GeoModelKernel/GeoPhysVol.h" #include "GeoModelKernel/GeoVFullPhysVol.h" +#include <atomic> using namespace std; int GmxInterface::sensorId(map<string, int> &/*index*/) const { - static int sequentialId; - return sequentialId++; + static std::atomic<int> sequentialId; + return sequentialId++; } int GmxInterface::splitSensorId(map<string, int> &/*index*/, std::pair<std::string, int> &/*extraIndex*/, map<string, int> &/*updatedIndex*/) const { - static int sequentialId; - return sequentialId++; + static std::atomic<int> sequentialId; + return sequentialId++; } void GmxInterface::addSensorType(string clas, string type, map<string, string> params) { diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxUtil.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxUtil.cxx index 37fc51aad..3e2ca1780 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxUtil.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxUtil.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelXml/GmxUtil.h" @@ -82,7 +82,7 @@ GmxInterface * GmxUtil::gmxInterface() { double GmxUtil::evaluate(char const *expression) { static string lastGoodExpression("none"); // It is helpful for debugging to get some idea of where we had got to... - string strExpression(expression); + string thread_local strExpression(expression); bool isWhiteSpace = true; for(unsigned int i = 0; i < strExpression.length(); ++i){ diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx index c6a6736bc..2ef81b8e0 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolProcessor.cxx @@ -47,7 +47,7 @@ void LogvolProcessor::process(const DOMElement *element, GmxUtil &gmxUtil, GeoNo // map<string, LogVolStore>::iterator entry; if ((entry = m_map.find(name)) == m_map.end()) { // Not in registry; make a new item -// + // // Name // m_map[name] = LogVolStore(); @@ -65,11 +65,12 @@ void LogvolProcessor::process(const DOMElement *element, GmxUtil &gmxUtil, GeoNo // Check it is a shape... its parent should be a <shapes>. DTD cannot do this for us. DOMNode *parent = refShape->getParentNode(); if (XMLString::compareIString(parent->getNodeName(), XMLString::transcode("shapes")) != 0) { - + char* shape_s = XMLString::transcode (shape); msglog << MSG::FATAL << "Processing logvol " << name << - ". Error in gmx file. An IDREF for a logvol shape did not refer to a shape.\n" << - "Shape ref was " << shape << "; exiting" << endmsg; - exit (1); // Need to improve... + ". Error in gmx file. An IDREF for a logvol shape did not refer to a shape.\n" << + "Shape ref was " << shape_s << "; exiting" << endmsg; + XMLString::release (&shape_s); + std::abort(); } // // What sort of shape? @@ -79,7 +80,7 @@ void LogvolProcessor::process(const DOMElement *element, GmxUtil &gmxUtil, GeoNo XMLString::release(&name2release); XMLString::release(&shape_tmp); - GeoShape *s = (GeoShape *) gmxUtil.geoItemRegistry.find(shapeType)->process(refShape, gmxUtil); + const GeoShape *s = static_cast<const GeoShape *>(gmxUtil.geoItemRegistry.find(shapeType)->process(refShape, gmxUtil)); // // Get the material // @@ -90,28 +91,30 @@ void LogvolProcessor::process(const DOMElement *element, GmxUtil &gmxUtil, GeoNo parent = refMaterial->getParentNode(); XMLCh * materials_tmp = XMLString::transcode("materials"); if (XMLString::compareIString(parent->getNodeName(), materials_tmp) != 0) { + char* material_s = XMLString::transcode (material); msglog << MSG::FATAL << "Processing logvol " << name << - ". Error in gmx file. An IDREF for a logvol material did not refer to a material.\n" << - "Material ref was " << material << "; exiting" << endmsg; - exit (1); // Need to improve... + ". Error in gmx file. An IDREF for a logvol material did not refer to a material.\n" << + "Material ref was " << material_s << "; exiting" << endmsg; + XMLString::release (&material_s); + std::abort(); } - std::string nam_mat=XMLString::transcode(material); + std::string nam_mat=XMLString::transcode(material); - GeoMaterial* m=0; + const GeoMaterial* m=nullptr; if (gmxUtil.matManager) { if (!gmxUtil.matManager->isMaterialDefined(nam_mat)) { - GeoMaterial* tempMat=(GeoMaterial *) gmxUtil.tagHandler.material.process(refMaterial, gmxUtil); + GeoMaterial* tempMat=static_cast<GeoMaterial *>(gmxUtil.tagHandler.material.process(refMaterial, gmxUtil)); // we let GMX create the material and store it in the MM gmxUtil.matManager->addMaterial(tempMat); } - m=const_cast<GeoMaterial*>(gmxUtil.matManager->getMaterial(nam_mat)); + m=gmxUtil.matManager->getMaterial(nam_mat); } else - m=(GeoMaterial *) gmxUtil.tagHandler.material.process(refMaterial, gmxUtil); + m=static_cast<const GeoMaterial *>(gmxUtil.tagHandler.material.process(refMaterial, gmxUtil)); // // Make the LogVol and add it to the map ready for next time diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolrefProcessor.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolrefProcessor.cxx index 7270fea6b..9b3bcbd97 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolrefProcessor.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/LogvolrefProcessor.cxx @@ -35,7 +35,7 @@ char *toRelease; if (nodeName != string("logvol")) { msglog << MSG::FATAL << "Error in xml/gmx file: logvolref " << XMLString::transcode(idref) << " referenced a " << nodeName << " instead of a logvol." << endmsg; - exit(999); // Should do better... + std::abort(); } // // Process it diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeBox.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeBox.cxx index 75a1e43c1..bd8cf3e8b 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeBox.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeBox.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -14,7 +14,7 @@ using namespace xercesc; MakeBox::MakeBox() {} -const RCBase * MakeBox::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeBox::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 3; char const *parName[nParams] = {"xhalflength", "yhalflength", "zhalflength"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeCons.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeCons.cxx index 7acac8dc1..092261f6d 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeCons.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeCons.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -14,7 +14,7 @@ using namespace xercesc; MakeCons::MakeCons() {} -const RCBase * MakeCons::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeCons::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 7; char const *parName[nParams] = {"rmin1", "rmin2", "rmax1", "rmax2", "dz", "sphi", "dphi"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeElement.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeElement.cxx index 9129d0f98..b6c84ba0b 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeElement.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeElement.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelXml/MakeElement.h" @@ -15,7 +15,7 @@ using namespace GeoModelKernelUnits; MakeElement::MakeElement() {} -const RCBase * MakeElement::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeElement::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { //std::cout<<"this is MakeElement: make()"<<std::endl; char *name, *shortname, *z,*a; XMLCh *name_tmp,*shortname_tmp,*z_tmp,*a_tmp; @@ -65,5 +65,5 @@ const RCBase * MakeElement::make(const xercesc::DOMElement *element, GmxUtil &gm XMLString::release(&name_tmp); XMLString::release(&shortname_tmp); - return (const RCBase *) el; + return (RCBase *) el; } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeEllipticalTube.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeEllipticalTube.cxx index 016240406..6b874b879 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeEllipticalTube.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeEllipticalTube.cxx @@ -13,7 +13,7 @@ using namespace xercesc; MakeEllipticalTube::MakeEllipticalTube() {} -const RCBase * MakeEllipticalTube::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeEllipticalTube::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 3; char const *parName[nParams] = {"xhalflength", "yhalflength", "zhalflength"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeGenericTrap.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeGenericTrap.cxx index df1a86fc8..4bf1df752 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeGenericTrap.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeGenericTrap.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // *NOT*!!! Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -18,7 +18,7 @@ using namespace xercesc; MakeGenericTrap::MakeGenericTrap() {} -const RCBase * MakeGenericTrap::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeGenericTrap::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 17; char const *parName[nParams] = {"x0", "y0", "x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4", "x5", "y5", "x6", "y6", "x7", "y7", "zhalflength"}; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx index 8b5a7b2be..a985b595d 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -21,43 +21,45 @@ using namespace std; MakeIntersection::MakeIntersection() {} -const RCBase * MakeIntersection::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeIntersection::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { // // Process child elements; first is first shaperef; then transform; then second shaperef. // - GeoShape *first = 0; - GeoShape *second = 0; + const GeoShape *first = 0; + const GeoShape *second = 0; GeoTrf::Transform3D hepXf=GeoTrf::Transform3D::Identity(); int elementIndex = 0; for (DOMNode *child = element->getFirstChild(); child != 0; child = child->getNextSibling()) { if (child->getNodeType() == DOMNode::ELEMENT_NODE) { // Skips text nodes - switch (elementIndex) { - case 0: { // First element is first shaperef - first = (GeoShape *) gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil); - break; - } - case 1: { // Second element is transformation or transformationref - char *toRelease = XMLString::transcode(child->getNodeName()); - string nodeName(toRelease); - XMLString::release(&toRelease); - GeoTransform *geoXf = nodeName == "transformation"? -(GeoTransform *) gmxUtil.tagHandler.transformation.process(dynamic_cast<DOMElement *>(child), gmxUtil): -(GeoTransform *) gmxUtil.tagHandler.transformationref.process(dynamic_cast<DOMElement *>(child), gmxUtil); - hepXf = geoXf->getTransform(); - break; - } - case 2: { // Third element is second shaperef - second = (GeoShape *) gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil); - break; - } - default: // More than 3 elements? - msglog << MSG::FATAL << "MakeIntersection: Incompatible DTD? got more than 3 child elements\n"; - } - elementIndex++; + switch (elementIndex) { + case 0: { // First element is first shaperef + first = static_cast<const GeoShape *>(gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil)); + break; + } + case 1: { // Second element is transformation or transformationref + char *toRelease = XMLString::transcode(child->getNodeName()); + string nodeName(toRelease); + XMLString::release(&toRelease); + const GeoTransform *geoXf = (nodeName == "transformation") + ? static_cast<const GeoTransform *>( gmxUtil.tagHandler.transformation.process(dynamic_cast<DOMElement *>(child), gmxUtil)) + : static_cast<const GeoTransform *>( gmxUtil.tagHandler.transformationref.process(dynamic_cast<DOMElement *>(child), gmxUtil)); + hepXf = geoXf->getTransform(); + break; + } + case 2: { // Third element is second shaperef + second = static_cast<const GeoShape *>( gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil)); + break; + } + default: // More than 3 elements? + msglog << MSG::FATAL << "MakeIntersection: Incompatible DTD? got more than 3 child elements\n"; + } + elementIndex++; } } - - const GeoShapeIntersection *temp = &(first->intersect(*(GeoShape *) &(*(second) << hepXf))); + // FIXME: intersect() returns a new'd object --- should really be + // returning a `unique_ptr<GeoShapeIntersection>' not a + // `const GeoShapeIntersection' + GeoShapeIntersection *temp = const_cast<GeoShapeIntersection*>(&(first->intersect(*(GeoShape *) &(*(second) << hepXf)))); return (RCBase *) temp; } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeMaterial.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeMaterial.cxx index 79747e7df..e2ac66ebe 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeMaterial.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeMaterial.cxx @@ -18,7 +18,7 @@ using namespace GeoModelKernelUnits; MakeMaterial::MakeMaterial() {} -const RCBase * MakeMaterial::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeMaterial::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { char *name; char *density; char *densitySF; @@ -48,7 +48,7 @@ char *toRelease; if (XMLString::compareIString(parent->getNodeName(), materials_tmp) != 0) { msglog << MSG::FATAL << "Asked to make a material for non-material element. Parent element was " << XMLString::transcode(parent->getNodeName()) << "; error in gmx file; exiting" << endmsg; - exit(1); + std::abort(); } double scaleFactor(1.0); DOMElement *el = dynamic_cast<DOMElement *> (parent); @@ -89,26 +89,25 @@ char *toRelease; if (nodeName != string("element")) { msglog << MSG::FATAL << "Error in xml/gmx file: An elementref referenced a " << nodeName << " instead of an element." << endmsg; - exit(999); // Should do better... + std::abort(); } - const GeoElement *geoElem = 0; + const GeoElement *geoElem = nullptr; if (gmxUtil.matManager) { name=XMLString::transcode(idref); if (!gmxUtil.matManager->isElementDefined(name)) { - GeoElement *temp=(GeoElement *) gmxUtil.tagHandler.element.process(elem, gmxUtil); - //gmxUtil.matManager->addElement(temp); + const GeoElement *temp=static_cast<const GeoElement *>( gmxUtil.tagHandler.element.process(elem, gmxUtil)); + //gmxUtil.matManager->addElement(temp); } - geoElem=const_cast<GeoElement*>(gmxUtil.matManager->getElement(name)); + geoElem=gmxUtil.matManager->getElement(name); XMLString::release(&name); } else { - - geoElem=(const GeoElement *) gmxUtil.tagHandler.element.process(elem, gmxUtil); - if (!geoElem) std::cout<<"could not retrieve element!!!!!"<<std::endl; + geoElem=static_cast<const GeoElement *>( gmxUtil.tagHandler.element.process(elem, gmxUtil)); + if (!geoElem) std::cout<<"could not retrieve element!!!!!"<<std::endl; } @@ -135,7 +134,7 @@ char *toRelease; if (nodeName != string("chemical")) { msglog << MSG::FATAL << "Error in xml/gmx file: A chemref referenced a " << nodeName << " instead of a chemical." << endmsg; - exit(999); // Should do better... + std::abort(); } fracString = XMLString::transcode(chemRef->getAttribute(fraction_tmp)); @@ -145,7 +144,7 @@ char *toRelease; // Loop over chemical contents, adding each element to this material DOMNodeList *chemEls = chem->getElementsByTagName(elemcontent_tmp); int nChemEls = chemEls->getLength(); - vector<GeoElement *> geoElem; + vector<const GeoElement *> geoElem; vector<double> atomicWeight; double molWeight = 0.0; vector<double> formula; @@ -160,18 +159,18 @@ char *toRelease; if (nodeName != string("element")) { msglog << MSG::FATAL << "Error in xml/gmx file: An elementref referenced a " << nodeName << " instead of an element." << endmsg; - exit(999); // Should do better... + std::abort(); } if (gmxUtil.matManager) { name=XMLString::transcode(idref); - geoElem.push_back((GeoElement *)gmxUtil.matManager->getElement(name)); + geoElem.push_back(gmxUtil.matManager->getElement(name)); XMLString::release(&name); } else { - geoElem.push_back((GeoElement *) gmxUtil.tagHandler.element.process(elem, gmxUtil)); + geoElem.push_back(static_cast<const GeoElement *>(gmxUtil.tagHandler.element.process(elem, gmxUtil))); } atomicWeight.push_back(geoElem.back()->getA()); @@ -245,5 +244,5 @@ char *toRelease; XMLString::release(&materialref_tmp); - return (const RCBase *) material; + return (RCBase *) material; } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePara.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePara.cxx index e1aaef2b7..c68e18761 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePara.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePara.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -14,7 +14,7 @@ using namespace xercesc; MakePara::MakePara() {} -const RCBase * MakePara::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakePara::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 6; char const *parName[nParams] = {"xhalflength", "yhalflength", "zhalflength", "alpha", "theta", "phi"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePcon.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePcon.cxx index f333f5fdd..4b98472a3 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePcon.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePcon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -15,7 +15,7 @@ using namespace xercesc; MakePcon::MakePcon() {} -const RCBase * MakePcon::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakePcon::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 2; char const *parName[nParams] = {"sphi", "dphi"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePgon.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePgon.cxx index a57daf512..a73b002c7 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePgon.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakePgon.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -15,7 +15,7 @@ using namespace xercesc; MakePgon::MakePgon() {} -const RCBase * MakePgon::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakePgon::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 3; char const *parName[nParams] = {"sphi", "dphi", "nsides"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx index 86aa0d39f..ce74ffe59 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeShaperef.cxx @@ -15,7 +15,7 @@ using namespace std; using namespace xercesc; -const RCBase *MakeShaperef::process(const DOMElement *element, GmxUtil &gmxUtil) const { +RCBase *MakeShaperef::process(const DOMElement *element, GmxUtil &gmxUtil) const { // // Get the referenced shape // @@ -35,7 +35,7 @@ const RCBase *MakeShaperef::process(const DOMElement *element, GmxUtil &gmxUtil) msglog << MSG::FATAL << "Error processing <shaperef> tag: An IDREF for a shape did not refer to a shape.\nShape ref was " << idref_s << "; exiting" << endmsg; XMLString::release (&idref_s); - exit (1); // Need to improve... + std::abort(); } // // Get what sort of shape diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSimplePolygonBrep.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSimplePolygonBrep.cxx index 3b1ba55db..80943dc73 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSimplePolygonBrep.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSimplePolygonBrep.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include <string> #include <vector> @@ -16,7 +16,7 @@ using namespace xercesc; MakeSimplePolygonBrep::MakeSimplePolygonBrep() {} -const RCBase * MakeSimplePolygonBrep::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeSimplePolygonBrep::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 3; char const *parName[nParams] = {"xpoints", "ypoints", "zhalflength"}; double z; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx index 1167dcf44..9195c58b8 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -22,43 +22,45 @@ using namespace std; MakeSubtraction::MakeSubtraction() {} -const RCBase * MakeSubtraction::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeSubtraction::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { // // Process child elements; first is first shaperef; then transformation; then second shaperef. // - GeoShape *first = 0; - GeoShape *second = 0; + const GeoShape *first = 0; + const GeoShape *second = 0; GeoTrf::Transform3D hepXf=GeoTrf::Transform3D::Identity(); int elementIndex = 0; for (DOMNode *child = element->getFirstChild(); child != 0; child = child->getNextSibling()) { if (child->getNodeType() == DOMNode::ELEMENT_NODE) { // Skips text nodes - switch (elementIndex) { - case 0: { // First element is first shaperef - first = (GeoShape *) gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil); - break; - } - case 1: { // Second element is transformation or transformationref - char *toRelease = XMLString::transcode(child->getNodeName()); - string nodeName(toRelease); - XMLString::release(&toRelease); - GeoTransform *geoXf = nodeName == "transformation"? -(GeoTransform *) gmxUtil.tagHandler.transformation.process(dynamic_cast<DOMElement *>(child), gmxUtil): -(GeoTransform *) gmxUtil.tagHandler.transformationref.process(dynamic_cast<DOMElement *>(child), gmxUtil); - hepXf = geoXf->getTransform(); - break; - } - case 2: { // Third element is second shaperef - second = (GeoShape *) gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil); - break; - } - default: // More than 3 elements? - msglog << MSG::FATAL << "MakeSubtraction: Incompatible DTD? got more than 3 child elements" << endmsg; - } - elementIndex++; + switch (elementIndex) { + case 0: { // First element is first shaperef + first = static_cast<const GeoShape *>(gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil)); + break; + } + case 1: { // Second element is transformation or transformationref + char *toRelease = XMLString::transcode(child->getNodeName()); + string nodeName(toRelease); + XMLString::release(&toRelease); + const GeoTransform *geoXf = (nodeName == "transformation") + ? static_cast<const GeoTransform *>( gmxUtil.tagHandler.transformation.process(dynamic_cast<DOMElement *>(child), gmxUtil)) + : static_cast<const GeoTransform *>( gmxUtil.tagHandler.transformationref.process(dynamic_cast<DOMElement *>(child), gmxUtil)); + hepXf = geoXf->getTransform(); + break; + } + case 2: { // Third element is second shaperef + second = (GeoShape *) gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil); + break; + } + default: // More than 3 elements? + msglog << MSG::FATAL << "MakeSubtraction: Incompatible DTD? got more than 3 child elements" << endmsg; + } + elementIndex++; } } - - const GeoShapeSubtraction *temp = &(first->subtract(*(GeoShape *) &(*(second) << hepXf))); + // FIXME: subtract() returns a new'd object --- should really be + // returning a `unique_ptr<GeoShapeSubtraction>' not a + // `const GeoShapeSubtraction' + GeoShapeSubtraction *temp = const_cast<GeoShapeSubtraction*>(&(first->subtract(*(GeoShape *) &(*(second) << hepXf)))); return (RCBase *) temp; } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTorus.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTorus.cxx index d1e3b9c36..205a260e5 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTorus.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTorus.cxx @@ -15,7 +15,7 @@ using namespace xercesc; MakeTorus::MakeTorus() {} -const RCBase * MakeTorus::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeTorus::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 5; char const *parName[nParams] = {"rmin", "rmax", "rtor", "sphi", "dphi"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformation.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformation.cxx index 603b094b6..5c1e1cf30 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformation.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformation.cxx @@ -18,7 +18,7 @@ using namespace std; MakeTransformation::MakeTransformation() {} -const RCBase * MakeTransformation::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeTransformation::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { char *name2release; GeoTrf::Transform3D hepTransform=GeoTrf::Transform3D::Identity(); // Starts as Identity transform // @@ -53,9 +53,9 @@ char *name2release; XMLString::release(&toRelease); XMLString::release(&alignable_tmp); if (alignable.compare(string("true")) == 0) { - return (const RCBase *) new GeoAlignableTransform(hepTransform); + return (RCBase *) new GeoAlignableTransform(hepTransform); } else { - return (const RCBase *) new GeoTransform(hepTransform); + return (RCBase *) new GeoTransform(hepTransform); } } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformationref.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformationref.cxx index 235aae6ed..31215493e 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformationref.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTransformationref.cxx @@ -16,7 +16,7 @@ using namespace std; using namespace xercesc; -const RCBase *MakeTransformationref::make(const DOMElement *element, GmxUtil &gmxUtil) const { +RCBase *MakeTransformationref::make(const DOMElement *element, GmxUtil &gmxUtil) const { XMLCh *ref = XMLString::transcode("ref"); const XMLCh *idref; DOMDocument *doc = element->getOwnerDocument(); @@ -35,7 +35,7 @@ char *toRelease; if (nodeName != string("transformation")) { msglog << MSG::FATAL << "Error in xml/gmx file: transformationref " << XMLString::transcode(idref) << " referenced a " << nodeName << " instead of a transformation." << endmsg; - exit(999); // Should do better... + std::abort(); } // // Process it diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrap.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrap.cxx index c7c64b3eb..6e881629f 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrap.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrap.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -14,7 +14,7 @@ using namespace xercesc; MakeTrap::MakeTrap() {} -const RCBase * MakeTrap::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeTrap::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 11; char const *parName[nParams] = {"zhalflength", "theta", "phi", "dydzn", "dxdyndzn", "dxdypdzn", "angleydzn", "dydzp", "dxdyndzp", "dxdypdzp", "angleydzp"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrd.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrd.cxx index afe9dd86a..7b326216d 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrd.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTrd.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -14,7 +14,7 @@ using namespace xercesc; MakeTrd::MakeTrd() {} -const RCBase * MakeTrd::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeTrd::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 5; char const *parName[nParams] = {"xhalflength1", "xhalflength2", "yhalflength1", "yhalflength2", "zhalflength"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTube.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTube.cxx index b8690d063..e916cd98a 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTube.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTube.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -14,7 +14,7 @@ using namespace xercesc; MakeTube::MakeTube() {} -const RCBase * MakeTube::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeTube::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 3; char const *parName[nParams] = {"rmin", "rmax", "zhalflength"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTubs.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTubs.cxx index b0d4d79bf..f6c76a6a9 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTubs.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTubs.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // Automatically generated code from /home/hessey/prog/gmx2geo/makeshape @@ -14,7 +14,7 @@ using namespace xercesc; MakeTubs::MakeTubs() {} -const RCBase * MakeTubs::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeTubs::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 5; char const *parName[nParams] = {"rmin", "rmax", "zhalflength", "sphi", "dphi"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTwistedTrap.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTwistedTrap.cxx index 7f3a62d38..786e506a8 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTwistedTrap.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeTwistedTrap.cxx @@ -33,7 +33,7 @@ using namespace xercesc; MakeTwistedTrap::MakeTwistedTrap() {} -const RCBase * MakeTwistedTrap::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeTwistedTrap::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { const int nParams = 11; char const *parName[nParams] = {"twist", "dz", "theta","phi","dy1","dx1","dx2","dy2","dx3","dx4","alpha"}; double p[nParams]; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx index d2e6c8df6..6bb70ce92 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelXml/shape/MakeUnion.h" @@ -20,43 +20,45 @@ using namespace std; MakeUnion::MakeUnion() {} -const RCBase * MakeUnion::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { +RCBase * MakeUnion::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) const { // // Process child elements; first is first shaperef; then transform; then second shaperef. // - GeoShape *first = 0; - GeoShape *second = 0; + const GeoShape *first = 0; + const GeoShape *second = 0; GeoTrf::Transform3D hepXf=GeoTrf::Transform3D::Identity(); int elementIndex = 0; for (DOMNode *child = element->getFirstChild(); child != 0; child = child->getNextSibling()) { if (child->getNodeType() == DOMNode::ELEMENT_NODE) { // Skips text nodes - switch (elementIndex) { - case 0: { // First element is first shaperef - first = (GeoShape *) gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil); - break; - } - case 1: { // Second element is transformation or transformationref - char *toRelease = XMLString::transcode(child->getNodeName()); - string nodeName(toRelease); - XMLString::release(&toRelease); - GeoTransform *geoXf = nodeName == "transformation"? -(GeoTransform *) gmxUtil.tagHandler.transformation.process(dynamic_cast<DOMElement *>(child), gmxUtil): -(GeoTransform *) gmxUtil.tagHandler.transformationref.process(dynamic_cast<DOMElement *>(child), gmxUtil); - hepXf = geoXf->getTransform(); - break; - } - case 2: { // Third element is second shaperef - second = (GeoShape *) gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil); - break; - } - default: // More than 3 elements? - msglog << MSG::FATAL << "MakeUnion: Incompatible DTD? got more than 3 child elements" << endmsg; - } - elementIndex++; + switch (elementIndex) { + case 0: { // First element is first shaperef + first = static_cast<GeoShape *>( gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil)); + break; + } + case 1: { // Second element is transformation or transformationref + char *toRelease = XMLString::transcode(child->getNodeName()); + string nodeName(toRelease); + XMLString::release(&toRelease); + const GeoTransform *geoXf = (nodeName == "transformation") + ? static_cast<const GeoTransform *>( gmxUtil.tagHandler.transformation.process(dynamic_cast<DOMElement *>(child), gmxUtil)) + : static_cast<const GeoTransform *>( gmxUtil.tagHandler.transformationref.process(dynamic_cast<DOMElement *>(child), gmxUtil)); + hepXf = geoXf->getTransform(); + break; + } + case 2: { // Third element is second shaperef + second = static_cast<const GeoShape *>( gmxUtil.tagHandler.shaperef.process(dynamic_cast<DOMElement *> (child), gmxUtil)); + break; + } + default: // More than 3 elements? + msglog << MSG::FATAL << "MakeUnion: Incompatible DTD? got more than 3 child elements" << endmsg; + } + elementIndex++; } } - - const GeoShapeUnion *temp = &(first->add(*(GeoShape *) &(*(second) << hepXf))); + // FIXME: add() returns a new'd object --- should really be + // returning a `unique_ptr<GeoShapeUnion>' not a + // `const GeoShapeUnion' + GeoShapeUnion *temp = const_cast<GeoShapeUnion*>(&(first->add(*(GeoShape *) &(*(second) << hepXf)))); return (RCBase *) temp; } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MulticopyProcessor.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MulticopyProcessor.cxx index 395798d38..e5b5d7c32 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MulticopyProcessor.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MulticopyProcessor.cxx @@ -90,7 +90,7 @@ DOMDocument *doc = element->getOwnerDocument(); if (!gmxUtil.eval.findVariable(firstElement.c_str())) { msglog << MSG::FATAL << "Error in .gmx file. Processing multicopy element with name " << name << ". Found loopvar set to " << varname << ", but no vector with that name has been defined." << endmsg; - exit(999); // Should do better + std::abort(); } } // @@ -108,7 +108,7 @@ DOMDocument *doc = element->getOwnerDocument(); else { // Not OK msglog << MSG::FATAL << "Error in .gmx file. Processing multicopy element with name " << name << ". \nIt gives loopvar therefore should have a <transformation> and not a <transformationref> (despite the DTD)\n"; - exit(999); // Should do better + std::abort(); } } else { @@ -125,12 +125,12 @@ DOMDocument *doc = element->getOwnerDocument(); for (int i = 0; i < nCopies; ++i) { gmxUtil.eval.setVariable(varname.c_str(), (varname + "_" + to_string(i)).c_str()); if (alignable) { - geoAXf = (GeoAlignableTransform *) xFormProcessor->make(elXf, gmxUtil); - xfList->push_back((GeoGraphNode *) geoAXf); + geoAXf = static_cast<GeoAlignableTransform *>( xFormProcessor->make(elXf, gmxUtil)); + xfList->push_back((GeoGraphNode *) geoAXf); } else { - geoXf = (GeoTransform *) xFormProcessor->make(elXf, gmxUtil); - xfList->push_back((GeoGraphNode *) geoXf); + geoXf = static_cast<GeoTransform *>( xFormProcessor->make(elXf, gmxUtil)); + xfList->push_back((GeoGraphNode *) geoXf); } gmxUtil.eval.removeVariable(varname.c_str()); // Avoids a warning status in evaluator } @@ -142,12 +142,12 @@ DOMDocument *doc = element->getOwnerDocument(); // GeoTrf::Transform3D hepXf0=GeoTrf::Transform3D::Identity(); if (alignable) { - geoAXf = (GeoAlignableTransform *) xFormProcessor->make(elXf, gmxUtil); - hepXf0 = geoAXf->getTransform(); + geoAXf = static_cast<GeoAlignableTransform *>( xFormProcessor->make(elXf, gmxUtil)); + hepXf0 = geoAXf->getTransform(); } else { - geoXf = (GeoTransform *) xFormProcessor->make(elXf, gmxUtil); - hepXf0 = geoXf->getTransform(); + geoXf = static_cast<GeoTransform *>( xFormProcessor->make(elXf, gmxUtil)); + hepXf0 = geoXf->getTransform(); } GeoTrf::Transform3D hepXf=GeoTrf::Transform3D::Identity(); // Identity initially for (int i = 0; i < nCopies; ++i) { @@ -204,7 +204,7 @@ DOMDocument *doc = element->getOwnerDocument(); msglog << MSG::FATAL << "multicopyprocessor: error in " << name << ". <transform> object was neither assemblyref nor logvolref\n" << "Exiting Athena" << endmsg; - exit(999); // Should do better + std::abort(); } } } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx index 7a2b3ad65..81104cdea 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include <cstdlib> @@ -104,7 +104,7 @@ void PositionIndex::indices(map<string, int> &index, Evaluator &eval) { eval.print_error(); msglog << m_formula[name] << endl << string(eval.error_position(), '-') << '^' << '\n' << "Exiting program." << endmsg; - exit(999); // Should do better... + std::abort(); } // // And create a CLHEP variable with the same index-name in case the user needs it diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformProcessor.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformProcessor.cxx index 55774d471..71a593bd4 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformProcessor.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformProcessor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -51,7 +51,7 @@ char *tagName; DOMElement *transformation = element->getFirstElementChild(); tagName = XMLString::transcode(transformation->getTagName()); // transformation or transformationref // ******* Should check here that an alignable transform is given an alignable transformation and object; to be done - toAdd.push_back((GeoGraphNode *)gmxUtil.geoItemRegistry.find(string(tagName))->process(transformation, gmxUtil)); + toAdd.push_back((GeoGraphNode *)(gmxUtil.geoItemRegistry.find(string(tagName))->process(transformation, gmxUtil))); XMLString::release(&tagName); // // Add transformation to DetectorManager via GmxInterface, if it is alignable diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformrefProcessor.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformrefProcessor.cxx index e18727a3a..7db59b85b 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformrefProcessor.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/TransformrefProcessor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -35,7 +35,7 @@ char *toRelease; if (nodeName != "transform") { msglog << MSG::FATAL<< "Error in xml/gmx file: transformref " << XMLString::transcode(idref) << " referenced a " << nodeName << " instead of a logvol." << endmsg; - exit(999); // Should do better... + std::abort(); } // // Process it diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/decompress.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/decompress.cxx index 6566366cb..48bf3168c 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/decompress.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/decompress.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -24,7 +24,8 @@ string decompress(const string& str) { zs.zalloc = NULL; zs.zfree = NULL; zs.opaque = NULL; - zs.next_in = (Bytef *)str.c_str(); + char* str_nc = const_cast<char*> (str.c_str()); + zs.next_in = reinterpret_cast<Bytef *>(str_nc); zs.avail_in = str.size(); // According to the official manual, 2nd param is windowsBits and is max. 15. But a web page somewhere -- GitLab