CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
cms::DDDetector Class Reference

#include <DDDetector.h>

Public Member Functions

 DDDetector ()=delete
 
 DDDetector (const std::string &, const std::string &, bool bigXML=false)
 
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

◆ DDDetector() [1/2]

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

Definition at line 14 of file DDDetector.cc.

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  }

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

◆ DDDetector() [2/2]

cms::DDDetector::DDDetector ( )
delete

Member Function Documentation

◆ description()

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

◆ findElement()

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.

75  {
77  return dd4hep::detail::tools::findElement(*m_description, path);
78  }

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

◆ manager()

TGeoManager & cms::DDDetector::manager ( ) const

The geometry manager of this instance.

Definition at line 70 of file DDDetector.cc.

70  {
72  return m_description->manager();
73  }

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

◆ partsels()

dd4hep::PartSelectionMap const& cms::DDDetector::partsels ( ) const
inline

Definition at line 19 of file DDDetector.h.

19 { return m_partsels; }

References m_partsels.

◆ process()

void cms::DDDetector::process ( const std::string &  fileName)
private

Definition at line 43 of file DDDetector.cc.

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  }

References MillePedeFileConverter_cfg::fileName, submitPVResolutionJobs::files, m_description, Skims_PA_cff::name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDDetector().

◆ processXML()

void cms::DDDetector::processXML ( const std::string &  xml)
private

Definition at line 49 of file DDDetector.cc.

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  }

References writedatasetfile::args, boostedTaus_cff::doc, m_description, Skims_PA_cff::name, dumpparser::parse(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDDetector().

◆ specpars()

dd4hep::SpecParRegistry const& cms::DDDetector::specpars ( ) const
inline

◆ vectors()

cms::DDVectorsMap const& cms::DDDetector::vectors ( ) const
inline

◆ world()

dd4hep::DetElement cms::DDDetector::world ( ) const

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

Definition at line 65 of file DDDetector.cc.

65  {
67  return m_description->world();
68  }

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

◆ worldVolume()

dd4hep::Volume cms::DDDetector::worldVolume ( ) const

Member Data Documentation

◆ m_description

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

◆ m_partsels

dd4hep::PartSelectionMap cms::DDDetector::m_partsels
private

Definition at line 43 of file DDDetector.h.

Referenced by DDDetector(), and partsels().

◆ m_specpars

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

Definition at line 44 of file DDDetector.h.

Referenced by DDDetector(), and specpars().

◆ m_tag

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

Definition at line 45 of file DDDetector.h.

Referenced by DDDetector().

◆ m_vectors

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

Definition at line 42 of file DDDetector.h.

Referenced by DDDetector(), and vectors().

writedatasetfile.args
args
Definition: writedatasetfile.py:18
cms::DDDetector::m_tag
const std::string m_tag
Definition: DDDetector.h:45
boostedTaus_cff.doc
doc
Definition: boostedTaus_cff.py:20
cms::DDParsingContext
Definition: DDParsingContext.h:14
cms::cuda::assert
assert(be >=bs)
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
submitPVResolutionJobs.files
files
Definition: submitPVResolutionJobs.py:373
cms::DDDetector::process
void process(const std::string &)
Definition: DDDetector.cc:43
cms::DDDetector::m_partsels
dd4hep::PartSelectionMap m_partsels
Definition: DDDetector.h:43
dumpparser.parse
def parse(path, config)
Definition: dumpparser.py:13
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cms::cuda::device::unique_ptr
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
Definition: device_unique_ptr.h:33
cms::DDDetector::m_specpars
dd4hep::SpecParRegistry m_specpars
Definition: DDDetector.h:44
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
cms::DDDetector::m_vectors
cms::DDVectorsMap m_vectors
Definition: DDDetector.h:42
cms::DDVectorsMap
std::unordered_map< std::string, std::vector< double > > DDVectorsMap
Definition: DDNamespace.h:20
cms::DDDetector::processXML
void processXML(const std::string &)
Definition: DDDetector.cc:49
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
cms::DDDetector::m_description
dd4hep::Detector * m_description
Definition: DDDetector.h:41