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>,
59  BooleanShape<dd4hep::SubtractionSolid>,
60  BooleanShape<dd4hep::IntersectionSolid>>>
62 
64  CompositeMaterial(const std::string& n, double f) : name(n), fraction(f) {}
65 
67  double fraction;
68  };
69 
70  std::map<std::string, std::vector<CompositeMaterial>> unresolvedMaterials;
71  std::map<std::string, std::vector<std::string>> unresolvedVectors;
72 
73  bool geo_inited = false;
74 
75  // Debug flags
76  bool debug_includes = false;
77  bool debug_constants = false;
78  bool debug_materials = false;
79  bool debug_rotations = false;
80  bool debug_shapes = false;
81  bool debug_volumes = false;
82  bool debug_placements = false;
83  bool debug_namespaces = false;
84  bool debug_visattr = false;
85  bool debug_algorithms = false;
86  bool debug_specpars = false;
87  };
88 } // namespace cms
89 
90 #endif
cms::DDParsingContext::debug_namespaces
bool debug_namespaces
Definition: DDParsingContext.h:83
cms::DDParsingContext::geo_inited
bool geo_inited
Definition: DDParsingContext.h:73
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
cms::DDParsingContext::debug_visattr
bool debug_visattr
Definition: DDParsingContext.h:84
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
cms::DDParsingContext
Definition: DDParsingContext.h:14
cms::DDParsingContext::unresolvedMaterials
std::map< std::string, std::vector< CompositeMaterial > > unresolvedMaterials
Definition: DDParsingContext.h:70
cms::DDParsingContext::debug_placements
bool debug_placements
Definition: DDParsingContext.h:82
cms::DDParsingContext::BooleanShape::transform
dd4hep::Transform3D transform
Definition: DDParsingContext.h:50
cms::DDParsingContext::CompositeMaterial
Definition: DDParsingContext.h:63
cms::DDParsingContext::unresolvedVectors
std::map< std::string, std::vector< std::string > > unresolvedVectors
Definition: DDParsingContext.h:71
cms::DDParsingContext::disabledAlgs
tbb::concurrent_vector< std::string > disabledAlgs
Definition: DDParsingContext.h:40
cms::DDParsingContext::description
std::atomic< dd4hep::Detector * > description
Definition: DDParsingContext.h:36
cms::DDParsingContext::debug_materials
bool debug_materials
Definition: DDParsingContext.h:78
cms::DDParsingContext::volumes
tbb::concurrent_unordered_map< std::string, dd4hep::Volume > volumes
Definition: DDParsingContext.h:39
cms::DDParsingContext::CompositeMaterial::CompositeMaterial
CompositeMaterial(const std::string &n, double f)
Definition: DDParsingContext.h:64
cms::DDParsingContext::CompositeMaterial::name
const std::string name
Definition: DDParsingContext.h:66
cms::DDParsingContext::rotations
tbb::concurrent_unordered_map< std::string, dd4hep::Rotation3D > rotations
Definition: DDParsingContext.h:37
cms::DDParsingContext::debug_algorithms
bool debug_algorithms
Definition: DDParsingContext.h:85
OrderedSet.t
t
Definition: OrderedSet.py:90
cms::DDParsingContext::BooleanShape::secondSolidName
const std::string secondSolidName
Definition: DDParsingContext.h:49
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:52
cms::DDParsingContext::BooleanShape
Definition: DDParsingContext.h:44
cms::DDParsingContext::BooleanShape::BooleanShape
BooleanShape(const std::string &aName, const std::string &bName, dd4hep::Transform3D t)
Definition: DDParsingContext.h:45
res
Definition: Electron.h:6
align::Detector
Definition: StructureType.h:86
cms::DDParsingContext::CompositeMaterial::fraction
double fraction
Definition: DDParsingContext.h:67
cms::DDParsingContext::debug_constants
bool debug_constants
Definition: DDParsingContext.h:77
cms::DDParsingContext::debug_rotations
bool debug_rotations
Definition: DDParsingContext.h:79
cms::DDParsingContext::unresolvedShapes
std::map< std::string, std::variant< BooleanShape< dd4hep::UnionSolid >, BooleanShape< dd4hep::SubtractionSolid >, BooleanShape< dd4hep::IntersectionSolid > > > unresolvedShapes
Definition: DDParsingContext.h:61
cms::DDParsingContext::shapes
tbb::concurrent_unordered_map< std::string, dd4hep::Solid > shapes
Definition: DDParsingContext.h:38
runonSM.TYPE
TYPE
Definition: runonSM.py:21
cms::DDParsingContext::debug_specpars
bool debug_specpars
Definition: DDParsingContext.h:86
cms::DDParsingContext::namespaces
tbb::concurrent_queue< std::string > namespaces
Definition: DDParsingContext.h:41
cms::DDParsingContext::DDParsingContext
DDParsingContext(dd4hep::Detector *det)
Definition: DDParsingContext.h:16
mps_fire.result
result
Definition: mps_fire.py:303
cms::DDParsingContext::~DDParsingContext
~DDParsingContext()
Definition: DDParsingContext.h:18
genParticles_cff.map
map
Definition: genParticles_cff.py:11
cms::DDParsingContext::debug_includes
bool debug_includes
Definition: DDParsingContext.h:76
cms::DDParsingContext::BooleanShape::firstSolidName
const std::string firstSolidName
Definition: DDParsingContext.h:48
cms::DDParsingContext::debug_volumes
bool debug_volumes
Definition: DDParsingContext.h:81
cms::DDParsingContext::debug_shapes
bool debug_shapes
Definition: DDParsingContext.h:80
cms::DDParsingContext::ns
const bool ns(std::string &result)
Definition: DDParsingContext.h:26
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21