CMS 3D CMS Logo

DDParsingContext.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_DD_PARSING_CONTEXT_H
2 #define DETECTOR_DESCRIPTION_DD_PARSING_CONTEXT_H
3 
4 #include "DD4hep/Detector.h"
5 
6 #include <string>
7 #include <variant>
8 #include <unordered_map>
9 #include <vector>
10 
11 namespace cms {
12 
14  public:
16  assemblies.reserve(100);
17  rotations.reserve(3000);
18  shapes.reserve(4000);
19  volumes.reserve(3000);
20  unresolvedMaterials.reserve(300);
21  unresolvedVectors.reserve(300);
22  unresolvedShapes.reserve(1000);
23 
24  namespaces.emplace_back("");
25  }
26 
27  DDParsingContext() = delete;
28  DDParsingContext(const DDParsingContext&) = delete;
30 
31  ~DDParsingContext() = default;
32 
33  const std::string& ns() const { return namespaces.back(); }
34 
35  template <class TYPE>
36  struct BooleanShape {
37  BooleanShape(const std::string& aName, const std::string& bName, dd4hep::Transform3D t)
38  : firstSolidName(aName), secondSolidName(bName), transform(t) {}
39 
42  dd4hep::Transform3D transform;
43 
44  dd4hep::Solid make(dd4hep::Solid firstSolid, dd4hep::Solid secondSolid) {
45  return TYPE(firstSolid, secondSolid, transform);
46  }
47  };
48 
50  CompositeMaterial(const std::string& n, double f) : name(n), fraction(f) {}
51 
53  double fraction;
54  };
55 
56  // Debug flags
57  bool debug_includes = false;
58  bool debug_constants = false;
59  bool debug_materials = false;
60  bool debug_rotations = false;
61  bool debug_shapes = false;
62  bool debug_volumes = false;
63  bool debug_placements = false;
64  bool debug_namespaces = false;
65  bool debug_algorithms = false;
66  bool debug_specpars = false;
67 
69 
70  std::unordered_map<std::string, dd4hep::Assembly> assemblies;
71  std::unordered_map<std::string, dd4hep::Rotation3D> rotations;
72  std::unordered_map<std::string, dd4hep::Solid> shapes;
73  std::unordered_map<std::string, dd4hep::Volume> volumes;
74  std::vector<std::string> namespaces;
75 
76  std::unordered_map<std::string, std::vector<CompositeMaterial>> unresolvedMaterials;
77  std::unordered_map<std::string, std::vector<std::string>> unresolvedVectors;
78  std::unordered_map<std::string,
79  std::variant<BooleanShape<dd4hep::UnionSolid>,
83  };
84 } // namespace cms
85 
86 #endif
cms::DDParsingContext::debug_namespaces
bool debug_namespaces
Definition: DDParsingContext.h:64
cms::DDParsingContext::DDParsingContext
DDParsingContext()=delete
cms::DDParsingContext::unresolvedMaterials
std::unordered_map< std::string, std::vector< CompositeMaterial > > unresolvedMaterials
Definition: DDParsingContext.h:76
cms::DDParsingContext::unresolvedVectors
std::unordered_map< std::string, std::vector< std::string > > unresolvedVectors
Definition: DDParsingContext.h:77
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
cms::DDParsingContext
Definition: DDParsingContext.h:13
cms::DDParsingContext::debug_placements
bool debug_placements
Definition: DDParsingContext.h:63
cms::DDParsingContext::BooleanShape::transform
dd4hep::Transform3D transform
Definition: DDParsingContext.h:42
cms::DDParsingContext::ns
const std::string & ns() const
Definition: DDParsingContext.h:33
cms::DDParsingContext::CompositeMaterial
Definition: DDParsingContext.h:49
cms::DDParsingContext::rotations
std::unordered_map< std::string, dd4hep::Rotation3D > rotations
Definition: DDParsingContext.h:71
cms::DDParsingContext::~DDParsingContext
~DDParsingContext()=default
cms::DDParsingContext::debug_materials
bool debug_materials
Definition: DDParsingContext.h:59
cms::DDParsingContext::CompositeMaterial::CompositeMaterial
CompositeMaterial(const std::string &n, double f)
Definition: DDParsingContext.h:50
cms::DDParsingContext::CompositeMaterial::name
const std::string name
Definition: DDParsingContext.h:52
cms::DDParsingContext::debug_algorithms
bool debug_algorithms
Definition: DDParsingContext.h:65
cms::DDParsingContext::BooleanShape::secondSolidName
const std::string secondSolidName
Definition: DDParsingContext.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::DDParsingContext::BooleanShape::make
dd4hep::Solid make(dd4hep::Solid firstSolid, dd4hep::Solid secondSolid)
Definition: DDParsingContext.h:44
cms::DDParsingContext::shapes
std::unordered_map< std::string, dd4hep::Solid > shapes
Definition: DDParsingContext.h:72
cms::DDParsingContext::BooleanShape
Definition: DDParsingContext.h:36
cms::DDParsingContext::assemblies
std::unordered_map< std::string, dd4hep::Assembly > assemblies
Definition: DDParsingContext.h:70
cms::DDParsingContext::BooleanShape::BooleanShape
BooleanShape(const std::string &aName, const std::string &bName, dd4hep::Transform3D t)
Definition: DDParsingContext.h:37
cms::DDParsingContext::namespaces
std::vector< std::string > namespaces
Definition: DDParsingContext.h:74
align::Detector
Definition: StructureType.h:92
cms::DDParsingContext::CompositeMaterial::fraction
double fraction
Definition: DDParsingContext.h:53
cms::DDParsingContext::debug_constants
bool debug_constants
Definition: DDParsingContext.h:58
cms::DDParsingContext::operator=
DDParsingContext & operator=(const DDParsingContext &)=delete
cms::DDParsingContext::debug_rotations
bool debug_rotations
Definition: DDParsingContext.h:60
runonSM.TYPE
TYPE
Definition: runonSM.py:21
cms::DDParsingContext::debug_specpars
bool debug_specpars
Definition: DDParsingContext.h:66
cms::DDParsingContext::DDParsingContext
DDParsingContext(dd4hep::Detector &det)
Definition: DDParsingContext.h:15
cms::DDParsingContext::volumes
std::unordered_map< std::string, dd4hep::Volume > volumes
Definition: DDParsingContext.h:73
cms::DDParsingContext::debug_includes
bool debug_includes
Definition: DDParsingContext.h:57
cms::DDParsingContext::BooleanShape::firstSolidName
const std::string firstSolidName
Definition: DDParsingContext.h:40
cms::DDParsingContext::debug_volumes
bool debug_volumes
Definition: DDParsingContext.h:62
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
cms::DDParsingContext::unresolvedShapes
std::unordered_map< std::string, std::variant< BooleanShape< dd4hep::UnionSolid >, BooleanShape< dd4hep::SubtractionSolid >, BooleanShape< dd4hep::IntersectionSolid > > > unresolvedShapes
Definition: DDParsingContext.h:82
cms::DDParsingContext::debug_shapes
bool debug_shapes
Definition: DDParsingContext.h:61
cms::DDParsingContext::description
dd4hep::Detector & description
Definition: DDParsingContext.h:68
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21