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 "tbb/concurrent_unordered_map.h"
9 #include "tbb/concurrent_vector.h"
10 #include "tbb/concurrent_queue.h"
11 
12 namespace cms {
13 
15  public:
17 
19  rotations.clear();
20  shapes.clear();
21  volumes.clear();
22  disabledAlgs.clear();
23  namespaces.clear();
24  };
25 
26  bool const ns(std::string& result) {
28  if (namespaces.try_pop(res)) {
29  result = res;
30  namespaces.emplace(res);
31  return true;
32  }
33  return false;
34  }
35 
36  std::atomic<dd4hep::Detector*> description;
37  tbb::concurrent_unordered_map<std::string, dd4hep::Rotation3D> rotations;
38  tbb::concurrent_unordered_map<std::string, dd4hep::Solid> shapes;
39  tbb::concurrent_unordered_map<std::string, dd4hep::Volume> volumes;
40  tbb::concurrent_vector<std::string> disabledAlgs;
41  tbb::concurrent_queue<std::string> namespaces;
42 
43  template <class TYPE>
44  struct BooleanShape {
45  BooleanShape(const std::string& aName, const std::string& bName, dd4hep::Transform3D t)
46  : firstSolidName(aName), secondSolidName(bName), transform(t) {}
47 
50  dd4hep::Transform3D transform;
51 
52  dd4hep::Solid make(dd4hep::Solid firstSolid, dd4hep::Solid secondSolid) {
53  return TYPE(firstSolid, secondSolid, transform);
54  }
55  };
56 
58  std::variant<BooleanShape<dd4hep::UnionSolid>,
62 
64  CompositeMaterial(const std::string& n, double f) : name(n), fraction(f) {}
65 
66  const std::string name;
67  double fraction;
68  };
69 
70  std::map<std::string, std::vector<CompositeMaterial>> unresolvedMaterials;
71 
72  bool geo_inited = false;
73 
74  // Debug flags
75  bool debug_includes = false;
76  bool debug_constants = false;
77  bool debug_materials = false;
78  bool debug_rotations = false;
79  bool debug_shapes = false;
80  bool debug_volumes = false;
81  bool debug_placements = false;
82  bool debug_namespaces = false;
83  bool debug_visattr = false;
84  bool debug_algorithms = false;
85  bool debug_specpars = false;
86  };
87 } // namespace cms
88 
89 #endif
dd4hep::Solid make(dd4hep::Solid firstSolid, dd4hep::Solid secondSolid)
BooleanShape(const std::string &aName, const std::string &bName, dd4hep::Transform3D t)
tbb::concurrent_vector< std::string > disabledAlgs
bool const ns(std::string &result)
std::map< std::string, std::vector< CompositeMaterial > > unresolvedMaterials
std::atomic< dd4hep::Detector * > description
Definition: Electron.h:6
tbb::concurrent_unordered_map< std::string, dd4hep::Rotation3D > rotations
double f[11][100]
tbb::concurrent_unordered_map< std::string, dd4hep::Volume > volumes
CompositeMaterial(const std::string &n, double f)
Namespace of DDCMS conversion namespace.
std::map< std::string, std::variant< BooleanShape< dd4hep::UnionSolid >, BooleanShape< dd4hep::SubtractionSolid >, BooleanShape< dd4hep::IntersectionSolid > > > unresolvedShapes
tbb::concurrent_unordered_map< std::string, dd4hep::Solid > shapes
DDParsingContext(dd4hep::Detector *det)
tbb::concurrent_queue< std::string > namespaces