CMS 3D CMS Logo

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

#include <DD4hep_DDDWorld.h>

Public Member Functions

 DDDWorld (const cms::DDDetector *, dd4hep::sim::Geant4GeometryMaps::VolumeMap &)
 
const G4VPhysicalVolume * getWorldVolume () const
 
G4VPhysicalVolume * getWorldVolumeForWorker () const
 
 ~DDDWorld ()
 

Static Public Member Functions

static void workerSetAsWorld (G4VPhysicalVolume *pv)
 

Private Member Functions

void setAsWorld (G4VPhysicalVolume *pv)
 

Private Attributes

G4VPhysicalVolume * m_world
 

Detailed Description

Definition at line 12 of file DD4hep_DDDWorld.h.

Constructor & Destructor Documentation

◆ DDDWorld()

DDDWorld::DDDWorld ( const cms::DDDetector ddd,
dd4hep::sim::Geant4GeometryMaps::VolumeMap &  map 
)

Definition at line 19 of file DD4hep_DDDWorld.cc.

References cms::DDDetector::description(), hgcalTestNeighbor_cfi::detector, align::Detector, unpackBuffers-CaloStage2::INFO, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqm-mbProfile::log, and genParticles_cff::map.

19  {
20  LogVerbatim("SimG4CoreApplication") << "DD4hep_DDDWorld: initialization of DDDWorld...";
21 
22  DetElement world = ddd->description()->world();
23  printout(INFO, "SimDD4CMS", "+++ DDDWorld::DDDWorld start... %s", world.name());
24  const Detector& detector = *ddd->description();
25  Geant4Converter g4Geo(detector);
26  Geant4GeometryInfo* geometry = g4Geo.create(world).detach();
27  map = geometry->g4Volumes;
28 
29  auto it = geometry->g4Volumes.find(detector.worldVolume().ptr());
30  LogVerbatim("Geometry") << "The world is " << it->first.name();
31 
32  if (geometry) {
33  LogVerbatim("Geometry").log([&](auto& log) {
34  for (auto iter = map.begin(); iter != map.end(); ++iter) {
35  log << iter->first.name() << " = ";
36  if (iter->second)
37  log << iter->second->GetName() << "; ";
38  else
39  log << "***none***; ";
40  }
41  log << "\n";
42  });
43  }
44  m_world = geometry->world();
45 
47  printout(INFO, "SimDD4CMS", "+++ DDDWorld::DDDWorld done!");
48 
49  LogVerbatim("SimG4CoreApplication") << "DD4hep_DDDWorld: initialization of DDDWorld done.";
50 }
Log< level::Info, true > LogVerbatim
dd4hep::Detector const * description() const
Definition: DDDetector.h:35
G4VPhysicalVolume * m_world
void setAsWorld(G4VPhysicalVolume *pv)

◆ ~DDDWorld()

DDDWorld::~DDDWorld ( )

Definition at line 52 of file DD4hep_DDDWorld.cc.

52 {}

Member Function Documentation

◆ getWorldVolume()

const G4VPhysicalVolume* cms::DDDWorld::getWorldVolume ( ) const
inline

Definition at line 17 of file DD4hep_DDDWorld.h.

References m_world.

17 { return m_world; }
G4VPhysicalVolume * m_world

◆ getWorldVolumeForWorker()

G4VPhysicalVolume* cms::DDDWorld::getWorldVolumeForWorker ( ) const
inline

Definition at line 23 of file DD4hep_DDDWorld.h.

References m_world.

23 { return m_world; }
G4VPhysicalVolume * m_world

◆ setAsWorld()

void DDDWorld::setAsWorld ( G4VPhysicalVolume *  pv)
private

Definition at line 54 of file DD4hep_DDDWorld.cc.

54  {
55  G4RunManagerKernel* kernel = G4RunManagerKernel::GetRunManagerKernel();
56 
57  if (kernel)
58  kernel->DefineWorldVolume(pv);
59  else
60  edm::LogError("SimG4CoreGeometry") << "cms::DDDWorld::setAsWorld: No G4RunManagerKernel?";
61 
62  edm::LogInfo("SimG4CoreGeometry") << " World volume defined ";
63 }
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo

◆ workerSetAsWorld()

void DDDWorld::workerSetAsWorld ( G4VPhysicalVolume *  pv)
static

Definition at line 65 of file DD4hep_DDDWorld.cc.

65  {
66  G4RunManagerKernel* kernel = G4RunManagerKernel::GetRunManagerKernel();
67  if (kernel) {
68  kernel->WorkerDefineWorldVolume(pv);
69  // The following does not get done in WorkerDefineWorldVolume()
70  // because we don't use G4MTRunManager
71  G4TransportationManager* transM = G4TransportationManager::GetTransportationManager();
72  transM->SetWorldForTracking(pv);
73  } else
74  edm::LogError("SimG4CoreGeometry") << "cms::DDDWorld::workerSetAsWorld: No G4RunManagerKernel?";
75 
76  edm::LogInfo("SimG4CoreGeometry") << " World volume defined (for worker) ";
77 }
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo

Member Data Documentation

◆ m_world

G4VPhysicalVolume* cms::DDDWorld::m_world
private

Definition at line 27 of file DD4hep_DDDWorld.h.

Referenced by getWorldVolume(), and getWorldVolumeForWorker().