CMS 3D CMS Logo

DDDetector.cc
Go to the documentation of this file.
3 #include <DD4hep/Detector.h>
4 #include <DD4hep/DetectorTools.h>
5 #include <DD4hep/Volumes.h>
6 #include <XML/DocumentHandler.h>
7 #include <XML/XMLElements.h>
8 
9 #include <iostream>
10 
11 using namespace cms;
12 using namespace std;
13 
14 DDDetector::DDDetector(const string& tag, const string& fileName, bool bigXML) : m_tag(tag) {
15  m_description = &Detector::getInstance(tag);
16  m_description->addExtension<DDVectorsMap>(&m_vectors);
17  m_description->addExtension<DDPartSelectionMap>(&m_partsels);
18  m_description->addExtension<DDSpecParRegistry>(&m_specpars);
19  if (bigXML)
20  processXML(fileName);
21  else
23 }
24 
25 void DDDetector::process(const string& fileName) {
26  std::string name("DD4hep_CompactLoader");
27  const char* files[] = {fileName.c_str(), nullptr};
28  m_description->apply(name.c_str(), 2, (char**)files);
29 }
30 
32  edm::LogVerbatim("Geometry") << "DDDetector::processXML process string size " << xml.size() << " with max_size "
33  << xml.max_size();
34  std::string name("DD4hep_XMLProcessor");
35  dd4hep::xml::DocumentHolder doc(dd4hep::xml::DocumentHandler().parse(xml.c_str(), xml.length()));
36 
37  char* args[] = {(char*)doc.root().ptr(), nullptr};
38  m_description->apply(name.c_str(), 1, (char**)args);
39 }
40 
43  return m_description->worldVolume();
44 }
45 
46 dd4hep::PlacedVolume DDDetector::worldPlacement() const { return world().placement(); }
47 
48 dd4hep::DetElement DDDetector::world() const {
50  return m_description->world();
51 }
52 
53 const dd4hep::Detector::HandleMap& DDDetector::detectors() const {
55  return m_description->detectors();
56 }
57 
58 TGeoManager& DDDetector::manager() const {
60  return m_description->manager();
61 }
62 
63 dd4hep::DetElement DDDetector::findElement(const std::string& path) const {
65  return dd4hep::detail::tools::findElement(*m_description, path);
66 }
writedatasetfile.args
args
Definition: writedatasetfile.py:18
common_cff.doc
doc
Definition: common_cff.py:54
MessageLogger.h
cms::DDVectorsMap
tbb::concurrent_unordered_map< std::string, tbb::concurrent_vector< double > > DDVectorsMap
Definition: DDNamespace.h:14
cms::DDDetector::detectors
const HandleMap & detectors() const
The map of sub-detectors.
Definition: DDDetector.cc:53
cms::DDDetector::manager
TGeoManager & manager() const
The geometry manager of this instance.
Definition: DDDetector.cc:58
cms::DDSpecParRegistry
Definition: DDSpecParRegistry.h:32
cms::cuda::assert
assert(be >=bs)
cms::PlacedVolume
dd4hep::PlacedVolume PlacedVolume
Definition: DDFilteredView.h:46
cms::DDDetector::DDDetector
DDDetector()=delete
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
cms::DDDetector::process
void process(const std::string &)
Definition: DDDetector.cc:25
DDDetector.h
MainPageGenerator.files
files
Definition: MainPageGenerator.py:256
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
cms::DDPartSelectionMap
tbb::concurrent_unordered_map< std::string, tbb::concurrent_vector< std::string > > DDPartSelectionMap
Definition: DDSpecParRegistry.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::Volume
dd4hep::Volume Volume
Definition: DDFilteredView.h:45
dumpparser.parse
def parse(path, config)
Definition: dumpparser.py:13
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
cms::DDDetector::findElement
DetElement findElement(const std::string &) const
Find DetElement as child of the top level volume by it's absolute path.
Definition: DDDetector.cc:63
edm::LogVerbatim
Definition: MessageLogger.h:297
std
Definition: JetResolutionObject.h:76
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
cms::DDDetector::processXML
void processXML(const std::string &)
Definition: DDDetector.cc:31
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
cms::DDDetector::worldPlacement
PlacedVolume worldPlacement() const
Access to the physical volume of the world detector element.
Definition: DDDetector.cc:46
cms::DDDetector::m_description
Detector * m_description
Definition: DDDetector.h:52
cms::DDDetector::worldVolume
Volume worldVolume() const
Handle to the world volume containing everything.
Definition: DDDetector.cc:41
cms::DDDetector::world
DetElement world() const
Reference to the top-most (world) detector element.
Definition: DDDetector.cc:48
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21