diff --git a/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h b/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h index f8818abcf9398a608f7a2e93e45e954a2ddad447..4e2b2e8e69fbf6a58fb37ce859c420ba564f9289 100644 --- a/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h +++ b/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h @@ -32,8 +32,15 @@ struct GeoChildNodeWithTrf { GeoChildNodeWithTrf(GeoVolumeCursor& curs); }; +/*** @brief Returns all direct children of a volume with their transform. Equicalent volumes can be summarized. + * In this case, the inductionRule transform to move from one copy to the next, is non-trivial +*/ std::vector <GeoChildNodeWithTrf> getChildrenWithRef (PVConstLink physVol, bool summarizeEqualVol = true); +/**** @brief Traverses through the GeoVPhysVol tree and returns all sub volumes of this tree.*/ +std::vector<GeoChildNodeWithTrf> getAllSubVolumes(PVConstLink physVol); + + /** * Returns whether a volume has fullPhysical volume nodes in diff --git a/GeoModelCore/GeoModelHelpers/src/GeoDeDuplicator.cxx b/GeoModelCore/GeoModelHelpers/src/GeoDeDuplicator.cxx index 45a9ec90541751d8ef95d2f2aa03e4d88828818e..28415b1e403dfd1e4b2ccf1b8e99293651191bf9 100644 --- a/GeoModelCore/GeoModelHelpers/src/GeoDeDuplicator.cxx +++ b/GeoModelCore/GeoModelHelpers/src/GeoDeDuplicator.cxx @@ -1,4 +1,3 @@ - /* Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ diff --git a/GeoModelCore/GeoModelHelpers/src/cloneVolume.cxx b/GeoModelCore/GeoModelHelpers/src/cloneVolume.cxx index ef8fc56bb9fb835a3387e0e45ba5304744dcb759..a49048f21b166281c0170bf596278c01a657a5d8 100644 --- a/GeoModelCore/GeoModelHelpers/src/cloneVolume.cxx +++ b/GeoModelCore/GeoModelHelpers/src/cloneVolume.cxx @@ -1,4 +1,6 @@ - +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ #include "GeoModelHelpers/cloneVolume.h" #include "GeoModelHelpers/getChildNodesWithTrf.h" @@ -29,4 +31,4 @@ PVLink cloneVolume(PVLink volume, } return newVolume; -} \ No newline at end of file +} diff --git a/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx b/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx index 91389b27acf0a9865133fd84f4108e25d4100f83..3aa9dd8eb97d1db64c0bb4824ca4269b10b923ba 100644 --- a/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx +++ b/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx @@ -64,6 +64,24 @@ std::vector <GeoChildNodeWithTrf> getChildrenWithRef(PVConstLink physVol, } return children; } + +std::vector<GeoChildNodeWithTrf> getAllSubVolumes(PVConstLink physVol) { + std::vector<GeoChildNodeWithTrf> children{getChildrenWithRef(physVol, false)}, subVolumes{}; + subVolumes.reserve(children.size()); + for (const GeoChildNodeWithTrf& child : children) { + subVolumes.push_back(child); + std::vector<GeoChildNodeWithTrf> grandChildren = getAllSubVolumes(child.volume); + subVolumes.reserve(grandChildren.size() + subVolumes.size()); + std::transform(std::make_move_iterator(grandChildren.begin()), + std::make_move_iterator(grandChildren.end()), + std::back_inserter(subVolumes), [&child](GeoChildNodeWithTrf&& grandChild){ + grandChild.transform = child.transform * grandChild.transform; + return grandChild; + }); + } + return subVolumes; +} + bool hasFullPhysVolInTree(PVConstLink physVol) { if (typeid(*physVol) == typeid(GeoFullPhysVol) || typeid(*physVol) == typeid(GeoVFullPhysVol)){ diff --git a/GeoModelCore/GeoModelHelpers/tests/testFullPhysVol.cxx b/GeoModelCore/GeoModelHelpers/tests/testFullPhysVol.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3ef854fa10e496982bed95593981acf4fde0e71 --- /dev/null +++ b/GeoModelCore/GeoModelHelpers/tests/testFullPhysVol.cxx @@ -0,0 +1,123 @@ +// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + + +#include <GeoModelKernel/GeoFullPhysVol.h> +#include <GeoModelKernel/GeoTransform.h> +#include <GeoModelKernel/GeoPhysVol.h> +#include <GeoModelKernel/GeoFullPhysVol.h> +#include <GeoModelKernel/GeoBox.h> +#include <GeoModelKernel/GeoIdentifierTag.h> + +#include <GeoModelHelpers/defineWorld.h> +#include <GeoModelHelpers/TransformSorter.h> +#include <GeoModelHelpers/TransformToStringConverter.h> +#include <GeoModelHelpers/getChildNodesWithTrf.h> +#include <iostream> + + +int main(int argc, char *argv[]){ + GeoIntrusivePtr<GeoMaterial> material = make_intrusive<GeoMaterial>("Snow", 1.45); + GeoIntrusivePtr<GeoBox> uniCave = make_intrusive<GeoBox>(100., 100., 100.); + /// Create the logical volume forklift which should increase the counters by one unit + GeoIntrusivePtr<GeoLogVol> logVol = make_intrusive<GeoLogVol>("Forklift", uniCave, material); + + PVLink world = createGeoWorld(); + PVConstLink cWorld{world}; + + + GeoIntrusivePtr<GeoTransform> transNode0 = make_intrusive<GeoTransform>(GeoTrf::get3DRotMatX(0.3 * M_PI) * GeoTrf::TranslateX3D(50.)); + GeoIntrusivePtr<GeoTransform> transNode1 = make_intrusive<GeoTransform>(GeoTrf::get3DRotMatZ(0.3 * M_PI) * GeoTrf::TranslateY3D(50.)); + + PVLink parent{world}; + GeoTrf::Transform3D testTrf{GeoTrf::Transform3D::Identity()}; + + const GeoTrf::TransformSorter trfSorter{}; + constexpr unsigned int treeDepth = 10; + for (unsigned int k = 0 ; k< treeDepth; ++k) { + GeoIntrusivePtr<GeoTransform> transNode { k %2 ? transNode0 : transNode1}; + parent->add(make_intrusive<GeoIdentifierTag>(k)); + parent->add(transNode); + testTrf = testTrf * transNode->getTransform(); + + if (k % 2) { + GeoIntrusivePtr<GeoFullPhysVol> physVol{make_intrusive<GeoFullPhysVol>(logVol)}; + parent->add(physVol); + if (!parent->getChildVol(0)) { + std::cerr<<__FILE__<<":"<<__LINE__<<" Failed to access the 0-th child volume "<<physVol.get()<<std::endl; + return EXIT_FAILURE; + } + parent = physVol; + if (trfSorter.compare(testTrf, physVol->getAbsoluteTransform())){ + std::cerr<<__FILE__<<":"<<__LINE__<<" Transform application failed "<<GeoTrf::toString(testTrf) + <<" vs. "<<GeoTrf::toString(physVol->getAbsoluteTransform())<<std::endl; + return EXIT_FAILURE; + } + } else { + PVLink physVol{make_intrusive<GeoPhysVol>(logVol)}; + parent->add(physVol); + /// Ensure that the 0-th volume can be accessed + if (!parent->getChildVol(0)) { + std::cerr<<__FILE__<<":"<<__LINE__<<" Failed to access the 0-th child volume "<<physVol.get()<<std::endl; + return EXIT_FAILURE; + } + parent = physVol; + } + } + + { + /// Test shared mechanism + PVLink sharedVol{make_intrusive<GeoPhysVol>(logVol)}; + if (sharedVol->isShared()) { + std::cerr<<__FILE__<<":"<<__LINE__<<" Volume is constructed as a shared volume "<<std::endl; + return EXIT_FAILURE; + } + world->add(sharedVol); + if (sharedVol->isShared() || sharedVol->getParent() != cWorld) { + std::cerr<<__FILE__<<":"<<__LINE__<<" Volume is only added to the world once. Should not be shared yet "<<std::endl; + return EXIT_FAILURE; + } + world->add(sharedVol); + if (!sharedVol->isShared() || sharedVol->getParent()) { + std::cerr<<__FILE__<<":"<<__LINE__<<" The volume should be from now on treated as shared "<<std::endl; + return EXIT_FAILURE; + } + } + + /// Find the GeoIdentifier tag + unsigned int currentK = treeDepth -1; + PVConstLink cParent{parent->getParent()}; + parent.reset(); + while (cParent) { + Query<int> query = cParent->getIdOfChildVol(0); + if (!query.isValid()) { + std::cerr<<__FILE__<<":"<<__LINE__<<" Failed to obtain a valid child volume ID. Expected "<<currentK + <<" "<<typeid(*cParent->getChildVol(0)).name()<<std::endl; + return EXIT_FAILURE; + } + unsigned int parentID = query; + if (parentID != currentK) { + std::cerr<<__FILE__<<":"<<__LINE__<<" Expected "<<currentK<<" but got "<<parentID; + return EXIT_FAILURE; + } + cParent = cParent->getParent(); + --currentK; + } + /// Test tree traversing + std::vector<GeoChildNodeWithTrf> geoTree = getAllSubVolumes(world); + for (const GeoChildNodeWithTrf& childNode : geoTree) { + /// Volume is shared + if (childNode.volume->isShared()) { + continue; + } + /// The volume is a full physical volume + if (childNode.isSensitive) { + GeoIntrusivePtr<const GeoVFullPhysVol> fullVol = dynamic_pointer_cast<const GeoVFullPhysVol>(childNode.volume); + if (trfSorter.compare(fullVol->getAbsoluteTransform(), childNode.transform)) { + std::cerr<<__FILE__<<":"<<__LINE__<<" Transform application failed "<<GeoTrf::toString(childNode.transform) + <<" vs. "<<GeoTrf::toString(fullVol->getAbsoluteTransform())<<std::endl; + return EXIT_FAILURE; + } + } + } + return EXIT_SUCCESS; +} diff --git a/GeoModelCore/GeoModelKernel/CMakeLists.txt b/GeoModelCore/GeoModelKernel/CMakeLists.txt index 819c6c9521ce5d44334faedad600506537153082..11b72cbb7b2caec71e275d075a2ff33e55d67531 100644 --- a/GeoModelCore/GeoModelKernel/CMakeLists.txt +++ b/GeoModelCore/GeoModelKernel/CMakeLists.txt @@ -2,7 +2,7 @@ # Find the header and source files. file( GLOB SOURCES src/*.cxx ) -file( GLOB HEADERS GeoModelKernel/*.h GeoModelKernel/*.tpp ) +file( GLOB HEADERS GeoModelKernel/*.h GeoModelKernel/*.tpp GeoModelKernel/*.icc ) # Create the library. add_library( GeoModelKernel SHARED ${HEADERS} ${SOURCES} ) diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoAbsPositionInfo.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoAbsPositionInfo.h deleted file mode 100644 index c8f8c8c68a2b773ad941aacb563426b5d608d09e..0000000000000000000000000000000000000000 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoAbsPositionInfo.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEOMODELKERNEL_GEOABSPOSITIONINFO_H -#define GEOMODELKERNEL_GEOABSPOSITIONINFO_H - -/** - * @class GeoAbsPositionInfo - * - * @brief This class represents anything whose default and aligned - * postions are known and cached. - */ - -#include <GeoModelKernel/GeoDefinitions.h> -#include <memory> - -class GeoAbsPositionInfo -{ - public: - GeoAbsPositionInfo() = default; - ~GeoAbsPositionInfo() = default; - - // Returns the default absolute transform. - const GeoTrf::Transform3D * getAbsTransform () const { - return m_absTransform.get(); - } - - // Returns the default absolute transform. - const GeoTrf::Transform3D * getDefAbsTransform () const { - return m_defAbsTransform.get(); - } - - - // Clears the absolute transform. - void clearAbsTransform (); - - // Clears the default absolute transform. - void clearDefAbsTransform (); - - // Sets the absolute transform. - void setAbsTransform (const GeoTrf::Transform3D & xform); - - // Sets the absolute transform. - void setDefAbsTransform (const GeoTrf::Transform3D & xform); - - private: - - // The absolute transform from the world coord down to this - // positioned object. - std::unique_ptr<GeoTrf::Transform3D> m_absTransform{}; - - // The default absolute transform from the world coord down - // to this positioned object. - std::unique_ptr<GeoTrf::Transform3D> m_defAbsTransform{}; -}; - -#endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoFullPhysVol.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoFullPhysVol.h index 03724c50c2f016f85c0f6e451e8d37151f7c2945..e1fafcec313716bfb847a58740c65a2d3e11e910 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoFullPhysVol.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoFullPhysVol.h @@ -27,38 +27,16 @@ class GeoVAlignmentStore; * ReadoutElement. */ -class GeoFullPhysVol final : public GeoVFullPhysVol -{ - public: - GeoFullPhysVol (const GeoLogVol* LogVol); - - /// Adds a Graph Node to the Geometry Graph - virtual void add(GeoGraphNode* graphNode) override final; - - /// Returns the number of child physical volumes. - virtual unsigned int getNChildVols() const override; - - /// Returns the ith child volume - virtual PVConstLink getChildVol(unsigned int index) const override; - - /// Returns the transform to the ith volume. - virtual GeoTrf::Transform3D getXToChildVol(unsigned int index, const GeoVAlignmentStore* store=nullptr) const override; - - /// Returns the default transform to the ith volume. - virtual GeoTrf::Transform3D getDefXToChildVol(unsigned int index, const GeoVAlignmentStore* store=nullptr) const override; +class GeoFullPhysVol final : public GeoVFullPhysVol { + + public: + GeoFullPhysVol (const GeoLogVol* LogVol); + /// Executes a GeoNodeAction. - virtual void exec(GeoNodeAction *action) const override; - - /// Returns the name of the child. - virtual std::string getNameOfChildVol(unsigned int i) const override; - - /// Returns the id of the child. - virtual Query<int> getIdOfChildVol(unsigned int i) const override; - - /// Returns the number of child physical volumes and Serial Transformers. - virtual unsigned int getNChildVolAndST() const override; + virtual void exec(GeoNodeAction *action) const override final; + /// Meaning of the input parameter 'attached' /// TRUE: all cloned volumes are meant to stay identical to their clone origin for the lifetime /// further changes are permitted neither in the origin nor in the clone results @@ -75,21 +53,10 @@ class GeoFullPhysVol final : public GeoVFullPhysVol /// don't call it until geometry has been completely translated to G4 void clear(); // drop subtree - virtual GeoTrf::Transform3D getX (const GeoVAlignmentStore* store=nullptr) const override; - virtual GeoTrf::Transform3D getDefX (const GeoVAlignmentStore* store=nullptr) const override; - virtual unsigned int getNChildNodes() const override; - virtual const GeoGraphNode * const *getChildNode (unsigned int i) const override; - virtual const GeoGraphNode * const *findChildNode(const GeoGraphNode *n) const override; - - protected: - virtual ~GeoFullPhysVol() = default; private: - - /// Hold the list of children. - std::vector<GeoIntrusivePtr<GeoGraphNode>> m_daughters{}; - - const GeoFullPhysVol* m_cloneOrigin{nullptr}; + virtual ~GeoFullPhysVol() = default; + const GeoFullPhysVol* m_cloneOrigin{nullptr}; }; #endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoIntrusivePtr.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoIntrusivePtr.h index 8c82309e9635a1f65e794cbd33be1c9e7d9e487d..dcd1c028c588918e7eaeb2e2bb73392e16f8e462 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoIntrusivePtr.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoIntrusivePtr.h @@ -113,6 +113,11 @@ class GeoIntrusivePtr{ bool operator==(GeoType* other) const { return m_ptr == other; } + template <typename AnyObj> + bool operator !=(const AnyObj & other) const { + return !( (*this) == other ); + } + /// Odering operator bool operator<(const GeoIntrusivePtr& other) const { return m_ptr < other.m_ptr; diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoNodePositioning.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoNodePositioning.h new file mode 100644 index 0000000000000000000000000000000000000000..d3525eb1b28eb520cfe958bbf740a257f6383afa --- /dev/null +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoNodePositioning.h @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef GEOMODELKERNEL_GeoNodePositioning_H +#define GEOMODELKERNEL_GeoNodePositioning_H + +#include "GeoModelKernel/GeoPlacement.h" +#include "GeoModelKernel/GeoGraphNode.h" +#include "GeoModelKernel/GeoDefinitions.h" + + +#include <shared_mutex> +#include <memory> + +class GeoNodePositioning { + + public: + + /// Returns the (default) absolute transform of the volume. + /// 1. When store=nullptr. This is considered a "serial case" when + /// the cached (default) absolute transform is kept as a data member of the + /// GeoVFullPhysVol class. If the local cache is empty, then it gets computed and stored. + /// + /// 2. When store!=nullptr. This is considered a "multithreaded case" when + /// the cached (default) absolute trnasforms of Full Physical Volumes are kept in + /// an external object pointed by store. If the cache for given full physical + /// volume is missing, it gets computed and saved in the store. + const GeoTrf::Transform3D& getAbsoluteTransform(GeoVAlignmentStore* store=nullptr) const; + const GeoTrf::Transform3D& getDefAbsoluteTransform(GeoVAlignmentStore* store=nullptr) const; + + /// Returns the previously computed and cached (default) absolute transform of the volume. + /// If the cache has not yet been computed, and exception gets thrown + const GeoTrf::Transform3D& getCachedAbsoluteTransform(const GeoVAlignmentStore* store=nullptr) const; + const GeoTrf::Transform3D& getCachedDefAbsoluteTransform(const GeoVAlignmentStore* store=nullptr) const; + + /// Clears the position information. This can be used if + /// the cache is determined to be invalid. The usual client + /// is one of the parents, upon changing its own position. + /// There is little need for casual users to call this. + void clearPositionInfo() const; + + protected: + GeoNodePositioning(const GeoPlacement* node); + + private: + + /// @brief Enum to toggle whether the transform or the defAbsTransform shall accumulated + enum class AccumlType{ + Aligned, Default + }; + /// @brief Accumulates the transforms to globally position the volume + GeoTrf::Transform3D accumulateTrfs(GeoVAlignmentStore* store, const AccumlType type) const; + + const GeoPlacement* m_node{nullptr}; + /// Mutex for protecting the absolute position info + mutable std::shared_mutex m_mutex; + /// @brief Pointer to the transform holding the aboslute transform of the node + mutable std::unique_ptr<GeoTrf::Transform3D> m_absTransf{nullptr}; + /// @brief Pointer to the transform holding the default transform of the node + mutable std::unique_ptr<GeoTrf::Transform3D> m_absDefTransf{nullptr}; +}; + +#endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPhysVol.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPhysVol.h index 2e5988637d10add49e3a22dc1214487d1354055f..160065c67f8b485edce641cb53299faf41a1d520 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPhysVol.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPhysVol.h @@ -25,54 +25,17 @@ * memory cost. */ -#include <mutex> +class GeoPhysVol : public GeoVPhysVol{ + public: + GeoPhysVol(const GeoLogVol* LogVol); -class GeoPhysVol : public GeoVPhysVol { - public: - GeoPhysVol(const GeoLogVol* LogVol); + /// Executes a GeoNodeAction. + void exec(GeoNodeAction *action) const override final; + protected: + virtual ~GeoPhysVol() = default; - /// Adds a Graph Node to the Geometry Graph - virtual void add(GeoGraphNode* graphNode) override final; - - /// Returns the number of child physical volumes. - virtual unsigned int getNChildVols() const override final; - - /// Returns the ith child volume - virtual PVConstLink getChildVol(unsigned int index) const override final; - - /// Returns the transform to the ith volume. - virtual GeoTrf::Transform3D getXToChildVol(unsigned int index - ,const GeoVAlignmentStore* store=nullptr) const override final; - - /// Returns the default transform to the ith volume. - virtual GeoTrf::Transform3D getDefXToChildVol(unsigned int index - ,const GeoVAlignmentStore* store=nullptr) const override final; - - /// Executes a GeoNodeAction. - virtual void exec(GeoNodeAction *action) const override final; - - /// Returns the name of the child. - virtual std::string getNameOfChildVol(unsigned int i) const override final; - - /// Returns the id of the child. - virtual Query<int> getIdOfChildVol(unsigned int i) const override final; - - /// Returns the number of child physical volumes and Serial Transformers. - virtual unsigned int getNChildVolAndST() const override final; - - virtual GeoTrf::Transform3D getX (const GeoVAlignmentStore* store=nullptr) const override final; - virtual GeoTrf::Transform3D getDefX (const GeoVAlignmentStore* store=nullptr) const override final; - virtual unsigned int getNChildNodes() const override final; - virtual const GeoGraphNode * const *getChildNode (unsigned int i) const override final; - virtual const GeoGraphNode * const *findChildNode(const GeoGraphNode *n) const override final; - - protected: - virtual ~GeoPhysVol() = default; - - private: - std::vector<GeoIntrusivePtr<GeoGraphNode>> m_daughters{}; - mutable std::mutex m_muxVec; }; + #endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPlacement.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPlacement.h new file mode 100644 index 0000000000000000000000000000000000000000..d03bda134c1f3aa7b7d27005f8a540ba1a72b1e3 --- /dev/null +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPlacement.h @@ -0,0 +1,51 @@ + +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef GEOMODELKERNEL_GEOPLACEMENT_H +#define GEOMODELKERNEL_GEOPLACEMENT_H +#include "GeoModelKernel/GeoVAlignmentStore.h" +#include "GeoModelKernel/GeoDefinitions.h" +#include "GeoModelKernel/GeoGraphNode.h" +#include "GeoModelKernel/GeoIntrusivePtr.h" + +#include <optional> + +/** + * @brief: Basic geo graphNode which contains placement information w.r.t. its mother volume +*/ +class GeoPlacement: public GeoGraphNode { + +public: + + /** @brief: Default constructor */ + GeoPlacement() = default; + /** @brief: Returns the transformation to go from frame of the GeoPlacement into the frame of the + * mother volume. The transformation takes alignment displacements into account */ + GeoTrf::Transform3D getX(const GeoVAlignmentStore* store=nullptr) const; + /** @brief: Returns the transformation to go from frame of the GeoPlacement into the frame of the + * mother volume. The method ignores all alignment deformations */ + GeoTrf::Transform3D getDefX(const GeoVAlignmentStore* store=nullptr) const; + + /// Returns true if the physical volume is accessed by more than one parent. + /// Should check this before trusting the parent pointer. + bool isShared() const; + + void dockTo (GeoVPhysVol* parent) override final; + /// Gets the parent, if the parent is unique, and otherwise returns a nullptr pointer. + GeoIntrusivePtr<const GeoVPhysVol> getParent() const; + + + protected: + virtual ~GeoPlacement() = default; + + private: + const GeoVPhysVol* m_parentPtr{nullptr}; + bool m_uniqueParent{true}; + + + +}; + + +#endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoRectSurface.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoRectSurface.h new file mode 100644 index 0000000000000000000000000000000000000000..40f267001cf3bf9e89b23003aefd3fa7e6c6df9c --- /dev/null +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoRectSurface.h @@ -0,0 +1,33 @@ +#ifndef GEOMODELKERNEL_GEORECTSURFACE_H +#define GEOMODELKERNEL_GEORECTSURFACE_H + +#include "GeoModelKernel/GeoVSurface.h" + +class GeoRectSurface : public GeoVSurface +{ + public: + // Constructor for the Rectangular Surface + GeoRectSurface (double XHalfLength, double YHalfLength); + + // Returns the area of the surface + double area() const override; + + // Half length in the x-direction + double getXHalfLength () const { + return m_xHalfLength; + } + + // Half-length in the y direction + double getYHalfLength () const { + return m_yHalfLength; + } + + protected: + virtual ~GeoRectSurface() = default; + + double m_xHalfLength{0.}; + double m_yHalfLength{0.}; +}; + + +#endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVAlignmentStore.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVAlignmentStore.h index e4e3f4471d02c111a62fbf3c2f5a9d843a4ae2d8..2d0c8746b48e56b240e66195e8ccc9c5738c369d 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVAlignmentStore.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVAlignmentStore.h @@ -11,29 +11,28 @@ * @brief Abstract base class for GeoModel alignment stores * The interface allows to store/retrieve transformations that serve as: * 1. Delta-s of Alignable Transforms - * 2. Abs positions of Full Physical Volumes - * 3. Def Abs positions of Full Physical Volumes + * 2. Abs positions of Full Physical Volumes (or base class GeoPositionCacheNode) + * 3. Def Abs positions of Full Physical Volumes (or base class GeoPositionCacheNode) */ #include "GeoModelKernel/GeoDefinitions.h" class GeoAlignableTransform; -class GeoVFullPhysVol; +class GeoNodePositioning; -class GeoVAlignmentStore -{ - public: - GeoVAlignmentStore() {} - virtual ~GeoVAlignmentStore() {} +class GeoVAlignmentStore { + public: + GeoVAlignmentStore() = default; + virtual ~GeoVAlignmentStore() = default; - virtual void setDelta(const GeoAlignableTransform*, const GeoTrf::Transform3D&) = 0; - virtual const GeoTrf::Transform3D* getDelta(const GeoAlignableTransform*) const = 0; + virtual void setDelta(const GeoAlignableTransform*, const GeoTrf::Transform3D&) = 0; + virtual const GeoTrf::Transform3D* getDelta(const GeoAlignableTransform*) const = 0; - virtual void setAbsPosition(const GeoVFullPhysVol*, const GeoTrf::Transform3D&) = 0; - virtual const GeoTrf::Transform3D* getAbsPosition(const GeoVFullPhysVol*) const = 0; + virtual void setAbsPosition(const GeoNodePositioning*, const GeoTrf::Transform3D&) = 0; + virtual const GeoTrf::Transform3D* getAbsPosition(const GeoNodePositioning*) const = 0; - virtual void setDefAbsPosition(const GeoVFullPhysVol*, const GeoTrf::Transform3D&) = 0; - virtual const GeoTrf::Transform3D* getDefAbsPosition(const GeoVFullPhysVol*) const = 0; + virtual void setDefAbsPosition(const GeoNodePositioning*, const GeoTrf::Transform3D&) = 0; + virtual const GeoTrf::Transform3D* getDefAbsPosition(const GeoNodePositioning*) const = 0; }; diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVFullPhysVol.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVFullPhysVol.h index 546f536d11b7c1acf25f73889f2415a9cce0031b..dabee2af5b9aef43448e1906eb5804882aa7e7c9 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVFullPhysVol.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVFullPhysVol.h @@ -1,60 +1,27 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELKERNEL_GEOVFULLPHYSVOL_H #define GEOMODELKERNEL_GEOVFULLPHYSVOL_H #include "GeoModelKernel/GeoVPhysVol.h" -#include "GeoModelKernel/GeoAbsPositionInfo.h" -#include <mutex> -#include <memory> +#include "GeoModelKernel/GeoNodePositioning.h" -class GeoVAlignmentStore; -// To Do: consider dropping it from the class hierarchy? -class GeoVFullPhysVol : public GeoVPhysVol -{ +class GeoVFullPhysVol : public GeoVPhysVol, public GeoNodePositioning { public: - GeoVFullPhysVol(const GeoLogVol* logVol); + GeoVFullPhysVol(const GeoLogVol* logVol); - /// Returns the (default) absolute transform of the volume. - /// 1. When store=nullptr. This is considered a "serial case" when - /// the cached (default) absolute transform is kept as a data member of the - /// GeoVFullPhysVol class. If the local cache is empty, then it gets computed and stored. - /// - /// 2. When store!=nullptr. This is considered a "multithreaded case" when - /// the cached (default) absolute trnasforms of Full Physical Volumes are kept in - /// an external object pointed by store. If the cache for given full physical - /// volume is missing, it gets computed and saved in the store. - const GeoTrf::Transform3D& getAbsoluteTransform(GeoVAlignmentStore* store=nullptr) const; - const GeoTrf::Transform3D& getDefAbsoluteTransform(GeoVAlignmentStore* store=nullptr) const; + /// Returns the absolute name of this node. + const std::string& getAbsoluteName() const; - /// Returns the previously computed and cached (default) absolute transform of the volume. - /// If the cache has not yet been computed, and exception gets thrown - const GeoTrf::Transform3D& getCachedAbsoluteTransform(const GeoVAlignmentStore* store=nullptr) const; - const GeoTrf::Transform3D& getCachedDefAbsoluteTransform(const GeoVAlignmentStore* store=nullptr) const; - - /// Clears the position information. This can be used if - /// the cache is determined to be invalid. The usual client - /// is one of the parents, upon changing its own position. - /// There is little need for casual users to call this. - void clearPositionInfo() const; - - /// Returns the absolute name of this node. - const std::string& getAbsoluteName() const; - - /// Returns the identification bits. - unsigned int getId() const; + /// Returns the identification bits. + unsigned int getId() const; protected: virtual ~GeoVFullPhysVol() = default; - /// Mutex serving dual purpose: - /// 1. To protect the absolute position info - /// 2. To protect m_daughters container in the derived GeoFullPhysVol - mutable std::mutex m_mutex; - private: /// The absolute name of this volume. mutable std::string m_absName{}; @@ -62,9 +29,7 @@ class GeoVFullPhysVol : public GeoVPhysVol /// An identifier. This is locally cached in a full physical volume. mutable std::unique_ptr<Query<int>> m_id{nullptr}; - /// Information on the where this volume is, by default and after alignment corrections. - mutable std::unique_ptr<GeoAbsPositionInfo> m_absPosInfo{nullptr}; - + }; #endif diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h index f7df474dfb3ce5d58374bff1760657e9ebfb5833..daa7945c49c8cb859edff5775b53218d0066de57 100644 --- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVPhysVol.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef GEOMODELKERNEL_GEOVPHYSVOL_H @@ -8,15 +8,19 @@ #include "GeoModelKernel/GeoIntrusivePtr.h" #include "GeoModelKernel/GeoDefinitions.h" #include "GeoModelKernel/Query.h" -#include <string> + #include "GeoModelKernel/GeoLogVol.h" +#include "GeoModelKernel/GeoPlacement.h" #include "GeoModelKernel/GeoGraphNode.h" + +#include <string> +#include <shared_mutex> class GeoVolumeAction; class GeoVAlignmentStore; -class GeoVPhysVol : public GeoGraphNode { +class GeoVPhysVol: public GeoPlacement { public: using PVLink = GeoIntrusivePtr<GeoVPhysVol>; using PVConstLink = GeoIntrusivePtr<const GeoVPhysVol>; @@ -24,78 +28,61 @@ class GeoVPhysVol : public GeoGraphNode { GeoVPhysVol(const GeoLogVol* LogVol); - /// Returns true if the physical volume is accessed by more than one parent. - /// Should check this before trusting the parent pointer. - bool isShared() const { - return m_parentPtr == this; - } - - /// Returns the index of a specific daughter volume. The Query class can be used - /// just like an unsigned int, but it provides and isValid() method to determine - /// whether it is valid and throws an exception if an invalid value is blithely used. - Query<unsigned int> indexOf(PVConstLink daughter) const; - /// Gets the parent, if the parent is unique, and otherwise returns a nullptr pointer. - PVConstLink getParent() const { - return PVConstLink{isShared() ? nullptr : m_parentPtr}; - } + /// Returns the index of a specific daughter volume. The Query class can be used + /// just like an unsigned int, but it provides and isValid() method to determine + /// whether it is valid and throws an exception if an invalid value is blithely used. + Query<unsigned int> indexOf(PVConstLink daughter) const; - /// Returns the logical volume. - const GeoLogVol* getLogVol() const { - return m_logVol; - } + /// Returns the logical volume. + const GeoLogVol* getLogVol() const { + return m_logVol; + } - /// Returns the number of child physical volumes. - virtual unsigned int getNChildVols() const = 0; + /// Returns the number of child physical volumes. + unsigned int getNChildVols() const; - /// Returns the ith child volume - virtual PVConstLink getChildVol(unsigned int index) const = 0; + /// Returns the ith child volume + PVConstLink getChildVol(unsigned int index) const; - /// Returns the transform to the ith volume. - virtual GeoTrf::Transform3D getXToChildVol(unsigned int index, const GeoVAlignmentStore* store=nullptr) const = 0; + /// Returns the transform to the ith volume. + GeoTrf::Transform3D getXToChildVol(unsigned int index, const GeoVAlignmentStore* store=nullptr) const; - /// Returns the default transform to the ith volume. - virtual GeoTrf::Transform3D getDefXToChildVol(unsigned int index, const GeoVAlignmentStore* store=nullptr) const = 0; + /// Returns the default transform to the ith volume. + GeoTrf::Transform3D getDefXToChildVol(unsigned int index, const GeoVAlignmentStore* store=nullptr) const; - /// Returns the name of the child. - virtual std::string getNameOfChildVol(unsigned int i) const = 0; + /// Returns the name of the child. + std::string getNameOfChildVol(unsigned int i) const; - /// Applies an action to the volume. The volume executes the action and the applies - /// it to the children, either from the top down or the bottom up, depending upon - /// the configuration of the action. - void apply(GeoVolumeAction* action) const; + /// Applies an action to the volume. The volume executes the action and the applies + /// it to the children, either from the top down or the bottom up, depending upon + /// the configuration of the action. + void apply(GeoVolumeAction* action) const; - /// When a node is added to a parent in the graph, the node is always notified. - /// What happens at that time is up to the node. Most nodes do not need to do - /// anything. Some--the alignable transforms in particular--need to take some - /// actions, such as adding the parent volume to a list. - virtual void dockTo(GeoVPhysVol* parent); + + /// Returns the id of the child. + Query<int> getIdOfChildVol(unsigned int i) const; - /// Returns the id of the child. - virtual Query<int> getIdOfChildVol(unsigned int i) const = 0; + /// Returns the number of child physical volumes and Serial Transformers. + unsigned int getNChildVolAndST() const; - /// Returns the number of child physical volumes and Serial Transformers. - virtual unsigned int getNChildVolAndST() const = 0; + /// Returns the number of child nodes + unsigned int getNChildNodes() const; + + const GeoGraphNode* const* getChildNode (unsigned int i) const; + const GeoGraphNode* const* findChildNode(const GeoGraphNode *n) const; - virtual GeoTrf::Transform3D getX (const GeoVAlignmentStore* store=nullptr) const = 0; - virtual GeoTrf::Transform3D getDefX (const GeoVAlignmentStore* store=nullptr) const = 0; - virtual unsigned int getNChildNodes() const=0; - virtual const GeoGraphNode * const *getChildNode (unsigned int i) const=0; - virtual const GeoGraphNode * const *findChildNode(const GeoGraphNode *n) const=0; - - /// Adds a Graph Node to the Geometry Graph - virtual void add(GeoGraphNode* graphNode) = 0; - - protected: - virtual ~GeoVPhysVol() = default; + /// Adds a Graph Node to the Geometry Graph + void add(GeoIntrusivePtr<GeoGraphNode> graphNode); + protected: + virtual ~GeoVPhysVol() = default; private: - /// If one parent ...pointer=PARENT; - /// If no parent ...pointer=nullptr. - /// If more than one parent ...pointer=this; - const GeoVPhysVol* m_parentPtr{nullptr}; - - GeoIntrusivePtr<const GeoLogVol> m_logVol{}; + GeoIntrusivePtr<const GeoLogVol> m_logVol{}; + protected: + std::vector<GeoIntrusivePtr<GeoGraphNode>> m_daughters{}; + mutable std::shared_mutex m_muxVec{}; + }; using PVLink = GeoVPhysVol::PVLink; diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVSurface.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVSurface.h new file mode 100644 index 0000000000000000000000000000000000000000..cecb1be89e740fe177404ae69b758df04de18948 --- /dev/null +++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoVSurface.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef GEOMODELKERNEL_GeoVSurface_H +#define GEOMODELKERNEL_GeoVSurface_H + +/** + * @class GeoVSurface + * + * @brief An abstract class of virtual surfaces + * + */ + +#include "GeoModelKernel/GeoPlacement.h" +#include "GeoModelKernel/GeoNodePositioning.h" +#include "GeoModelKernel/GeoDefinitions.h" + + +class GeoVSurface : public GeoPlacement, public GeoNodePositioning { + public: + GeoVSurface(): + GeoNodePositioning{this}{ + } + + virtual double area() const=0; // calculate the area of a surface + + // method from GeoPlacement + + + protected: + virtual ~GeoVSurface() = default; +}; + + +#endif diff --git a/GeoModelCore/GeoModelKernel/src/GeoAbsPositionInfo.cxx b/GeoModelCore/GeoModelKernel/src/GeoAbsPositionInfo.cxx deleted file mode 100755 index f766e2013b63de495fec5784d6f407eb80a7ea34..0000000000000000000000000000000000000000 --- a/GeoModelCore/GeoModelKernel/src/GeoAbsPositionInfo.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -*/ - -#include "GeoModelKernel/GeoAbsPositionInfo.h" -#include "GeoModelKernel/GeoDefinitions.h" - -void GeoAbsPositionInfo::clearAbsTransform () { - m_absTransform.reset(); -} - -void GeoAbsPositionInfo::clearDefAbsTransform () { - m_defAbsTransform.reset(); -} - -void GeoAbsPositionInfo::setAbsTransform (const GeoTrf::Transform3D & xform) -{ - if (m_absTransform) { - (*m_absTransform) = xform; - } else { - m_absTransform = std::make_unique<GeoTrf::Transform3D> (xform); - } -} - -void GeoAbsPositionInfo::setDefAbsTransform (const GeoTrf::Transform3D& xform) { - if (m_defAbsTransform) { - (*m_defAbsTransform) = xform; - } else { - m_defAbsTransform = std::make_unique<GeoTrf::Transform3D>(xform); - } -} diff --git a/GeoModelCore/GeoModelKernel/src/GeoFullPhysVol.cxx b/GeoModelCore/GeoModelKernel/src/GeoFullPhysVol.cxx index 9022dbd2e13f9687cae239f62fe489c96b98a587..f1707f72d2060d34c5e357d3a98486ce87f637da 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoFullPhysVol.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoFullPhysVol.cxx @@ -14,45 +14,7 @@ GeoFullPhysVol::GeoFullPhysVol (const GeoLogVol* LogVol) : GeoVFullPhysVol(LogVol){ } -void GeoFullPhysVol::add(GeoGraphNode* graphNode) -{ - if(m_cloneOrigin) throw std::runtime_error("Attempt to modify contents of a cloned FPV"); - std::scoped_lock<std::mutex> guard(m_mutex); - GeoIntrusivePtr<GeoGraphNode> nodePtr{graphNode}; - m_daughters.emplace_back(nodePtr); - graphNode->dockTo(this); -} - -unsigned int GeoFullPhysVol::getNChildVols() const -{ - GeoCountVolAction cv; - exec(&cv); - return cv.getCount(); -} - -PVConstLink GeoFullPhysVol::getChildVol(unsigned int index) const -{ - GeoAccessVolumeAction av(index,nullptr); - exec(&av); - return av.getVolume(); -} - -GeoTrf::Transform3D GeoFullPhysVol::getXToChildVol(unsigned int index, const GeoVAlignmentStore* store) const -{ - GeoAccessVolumeAction av(index,store); - exec(&av); - return av.getTransform(); -} - -GeoTrf::Transform3D GeoFullPhysVol::getDefXToChildVol(unsigned int index, const GeoVAlignmentStore* store) const -{ - GeoAccessVolumeAction av(index,store); - exec(&av); - return av.getDefTransform(); -} - -void GeoFullPhysVol::exec(GeoNodeAction *action) const -{ +void GeoFullPhysVol::exec(GeoNodeAction *action) const { // // Put this node on the head of the path: bb // @@ -78,11 +40,11 @@ void GeoFullPhysVol::exec(GeoNodeAction *action) const && action->getPath()->getLength() > action->getDepthLimit()) { } else { - for(size_t c = 0; c<m_daughters.size(); c++) { - m_daughters[c]->exec(action); + for(const GeoIntrusivePtr<GeoGraphNode>& node : m_daughters) { + node->exec(action); if(action->shouldTerminate()) { - action->getPath()->pop(); - return; + action->getPath()->pop(); + return; } } } @@ -93,29 +55,7 @@ void GeoFullPhysVol::exec(GeoNodeAction *action) const action->getPath()->pop(); } -std::string GeoFullPhysVol::getNameOfChildVol(unsigned int i) const -{ - GeoAccessVolumeAction av(i,nullptr); - exec(&av); - return av.getName(); -} - -Query<int> GeoFullPhysVol::getIdOfChildVol(unsigned int i) const -{ - GeoAccessVolumeAction av(i,nullptr); - exec(&av); - return av.getId (); -} - -unsigned int GeoFullPhysVol::getNChildVolAndST() const -{ - GeoCountVolAndSTAction cv; - exec(&cv); - return cv.getCount(); -} - -GeoFullPhysVol* GeoFullPhysVol::clone(bool attached) -{ +GeoFullPhysVol* GeoFullPhysVol::clone(bool attached) { GeoFullPhysVol* clone = new GeoFullPhysVol(this->getLogVol()); for(auto daughter : m_daughters) { clone->add(daughter); @@ -131,105 +71,14 @@ GeoFullPhysVol* GeoFullPhysVol::clone(bool attached) return clone; } -const GeoFullPhysVol* GeoFullPhysVol::cloneOrigin() const -{ +const GeoFullPhysVol* GeoFullPhysVol::cloneOrigin() const { return m_cloneOrigin; } /// Breaks the consistency of cloned volumes! /// Use it only in Simulation jobs and /// Don't call it until geometry has been completely translated to G4 -void GeoFullPhysVol::clear() -{ - m_daughters.clear(); +void GeoFullPhysVol::clear() { + m_daughters.clear(); } -GeoTrf::Transform3D GeoFullPhysVol::getX(const GeoVAlignmentStore* store) const { - // - // Check we are not shared: - // - if (isShared()) throw std::runtime_error("Transform requested from shared volume"); - GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity()); - // - // Get the address of the first graph node, from the parent: - // - const GeoGraphNode * const * fence = getParent()->getChildNode(0); - const GeoGraphNode * const * node1 = getParent()->findChildNode(this); - - for(const GeoGraphNode * const * current = node1 - 1; current>=fence; current--) { - - // If this happens, we are done, compute & return--------------------// - // // - if (dynamic_cast<const GeoVPhysVol *>(*current)) break; // - //-------------------------------------------------------------------// - - // If this happens, we are done, compute & return--------------------// - // // - if (dynamic_cast<const GeoSerialTransformer *>(*current)) break; // - //-------------------------------------------------------------------// - - const GeoTransform *xf = dynamic_cast<const GeoTransform *> (*current); - - //-------------------------------------------------------------------// - // If this happens, accumulate into transform // - if (xf) xform = xf->getTransform(store)*xform; // - //-------------------------------------------------------------------// - } - return xform; -} - -GeoTrf::Transform3D GeoFullPhysVol::getDefX(const GeoVAlignmentStore* store) const { - // - // Check we are not shared: - // - if (isShared()) throw std::runtime_error("Transform requested from shared volume"); - GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity()); - // - // Get the address of the first graph node, from the parent: - // - const GeoGraphNode * const * fence = getParent()->getChildNode(0); - const GeoGraphNode * const * node1 = getParent()->findChildNode(this); - - for(const GeoGraphNode * const * current = node1 - 1; current>=fence; current--) { - - // If this happens, we are done, compute & return--------------------// - // // - if (dynamic_cast<const GeoVPhysVol *>(*current)) break; // - //-------------------------------------------------------------------// - - // If this happens, we are done, compute & return--------------------// - // // - if (dynamic_cast<const GeoSerialTransformer *>(*current)) break; // - //-------------------------------------------------------------------// - - const GeoTransform *xf = dynamic_cast<const GeoTransform *> (*current); - - //-------------------------------------------------------------------// - // If this happens, accumulate into transform // - if (xf) xform = xf->getDefTransform(store)*xform; // - //-------------------------------------------------------------------// - } - return xform; - -} - -unsigned int GeoFullPhysVol::getNChildNodes() const -{ - std::scoped_lock<std::mutex> guard(m_mutex); - return m_daughters.size(); -} - -const GeoGraphNode * const * GeoFullPhysVol::getChildNode(unsigned int i) const { - std::scoped_lock<std::mutex> guard(m_mutex); - return m_daughters[i]; -} -const GeoGraphNode * const * GeoFullPhysVol::findChildNode(const GeoGraphNode * n) const -{ - std::scoped_lock<std::mutex> guard(m_mutex); - std::vector<GeoIntrusivePtr<GeoGraphNode>>::const_iterator i = std::find(m_daughters.begin(),m_daughters.end(),n); - if (i==m_daughters.end()) { - return nullptr; - } - return (*i); - -} diff --git a/GeoModelCore/GeoModelKernel/src/GeoNodePositioning.cxx b/GeoModelCore/GeoModelKernel/src/GeoNodePositioning.cxx new file mode 100644 index 0000000000000000000000000000000000000000..51914d11d9bb9850a3a767c9aff69b6f9153c3ba --- /dev/null +++ b/GeoModelCore/GeoModelKernel/src/GeoNodePositioning.cxx @@ -0,0 +1,122 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GeoModelKernel/GeoNodePositioning.h" +#include "GeoModelKernel/GeoVPhysVol.h" + +#include <mutex> +#include <thread> + + +GeoNodePositioning::GeoNodePositioning(const GeoPlacement* node): + m_node{node} { + +} + + GeoTrf::Transform3D GeoNodePositioning::accumulateTrfs(GeoVAlignmentStore* store, + const AccumlType type) const { + GeoTrf::Transform3D tProd{GeoTrf::Transform3D::Identity()}; + + if(m_node->isShared()) { + throw std::runtime_error("GeoPlacement node is shared"); + } + GeoIntrusivePtr<const GeoPlacement> child{m_node}, parent{m_node->getParent()}; + while (parent) { + const GeoTrf::Transform3D transform{type == AccumlType::Aligned ? child->getX(store) : child->getDefX(store)}; + tProd = transform * tProd; + child = parent; + if(child->isShared()) { + throw std::runtime_error("GeoPlacement node is shared."); + } else { + parent = child->getParent(); + } + } + return tProd; +} + +const GeoTrf::Transform3D& + GeoNodePositioning::getAbsoluteTransform(GeoVAlignmentStore* store) const { + + if (!store) { + std::unique_lock guard{m_mutex}; + if (!m_absTransf) { + m_absTransf = std::make_unique<GeoTrf::Transform3D>(accumulateTrfs(store, AccumlType::Aligned)); + } + assert(m_absTransf.get() != nullptr); + return *m_absTransf; + } + + const GeoTrf::Transform3D* cachedTrf{store->getAbsPosition(this)}; + if (cachedTrf) { + return *cachedTrf; + } + store->setAbsPosition(this, accumulateTrfs(store, AccumlType::Aligned)); + cachedTrf = store->getAbsPosition(this); + + assert(cachedTrf != nullptr); + + return *cachedTrf; + +} + + +const GeoTrf::Transform3D& GeoNodePositioning::getCachedAbsoluteTransform(const GeoVAlignmentStore* store) const { + if(!store) { + std::shared_lock guard{m_mutex}; + if (m_absTransf) return *m_absTransf; + } else { + const GeoTrf::Transform3D* storedPos = store->getAbsPosition(this); + assert(storedPos != nullptr); + if(storedPos) return *storedPos; + } + throw std::runtime_error("Failed to find the cached absolute transform "); +} + +void GeoNodePositioning::clearPositionInfo() const { + std::unique_lock guard{m_mutex}; + m_absDefTransf.reset(); + m_absTransf.reset(); +} + + +const GeoTrf::Transform3D& GeoNodePositioning::getDefAbsoluteTransform(GeoVAlignmentStore* store) const { + if (!store) { + std::unique_lock guard{m_mutex}; + if (!m_absDefTransf) { + m_absDefTransf = std::make_unique<GeoTrf::Transform3D>(accumulateTrfs(store, AccumlType::Default)); + } + assert(m_absDefTransf.get() != nullptr); + return *m_absDefTransf; + } + + const GeoTrf::Transform3D* cachedTrf{store->getDefAbsPosition(this)}; + if (cachedTrf) { + return *cachedTrf; + } + store->setDefAbsPosition(this, accumulateTrfs(store, AccumlType::Default)); + cachedTrf = store->getDefAbsPosition(this); + + assert(cachedTrf != nullptr); + + return *cachedTrf; +} + + +const GeoTrf::Transform3D& + GeoNodePositioning::getCachedDefAbsoluteTransform(const GeoVAlignmentStore* store) const { + if(!store) { + std::shared_lock guar{m_mutex}; + if(m_absDefTransf) return *m_absDefTransf; + } else { + const GeoTrf::Transform3D* storedPos = store->getDefAbsPosition(this); + + assert(storedPos != nullptr); + + if(storedPos) return *storedPos; + } + throw std::runtime_error("Failed to find the cached default absolute transform. "); +} + + + diff --git a/GeoModelCore/GeoModelKernel/src/GeoPhysVol.cxx b/GeoModelCore/GeoModelKernel/src/GeoPhysVol.cxx index fdc2568b36a1704ae9d7c3aea9d92527f4e4519d..b0c74835cd9c1803444c90346b875c1ba7b910ea 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoPhysVol.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoPhysVol.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelKernel/GeoPhysVol.h" @@ -12,49 +12,11 @@ #include <algorithm> -GeoPhysVol::GeoPhysVol(const GeoLogVol* LogVol) - : GeoVPhysVol(LogVol) {} +GeoPhysVol::GeoPhysVol(const GeoLogVol* LogVol): + GeoVPhysVol{LogVol}{} -void GeoPhysVol::add(GeoGraphNode* graphNode) { - std::scoped_lock<std::mutex> lk(m_muxVec); - GeoIntrusivePtr<GeoGraphNode> nodePtr{graphNode}; - m_daughters.emplace_back(nodePtr); - graphNode->dockTo(this); -} - -unsigned int GeoPhysVol::getNChildVols() const -{ - GeoCountVolAction cv; - exec(&cv); - return cv.getCount (); -} - -PVConstLink GeoPhysVol::getChildVol(unsigned int index) const -{ - GeoAccessVolumeAction av(index,nullptr); - exec(&av); - return av.getVolume(); -} - -GeoTrf::Transform3D GeoPhysVol::getXToChildVol(unsigned int index - ,const GeoVAlignmentStore* store) const -{ - GeoAccessVolumeAction av(index,store); - exec(&av); - return av.getTransform(); -} - -GeoTrf::Transform3D GeoPhysVol::getDefXToChildVol(unsigned int index - ,const GeoVAlignmentStore* store) const -{ - GeoAccessVolumeAction av(index,store); - exec(&av); - return av.getDefTransform(); -} - -void GeoPhysVol::exec(GeoNodeAction *action) const -{ +void GeoPhysVol::exec(GeoNodeAction *action) const { // // Put this node on the head of the path: // @@ -80,13 +42,13 @@ void GeoPhysVol::exec(GeoNodeAction *action) const } else { // FIXME: m_daughters access is now protected in other methods, but having the lock here makes a deadlock - // std::scoped_lock<std::mutex> lk(m_muxVec); + // std::scoped_lock lk(m_muxVec); // TODO: Think more thouroughly about thread-safe of this class...!! - for(size_t c = 0; c < m_daughters.size (); c++) { - m_daughters[c]->exec(action); + for(const GeoIntrusivePtr<GeoGraphNode>& child : m_daughters) { + child->exec(action); if(action->shouldTerminate()) { - action->getPath()->pop(); - return; + action->getPath()->pop(); + return; } } } @@ -95,113 +57,3 @@ void GeoPhysVol::exec(GeoNodeAction *action) const // action->getPath()->pop(); } - -std::string GeoPhysVol::getNameOfChildVol(unsigned int i) const -{ - GeoAccessVolumeAction av(i,nullptr); - exec(&av); - return av.getName(); -} - -Query<int> GeoPhysVol::getIdOfChildVol(unsigned int i) const -{ - GeoAccessVolumeAction av(i,nullptr); - exec(&av); - return av.getId(); -} - -unsigned int GeoPhysVol::getNChildVolAndST() const -{ - GeoCountVolAndSTAction cv; - exec(&cv); - return cv.getCount(); -} - -GeoTrf::Transform3D GeoPhysVol::getX(const GeoVAlignmentStore* store) const { - // - // Check we are not shared: - // - if (isShared()) throw std::runtime_error("Transform requested from shared volume"); - GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity()); - // - // Get the address of the first graph node, from the parent: - // - const GeoGraphNode * const * fence = getParent()->getChildNode(0); - const GeoGraphNode * const * node1 = getParent()->findChildNode(this); - - for(const GeoGraphNode * const * current = node1 - 1; current>=fence; current--) { - - // If this happens, we are done, compute & return--------------------// - // // - if(dynamic_cast<const GeoVPhysVol *>(*current)) break; // - //-------------------------------------------------------------------// - - // If this happens, we are done, compute & return--------------------// - // // - if(dynamic_cast<const GeoSerialTransformer *>(*current)) break; // - //-------------------------------------------------------------------// - - const GeoTransform *xf = dynamic_cast<const GeoTransform *> (*current); - - //-------------------------------------------------------------------// - // If this happens, accumulate into transform // - if (xf) xform = xf->getTransform(store)*xform; // - //-------------------------------------------------------------------// - } - return xform; -} - -GeoTrf::Transform3D GeoPhysVol::getDefX(const GeoVAlignmentStore* store) const { - // - // Check we are not shared: - // - if (isShared()) throw std::runtime_error("Transform requested from shared volume"); - GeoTrf::Transform3D xform(GeoTrf::Transform3D::Identity()); - // - // Get the address of the first graph node, from the parent: - // - const GeoGraphNode * const * fence = getParent()->getChildNode(0); - const GeoGraphNode * const * node1 = getParent()->findChildNode(this); - - for(const GeoGraphNode * const * current = node1 - 1; current>=fence; current--) { - - // If this happens, we are done, compute & return--------------------// - // // - if (dynamic_cast<const GeoVPhysVol *>(*current)) break; // - //-------------------------------------------------------------------// - - // If this happens, we are done, compute & return--------------------// - // // - if (dynamic_cast<const GeoSerialTransformer *>(*current)) break; // - //-------------------------------------------------------------------// - - const GeoTransform *xf = dynamic_cast<const GeoTransform *> (*current); - - //-------------------------------------------------------------------// - // If this happens, accumulate into transform // - if (xf) xform = xf->getDefTransform(store)*xform; // - //-------------------------------------------------------------------// - } - return xform; -} - -unsigned int GeoPhysVol::getNChildNodes() const -{ - std::scoped_lock<std::mutex> lk(m_muxVec); - return m_daughters.size(); -} - -const GeoGraphNode * const * GeoPhysVol::getChildNode(unsigned int i) const { - std::scoped_lock<std::mutex> lk(m_muxVec); - return m_daughters[i]; -} - -const GeoGraphNode * const * GeoPhysVol::findChildNode(const GeoGraphNode * n) const { - std::scoped_lock<std::mutex> lk(m_muxVec); - std::vector<GeoIntrusivePtr<GeoGraphNode>>::const_iterator i = std::find(m_daughters.begin(),m_daughters.end(),n); - if (i==m_daughters.end()) { - return nullptr; - } - return (*i); - -} diff --git a/GeoModelCore/GeoModelKernel/src/GeoPlacement.cxx b/GeoModelCore/GeoModelKernel/src/GeoPlacement.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e1d1fae373c9e6c9223f482aa3e862b09992a83a --- /dev/null +++ b/GeoModelCore/GeoModelKernel/src/GeoPlacement.cxx @@ -0,0 +1,105 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +#include "GeoModelKernel/GeoPlacement.h" +#include "GeoModelKernel/GeoSerialTransformer.h" +#include "GeoModelKernel/GeoVPhysVol.h" +#include "GeoModelKernel/GeoTransform.h" + + + +void GeoPlacement::dockTo(GeoVPhysVol* parent) { + if (!m_parentPtr && m_uniqueParent) { + m_parentPtr = parent; + } else { + m_parentPtr = nullptr; + m_uniqueParent = false; + } +} + + +bool GeoPlacement::isShared() const { + return !m_uniqueParent; +} +GeoIntrusivePtr<const GeoVPhysVol> GeoPlacement::getParent() const { + return GeoIntrusivePtr<const GeoVPhysVol>{m_parentPtr}; +} + + +GeoTrf::Transform3D GeoPlacement::getX(const GeoVAlignmentStore* store) const { + // + // Check we are not shared: + // + if (isShared()) throw std::runtime_error("Transform requested from shared volume"); + GeoTrf::Transform3D xform{GeoTrf::Transform3D::Identity()}; + + if (!m_parentPtr) { + return xform; + } + // + // Get the address of the first graph node, from the parent: + // + const GeoGraphNode * const * fence = m_parentPtr->getChildNode(0); + const GeoGraphNode * const * node1 = m_parentPtr->findChildNode(this); + + for(const GeoGraphNode * const * current = node1 - 1; current>=fence; current--) { + + // If this happens, we are done, compute & return--------------------// + // // + if (dynamic_cast<const GeoVPhysVol *>(*current)) break; // + //-------------------------------------------------------------------// + + // If this happens, we are done, compute & return--------------------// + // // + if (dynamic_cast<const GeoSerialTransformer *>(*current)) break; // + //-------------------------------------------------------------------// + + const GeoTransform *xf = dynamic_cast<const GeoTransform *> (*current); + + //-------------------------------------------------------------------// + // If this happens, accumulate into transform // + if (xf) xform = xf->getTransform(store)*xform; // + //-------------------------------------------------------------------// + } + return xform; +} + +GeoTrf::Transform3D GeoPlacement::getDefX(const GeoVAlignmentStore* store) const { + // + // Check we are not shared: + // + if (isShared()) throw std::runtime_error("Transform requested from shared volume"); + GeoTrf::Transform3D xform{GeoTrf::Transform3D::Identity()}; + + if (!m_parentPtr) { + return xform; + } + + // + // Get the address of the first graph node, from the parent: + // + const GeoGraphNode * const * fence = m_parentPtr->getChildNode(0); + const GeoGraphNode * const * node1 = m_parentPtr->findChildNode(this); + + for(const GeoGraphNode * const * current = node1 - 1; current>=fence; current--) { + + // If this happens, we are done, compute & return--------------------// + // // + if (dynamic_cast<const GeoVPhysVol *>(*current)) break; // + //-------------------------------------------------------------------// + + // If this happens, we are done, compute & return--------------------// + // // + if (dynamic_cast<const GeoSerialTransformer *>(*current)) break; // + //-------------------------------------------------------------------// + + const GeoTransform *xf = dynamic_cast<const GeoTransform *> (*current); + + //-------------------------------------------------------------------// + // If this happens, accumulate into transform // + if (xf) xform = xf->getDefTransform(store)*xform; // + //-------------------------------------------------------------------// + } + return xform; + +} diff --git a/GeoModelCore/GeoModelKernel/src/GeoRectSurface.cxx b/GeoModelCore/GeoModelKernel/src/GeoRectSurface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3d267b2684941e6792d64ad984c10254542234e7 --- /dev/null +++ b/GeoModelCore/GeoModelKernel/src/GeoRectSurface.cxx @@ -0,0 +1,11 @@ +#include "GeoModelKernel/GeoRectSurface.h" + +GeoRectSurface::GeoRectSurface (double XHalfLength, double YHalfLength): + m_xHalfLength {XHalfLength}, + m_yHalfLength {YHalfLength} {} + + +double GeoRectSurface::area () const { + return 4.0 * m_xHalfLength * m_yHalfLength; +} + diff --git a/GeoModelCore/GeoModelKernel/src/GeoVFullPhysVol.cxx b/GeoModelCore/GeoModelKernel/src/GeoVFullPhysVol.cxx index 5cd477be53df390b5371551ade2de9bec7683aa7..1c014d7ee148efe8a02dbf8bb36ed7fa8772ed37 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoVFullPhysVol.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoVFullPhysVol.cxx @@ -5,159 +5,11 @@ #include "GeoModelKernel/GeoVFullPhysVol.h" #include "GeoModelKernel/GeoVAlignmentStore.h" #include <string> - GeoVFullPhysVol::GeoVFullPhysVol(const GeoLogVol* logVol) - : GeoVPhysVol(logVol){} - - -const GeoTrf::Transform3D & GeoVFullPhysVol::getAbsoluteTransform(GeoVAlignmentStore* store) const -{ - //------------------------------------------------------------------------------------------------// - // // - // Get ready for something to go wrong: // - // // - static std::string errorMessage("Full Physical Volume errroneously placed in a shared portion of a detector description graph.\nLogVol name of shared volume: "); - // // - //------------------------------------------------------------------------------------------------// - - if(isShared()) throw std::runtime_error(errorMessage+getLogVol()->getName()); - - std::scoped_lock<std::mutex> guard(m_mutex); - - if(!store && !m_absPosInfo) m_absPosInfo = std::make_unique<GeoAbsPositionInfo>(); - - // - // Check the cache first. If not empty, then return the cached value - // - if(!store) { - if(m_absPosInfo->getAbsTransform()) return *m_absPosInfo->getAbsTransform(); - } else { - const GeoTrf::Transform3D* storedPos = store->getAbsPosition(this); - if(storedPos!=nullptr) return *storedPos; - } - - // The cache is empty. Compute the absolute position from the top of the tree down to here, and cache it - PVConstLink child(this), parent(getParent()); - GeoTrf::Transform3D tProd(GeoTrf::Transform3D::Identity()); - - while (parent) { -#ifdef HOSED - int index = parent->indexOf (child); - GeoTrf::Transform3D transform = parent->getXToChildVol(index,store); -#else - GeoTrf::Transform3D transform = child->getX(store); -#endif - tProd = transform * tProd; - child = parent; - if(child->isShared()) { - throw std::runtime_error(errorMessage+ getLogVol()->getName() + " because of " + child->getLogVol()->getName()); - } - else { - parent = child->getParent(); - } - } - - if(store==nullptr) { - m_absPosInfo->setAbsTransform(tProd); - return *m_absPosInfo->getAbsTransform(); - } - else { - store->setAbsPosition(this,tProd); - const GeoTrf::Transform3D* storedPosition = store->getAbsPosition(this); - return *storedPosition; - } -} - -const GeoTrf::Transform3D& GeoVFullPhysVol::getCachedAbsoluteTransform(const GeoVAlignmentStore* store) const -{ - if(store==nullptr) { - std::scoped_lock<std::mutex> guard(m_mutex); - if(m_absPosInfo->getAbsTransform()) return *m_absPosInfo->getAbsTransform(); - } - else { - const GeoTrf::Transform3D* storedPos = store->getAbsPosition(this); - if(storedPos) return *storedPos; - } - throw std::runtime_error("Failed to find the cached absolute transform for " + getLogVol()->getName()); -} - - -void GeoVFullPhysVol::clearPositionInfo() const -{ - std::scoped_lock<std::mutex> guard(m_mutex); - m_absPosInfo.reset(); -} - -const GeoTrf::Transform3D& GeoVFullPhysVol::getDefAbsoluteTransform(GeoVAlignmentStore* store) const -{ - //------------------------------------------------------------------------------------------------// - // // - // Get ready for something to go wrong: // - // // - static std::string errorMessage("Full Physical Volume errroneously placed in a shared portion of a detector description graph.\nName of shared volume: "); - // // - //------------------------------------------------------------------------------------------------// - if(isShared()) throw std::runtime_error(errorMessage + getLogVol()->getName()); - - std::scoped_lock<std::mutex> guard(m_mutex); - - if(!store && !m_absPosInfo) m_absPosInfo = std::make_unique<GeoAbsPositionInfo>(); - - // - // Check the cache first. If not empty, then return the cached value - // - if(!store){ - if(m_absPosInfo->getDefAbsTransform()) return *m_absPosInfo->getDefAbsTransform(); - } else { - const GeoTrf::Transform3D* storedPos = store->getDefAbsPosition(this); - if(storedPos!=nullptr) return *storedPos; - } - - // The cache is empty. Compute the absolute position from the top of the tree down to here, and cache it - PVConstLink child(this), parent(getParent()); - GeoTrf::Transform3D tProd(GeoTrf::Transform3D::Identity()); - - while (parent) { -#ifdef HOSED - int index = parent->indexOf (child); - GeoTrf::Transform3D transform = parent->getDefXToChildVol(index,store); -#else - GeoTrf::Transform3D transform = child->getDefX(store); -#endif - tProd = transform * tProd; - child = parent; - if(child->isShared()) { - throw std::runtime_error(errorMessage + getLogVol()->getName() + " because of " + child->getLogVol()->getName()); - } - else { - parent = child->getParent(); - } - } - - if(store==nullptr) { - m_absPosInfo->setDefAbsTransform(tProd); - return *m_absPosInfo->getDefAbsTransform(); - } - else { - store->setDefAbsPosition(this,tProd); - const GeoTrf::Transform3D* storedPosition = store->getDefAbsPosition(this); - return *storedPosition; - } -} - -const GeoTrf::Transform3D& GeoVFullPhysVol::getCachedDefAbsoluteTransform(const GeoVAlignmentStore* store) const -{ - if(store==nullptr) { - std::scoped_lock<std::mutex> guard(m_mutex); - if(m_absPosInfo->getDefAbsTransform()) return *m_absPosInfo->getDefAbsTransform(); - } - else { - const GeoTrf::Transform3D* storedPos = store->getDefAbsPosition(this); - if(storedPos) return *storedPos; - } - throw std::runtime_error("Failed to find the cached default absolute transform for " + getLogVol()->getName()); -} + : GeoVPhysVol{logVol}, + GeoNodePositioning{this}{} + const std::string & GeoVFullPhysVol::getAbsoluteName () const { //------------------------------------------------------------------------------------------------// diff --git a/GeoModelCore/GeoModelKernel/src/GeoVPhysVol.cxx b/GeoModelCore/GeoModelKernel/src/GeoVPhysVol.cxx index 7bdcd2a8a0bd9a927bc795dd9a0c4aae2b45f4f1..ef0238e1ecc0476a944325afc70a03a33be32f03 100755 --- a/GeoModelCore/GeoModelKernel/src/GeoVPhysVol.cxx +++ b/GeoModelCore/GeoModelKernel/src/GeoVPhysVol.cxx @@ -1,19 +1,21 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelKernel/GeoVPhysVol.h" #include "GeoModelKernel/GeoVolumeAction.h" #include "GeoModelKernel/GeoAccessVolumeAction.h" +#include "GeoModelKernel/GeoCountVolAction.h" +#include "GeoModelKernel/GeoCountVolAndSTAction.h" #include <stdexcept> #include <string> +#include <mutex> GeoVPhysVol::GeoVPhysVol(const GeoLogVol* LogVol): - m_logVol(LogVol) {} + m_logVol(LogVol) {} -Query<unsigned int> GeoVPhysVol::indexOf(PVConstLink daughter) const -{ +Query<unsigned int> GeoVPhysVol::indexOf(PVConstLink daughter) const { unsigned int nChildVols{getNChildVols()}; for(unsigned int i=0; i<nChildVols; i++) { // To Do: replace this with Volume Iterator! if(getChildVol(i) == daughter) return i; @@ -69,12 +71,74 @@ void GeoVPhysVol::apply(GeoVolumeAction *action) const { } } -void GeoVPhysVol::dockTo(GeoVPhysVol* parent) +void GeoVPhysVol::add(GeoIntrusivePtr<GeoGraphNode> graphNode) { + std::unique_lock lk{m_muxVec}; + m_daughters.emplace_back(graphNode); + graphNode->dockTo(this); +} + +unsigned int GeoVPhysVol::getNChildVols() const { + GeoCountVolAction cv; + exec(&cv); + return cv.getCount(); +} + +PVConstLink GeoVPhysVol::getChildVol(unsigned int index) const { + GeoAccessVolumeAction av(index,nullptr); + exec(&av); + return av.getVolume(); +} + +GeoTrf::Transform3D GeoVPhysVol::getXToChildVol(unsigned int index, + const GeoVAlignmentStore* store) const { + GeoAccessVolumeAction av(index,store); + exec(&av); + return av.getTransform(); +} + +GeoTrf::Transform3D GeoVPhysVol::getDefXToChildVol(unsigned int index, + const GeoVAlignmentStore* store) const { - if(m_parentPtr) { - m_parentPtr = this; - } - else { - m_parentPtr = parent; + GeoAccessVolumeAction av(index,store); + exec(&av); + return av.getDefTransform(); +} + + +std::string GeoVPhysVol::getNameOfChildVol(unsigned int i) const { + GeoAccessVolumeAction av(i,nullptr); + exec(&av); + return av.getName(); +} + +Query<int> GeoVPhysVol::getIdOfChildVol(unsigned int i) const { + GeoAccessVolumeAction av(i,nullptr); + exec(&av); + return av.getId(); +} + +unsigned int GeoVPhysVol::getNChildVolAndST() const { + GeoCountVolAndSTAction cv; + exec(&cv); + return cv.getCount(); +} + +unsigned int GeoVPhysVol::getNChildNodes() const { + std::shared_lock lk{m_muxVec}; + return m_daughters.size(); +} + +const GeoGraphNode * const * GeoVPhysVol::getChildNode(unsigned int i) const { + std::shared_lock lk{m_muxVec}; + return m_daughters[i]; +} + +const GeoGraphNode * const * GeoVPhysVol::findChildNode(const GeoGraphNode * n) const { + std::shared_lock lk{m_muxVec}; + std::vector<GeoIntrusivePtr<GeoGraphNode>>::const_iterator i = std::find(m_daughters.begin(),m_daughters.end(),n); + if (i==m_daughters.end()) { + return nullptr; } + return (*i); + } diff --git a/GeoModelExamples/CMakeLists.txt b/GeoModelExamples/CMakeLists.txt index 2ac1024bc4281280c7395b585a9d8f9633c51e0e..b819e97a343cf5f7a5d9c693d4e68690d7fe5dcf 100644 --- a/GeoModelExamples/CMakeLists.txt +++ b/GeoModelExamples/CMakeLists.txt @@ -12,6 +12,7 @@ project( "GeoModelExamples" VERSION 4.1.0 LANGUAGES CXX ) # Getting-started examples add_subdirectory( KitchenSinkPlugin ) add_subdirectory( MinimalPlugin ) +add_subdirectory( SurfaceTestPlugin ) add_subdirectory( HelloGeo ) add_subdirectory( HelloGeoWrite ) diff --git a/GeoModelExamples/SurfaceTestPlugin/CMakeLists.txt b/GeoModelExamples/SurfaceTestPlugin/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4a8db4175e3098082ccc20daf836c596771f821b --- /dev/null +++ b/GeoModelExamples/SurfaceTestPlugin/CMakeLists.txt @@ -0,0 +1,47 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +################################################################################ +# Package: HelloGeo +# author: Riccardo Maria BIANCHI @ CERN - Nov, 2018 +################################################################################ + +cmake_minimum_required(VERSION 3.16...3.26) + +# Compile with C++17 +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS ON) + + +# Find the needed dependencies, when building individually + message (${CMAKE_SOURCE_DIR}) + message (${PROJECT_SOURCE_DIR}) + +if ( CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR ) # when buildingindividually + find_package( GeoModelCore REQUIRED ) +endif() + + +# Find the header and source files. +file( GLOB SOURCES src/*.cxx ) + +add_library( SurfaceTestPlugin SHARED ${SOURCES} ) +target_link_libraries( SurfaceTestPlugin PUBLIC GeoModelCore::GeoModelKernel GeoModelCore::GeoModelHelpers) + +target_include_directories( SurfaceTestPlugin PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> + $<INSTALL_INTERFACE:include> ) + +source_group( "src" FILES ${SOURCES} ) + +set_target_properties( SurfaceTestPlugin PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} ) + +# Install the library. +install( TARGETS SurfaceTestPlugin + EXPORT ${PROJECT_NAME}-export + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT Runtime + NAMELINK_SKIP ) + diff --git a/GeoModelExamples/SurfaceTestPlugin/src/SurfaceTestPlugin.cxx b/GeoModelExamples/SurfaceTestPlugin/src/SurfaceTestPlugin.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5d4bac3a2e5df4db2a2502bc1161b037c2fe5e55 --- /dev/null +++ b/GeoModelExamples/SurfaceTestPlugin/src/SurfaceTestPlugin.cxx @@ -0,0 +1,127 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// +// Kitchen Sink Plugin +// Joe Boudreau Jan 11 2021 +// +// This is an example plugin. It compiles to a shared library +// (with .so or .dylib extension) which can be viewed with gmex. +// +// This plugin is used to test and develop surfaces, our first +// example of virtual geometry. +// +// +// -------------------------------------------------------------------- + +#include "GeoModelKernel/GeoVGeometryPlugin.h" +#include "GeoModelKernel/GeoDefinitions.h" +#include "GeoModelKernel/GeoMaterial.h" +#include "GeoModelKernel/GeoBox.h" +#include "GeoModelKernel/GeoTube.h" + +#include "GeoModelKernel/GeoLogVol.h" +#include "GeoModelKernel/GeoPhysVol.h" +#include "GeoModelKernel/GeoTransform.h" +#include "GeoModelKernel/GeoShapeSubtraction.h" +#include "GeoModelKernel/GeoShapeShift.h" +#include "GeoModelKernel/GeoRectSurface.h" +#include "GeoModelKernel/Units.h" +#include "GeoModelHelpers/defineWorld.h" +using namespace GeoModelKernelUnits; + +// Class Declaration + +class SurfaceTestPlugin : public GeoVGeometryPlugin { + + public: + + // Constructor: + SurfaceTestPlugin(); + + // Destructor: + ~SurfaceTestPlugin(); + + // Creation of geometry: + virtual void create(GeoVPhysVol *world, bool publish=false); + + private: + + // Illegal operations: + const SurfaceTestPlugin & operator=(const SurfaceTestPlugin &right)=delete; + SurfaceTestPlugin(const SurfaceTestPlugin &right) = delete; + +}; + + +// Class definition: + +// Constructor +SurfaceTestPlugin::SurfaceTestPlugin() +{ +} + +// Destructor +SurfaceTestPlugin::~SurfaceTestPlugin() +{ +} + +// The create algorithm creates a tree of physical volumes rooted under the +// "world" physical volume. The optional flag publish is not used in this +// example (normally one may "publish" a list of FullPhysVol's and Alignable +// transforms, but this example has none such). +// +void SurfaceTestPlugin::create(GeoVPhysVol *world, bool /*publish*/) { + // Define elements used in this example: + GeoElement *oxygen = new GeoElement("Oxygen", "O", 19, 39*gram/mole); + GeoElement *nitrogen = new GeoElement("Nitrogen", "N", 7, 14*gram/mole); + GeoElement *argon = new GeoElement("Argon", "Ar", 18, 40*gram/mole); + GeoElement *aluminium = new GeoElement("Aluminium", "Al", 13, 26*gram/mole); + + // Define materials: + + // Define Air: + double densityOfAir = 1.2E-3*gram/cm3; // g/cm^3 + GeoMaterial *Air = new GeoMaterial("Air",densityOfAir); + Air->add(oxygen,2*0.21); // diatomic oxygen 21% by volume. + Air->add(nitrogen,2*0.78); // diatomic nitrogen 78% by volume. + Air->add(argon,0.01); // monoatomic argon 78% by volume. + Air->lock(); + + // Define Aluminium + double densityOfAluminium=2.7*gram/cm3; // g/cm^3 + GeoMaterial *Aluminium = new GeoMaterial("Aluminium", densityOfAluminium); + Aluminium->add(aluminium,1.0); + Aluminium->lock(); + + GeoBox *boxShape = new GeoBox(10,15,20); + GeoLogVol *boxLog = new GeoLogVol("BoxLog",boxShape,Air); + GeoPhysVol *boxPhys = new GeoPhysVol(boxLog); + + + GeoRectSurface *rectSurface = new GeoRectSurface(5, 7.5); + boxPhys->add(rectSurface); + + { + GeoBox *boxShape = new GeoBox(5,5,5); + GeoLogVol *boxLog = new GeoLogVol("BoxLog",boxShape,Air); + GeoPhysVol *boxPhys2 = new GeoPhysVol(boxLog); + boxPhys->add(boxPhys2); + } + + world->add(boxPhys); + + + + //--------------------------------------// +} + +// The name of this routine must correspond to the name of the class, +// and also to the name of the source code file (this file) + +extern "C" SurfaceTestPlugin *createSurfaceTestPlugin() { + return new SurfaceTestPlugin; +} + diff --git a/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp b/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp index 3cd0838f6b34bd2d0ff1d23efb98a8c2d4c7b33d..276de5430480e6bc1618cf44ae31c20ef1613f54 100644 --- a/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp +++ b/GeoModelIO/GeoModelRead/src/ReadGeoModel.cpp @@ -1029,14 +1029,19 @@ GeoVPhysVol* ReadGeoModel::buildVPhysVolInstance(const unsigned int id, // Returning: [" << getVPhysVol(id, tableId, copyN) << "] -- // logvol: " << ((GeoVPhysVol*)getVPhysVol(id, tableId, // copyN))->getLogVol()->getName() << std::endl; - std::cout + const GeoPhysVol *pv=dynamic_cast<const GeoPhysVol *> (getVPhysVol(id,tableId)); + if (pv) { + std::cout << "getting the instance volume from memory... Returning: [" << getVPhysVol(id, tableId) << "] -- logvol: " - << ((GeoVPhysVol*)getVPhysVol(id, tableId)) - ->getLogVol() - ->getName() + << pv + ->getLogVol() + ->getName() << std::endl; - muxCout.unlock(); + muxCout.unlock(); + } + else { + } } // return dynamic_cast<GeoVPhysVol*>(getVPhysVol(id, tableId, // copyN)); diff --git a/athena_ci/apply_patches.sh b/athena_ci/apply_patches.sh index 3d61a057fb0211dc22df31afe0f0a844c8b094ff..2582d3a4b71b7fde84aae77448dd7fc5ab530f44 100755 --- a/athena_ci/apply_patches.sh +++ b/athena_ci/apply_patches.sh @@ -27,9 +27,13 @@ git checkout $NIGHTLY_COMMIT for p in "$SCRIPT_DIR"/patches/*.patch; do echo "---- Applying ${p} ----" - cat "${p}" | git am -3 - git --no-pager log -1 $sha + patch -p1 < ${p} + #cat "${p}" | git am -3 + #git --no-pager log -1 $sha + fill_line "-" done -git diff HEAD ${NIGHTLY_COMMIT} \ No newline at end of file + +#git diff HEAD ${NIGHTLY_COMMIT} +git diff diff --git a/athena_ci/athena_build.sh b/athena_ci/athena_build.sh index 0411c4e6f1029e1fac5b3cd7dfddde7916274e44..220a60ad087242e45cf42260a7632789956bf359 100755 --- a/athena_ci/athena_build.sh +++ b/athena_ci/athena_build.sh @@ -47,15 +47,16 @@ fi echo "ATHENA_SOURCE: ${ATHENA_SOURCE}" source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh || true -asetup none,gcc11 || true -lsetup cmake || true +asetup none,gcc13,cmakesetup || true lsetup git || true + NINJA=/cvmfs/sft.cern.ch/lcg/releases/ninja/1.10.0-d608d/x86_64-el9-gcc13-opt/bin/ninja EXTRA_FLAGS="" if [ -t 1 ]; then EXTRA_FLAGS="-fdiagnostics-color=always" fi +EXTRA_FLAGS="${EXTRA_FLAGS}" heading "Athena setup" @@ -98,14 +99,13 @@ lsetup "views ${LCG_RELEASE} ${LCG_PLATFORM}" || true CCACHE=$(command -v ccache) $CCACHE -z -heading "Rebase the GeoModel code base w.r.t. main" - -cd ${CI_PROJECT_DIR} -git fetch origin export if [ "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" == "main" ];then + heading "Rebase the GeoModel code base w.r.t. main" + cd ${CI_PROJECT_DIR} + fill_line "Changes w.r.t to main before rebase" git fetch origin git diff HEAD origin/main @@ -155,8 +155,11 @@ popd > /dev/null echo fill_line "=" +echo "$CCACHE -z" $CCACHE -z +echo "$CCACHE -C" +$CCACHE -C export CMAKE_PREFIX_PATH="${gm_install_dir}:$CMAKE_PREFIX_PATH" @@ -166,6 +169,7 @@ full_package_filters=$SCRIPT_DIR/package_filters.txt patch_package_filters=$SCRIPT_DIR/patch_package_filters.txt package_filters=$(mktemp) +echo "package_filters=${package_filters}" echo "IS_MERGE_REQUEST = $IS_MERGE_REQUEST" @@ -187,23 +191,38 @@ fill_line "-" cat "$package_filters" fill_line "-" + +heading "Start athena build" + + mkdir athena-build + + install_dir=$PWD/athena-install pushd athena-build + +export ROOT_INCLUDE_PATH="${gm_install_dir}/include:${ROOT_INCLUDE_PATH}" + cmake "$ATHENA_SOURCE/Projects/WorkDir" \ -GNinja \ -DCMAKE_MAKE_PROGRAM="$NINJA" \ - -DCMAKE_CXX_FLAGS="$EXTRA_FLAGS" \ - -DATLAS_PACKAGE_FILTER_FILE="$package_filters" \ + -DCMAKE_CXX_FLAGS="$EXTRA_FLAGS -isystem ${gm_install_dir}/include" \ + -DATLAS_PACKAGE_FILTER_FILE="$package_filters" \ -DCMAKE_CXX_COMPILER_LAUNCHER=$CCACHE \ -DCMAKE_INSTALL_PREFIX=$install_dir + popd echo "Patching env_setup.sh to pick up correct GeoModel shared libs" echo "" >> athena-build/*/env_setup.sh echo "# GeoModel hack build injected library path:" >> athena-build/*/env_setup.sh -echo "export LD_LIBRARY_PATH=\"${gm_install_dir}/lib64:\$LD_LIBRARY_PATH\"" >> athena-build/*/env_setup.sh +echo "export LD_LIBRARY_PATH=\"${gm_install_dir}/lib64:\${LD_LIBRARY_PATH}\"" >> athena-build/*/env_setup.sh + +echo "export PATH=\"${gm_install_dir}/share:\${PATH}\"" >> athena-build/*/env_setup.sh +echo "export ROOT_INCLUDE_PATH=\"${gm_install_dir}/include:\${ROOT_INCLUDE_PATH}\"" >> athena-build/*/env_setup.sh + + heading "Build Athena" @@ -211,7 +230,7 @@ if [ -z "$CI" ]; then heading "Interactive mode, dropping into shell" bash else - cmake --build athena-build -- -j3 + VERBOSE=1 cmake --build athena-build -- -j3 $CCACHE -s cmake --install athena-build > athena_install.log fi diff --git a/athena_ci/ci.yml b/athena_ci/ci.yml index dd7dc2441b0fee315856a7e800858ceb86cd5cd6..4730fbd21e36295f4da8914cfb7e0f4948171987 100644 --- a/athena_ci/ci.yml +++ b/athena_ci/ci.yml @@ -4,7 +4,7 @@ build_geomodel_athena: stage: step-A variables: - CCACHE_KEY_SUFFIX: r1 + CCACHE_KEY_SUFFIX: r2 CCACHE_DIR: ${CI_PROJECT_DIR}/ccache_${CCACHE_KEY_SUFFIX} CCACHE_MAXSIZE: 10G diff --git a/athena_ci/package_filters.txt b/athena_ci/package_filters.txt index 85ed841bfe37ecce7938607f73e1f46d31a03890..2d1a916e48e9cdc6a364f8ae1248090225aa2192 100644 --- a/athena_ci/package_filters.txt +++ b/athena_ci/package_filters.txt @@ -8,13 +8,13 @@ + Calorimeter/CaloDetDescr + Calorimeter/CaloDetDescrUtils + Calorimeter/CaloRec -+ Database/IOVDbSvc + DetectorDescription/AGDD/AGDDControl + DetectorDescription/AGDD/AGDDHandlers + DetectorDescription/AGDD/AGDDKernel ++ DetectorDescription/AGDD/AGDD2GeoSvc ++ DetectorDescription/AGDD/AGDDModel + DetectorDescription/GeoModel/GeoModelExamples + DetectorDescription/GeoModel/GeoModelInterfaces -+ DetectorDescription/GeoModel/GeoModelStandalone/GeoExporter + DetectorDescription/GeoModel/GeoModelSvc + DetectorDescription/GeoModel/GeoModelUtilities + DetectorDescription/GeoModel/GeoSpecialShapes @@ -96,7 +96,9 @@ + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg + MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData + MuonSpectrometer/MuonDetDescr/MuonAGDD ++ MuonSpectrometer/MuonDetDescr/MuonDetDescrUtils + MuonSpectrometer/MuonDetDescr/MuonAGDDBase ++ MuonSpectrometer/MuonDetDescr/MuonAGDDDescription + MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry + MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry + MuonSpectrometer/MuonDigitization/RPC_Digitization diff --git a/athena_ci/patch_package_filters.txt b/athena_ci/patch_package_filters.txt index 64185b44eebaca3f5bc86314f9cf2ed2747c0eae..1af0733cac65957da6adfc15366c248b1a153f26 100644 --- a/athena_ci/patch_package_filters.txt +++ b/athena_ci/patch_package_filters.txt @@ -1,14 +1,3 @@ # These Athena packages need to be rebuilt # due to patches in the `patches` directory -+ InnerDetector/InDetDetDescr/InDetServMatGeoModel - -+ HighGranularityTimingDetector/HGTD_DetDescr/HGTD_GeoModelXml -+ InnerDetector/InDetDetDescr/BCMPrimeGeoModelXml -+ InnerDetector/InDetDetDescr/InDetGeoModelUtils -+ InnerDetector/InDetDetDescr/PixelGeoModelXml -+ InnerDetector/InDetDetDescr/ServiceExtensionGeoModelXml -+ InnerDetector/InDetDetDescr/StripGeoModelXml -+ InnerDetector/InDetDetDescr/PLRGeoModelXml -+ InnerDetector/InDetDetDescr/PixelGeoModel - diff --git a/athena_ci/patches/0001-Adapt-to-interface-change-using-GeoPositioning-objec.patch b/athena_ci/patches/0001-Adapt-to-interface-change-using-GeoPositioning-objec.patch new file mode 100644 index 0000000000000000000000000000000000000000..c5ee80b5cae38032cabe2c632c047d337c08014b --- /dev/null +++ b/athena_ci/patches/0001-Adapt-to-interface-change-using-GeoPositioning-objec.patch @@ -0,0 +1,80 @@ +From 2404442b4ba8f6dbc92f0b0f25e201317ec2c141 Mon Sep 17 00:00:00 2001 +From: Johannes Josef Junggeburth <johannes.josef.junggeburth@cern.ch> +Date: Tue, 30 Apr 2024 09:41:11 +0200 +Subject: [PATCH] Adapt to interface change using GeoPositioning objects + +--- + .../GeoModelUtilities/GeoAlignmentStore.h | 14 +++++++------- + .../GeoModelUtilities/src/GeoAlignmentStore.cxx | 4 ++-- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h +index 4756f948abc..da2b126bd4b 100755 +--- a/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h ++++ b/DetectorDescription/GeoModel/GeoModelUtilities/GeoModelUtilities/GeoAlignmentStore.h +@@ -49,19 +49,19 @@ public: + /// full physical volume. + /// @param fullPhysVol: Full physical volume in the GeoModel tree to which the transforms belongs to + /// @param physVolTrf: Aligned placement of the physical volume in space +- virtual void setAbsPosition(const GeoVFullPhysVol* fullPhysVol, ++ virtual void setAbsPosition(const GeoNodePositioning* fullPhysVol, + const GeoTrf::Transform3D& physVolTrf) override final; + /// @brief: Returns the aligned transform associated with the full physical volume. Returns a + /// nullptr if the physical volume has not been added before +- virtual const GeoTrf::Transform3D* getAbsPosition(const GeoVFullPhysVol* fullPhysVol) const override final; ++ virtual const GeoTrf::Transform3D* getAbsPosition(const GeoNodePositioning* fullPhysVol) const override final; + /// @brief: Caches the aboslute transform of the perfectly aligned physical volume. + /// @param fullPhysVol: Full physical volume in the GeoModel tree to which the transforms belongs to + /// @param unAlignedTrf: Nominal placement of the full physical volume. +- virtual void setDefAbsPosition(const GeoVFullPhysVol* fullPhysVol, ++ virtual void setDefAbsPosition(const GeoNodePositioning* fullPhysVol, + const GeoTrf::Transform3D& unAlignedTrf) override final; + /// @brief: Returns the nominal position of the full phyiscal volume. Returns a nullptr if the + /// nominal position of the full physical volume has not been added before to the map +- virtual const GeoTrf::Transform3D* getDefAbsPosition(const GeoVFullPhysVol* fullPhysVol) const override final; ++ virtual const GeoTrf::Transform3D* getDefAbsPosition(const GeoNodePositioning* fullPhysVol) const override final; + + /// @brief: Copies, the deltas, the absolute and the nominal positions of the other map + /// to this object. Returns false if the two maps partially overlap. +@@ -76,7 +76,7 @@ public: + using DeltaMap = TransformMap<GeoAlignableTransform, GeoTrf::Transform3D>; + using DeltaMapPtr = GeoModel::TransientConstSharedPtr<DeltaMap>; + +- using PositioningMap = TransformMap<GeoVFullPhysVol, GeoTrf::Transform3D>; ++ using PositioningMap = TransformMap<GeoNodePositioning, GeoTrf::Transform3D>; + using PositioningMapPtr = GeoModel::TransientConstSharedPtr<PositioningMap>; + private: + DeltaMapPtr m_deltas{std::make_unique<DeltaMap>()}; +@@ -92,10 +92,10 @@ public: + inline const GeoTrf::Transform3D* GeoAlignmentStore::getDelta(const GeoAlignableTransform* axf) const { + return m_deltas->getTransform(axf); + } +-inline const GeoTrf::Transform3D* GeoAlignmentStore::getAbsPosition(const GeoVFullPhysVol* fpv) const { ++inline const GeoTrf::Transform3D* GeoAlignmentStore::getAbsPosition(const GeoNodePositioning* fpv) const { + return m_absPositions->getTransform(fpv); + } +-inline const GeoTrf::Transform3D* GeoAlignmentStore::getDefAbsPosition(const GeoVFullPhysVol* fpv) const { ++inline const GeoTrf::Transform3D* GeoAlignmentStore::getDefAbsPosition(const GeoNodePositioning* fpv) const { + return m_defAbsPositions->getTransform(fpv); + } + +diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx +index f0865e42b55..b9282562062 100644 +--- a/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx ++++ b/DetectorDescription/GeoModel/GeoModelUtilities/src/GeoAlignmentStore.cxx +@@ -11,10 +11,10 @@ void GeoAlignmentStore::setDelta(const GeoAlignableTransform* axf, const GeoTrf: + void GeoAlignmentStore::setDelta(const GeoAlignableTransform* axf, std::shared_ptr<const GeoTrf::Transform3D> trans) { + m_deltas->setTransform(axf, std::move(trans)); + } +-void GeoAlignmentStore::setAbsPosition(const GeoVFullPhysVol* fpv, const GeoTrf::Transform3D& xf) { ++void GeoAlignmentStore::setAbsPosition(const GeoNodePositioning* fpv, const GeoTrf::Transform3D& xf) { + m_absPositions->setTransform(fpv, xf); + } +-void GeoAlignmentStore::setDefAbsPosition(const GeoVFullPhysVol* fpv, const GeoTrf::Transform3D& xf) { ++void GeoAlignmentStore::setDefAbsPosition(const GeoNodePositioning* fpv, const GeoTrf::Transform3D& xf) { + m_defAbsPositions->setTransform(fpv, xf); + } + void GeoAlignmentStore::lockDelta() { +-- +2.34.1 + diff --git a/athena_ci/patches/0002-Reshuffle-includes-to-have-GeoModel-first.patch b/athena_ci/patches/0002-Reshuffle-includes-to-have-GeoModel-first.patch new file mode 100644 index 0000000000000000000000000000000000000000..413a5974799763f0f994b301503a61baf704856c --- /dev/null +++ b/athena_ci/patches/0002-Reshuffle-includes-to-have-GeoModel-first.patch @@ -0,0 +1,446 @@ +From ee9db39e73abc903bae4246bbc26e2bf77e6100a Mon Sep 17 00:00:00 2001 +From: Johannes Josef Junggeburth <johannes.josef.junggeburth@cern.ch> +Date: Wed, 1 May 2024 08:01:52 +0200 +Subject: [PATCH] Reshuffle includes to have GeoModel first + +Add debug mesage +--- + .../GeoModel/GeoModelUtilities/CMakeLists.txt | 17 ++++++++--------- + .../GeoModel/GeoSpecialShapes/CMakeLists.txt | 2 +- + .../ReadoutGeometryBase/CMakeLists.txt | 10 ++++------ + .../AFP/AFP_GeoModel/CMakeLists.txt | 2 +- + .../HGTD_GeoModelXml/CMakeLists.txt | 2 +- + .../HGTD_ReadoutGeometry/CMakeLists.txt | 2 +- + .../HGTD_G4/HGTD_G4_SD/CMakeLists.txt | 3 ++- + .../BCMPrimeGeoModelXml/CMakeLists.txt | 2 +- + .../InDetGeoModelUtils/CMakeLists.txt | 2 +- + .../InDetDetDescr/PLRGeoModelXml/CMakeLists.txt | 2 +- + .../PixelGeoModelXml/CMakeLists.txt | 2 +- + .../ServiceExtensionGeoModelXml/CMakeLists.txt | 2 +- + .../StripGeoModelXml/CMakeLists.txt | 2 +- + InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt | 2 +- + InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt | 2 +- + .../LArG4/LArG4FastSimulation/CMakeLists.txt | 2 +- + .../LArGeoH6Cryostats/CMakeLists.txt | 5 ++--- + Simulation/G4Utilities/Geo2G4/CMakeLists.txt | 2 +- + .../G4Utilities/GeoMaterial2G4/CMakeLists.txt | 2 +- + .../CombinedScintillator/CMakeLists.txt | 2 +- + .../TileAncillary/DeadMaterial/CMakeLists.txt | 2 +- + .../TileAncillary/LarCrate/CMakeLists.txt | 2 +- + .../TileAncillary/MuonWall/CMakeLists.txt | 2 +- + .../PhantomCalorimeter/CMakeLists.txt | 2 +- + Tracking/Acts/ActsGeometry/CMakeLists.txt | 2 +- + graphics/GeometryJiveXML/CMakeLists.txt | 2 +- + graphics/VP1/VP1Base/CMakeLists.txt | 2 +- + 27 files changed, 39 insertions(+), 42 deletions(-) + +diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt +index c0207a69420..0eeeb55dcb5 100644 +--- a/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt ++++ b/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt +@@ -4,7 +4,6 @@ + atlas_subdir( GeoModelUtilities ) + + # External dependencies. +-find_package( Eigen ) # Needed by GeoModelKernel + find_package( GeoModel COMPONENTS GeoGenericFunctions GeoModelKernel GeoModelHelpers ) + find_package( ROOT COMPONENTS Core ) + # The list of sources, and list of linked libraries depends on what project is +@@ -26,23 +25,23 @@ endif() + atlas_add_library( GeoModelUtilities + GeoModelUtilities/*.h ${sources} + PUBLIC_HEADERS GeoModelUtilities +- INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} +- LINK_LIBRARIES GeoPrimitives ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} ${libraries} ) ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ++ LINK_LIBRARIES ${GEOMODEL_LIBRARIES} ${libraries} GeoPrimitives ) + + atlas_add_test( GeoGetIds_test + SOURCES test/GeoGetIds_test.cxx +- INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} +- LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} GeoModelUtilities ) ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ++ LINK_LIBRARIES ${GEOMODEL_LIBRARIES} GeoModelUtilities ) + + atlas_add_test( GeoVisitVolumes_test + SOURCES test/GeoVisitVolumes_test.cxx +- INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} +- LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} GeoModelUtilities ) ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ++ LINK_LIBRARIES ${GEOMODEL_LIBRARIES} GeoModelUtilities ) + + atlas_add_test( GeoAlignStore_test + SOURCES test/testAlignStore.cxx +- INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} +- LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} ${ROOT_LIBRARIES} GeoModelUtilities ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ++ LINK_LIBRARIES ${GEOMODEL_LIBRARIES} ${ROOT_LIBRARIES} GeoModelUtilities + PROPERTIES TIMEOUT 600 + POST_EXEC_SCRIPT nopost.sh) + # Code in this file makes heavy use of eigen and runs orders of magnitude +diff --git a/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt b/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt +index 91d77688c3a..26487c7e6ac 100644 +--- a/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt ++++ b/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt +@@ -21,7 +21,7 @@ endif() + atlas_add_library( GeoSpecialShapes + GeoSpecialShapes/*.h src/*.cxx src/LArWheelCalculator_Impl/*.cxx + PUBLIC_HEADERS GeoSpecialShapes +- INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} + DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} ${extra_public_libs} +diff --git a/DetectorDescription/ReadoutGeometryBase/CMakeLists.txt b/DetectorDescription/ReadoutGeometryBase/CMakeLists.txt +index 3cf36a780ef..f5859272d71 100644 +--- a/DetectorDescription/ReadoutGeometryBase/CMakeLists.txt ++++ b/DetectorDescription/ReadoutGeometryBase/CMakeLists.txt +@@ -5,18 +5,16 @@ atlas_subdir( ReadoutGeometryBase ) + + # External dependencies: + find_package( CLHEP ) +-find_package( Eigen ) # Needed by GeoModelKernel + find_package( GeoModel COMPONENTS GeoModelKernel ) + + # Component(s) in the package: + atlas_add_library( ReadoutGeometryBase + ReadoutGeometryBase/*.h ReadoutGeometryBase/*.icc src/*.cxx + PUBLIC_HEADERS ReadoutGeometryBase +- INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} +- ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ++ + DEFINITIONS ${CLHEP_DEFINITIONS} +- LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} ++ LINK_LIBRARIES ${GEOMODEL_LIBRARIES} ${CLHEP_LIBRARIES} + CxxUtils AthenaKernel AtlasDetDescr GeoPrimitives Identifier +- GaudiKernel InDetCondTools TrkDetElementBase +- TrkEventPrimitives AthenaBaseComps ++ GaudiKernel InDetCondTools TrkDetElementBase AthenaBaseComps + PRIVATE_LINK_LIBRARIES GeoModelUtilities TrkSurfaces ) +diff --git a/ForwardDetectors/AFP/AFP_GeoModel/CMakeLists.txt b/ForwardDetectors/AFP/AFP_GeoModel/CMakeLists.txt +index d69c92a3e11..a4660c7abe6 100644 +--- a/ForwardDetectors/AFP/AFP_GeoModel/CMakeLists.txt ++++ b/ForwardDetectors/AFP/AFP_GeoModel/CMakeLists.txt +@@ -11,6 +11,6 @@ find_package( GeoModel COMPONENTS GeoModelKernel ) + atlas_add_component( AFP_GeoModel + src/*.cxx + src/components/*.cxx +- INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} AFP_Geometry AthenaKernel GeoModelUtilities AthenaPoolUtilities GaudiKernel GeoModelInterfaces GeoPrimitives StoreGateLib ) + +diff --git a/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_GeoModelXml/CMakeLists.txt b/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_GeoModelXml/CMakeLists.txt +index de95fea19f2..25eccf0043f 100644 +--- a/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_GeoModelXml/CMakeLists.txt ++++ b/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_GeoModelXml/CMakeLists.txt +@@ -11,7 +11,7 @@ find_package( GeoModel COMPONENTS GeoModelKernel GeoModelXml ExpressionEvaluator + atlas_add_component( HGTD_GeoModelXml + src/*.cxx + src/components/*.cxx +- PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} + GaudiKernel DetDescrConditions HGTD_ReadoutGeometry InDetGeoModelUtils InDetSimEvent ) + +diff --git a/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_ReadoutGeometry/CMakeLists.txt b/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_ReadoutGeometry/CMakeLists.txt +index a41dad238f1..80bf8b685a6 100644 +--- a/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_ReadoutGeometry/CMakeLists.txt ++++ b/HighGranularityTimingDetector/HGTD_DetDescr/HGTD_ReadoutGeometry/CMakeLists.txt +@@ -11,7 +11,7 @@ find_package( GeoModel COMPONENTS GeoPrimitives GeoModelKernel ) + atlas_add_library( HGTD_ReadoutGeometry + HGTD_ReadoutGeometry/*.h src/*.cxx + PUBLIC_HEADERS HGTD_ReadoutGeometry +- INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} Identifier + ReadoutGeometryBase TrkEventPrimitives HGTD_Identifier AthenaBaseComps +diff --git a/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt b/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt +index 75c3426473f..e4e434fa019 100644 +--- a/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt ++++ b/HighGranularityTimingDetector/HGTD_G4/HGTD_G4_SD/CMakeLists.txt +@@ -8,12 +8,13 @@ find_package( CLHEP ) + find_package( Geant4 ) + find_package( GeoModel COMPONENTS GeoModelKernel GeoModelRead GeoModelDBManager ) + ++message (INFO "Include dirs are ${GEOMODEL_INCLUDE_DIRS} ${GEOMODEL_LIBRARIES}") + # Component(s) in the package: + atlas_add_library( HGTD_G4_SD + src/*.h src/*.cxx src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GEOMODEL_LIBRARIES} StoreGateLib + HGTD_Identifier InDetSimEvent G4AtlasToolsLib MCTruth GeoModelInterfaces GeoPrimitives ) + set_target_properties( HGTD_G4_SD PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) +diff --git a/InnerDetector/InDetDetDescr/BCMPrimeGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/BCMPrimeGeoModelXml/CMakeLists.txt +index 41804d56745..badee4918f4 100644 +--- a/InnerDetector/InDetDetDescr/BCMPrimeGeoModelXml/CMakeLists.txt ++++ b/InnerDetector/InDetDetDescr/BCMPrimeGeoModelXml/CMakeLists.txt +@@ -11,7 +11,7 @@ find_package( GeoModel COMPONENTS GeoModelKernel GeoModelXml ExpressionEvaluator + atlas_add_component( BCMPrimeGeoModelXml + src/*.cxx + src/components/*.cxx +- PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} CxxUtils + GaudiKernel DetDescrConditions InDetGeoModelUtils InDetSimEvent BCMPrimeReadoutGeometry ) + +diff --git a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/CMakeLists.txt b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/CMakeLists.txt +index 6baf3845eea..ab60dc23a2d 100644 +--- a/InnerDetector/InDetDetDescr/InDetGeoModelUtils/CMakeLists.txt ++++ b/InnerDetector/InDetDetDescr/InDetGeoModelUtils/CMakeLists.txt +@@ -11,7 +11,7 @@ find_package( XercesC ) + atlas_add_library( InDetGeoModelUtils + src/*.cxx + PUBLIC_HEADERS InDetGeoModelUtils +- INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + LINK_LIBRARIES ${GEOMODEL_LIBRARIES} ${XERCESC_LIBRARIES} + AthenaKernel AthenaBaseComps CxxUtils GaudiKernel + GeoModelInterfaces GeoModelUtilities GeoPrimitives RDBAccessSvcLib +diff --git a/InnerDetector/InDetDetDescr/PLRGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/PLRGeoModelXml/CMakeLists.txt +index cbaf2526464..d432b3f1c55 100644 +--- a/InnerDetector/InDetDetDescr/PLRGeoModelXml/CMakeLists.txt ++++ b/InnerDetector/InDetDetDescr/PLRGeoModelXml/CMakeLists.txt +@@ -11,7 +11,7 @@ find_package( GeoModel COMPONENTS GeoModelKernel GeoModelXml ExpressionEvaluator + atlas_add_component( PLRGeoModelXml + src/*.cxx + src/components/*.cxx +- PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} + GaudiKernel DetDescrConditions InDetGeoModelUtils InDetSimEvent PixelGeoModelXmlLib PixelReadoutGeometryLib ) + +diff --git a/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt +index 6d46ceea828..c0a17e98543 100644 +--- a/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt ++++ b/InnerDetector/InDetDetDescr/PixelGeoModelXml/CMakeLists.txt +@@ -11,7 +11,7 @@ find_package( GeoModel COMPONENTS GeoModelKernel GeoModelXml ExpressionEvaluator + atlas_add_library( PixelGeoModelXmlLib + src/*.cxx + PUBLIC_HEADERS PixelGeoModelXml +- PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + LINK_LIBRARIES InDetGeoModelUtils PixelReadoutGeometryLib GeometryDBSvcLib + PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} + GaudiKernel DetDescrConditions InDetSimEvent ) +diff --git a/InnerDetector/InDetDetDescr/ServiceExtensionGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/ServiceExtensionGeoModelXml/CMakeLists.txt +index 4afc7c816fc..2cc077f882f 100644 +--- a/InnerDetector/InDetDetDescr/ServiceExtensionGeoModelXml/CMakeLists.txt ++++ b/InnerDetector/InDetDetDescr/ServiceExtensionGeoModelXml/CMakeLists.txt +@@ -10,7 +10,7 @@ find_package( GeoModel COMPONENTS GeoModelKernel GeoModelXml ExpressionEvaluator + atlas_add_component( ServiceExtensionGeoModelXml + src/*.cxx + src/components/*.cxx +- PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} + GaudiKernel InDetGeoModelUtils ) + +diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt +index 4f3dcab75a2..d96e9ef0c4b 100644 +--- a/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt ++++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt +@@ -10,7 +10,7 @@ find_package( GeoModel COMPONENTS GeoModelKernel GeoModelXml ExpressionEvaluator + atlas_add_component( StripGeoModelXml + src/*.cxx + src/components/*.cxx +- PRIVATE_INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEOMODEL_LIBRARIES} CxxUtils + GaudiKernel DetDescrConditions InDetGeoModelUtils InDetSimEvent SCT_ReadoutGeometry GeometryDBSvcLib ) + +diff --git a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt +index af77794fdab..e887345439e 100644 +--- a/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt ++++ b/InnerDetector/InDetG4/PixelG4_SD/CMakeLists.txt +@@ -14,7 +14,7 @@ atlas_add_library( PixelG4_SDLib + src/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} ${GEOMODEL_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib GeoModelInterfaces GeoPrimitives) + set_target_properties( PixelG4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt +index e3834fd4d81..2eac87ad8d7 100644 +--- a/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt ++++ b/InnerDetector/InDetG4/SCT_G4_SD/CMakeLists.txt +@@ -14,7 +14,7 @@ atlas_add_library( SCT_G4_SDLib + src/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEANT4_LIBRARIES} ${GTEST_LIBRARIES} ${GEOMODEL_LIBRARIES} G4AtlasToolsLib InDetSimEvent MCTruth StoreGateLib GeoModelInterfaces GeoPrimitives ) + set_target_properties( SCT_G4_SDLib PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt +index 11056af7c88..0b6e52e3ddd 100644 +--- a/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt ++++ b/LArCalorimeter/LArG4/LArG4FastSimulation/CMakeLists.txt +@@ -14,7 +14,7 @@ atlas_add_library( LArG4FastSimulation + src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEOMODEL_LIBRARIES} GaudiKernel StoreGateLib GeoSpecialShapes LArG4Code LArReadoutGeometry LArSimEvent G4AtlasToolsLib GeoPrimitives LArG4ShowerLibSvcLib RDBAccessSvcLib GeoModelInterfaces GeoModelUtilities) + set_target_properties( LArG4FastSimulation PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/LArCalorimeter/LArGeoModel/LArGeoH6Cryostats/CMakeLists.txt b/LArCalorimeter/LArGeoModel/LArGeoH6Cryostats/CMakeLists.txt +index db16b4839cc..415f9c53238 100644 +--- a/LArCalorimeter/LArGeoModel/LArGeoH6Cryostats/CMakeLists.txt ++++ b/LArCalorimeter/LArGeoModel/LArGeoH6Cryostats/CMakeLists.txt +@@ -4,14 +4,13 @@ + atlas_subdir( LArGeoH6Cryostats ) + + # External dependencies: +-find_package( Eigen ) + find_package( GeoModel COMPONENTS GeoModelKernel GeoGenericFunctions ) + + # Component(s) in the package: + atlas_add_library( LArGeoH6Cryostats + src/*.cxx + PUBLIC_HEADERS LArGeoH6Cryostats +- PRIVATE_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} +- LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODEL_LIBRARIES} StoreGateLib ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ++ LINK_LIBRARIES ${GEOMODEL_LIBRARIES} StoreGateLib GeoPrimitives + PRIVATE_LINK_LIBRARIES GaudiKernel GeoModelInterfaces RDBAccessSvcLib ) + +diff --git a/Simulation/G4Utilities/Geo2G4/CMakeLists.txt b/Simulation/G4Utilities/Geo2G4/CMakeLists.txt +index b3b21d94e97..1d778261270 100644 +--- a/Simulation/G4Utilities/Geo2G4/CMakeLists.txt ++++ b/Simulation/G4Utilities/Geo2G4/CMakeLists.txt +@@ -15,7 +15,7 @@ atlas_add_library( Geo2G4Lib + src/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GEOMODEL_LIBRARIES} ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel G4AtlasInterfaces G4AtlasToolsLib GeoModelUtilities GeoPrimitives +diff --git a/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt b/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt +index 7ca779f2507..ed156a98236 100644 +--- a/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt ++++ b/Simulation/G4Utilities/GeoMaterial2G4/CMakeLists.txt +@@ -12,7 +12,7 @@ atlas_add_library( GeoMaterial2G4 + src/*.cxx + OBJECT + PUBLIC_HEADERS GeoMaterial2G4 +- INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaBaseComps + PRIVATE_LINK_LIBRARIES CxxUtils GeoModelUtilities ) + set_target_properties( GeoMaterial2G4 PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) +diff --git a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt +index 35200501be8..2b29e3fb3a2 100644 +--- a/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt ++++ b/TileCalorimeter/TileG4/TileAncillary/CombinedScintillator/CMakeLists.txt +@@ -19,7 +19,7 @@ atlas_add_library( CombinedScintillator + src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} CaloIdentifier StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces TileSimEvent ) + set_target_properties( CombinedScintillator PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt +index 8c0a71b66eb..d7532619444 100644 +--- a/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt ++++ b/TileCalorimeter/TileG4/TileAncillary/DeadMaterial/CMakeLists.txt +@@ -19,7 +19,7 @@ atlas_add_library( DeadMaterial + src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces ) + set_target_properties( DeadMaterial PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt +index e670527a2d5..80449318f5b 100644 +--- a/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt ++++ b/TileCalorimeter/TileG4/TileAncillary/LarCrate/CMakeLists.txt +@@ -19,7 +19,7 @@ atlas_add_library( LarCrate + src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces ) + set_target_properties( LarCrate PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt +index aa54c9bb927..195db78b95e 100644 +--- a/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt ++++ b/TileCalorimeter/TileG4/TileAncillary/MuonWall/CMakeLists.txt +@@ -19,7 +19,7 @@ atlas_add_library( MuonWall + src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} CaloIdentifier StoreGateLib GaudiKernel G4AtlasToolsLib GeoModelInterfaces GeoMaterial2G4 TileSimEvent ) + set_target_properties( MuonWall PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt +index 4c6a4dbf265..8d52fe491b9 100644 +--- a/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt ++++ b/TileCalorimeter/TileG4/TileAncillary/PhantomCalorimeter/CMakeLists.txt +@@ -19,7 +19,7 @@ atlas_add_library( PhantomCalorimeter + src/components/*.cxx + OBJECT + NO_PUBLIC_HEADERS +- PRIVATE_INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} + PRIVATE_LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} CaloIdentifier StoreGateLib GaudiKernel G4AtlasToolsLib GeoMaterial2G4 GeoModelInterfaces TileSimEvent ) + set_target_properties( PhantomCalorimeter PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ATLAS_GEANT4_USE_LTO} ) + +diff --git a/Tracking/Acts/ActsGeometry/CMakeLists.txt b/Tracking/Acts/ActsGeometry/CMakeLists.txt +index 0b8b3661e18..fd1f4f9eb5a 100644 +--- a/Tracking/Acts/ActsGeometry/CMakeLists.txt ++++ b/Tracking/Acts/ActsGeometry/CMakeLists.txt +@@ -68,7 +68,7 @@ atlas_add_component( ActsGeometry + src/ActsPropStepRootWriterSvc.cxx + src/ActsCaloTrackingVolumeBuilder.cxx + src/components/*.cxx +- INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} ${ROOT_LIBRARIES} + ActsGeometryInterfacesLib + ActsGeometryLib +diff --git a/graphics/GeometryJiveXML/CMakeLists.txt b/graphics/GeometryJiveXML/CMakeLists.txt +index 95d7e159bcc..48410c04df8 100644 +--- a/graphics/GeometryJiveXML/CMakeLists.txt ++++ b/graphics/GeometryJiveXML/CMakeLists.txt +@@ -11,5 +11,5 @@ find_package( CLHEP ) + atlas_add_component( GeometryJiveXML + src/*.cxx + src/components/*.cxx +- INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaBaseComps CaloDetDescrLib CaloDetDescrUtils GaudiKernel InDetIdentifier InDetReadoutGeometry JiveXMLLib LArReadoutGeometry MuonIdHelpersLib MuonReadoutGeometry PixelReadoutGeometryLib SCT_ReadoutGeometry StoreGateLib TRT_ReadoutGeometry TileDetDescr ) +diff --git a/graphics/VP1/VP1Base/CMakeLists.txt b/graphics/VP1/VP1Base/CMakeLists.txt +index 0bda34efb86..987c26dca95 100644 +--- a/graphics/VP1/VP1Base/CMakeLists.txt ++++ b/graphics/VP1/VP1Base/CMakeLists.txt +@@ -33,7 +33,7 @@ set( CMAKE_AUTORCC TRUE ) + # declaration of PRIVATE_INCLUDE_DIRS. + atlas_add_library( VP1Base VP1Base/*.h src/*.cxx src/*.qrc + PUBLIC_HEADERS VP1Base +- INCLUDE_DIRS ${QT5_INCLUDE_DIRS} ${SOQT_INCLUDE_DIRS} ${COIN3D_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ++ INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS} ${QT5_INCLUDE_DIRS} ${SOQT_INCLUDE_DIRS} ${COIN3D_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} + LINK_LIBRARIES ${QT5_LIBRARIES} ${SOQT_LIBRARIES} ${COIN3D_LIBRARIES} ${GEOMODEL_LIBRARIES} GeoPrimitives xAODBase + PRIVATE_LINK_LIBRARIES VP1HEPVis ) +-- +2.34.1 +