![]() |
SHiP Geometry
SHiP experiment geometry implementation using GeoModel.
|
#include "SHiP/geometry/SubsystemDescriptor.h"#include <GeoModelKernel/GeoPhysVol.h>#include <cstdio>#include <cstdlib>#include <functional>#include <map>#include <stdexcept>#include <string>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | SHiP::geometry::SubsystemInfo |
| A registered subsystem: its descriptor plus how to build it. More... | |
| class | SHiP::geometry::UnknownSubsystem |
| Thrown when a subsystem name is not in the registry. More... | |
Namespaces | |
| namespace | SHiP |
| namespace | SHiP::geometry |
Macros | |
| #define | REGISTER_SUBSYSTEM(FACTORY) |
| Register a subsystem factory with the global registry. | |
Functions | |
| std::map< std::string, SubsystemInfo > & | SHiP::geometry::registry () |
| The global subsystem registry. | |
| bool | SHiP::geometry::registerSubsystem (const SubsystemDescriptor &desc, std::function< GeoVPhysVol *(Materials &)> build) |
| Add a subsystem to the registry. | |
| GeoPhysVol * | SHiP::geometry::assembleGeometry (const std::vector< std::string > &only={}) |
| Assemble the world plus a selection of registered subsystems. | |
| GeoVPhysVol * | SHiP::geometry::buildSubsystem (const std::string &name) |
| Build a single subsystem on its own, in its local frame. | |
| std::vector< std::string > | SHiP::geometry::subsystemNames () |
| The names of every registered subsystem, sorted. | |
| #define REGISTER_SUBSYSTEM | ( | FACTORY | ) |
Register a subsystem factory with the global registry.
Placed once in each subsystem's own .cpp (inside namespace SHiP::geometry). The factory must expose static SubsystemDescriptor descriptor() and be constructible from Materials& with a build() returning a volume.
It also defines FACTORY_linkAnchor(), an empty function. Nothing else references the registration, so without it the linker would drop the subsystem library (under –as-needed, or from a static archive) and the initialiser would never run. src/CMakeLists.txt generates a call to the anchor of every subsystem in SHIP_SUBSYSTEMS, assuming the factory of subsystem <Name> is called <Name>Factory.