diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoMaterial.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoMaterial.h index 1a328fd896f261de29ff60b4c914e0f7abe3935b..b7b24987b19876d4b1547897043236b54392243e 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoMaterial.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoMaterial.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELKERNEL_GEOMATERIAL_H @@ -27,8 +27,12 @@ */ #include "GeoModelKernel/RCBase.h" +#include "GeoModelKernel/GeoIntrusivePtr.h" #include "GeoModelKernel/GeoElement.h" #include <vector> +#include <memory> +#include <array> +#include <atomic> class GeoMaterial : public RCBase { @@ -73,70 +77,61 @@ class GeoMaterial : public RCBase double getFraction (int i) const; // The name of the material. - const std::string& getName () const; + const std::string& getName () const{ + return m_name; + } // The density of the material. - const double& getDensity () const; + double getDensity () const{ + return m_density; + } // Gives an integral identifier for the material. For // convenience. - const unsigned int& getID () const; + unsigned int getID () const { + return m_iD; + } + + protected: - virtual ~GeoMaterial(); + virtual ~GeoMaterial() = default; private: - GeoMaterial(const GeoMaterial &right); - GeoMaterial & operator=(const GeoMaterial &right); - - std::string m_name; - double m_density; - unsigned int m_iD; + + + std::string m_name{}; + double m_density{0.}; + unsigned int m_iD{0}; // A list of the fractional composition of each material. // Fraction is by mass. - std::vector<double> m_fraction; + std::vector<double> m_fraction{}; // The radiation length of the material. - double m_radLength; + double m_radLength{0.}; // The interaction length of the material. - double m_intLength; + double m_intLength{0.}; // A static used to assign unique identifiers to new // materials. - static unsigned int s_lastID; + static std::atomic<unsigned int> s_lastID; // The constant term in the formula governing dE/dx. - double m_dedDxConst; + double m_dedDxConst{0.}; // The ionization potential in the formula governing dE/dx. - double m_deDxI0; + double m_deDxI0{0.}; // A flag used to lock the material from further addition // of elements or other constituents. - bool m_locked; - - static const double s_ionizationPotential[93]; + bool m_locked{false}; private: // The list of GeoElements composing a GeoMaterial. - std::vector<const GeoElement *> m_element; + std::vector<GeoIntrusivePtr<const GeoElement>> m_element{}; }; -inline const std::string& GeoMaterial::getName () const -{ - return m_name; -} - -inline const double& GeoMaterial::getDensity () const -{ - return m_density; -} - -inline const unsigned int& GeoMaterial::getID () const -{ - return m_iD; -} #endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoSerialTransformer.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoSerialTransformer.h index 0e6fc9be1a6f9be5aee72ea7d42b83e59ea06ca0..c588fbb463088d1ba41b00843803bc387812cd6c 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoSerialTransformer.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoSerialTransformer.h @@ -16,6 +16,7 @@ #include "GeoModelKernel/GeoVPhysVol.h" #include "GeoModelKernel/GeoXF.h" +#include <memory> class GeoSerialTransformer : public GeoGraphNode { public: @@ -25,42 +26,38 @@ class GeoSerialTransformer : public GeoGraphNode virtual void exec (GeoNodeAction *action) const; // Returns the transformation field itself. - const GeoXF::Function * getFunction () const; + const GeoXF::Function * getFunction () const{ + return m_function.get(); + } // Returns the volume: - PVConstLink getVolume () const - { + PVConstLink getVolume () const { return m_physVol; } // Returns the number of copies: - unsigned int getNCopies () const - { - return m_nCopies; + unsigned int getNCopies () const { + return m_nCopies; } // Returns the transformation to the ith copy: - GeoTrf::Transform3D getTransform (int i) const - { + GeoTrf::Transform3D getTransform (int i) const { return (*m_function) (i); } protected: - virtual ~GeoSerialTransformer(); + virtual ~GeoSerialTransformer() = default; private: - GeoSerialTransformer(const GeoSerialTransformer &right); - GeoSerialTransformer & operator=(const GeoSerialTransformer &right); - // Number of copies of a physical volume to generate. - unsigned int m_nCopies; + unsigned int m_nCopies{0}; // Recipe for the transformation; specifically, a // Transform-valued m_function of a single variable. - const GeoXF::Function *m_function; + std::unique_ptr<const GeoXF::Function> m_function{}; // The physical volume to be multiply placed. - const GeoVPhysVol *m_physVol; + GeoPVConstLink m_physVol{}; }; #endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeIntersection.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeIntersection.h index d18233dabf787da8dc4f905906308c55d30b7c6d..f0f9e0978e024b1a98a9c0a6719e96545a9ba53a 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeIntersection.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeIntersection.h @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELKERNEL_GEOSHAPEINTERSECTION_H #define GEOMODELKERNEL_GEOSHAPEINTERSECTION_H #include "GeoModelKernel/GeoShape.h" +#include "GeoModelKernel/GeoIntrusivePtr.h" #ifndef _GeoShapePersistification_On_ class Persistifier; @@ -28,26 +29,34 @@ class GeoShapeIntersection : public GeoShape virtual bool contains (double x, double y, double z) const; // Returns the AND shape type, as a string. - virtual const std::string & type () const; + virtual const std::string & type () const { + return getClassType(); + } // Returns the AND shape type, as a coded integer. - virtual ShapeType typeID () const; + virtual ShapeType typeID () const { + return getClassTypeID(); + } // Returns the first operand being ANDed - const GeoShape* getOpA () const; + const GeoShape* getOpA () const { + return m_opA; + } // Returns the second operand being ANDed. - const GeoShape* getOpB () const; + const GeoShape* getOpB () const { + return m_opB; + } // Executes a GeoShapeAction virtual void exec (GeoShapeAction *action) const; // For type identification. - static const std::string& getClassType () { + static const std::string& getClassType() { return s_classType; } - inline ShapeType getClassTypeID() { + static ShapeType getClassTypeID() { return s_classTypeID; } diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeShift.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeShift.h index a6d8ed12862f60cbeff418c29bf053590f55bc11..ba62d62ed6cf09aa54be5a8b124051bc69032dbd 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeShift.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeShift.h @@ -6,7 +6,7 @@ #define GEOMODELKERNEL_GEOSHAPESHIFT_H #include "GeoModelKernel/GeoShape.h" -#include "GeoModelKernel/GeoIntusivePtr.h" +#include "GeoModelKernel/GeoIntrusivePtr.h" #include "GeoModelKernel/GeoDefinitions.h" @@ -45,7 +45,7 @@ class GeoShapeShift : public GeoShape { // Returns the shift of this shape. const GeoTrf::Transform3D & getX () const { - return m_shift + return m_shift; } // Executes a GeoShapeAction diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeSubtraction.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeSubtraction.h index 66fb34aca5890b0870f8f7af834c6d69ead435e0..b41d26a4bb4f0c4d7dde1be095aa52f8dec25c62 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeSubtraction.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeSubtraction.h @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELKERNEL_GEOSHAPESUBTRACTION_H #define GEOMODELKERNEL_GEOSHAPESUBTRACTION_H #include "GeoModelKernel/GeoShape.h" +#include "GeoModelKernel/GeoIntrusivePtr.h" #ifndef _GeoShapePersistification_On_ @@ -13,8 +14,7 @@ #endif -class GeoShapeSubtraction : public GeoShape -{ +class GeoShapeSubtraction : public GeoShape { public: // Constructor taking two shape operands GeoShapeSubtraction (const GeoShape* A, const GeoShape* B); @@ -30,59 +30,60 @@ class GeoShapeSubtraction : public GeoShape virtual bool contains (double x, double y, double z) const; // Returns the NOT shape type, as a string. - virtual const std::string & type () const; + virtual const std::string & type () const{ + return getClassType(); + } // Returns the NOT shape type, as a coded integer. - virtual ShapeType typeID () const; + virtual ShapeType typeID () const{ + return getClassTypeID(); + } // Returns the first operand in the subtraction - const GeoShape* getOpA () const; + const GeoShape* getOpA () const{ + return m_opA; + } // Returns the second operand in the subtraction - const GeoShape* getOpB () const; + const GeoShape* getOpB () const{ + return m_opB; + } // Executes a GeoShapeAction virtual void exec (GeoShapeAction *action) const; // For type identification. - static const std::string& getClassType (); + static const std::string& getClassType() { + return s_classType; + } // For type identification. - static ShapeType getClassTypeID (); + static ShapeType getClassTypeID() { + return s_classTypeID; + } protected: - virtual ~GeoShapeSubtraction(); + virtual ~GeoShapeSubtraction() = default; private: - GeoShapeSubtraction(const GeoShapeSubtraction &right); - GeoShapeSubtraction & operator=(const GeoShapeSubtraction &right); - + // The first shape operand in the Subtraction operation - const GeoShape* m_opA; + GeoIntrusivePtr<const GeoShape> m_opA{nullptr}; // The second shape operand in the Subtraction operation - const GeoShape* m_opB; + GeoIntrusivePtr<const GeoShape> m_opB{nullptr}; // Cached volume - mutable double fVolume = -1.; + mutable double fVolume{-1.}; static const std::string s_classType; static const ShapeType s_classTypeID; // For I/O only! - GeoShapeSubtraction(){} + GeoShapeSubtraction() = default; friend Persistifier; }; -inline const std::string& GeoShapeSubtraction::getClassType () -{ - return s_classType; -} - -inline ShapeType GeoShapeSubtraction::getClassTypeID () -{ - return s_classTypeID; -} #endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeUnion.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeUnion.h index 0fc3581fdf997d98f99ae4b199f1bf1e534209bf..067ce53b4f251780f3b07ed934459f4f25becf2d 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeUnion.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoShapeUnion.h @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELKERNEL_GEOSHAPEUNION_H #define GEOMODELKERNEL_GEOSHAPEUNION_H #include "GeoModelKernel/GeoShape.h" +#include "GeoModelKernel/GeoIntrusivePtr.h" #ifndef _GeoShapePersistification_On_ class Persistifier; @@ -27,39 +28,52 @@ class GeoShapeUnion : public GeoShape // Returns true if the shape contains the point, false otherwise virtual bool contains (double x, double y, double z) const; + + // Returns the OR shape type, as a string. - virtual const std::string & type () const; + virtual const std::string & type() const{ + return getClassType(); + } // Returns the OR shape type, as a coded integer. - virtual ShapeType typeID () const; + virtual ShapeType typeID() const { + return getClassTypeID(); + } // Returns the first operand being ORed - const GeoShape* getOpA () const; + const GeoShape* getOpA() const { + return m_opA; + } // Returns the second operand being ORed. - const GeoShape* getOpB () const; + const GeoShape* getOpB() const{ + return m_opB; + } // Executes a GeoShapeAction virtual void exec (GeoShapeAction *action) const; // For type identification. - static const std::string& getClassType (); + static const std::string& getClassType() { + return s_classType; + } // For type identification. - static ShapeType getClassTypeID (); + static ShapeType getClassTypeID() { + return s_classTypeID; + } protected: - virtual ~GeoShapeUnion(); + virtual ~GeoShapeUnion() = default; private: - GeoShapeUnion(const GeoShapeUnion &right); - GeoShapeUnion & operator=(const GeoShapeUnion &right); + // The first shape operand in the OR operation - const GeoShape* m_opA; + GeoIntrusivePtr<const GeoShape> m_opA{}; // The second shape operand in the OR operation - const GeoShape* m_opB; + GeoIntrusivePtr<const GeoShape> m_opB{}; // Cached volume mutable double fVolume = -1.; @@ -68,19 +82,9 @@ class GeoShapeUnion : public GeoShape static const ShapeType s_classTypeID; // For I/O only! - GeoShapeUnion(){} + GeoShapeUnion() = default; friend Persistifier; }; -inline const std::string& GeoShapeUnion::getClassType () -{ - return s_classType; -} - -inline ShapeType GeoShapeUnion::getClassTypeID () -{ - return s_classTypeID; -} - #endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h index b225f736475aae9bbba67a6f1a0f8c9f9d6ed06e..f51a978f932936a6ddd047b1f85df9b76c18e9a0 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h @@ -27,8 +27,6 @@ class GeoVPhysVol : public GeoGraphNode public: GeoVPhysVol(const GeoLogVol* LogVol); - GeoVPhysVol(const GeoVPhysVol &right) = delete; - GeoVPhysVol & operator=(const GeoVPhysVol &right) = delete; /// Returns true if the physical volume is accessed by more than one parent. /// Should check this before trusting the parent pointer. diff --git a/GeoModelCore/GeoModelKernel/src/GeoMaterial.cxx b/GeoModelCore/GeoModelKernel/src/GeoMaterial.cxx index 26f3e09e7bd68d418f91269db58660da4ec3269d..8ba68bd8756e88c5e3f17173f41dd2413518e255 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoMaterial.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoMaterial.cxx @@ -20,258 +20,139 @@ // semiempirical formulae are not accurate enough, so we take the // tabular values. These are in electron-volts. - -const double - GeoMaterial::s_ionizationPotential[93] = { - 0.0 * - GeoModelKernelUnits::eV, - 19.2 * - GeoModelKernelUnits::eV, - 41.8 * - GeoModelKernelUnits::eV, - 40.0 * - GeoModelKernelUnits::eV, - 63.7 * - GeoModelKernelUnits::eV, - 76.0 * - GeoModelKernelUnits::eV, - 78.0 * - GeoModelKernelUnits::eV, - 82.0 * - GeoModelKernelUnits::eV, - 95.0 * - GeoModelKernelUnits::eV, - 115.0 * - GeoModelKernelUnits::eV, - 137.0 * - GeoModelKernelUnits::eV, - 149.0 * - GeoModelKernelUnits::eV, - 156.0 * - GeoModelKernelUnits::eV, - 166.0 * - GeoModelKernelUnits::eV, - 173.0 * - GeoModelKernelUnits::eV, - 173.0 * - GeoModelKernelUnits::eV, - 180.0 * - GeoModelKernelUnits::eV, - 174.0 * - GeoModelKernelUnits::eV, - 188.0 * - GeoModelKernelUnits::eV, - 190.0 * - GeoModelKernelUnits::eV, - 191.0 * - GeoModelKernelUnits::eV, - 216.0 * - GeoModelKernelUnits::eV, - 233.0 * - GeoModelKernelUnits::eV, - 245.0 * - GeoModelKernelUnits::eV, - 257.0 * - GeoModelKernelUnits::eV, - 272.0 * - GeoModelKernelUnits::eV, - 286.0 * - GeoModelKernelUnits::eV, - 297.0 * - GeoModelKernelUnits::eV, - 311.0 * - GeoModelKernelUnits::eV, - 322.0 * - GeoModelKernelUnits::eV, - 330.0 * - GeoModelKernelUnits::eV, - 334.0 * - GeoModelKernelUnits::eV, - 350.0 * - GeoModelKernelUnits::eV, - 347.0 * - GeoModelKernelUnits::eV, - 348.0 * - GeoModelKernelUnits::eV, - 343.0 * - GeoModelKernelUnits::eV, - 352.0 * - GeoModelKernelUnits::eV, - 363.0 * - GeoModelKernelUnits::eV, - 366.0 * - GeoModelKernelUnits::eV, - 379.0 * - GeoModelKernelUnits::eV, - 393.0 * - GeoModelKernelUnits::eV, - 417.0 * - GeoModelKernelUnits::eV, - 424.0 * - GeoModelKernelUnits::eV, - 428.0 * - GeoModelKernelUnits::eV, - 441.0 * - GeoModelKernelUnits::eV, - 449.0 * - GeoModelKernelUnits::eV, - 470.0 * - GeoModelKernelUnits::eV, - 470.0 * - GeoModelKernelUnits::eV, - 469.0 * - GeoModelKernelUnits::eV, - 488.0 * - GeoModelKernelUnits::eV, - 488.0 * - GeoModelKernelUnits::eV, - 487.0 * - GeoModelKernelUnits::eV, - 485.0 * - GeoModelKernelUnits::eV, - 491.0 * - GeoModelKernelUnits::eV, - 482.0 * - GeoModelKernelUnits::eV, - 488.0 * - GeoModelKernelUnits::eV, - 491.0 * - GeoModelKernelUnits::eV, - 501.0 * - GeoModelKernelUnits::eV, - 523.0 * - GeoModelKernelUnits::eV, - 535.0 * - GeoModelKernelUnits::eV, - 546.0 * - GeoModelKernelUnits::eV, - 560.0 * - GeoModelKernelUnits::eV, - 574.0 * - GeoModelKernelUnits::eV, - 580.0 * - GeoModelKernelUnits::eV, - 591.0 * - GeoModelKernelUnits::eV, - 614.0 * - GeoModelKernelUnits::eV, - 628.0 * - GeoModelKernelUnits::eV, - 650.0 * - GeoModelKernelUnits::eV, - 658.0 * - GeoModelKernelUnits::eV, - 674.0 * - GeoModelKernelUnits::eV, - 684.0 * - GeoModelKernelUnits::eV, - 694.0 * - GeoModelKernelUnits::eV, - 705.0 * - GeoModelKernelUnits::eV, - 718.0 * - GeoModelKernelUnits::eV, - 727.0 * - GeoModelKernelUnits::eV, - 736.0 * - GeoModelKernelUnits::eV, - 746.0 * - GeoModelKernelUnits::eV, - 757.0 * - GeoModelKernelUnits::eV, - 790.0 * - GeoModelKernelUnits::eV, - 790.0 * - GeoModelKernelUnits::eV, - 800.0 * - GeoModelKernelUnits::eV, - 810.0 * - GeoModelKernelUnits::eV, - 823.0 * - GeoModelKernelUnits::eV, - 823.0 * - GeoModelKernelUnits::eV, - 830.0 * - GeoModelKernelUnits::eV, - 825.0 * - GeoModelKernelUnits::eV, - 794.0 * - GeoModelKernelUnits::eV, - 827.0 * - GeoModelKernelUnits::eV, - 826.0 * - GeoModelKernelUnits::eV, - 841.0 * - GeoModelKernelUnits::eV, - 847.0 * - GeoModelKernelUnits::eV, - 878.0 * - GeoModelKernelUnits::eV, - 890.0 * - GeoModelKernelUnits::eV +namespace{ +constexpr std::array<double, 93> s_ionizationPotential{ + 0.0 * GeoModelKernelUnits::eV, + 19.2 * GeoModelKernelUnits::eV, + 41.8 * GeoModelKernelUnits::eV, + 40.0 * GeoModelKernelUnits::eV, + 63.7 * GeoModelKernelUnits::eV, + 76.0 * GeoModelKernelUnits::eV, + 78.0 * GeoModelKernelUnits::eV, + 82.0 * GeoModelKernelUnits::eV, + 95.0 * GeoModelKernelUnits::eV, + 115.0 * GeoModelKernelUnits::eV, + 137.0 * GeoModelKernelUnits::eV, + 149.0 * GeoModelKernelUnits::eV, + 156.0 * GeoModelKernelUnits::eV, + 166.0 * GeoModelKernelUnits::eV, + 173.0 * GeoModelKernelUnits::eV, + 173.0 * GeoModelKernelUnits::eV, + 180.0 * GeoModelKernelUnits::eV, + 174.0 * GeoModelKernelUnits::eV, + 188.0 * GeoModelKernelUnits::eV, + 190.0 * GeoModelKernelUnits::eV, + 191.0 * GeoModelKernelUnits::eV, + 216.0 * GeoModelKernelUnits::eV, + 233.0 * GeoModelKernelUnits::eV, + 245.0 * GeoModelKernelUnits::eV, + 257.0 * GeoModelKernelUnits::eV, + 272.0 * GeoModelKernelUnits::eV, + 286.0 * GeoModelKernelUnits::eV, + 297.0 * GeoModelKernelUnits::eV, + 311.0 * GeoModelKernelUnits::eV, + 322.0 * GeoModelKernelUnits::eV, + 330.0 * GeoModelKernelUnits::eV, + 334.0 * GeoModelKernelUnits::eV, + 350.0 * GeoModelKernelUnits::eV, + 347.0 * GeoModelKernelUnits::eV, + 348.0 * GeoModelKernelUnits::eV, + 343.0 * GeoModelKernelUnits::eV, + 352.0 * GeoModelKernelUnits::eV, + 363.0 * GeoModelKernelUnits::eV, + 366.0 * GeoModelKernelUnits::eV, + 379.0 * GeoModelKernelUnits::eV, + 393.0 * GeoModelKernelUnits::eV, + 417.0 * GeoModelKernelUnits::eV, + 424.0 * GeoModelKernelUnits::eV, + 428.0 * GeoModelKernelUnits::eV, + 441.0 * GeoModelKernelUnits::eV, + 449.0 * GeoModelKernelUnits::eV, + 470.0 * GeoModelKernelUnits::eV, + 470.0 * GeoModelKernelUnits::eV, + 469.0 * GeoModelKernelUnits::eV, + 488.0 * GeoModelKernelUnits::eV, + 488.0 * GeoModelKernelUnits::eV, + 487.0 * GeoModelKernelUnits::eV, + 485.0 * GeoModelKernelUnits::eV, + 491.0 * GeoModelKernelUnits::eV, + 482.0 * GeoModelKernelUnits::eV, + 488.0 * GeoModelKernelUnits::eV, + 491.0 * GeoModelKernelUnits::eV, + 501.0 * GeoModelKernelUnits::eV, + 523.0 * GeoModelKernelUnits::eV, + 535.0 * GeoModelKernelUnits::eV, + 546.0 * GeoModelKernelUnits::eV, + 560.0 * GeoModelKernelUnits::eV, + 574.0 * GeoModelKernelUnits::eV, + 580.0 * GeoModelKernelUnits::eV, + 591.0 * GeoModelKernelUnits::eV, + 614.0 * GeoModelKernelUnits::eV, + 628.0 * GeoModelKernelUnits::eV, + 650.0 * GeoModelKernelUnits::eV, + 658.0 * GeoModelKernelUnits::eV, + 674.0 * GeoModelKernelUnits::eV, + 684.0 * GeoModelKernelUnits::eV, + 694.0 * GeoModelKernelUnits::eV, + 705.0 * GeoModelKernelUnits::eV, + 718.0 * GeoModelKernelUnits::eV, + 727.0 * GeoModelKernelUnits::eV, + 736.0 * GeoModelKernelUnits::eV, + 746.0 * GeoModelKernelUnits::eV, + 757.0 * GeoModelKernelUnits::eV, + 790.0 * GeoModelKernelUnits::eV, + 790.0 * GeoModelKernelUnits::eV, + 800.0 * GeoModelKernelUnits::eV, + 810.0 * GeoModelKernelUnits::eV, + 823.0 * GeoModelKernelUnits::eV, + 823.0 * GeoModelKernelUnits::eV, + 830.0 * GeoModelKernelUnits::eV, + 825.0 * GeoModelKernelUnits::eV, + 794.0 * GeoModelKernelUnits::eV, + 827.0 * GeoModelKernelUnits::eV, + 826.0 * GeoModelKernelUnits::eV, + 841.0 * GeoModelKernelUnits::eV, + 847.0 * GeoModelKernelUnits::eV, + 878.0 * GeoModelKernelUnits::eV, + 890.0 * GeoModelKernelUnits::eV }; -unsigned int GeoMaterial::s_lastID = 0; +} +std::atomic<unsigned int> GeoMaterial::s_lastID{0}; -GeoMaterial::GeoMaterial (const std::string &Name, double Density) +GeoMaterial::GeoMaterial(const std::string &Name, double Density) : m_name(Name) , m_density(Density) - , m_iD(s_lastID++) - , m_radLength(0) - , m_intLength(0) - , m_dedDxConst(0) - , m_deDxI0(0) - , m_locked(false) -{ -} + , m_iD(s_lastID++) {} -GeoMaterial::~GeoMaterial() -{ - for (size_t i = 0; i < m_element.size (); i++) - { - m_element[i]->unref (); - } -} void GeoMaterial::add (const GeoElement* element, double fraction) { // You can only add materials until you call "lock"... - if (!m_locked) - { - std::vector <const GeoElement *>::iterator e = std::find(m_element.begin(),m_element.end(),element); - if (e==m_element.end()) { - m_element.push_back (element); - m_fraction.push_back (fraction); - element->ref (); - } - else { - int n = e-m_element.begin(); - m_fraction[n]+=fraction; - } - } - else - { - throw std::out_of_range ("Element added after material locked"); - } + if (m_locked){ + throw std::out_of_range ("Element added after material locked"); + } + + std::vector <GeoIntrusivePtr<const GeoElement>>::iterator e = std::find(m_element.begin(),m_element.end(),element); + if (e==m_element.end()) { + m_element.push_back (element); + m_fraction.push_back (fraction); + } else { + int n = e-m_element.begin(); + m_fraction[n]+=fraction; + } } -void GeoMaterial::add (const GeoMaterial* material, double fraction) -{ - if (!m_locked) - { - for (size_t e = 0; e < material->getNumElements (); e++) - { - add(material->m_element[e],fraction * material->m_fraction[e]); - } - } - else - { - throw std::out_of_range ("Material added after material locked"); - } +void GeoMaterial::add (const GeoMaterial* material, double fraction) { + if (m_locked) { + throw std::out_of_range ("Material added after material locked"); + } + for (size_t e = 0; e < material->getNumElements (); ++e) { + add(material->m_element[e],fraction * material->m_fraction[e]); + } } -void GeoMaterial::lock () -{ +void GeoMaterial::lock() { if(m_locked) return; m_locked = true; diff --git a/GeoModelCore/GeoModelKernel/src/GeoSerialTransformer.cxx b/GeoModelCore/GeoModelKernel/src/GeoSerialTransformer.cxx index f97e6dc12fd762b06c35fd7d782275c203eda631..99aa495ad915867c9244b7f7fa7433d685ac4dc1 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoSerialTransformer.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoSerialTransformer.cxx @@ -5,27 +5,14 @@ #include "GeoModelKernel/GeoSerialTransformer.h" #include "GeoModelKernel/GeoNodeAction.h" -GeoSerialTransformer::GeoSerialTransformer (const GeoVPhysVol *volume, const GeoXF::Function *func, unsigned int copies) - : m_nCopies (copies) - , m_function (func->clone ()) - , m_physVol (volume) -{ - m_physVol->ref (); -} +GeoSerialTransformer::GeoSerialTransformer (const GeoVPhysVol *volume, + const GeoXF::Function *func, + unsigned int copies): + m_nCopies{copies}, + m_function{func->clone()}, + m_physVol{volume} {} -GeoSerialTransformer::~GeoSerialTransformer() -{ - m_physVol->unref (); - delete m_function; -} -void GeoSerialTransformer::exec (GeoNodeAction *action) const -{ - action->handleSerialTransformer (this); +void GeoSerialTransformer::exec(GeoNodeAction *action) const { + action->handleSerialTransformer(this); } - -const GeoXF::Function * GeoSerialTransformer::getFunction () const -{ - return m_function; -} - diff --git a/GeoModelCore/GeoModelKernel/src/GeoShapeIntersection.cxx b/GeoModelCore/GeoModelKernel/src/GeoShapeIntersection.cxx index 1e7889acbfaf09eca1244242545e35b8ac7b503e..5252c4328f8d87b2ebd3f6a4f46e9e4720289e7b 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoShapeIntersection.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoShapeIntersection.cxx @@ -42,26 +42,6 @@ bool GeoShapeIntersection::contains (double x, double y, double z) const return (getOpA()->contains(x, y, z)) ? getOpB()->contains(x, y, z) : false; } -const std::string & GeoShapeIntersection::type () const -{ - return s_classType; -} - -ShapeType GeoShapeIntersection::typeID () const -{ - return s_classTypeID; -} - -const GeoShape* GeoShapeIntersection::getOpA () const -{ - return m_opA; -} - -const GeoShape* GeoShapeIntersection::getOpB () const -{ - return m_opB; -} - void GeoShapeIntersection::exec (GeoShapeAction *action) const { action->getPath ()->push (this); diff --git a/GeoModelCore/GeoModelKernel/src/GeoShapeSubtraction.cxx b/GeoModelCore/GeoModelKernel/src/GeoShapeSubtraction.cxx index 12c36a1d679ba2aa3d22bb95608819e5e889ccd7..9bd764838efef470487ab275e3dc58181539e51f 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoShapeSubtraction.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoShapeSubtraction.cxx @@ -11,22 +11,11 @@ const std::string GeoShapeSubtraction::s_classType = "Subtraction"; const ShapeType GeoShapeSubtraction::s_classTypeID = 0x02; -GeoShapeSubtraction::GeoShapeSubtraction (const GeoShape* A, const GeoShape* B) - : m_opA (A) - , m_opB (B) -{ - m_opA->ref (); - m_opB->ref (); -} +GeoShapeSubtraction::GeoShapeSubtraction (const GeoShape* A, const GeoShape* B): + m_opA {A}, m_opB {B} {} -GeoShapeSubtraction::~GeoShapeSubtraction() -{ - m_opA->unref (); - m_opB->unref (); -} -double GeoShapeSubtraction::volume () const -{ +double GeoShapeSubtraction::volume () const { return (fVolume < 0.) ? (fVolume = GeoShape::volume()) : fVolume; } @@ -41,25 +30,7 @@ bool GeoShapeSubtraction::contains (double x, double y, double z) const return (!getOpA()->contains(x, y, z)) ? false : !getOpB()->contains(x, y, z); } -const std::string & GeoShapeSubtraction::type () const -{ - return s_classType; -} -ShapeType GeoShapeSubtraction::typeID () const -{ - return s_classTypeID; -} - -const GeoShape* GeoShapeSubtraction::getOpA () const -{ - return m_opA; -} - -const GeoShape* GeoShapeSubtraction::getOpB () const -{ - return m_opB; -} void GeoShapeSubtraction::exec (GeoShapeAction *action) const { diff --git a/GeoModelCore/GeoModelKernel/src/GeoShapeUnion.cxx b/GeoModelCore/GeoModelKernel/src/GeoShapeUnion.cxx index 932e637cf026f87e4e70640e2f99aac59271be3f..ceab1bd8c53fba81fbb58652fd47756a3944a3bb 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoShapeUnion.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoShapeUnion.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelKernel/GeoShapeUnion.h" @@ -11,19 +11,9 @@ const std::string GeoShapeUnion::s_classType = "Union"; const ShapeType GeoShapeUnion::s_classTypeID = 0x01; -GeoShapeUnion::GeoShapeUnion (const GeoShape* A, const GeoShape* B) - : m_opA (A) - , m_opB (B) -{ - m_opA->ref (); - m_opB->ref (); -} +GeoShapeUnion::GeoShapeUnion (const GeoShape* A, const GeoShape* B): + m_opA{A}, m_opB{B} {} -GeoShapeUnion::~GeoShapeUnion() -{ - m_opA->unref (); - m_opB->unref (); -} double GeoShapeUnion::volume () const { @@ -45,29 +35,8 @@ void GeoShapeUnion::extent (double& xmin, double& ymin, double& zmin, zmax = std::max(zmaxA, zmaxB); } -bool GeoShapeUnion::contains (double x, double y, double z) const -{ - return (getOpA()->contains(x, y, z)) ? true : getOpB()->contains(x, y, z); -} - -const std::string & GeoShapeUnion::type () const -{ - return s_classType; -} - -ShapeType GeoShapeUnion::typeID () const -{ - return s_classTypeID; -} - -const GeoShape* GeoShapeUnion::getOpA () const -{ - return m_opA; -} - -const GeoShape* GeoShapeUnion::getOpB () const -{ - return m_opB; +bool GeoShapeUnion::contains (double x, double y, double z) const { + return getOpA()->contains(x, y, z) || getOpB()->contains(x, y, z); } void GeoShapeUnion::exec (GeoShapeAction *action) const