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 (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

◆ DDDetector() [1/2]

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

Definition at line 15 of file DDDetector.cc.

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

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

◆ 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 82 of file DDDetector.cc.

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

82  {
84  return dd4hep::detail::tools::findElement(*m_description, path);
85  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
assert(be >=bs)

◆ manager()

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

The geometry manager of this instance.

Definition at line 77 of file DDDetector.cc.

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

77  {
79  return m_description->manager();
80  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
assert(be >=bs)

◆ partsels()

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

◆ process()

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

◆ processXML()

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

Definition at line 56 of file DDDetector.cc.

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

Referenced by DDDetector().

56  {
57  edm::LogVerbatim("Geometry") << "DDDetector::processXML process string size " << xml.size() << " with max_size "
58  << xml.max_size();
59  edm::LogVerbatim("Geometry") << "DDDetector::processXML XML string contents = " << xml.substr(0, 800);
60  std::string name("DD4hep_XMLProcessor");
61  dd4hep::xml::DocumentHolder doc(dd4hep::xml::DocumentHandler().parse(xml.c_str(), xml.length()));
62 
63  char* args[] = {(char*)doc.root().ptr(), nullptr};
64  m_description->apply(name.c_str(), 1, (char**)args);
65  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
Log< level::Info, true > LogVerbatim
vector< string > parse(string line, const string &delimiter)

◆ specpars()

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

◆ 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 72 of file DDDetector.cc.

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

72  {
74  return m_description->world();
75  }
dd4hep::Detector * m_description
Definition: DDDetector.h:41
assert(be >=bs)

◆ 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().