CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cms::DDDetector Class Reference

#include <DDDetector.h>

Public Member Functions

 DDDetector (const std::string &, const std::string &, bool bigXML=false)
 
 DDDetector ()=delete
 
dd4hep::Detector const * description () const
 
dd4hep::DetElement findElement (const std::string &) const
 Find DetElement as child of the top level volume by it's absolute path. More...
 
TGeoManager & manager () const
 The geometry manager of this instance. More...
 
dd4hep::PartSelectionMap const & partsels () const
 
dd4hep::SpecParRegistry const & specpars () const
 
cms::DDVectorsMap const & vectors () const
 
dd4hep::DetElement world () const
 Reference to the top-most (world) detector element. More...
 
dd4hep::Volume worldVolume () const
 Handle to the world volume containing everything. More...
 

Private Member Functions

void process (const std::string &)
 
void processXML (const std::string &)
 

Private Attributes

dd4hep::Detector * m_description = nullptr
 
dd4hep::PartSelectionMap m_partsels
 
dd4hep::SpecParRegistry m_specpars
 
const std::string m_tag
 
cms::DDVectorsMap m_vectors
 

Detailed Description

Definition at line 12 of file DDDetector.h.

Constructor & Destructor Documentation

cms::DDDetector::DDDetector ( const std::string &  tag,
const std::string &  fileName,
bool  bigXML = false 
)
explicit

Definition at line 14 of file DDDetector.cc.

References m_description, m_partsels, m_specpars, m_tag, m_vectors, process(), processXML(), and AlCaHLTBitMon_QueryRunRegistry::string.

14  : m_tag(tag) {
15  //We do not want to use any previously created TGeoManager but we do want to reset after we are done.
16  auto oldGeoManager = gGeoManager;
17  gGeoManager = nullptr;
18  auto resetManager = [oldGeoManager](TGeoManager*) { gGeoManager = oldGeoManager; };
19  std::unique_ptr<TGeoManager, decltype(resetManager)> sentry(oldGeoManager, resetManager);
20 
21  std::string tagStr(m_tag);
22  bool makePayload = false;
23  if (tagStr == "make-payload") {
24  makePayload = true;
25  tagStr = "";
26  }
27  m_description = &dd4hep::Detector::getInstance(tagStr);
28  m_description->addExtension<cms::DDVectorsMap>(&m_vectors);
29  auto parsingContext = new cms::DDParsingContext(*m_description, makePayload); // Removed at end of constructor
30  m_description->addExtension<cms::DDParsingContext>(parsingContext);
31  m_description->addExtension<dd4hep::PartSelectionMap>(&m_partsels);
32  m_description->addExtension<dd4hep::SpecParRegistry>(&m_specpars);
33  m_description->setStdConditions("NTP");
34  edm::LogVerbatim("Geometry") << "DDDetector::ctor Setting DD4hep STD conditions to NTP";
35  if (bigXML)
37  else
39  if (makePayload == false) // context no longer needed if not making payloads
40  m_description->removeExtension<cms::DDParsingContext>();
41  }
std::unordered_map< std::string, std::vector< double >> DDVectorsMap
Definition: DDNamespace.h:20
dd4hep::Detector * m_description
Definition: DDDetector.h:41
Log< level::Info, true > LogVerbatim
const std::string m_tag
Definition: DDDetector.h:45
dd4hep::PartSelectionMap m_partsels
Definition: DDDetector.h:43
void process(const std::string &)
Definition: DDDetector.cc:43
dd4hep::SpecParRegistry m_specpars
Definition: DDDetector.h:44
void processXML(const std::string &)
Definition: DDDetector.cc:49
cms::DDVectorsMap m_vectors
Definition: DDDetector.h:42
cms::DDDetector::DDDetector ( )
delete

Member Function Documentation

dd4hep::Detector const* cms::DDDetector::description ( ) const
inline

Definition at line 35 of file DDDetector.h.

References m_description.

Referenced by PrintGeomSolids::analyze(), OutputDD4hepToDDL::beginRun(), cms::DDG4Builder::BuildGeometry(), and cms::DDDWorld::DDDWorld().

35 { return m_description; }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
dd4hep::DetElement cms::DDDetector::findElement ( const std::string &  path) const

Find DetElement as child of the top level volume by it's absolute path.

Definition at line 75 of file DDDetector.cc.

References cms::cuda::assert(), and m_description.

75  {
77  return dd4hep::detail::tools::findElement(*m_description, path);
78  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
assert(be >=bs)
TGeoManager & cms::DDDetector::manager ( ) const

The geometry manager of this instance.

Definition at line 70 of file DDDetector.cc.

References cms::cuda::assert(), and m_description.

70  {
72  return m_description->manager();
73  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
assert(be >=bs)
dd4hep::PartSelectionMap const& cms::DDDetector::partsels ( ) const
inline

Definition at line 19 of file DDDetector.h.

References m_partsels.

19 { return m_partsels; }
dd4hep::PartSelectionMap m_partsels
Definition: DDDetector.h:43
void cms::DDDetector::process ( const std::string &  fileName)
private

Definition at line 43 of file DDDetector.cc.

References submitPVResolutionJobs::files, m_description, mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDDetector().

43  {
44  std::string name("DD4hep_CompactLoader");
45  const char* files[] = {fileName.c_str(), nullptr};
46  m_description->apply(name.c_str(), 2, (char**)files);
47  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
void cms::DDDetector::processXML ( const std::string &  xml)
private

Definition at line 49 of file DDDetector.cc.

References writedatasetfile::args, m_description, mergeVDriftHistosByStation::name, dumpparser::parse(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDDetector().

49  {
50  edm::LogVerbatim("Geometry") << "DDDetector::processXML process string size " << xml.size() << " with max_size "
51  << xml.max_size();
52  edm::LogVerbatim("Geometry") << "DDDetector::processXML XML string contents = " << xml.substr(0, 800);
53  std::string name("DD4hep_XMLProcessor");
54  dd4hep::xml::DocumentHolder doc(dd4hep::xml::DocumentHandler().parse(xml.c_str(), xml.length()));
55 
56  char* args[] = {(char*)doc.root().ptr(), nullptr};
57  m_description->apply(name.c_str(), 1, (char**)args);
58  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
Log< level::Info, true > LogVerbatim
dd4hep::SpecParRegistry const& cms::DDDetector::specpars ( ) const
inline

Definition at line 21 of file DDDetector.h.

References m_specpars.

Referenced by OutputDD4hepToDDL::beginRun(), cms::DDG4Builder::BuildGeometry(), DDDWorld::DDDWorld(), and cms::DDCompactView::specpars().

21 { return m_specpars; }
dd4hep::SpecParRegistry m_specpars
Definition: DDDetector.h:44
cms::DDVectorsMap const& cms::DDDetector::vectors ( ) const
inline

Definition at line 17 of file DDDetector.h.

References m_vectors.

Referenced by MTDParametersFromDD::build(), TrackerParametersFromDD::build(), and HGCalParametersFromDD::build().

17 { return m_vectors; }
cms::DDVectorsMap m_vectors
Definition: DDDetector.h:42
dd4hep::DetElement cms::DDDetector::world ( ) const

Reference to the top-most (world) detector element.

Definition at line 65 of file DDDetector.cc.

References cms::cuda::assert(), and m_description.

65  {
67  return m_description->world();
68  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
assert(be >=bs)
dd4hep::Volume cms::DDDetector::worldVolume ( ) const

Member Data Documentation

dd4hep::Detector* cms::DDDetector::m_description = nullptr
private
dd4hep::PartSelectionMap cms::DDDetector::m_partsels
private

Definition at line 43 of file DDDetector.h.

Referenced by DDDetector(), and partsels().

dd4hep::SpecParRegistry cms::DDDetector::m_specpars
private

Definition at line 44 of file DDDetector.h.

Referenced by DDDetector(), and specpars().

const std::string cms::DDDetector::m_tag
private

Definition at line 45 of file DDDetector.h.

Referenced by DDDetector().

cms::DDVectorsMap cms::DDDetector::m_vectors
private

Definition at line 42 of file DDDetector.h.

Referenced by DDDetector(), and vectors().