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.

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 }

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

◆ ~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.

17 { return m_world; }

References m_world.

◆ getWorldVolumeForWorker()

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

Definition at line 23 of file DD4hep_DDDWorld.h.

23 { return m_world; }

References 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 }

References MetAnalyzer::pv().

◆ 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 }

References MetAnalyzer::pv().

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

cms::DDDWorld::setAsWorld
void setAsWorld(G4VPhysicalVolume *pv)
Definition: DD4hep_DDDWorld.cc:54
geometry
Definition: geometry.py:1
cms::DDDWorld::m_world
G4VPhysicalVolume * m_world
Definition: DD4hep_DDDWorld.h:27
edm::LogInfo
Definition: MessageLogger.h:254
cms::DDDetector::description
Detector const * description() const
Definition: DDDetector.h:46
unpackBuffers-CaloStage2.INFO
INFO
Definition: unpackBuffers-CaloStage2.py:169
edm::LogError
Definition: MessageLogger.h:183
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
edm::LogVerbatim::log
LogVerbatim & log(F &&iF)
Definition: MessageLogger.h:327
edm::LogVerbatim
Definition: MessageLogger.h:297
align::Detector
Definition: StructureType.h:86
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
genParticles_cff.map
map
Definition: genParticles_cff.py:11