File indexing completed on 2025-01-18 10:13:56
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #ifndef VGDMLMiddleware_h
0010 #define VGDMLMiddleware_h
0011
0012 #include <string>
0013 #include <vector>
0014 #include <map>
0015
0016 #include "xercesc/util/XercesDefs.hpp"
0017
0018 #include "VecGeom/volumes/UnplacedVolume.h"
0019 #include "VecGeom/volumes/BooleanStruct.h"
0020
0021 #include "Auxiliary.h"
0022 #include "MaterialInfo.h"
0023 #include "RegionInfo.h"
0024
0025 XERCES_CPP_NAMESPACE_BEGIN
0026 class DOMDocument;
0027 class DOMLSParser;
0028 class DOMNode;
0029 class DOMNamedNodeMap;
0030 XERCES_CPP_NAMESPACE_END
0031
0032 namespace vecgeom {
0033 inline namespace VECGEOM_IMPL_NAMESPACE {
0034 class VUnplacedVolume;
0035 class UnplacedTessellated;
0036
0037
0038 }
0039 }
0040
0041 namespace vgdml {
0042 class Middleware {
0043 public:
0044 using MaterialMap_t = std::map<std::string, vgdml::Material>;
0045 using VolumeMatMap_t = std::map<int, vgdml::Material>;
0046 using VolumeAuxiliaryInfo_t = std::map<int, std::vector<Auxiliary>>;
0047 using UserInfo_t = std::vector<Auxiliary>;
0048
0049 bool Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument const *aDOMDocument);
0050 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *Save(void const *);
0051
0052
0053 MaterialMap_t const &GetMaterialMap() const { return materialMap; }
0054
0055
0056 VolumeMatMap_t const &GetVolumeMatMap() const { return volumeMaterialMap; }
0057
0058
0059 VolumeAuxiliaryInfo_t const &GetVolumeAuxiliaryInfo() const { return volumeAuxiliaryInfo; }
0060
0061
0062 UserInfo_t const &GetUserInfo() const { return userInfo; }
0063
0064 private:
0065 bool processNode(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0066 bool processSolid(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0067 bool processLogicVolume(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0068 bool processPhysicalVolume(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode, vecgeom::LogicalVolume *motherLogical);
0069 bool processWorld(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0070 bool processConstant(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0071 bool processPosition(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0072 bool processScale(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0073 bool processRotation(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0074
0075 bool processIsotope(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0076 bool processElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0077 bool processMaterial(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0078 bool processAuxiliary(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode, Auxiliary &aux);
0079 bool processUserInfo(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0080
0081 bool processFacet(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode,
0082 vecgeom::VECGEOM_IMPL_NAMESPACE::UnplacedTessellated &storage);
0083 template <vecgeom::BooleanOperation Op>
0084 vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume const *processBoolean(
0085 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0086 vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume const *processMultiUnion(
0087 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0088 vecgeom::VECGEOM_IMPL_NAMESPACE::VPlacedVolume const *processMultiUnionNode(
0089 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0090
0091 vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume const *processOrb(
0092 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0093 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processBox(
0094 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0095 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processTube(
0096 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0097 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processElTube(
0098 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0099 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processCutTube(
0100 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0101 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processCone(
0102 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0103 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processElCone(
0104 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0105 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processPolycone(
0106 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0107 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processGenPolycone(
0108 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0109 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processPolyhedron(
0110 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0111 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processTorus(
0112 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0113 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processSphere(
0114 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0115 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processEllipsoid(
0116 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0117 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processParallelepiped(
0118 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0119 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processTrd(
0120 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0121 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processTrapezoid(
0122 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0123 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processGenTrap(
0124 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0125 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processParaboloid(
0126 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0127 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processHype(
0128 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0129 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processTesselated(
0130 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0131 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processExtruded(
0132 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0133 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processTet(
0134 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0135 const vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume *processScaledShape(
0136 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0137
0138 double GetLengthMultiplier(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0139 double GetAngleMultiplier(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode const *aDOMNode);
0140
0141 private:
0142 std::map<std::string, vecgeom::VECGEOM_IMPL_NAMESPACE::VUnplacedVolume const *> unplacedVolumeMap;
0143 std::map<std::string, double> constantMap;
0144 std::map<std::string, vecgeom::VECGEOM_IMPL_NAMESPACE::Vector3D<double>> positionMap;
0145 std::map<std::string, vecgeom::VECGEOM_IMPL_NAMESPACE::Vector3D<double>> scaleMap;
0146 std::map<std::string, vecgeom::VECGEOM_IMPL_NAMESPACE::Vector3D<double>> rotationMap;
0147 std::map<std::string, vgdml::Isotope> isotopeMap;
0148 std::map<std::string, vgdml::Element> elementMap;
0149
0150 MaterialMap_t materialMap;
0151 VolumeMatMap_t volumeMaterialMap;
0152 VolumeAuxiliaryInfo_t volumeAuxiliaryInfo;
0153 UserInfo_t userInfo;
0154
0155 double GetDoubleAttribute(std::string const &attrName,
0156 XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap const *theAttributes);
0157 };
0158 }
0159 #endif