DD4hep  1.35.0
Detector Description Toolkit for High Energy Physics
Geant4DetectorGeometryConstruction.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // \author Markus Frank
11 // \date 2015-11-09
12 //
13 //==========================================================================
14 
15 // Framework include files
17 
19 namespace dd4hep {
20 
22  namespace sim {
23 
25 
36  unsigned long m_dumpHierarchy { 0 };
38  long m_debugVolManager { 0 };
40  bool m_haveVolManager { true };
42  bool m_debugMaterials { false };
44  bool m_debugElements { false };
46  bool m_debugShapes { false };
48  bool m_debugVolumes { false };
50  bool m_debugPlacements { false };
52  bool m_debugReflections { false };
54  bool m_debugRegions { false };
56  bool m_debugLimits { false };
58  bool m_debugSurfaces { false };
59 
61  bool m_printPlacements { false };
63  bool m_printSensitives { false };
64 
68  std::string m_dumpGDML;
69 
71  int writeGDML(const char* gdml_output);
73  int printVolumeObj(const char* vol_path, PlacedVolume pv, int flg);
75  int printVolumeTree(const char* vol_path);
77  int printVolTree(const char* vol_path);
79  int printG4Tree(const char* vol_path);
81  int printVolume(const char* vol_path);
83  int checkVolume(const char* vol_path);
85  int printMaterial(const char* mat_name);
86 
87  std::pair<std::string, PlacedVolume> resolve_path(const char* vol_path) const;
88  void printG4(const std::string& prefix, const G4VPhysicalVolume* g4pv) const;
89 
90  public:
92  Geant4DetectorGeometryConstruction(Geant4Context* ctxt, const std::string& nam);
98  virtual void installCommandMessenger() override;
99  };
100  } // End namespace sim
101 } // End namespace dd4hep
102 
103 
104 // Framework include files
105 #include <DD4hep/InstanceCount.h>
106 #include <DD4hep/DetectorTools.h>
107 #include <DD4hep/DD4hepUnits.h>
108 #include <DD4hep/Printout.h>
109 #include <DD4hep/Detector.h>
110 
112 #include <DDG4/Geant4UIMessenger.h>
113 #include <DDG4/Geant4Converter.h>
114 #include <DDG4/Geant4Kernel.h>
115 #include <DDG4/Factories.h>
116 
117 #include <TGeoScaledShape.h>
118 
119 // Geant4 include files
120 #include <G4LogicalVolume.hh>
121 #include <G4PVPlacement.hh>
122 #include <G4Material.hh>
123 #include <G4Version.hh>
124 #include <G4VSolid.hh>
125 #include <CLHEP/Units/SystemOfUnits.h>
126 
127 #ifndef GEANT4_NO_GDML
128 #include <G4GDMLParser.hh>
129 #endif
130 
131 #include <cmath>
132 
133 using namespace dd4hep::sim;
135 
138 : Geant4DetectorConstruction(ctxt,nam)
139 {
140  declareProperty("DebugMaterials", m_debugMaterials);
141  declareProperty("DebugElements", m_debugElements);
142  declareProperty("DebugShapes", m_debugShapes);
143  declareProperty("DebugVolumes", m_debugVolumes);
144  declareProperty("DebugPlacements", m_debugPlacements);
145  declareProperty("DebugReflections", m_debugReflections);
146  declareProperty("DebugRegions", m_debugRegions);
147  declareProperty("DebugLimits", m_debugLimits);
148  declareProperty("DebugSurfaces", m_debugSurfaces);
149  declareProperty("DebugVolManager", m_debugVolManager);
150  declareProperty("HaveVolManager", m_haveVolManager);
151 
152  declareProperty("PrintPlacements", m_printPlacements);
153  declareProperty("PrintSensitives", m_printSensitives);
154  declareProperty("GeoInfoPrintLevel", m_geoInfoPrintLevel = DEBUG);
155 
156  declareProperty("DumpHierarchy", m_dumpHierarchy);
157  declareProperty("DumpGDML", m_dumpGDML="");
159 }
160 
164 }
165 
169  DetElement world = ctxt->description.world();
170  Geant4Converter conv(ctxt->description, outputLevel());
173  conv.debugShapes = m_debugShapes;
179  conv.debugLimits = m_debugLimits;
182 
183  ctxt->geometry = conv.create(world).detach();
184  ctxt->geometry->printLevel = outputLevel();
185  g4map.attach(ctxt->geometry);
186  G4VPhysicalVolume* w = ctxt->geometry->world();
187  // Save away the reference to the world volume
188  context()->kernel().setWorld(w);
189  // Create Geant4 volume manager only if not yet available
192  if( m_haveVolManager ) {
193  g4map.volumeManager();
194  }
195  if ( m_dumpHierarchy != 0 ) {
197  dmp.dump("",w);
198  }
199  ctxt->world = w;
200  if ( !m_dumpGDML.empty() ) writeGDML(m_dumpGDML.c_str());
201  else if ( ::getenv("DUMP_GDML") ) writeGDML(::getenv("DUMP_GDML"));
202  enableUI();
203 }
204 
205 std::pair<std::string, dd4hep::PlacedVolume>
207  std::string p = vol_path;
209  PlacedVolume top = det.world().placement();
211  if ( !pv.isValid() ) {
213  if ( de.isValid() ) {
214  pv = de.placement();
216  }
217  }
218  return make_pair(p,pv);
219 }
220 
223  if ( mat_name ) {
224  auto& g4map = Geant4Mapping::instance().data().g4Materials;
225  for ( auto it = g4map.begin(); it != g4map.end(); ++it ) {
226  const auto* mat = (*it).second;
227  if ( mat->GetName() == mat_name ) {
228  std::stringstream output;
229  const auto* ion = mat->GetIonisation();
230  printP2("+++ Dump of GEANT4 material: %s", mat_name);
231  output << mat;
232  if ( ion ) {
233  output << " MEE: ";
234  output << std::setprecision(12);
235  output << ion->GetMeanExcitationEnergy()/CLHEP::eV;
236  output << " [eV]";
237  }
238  else
239  output << " MEE: UNKNOWN";
240  always("+++ printMaterial: \n%s\n", output.str().c_str());
241  return 1;
242  }
243  }
244  warning("+++ printMaterial: FAILED to find the material %s", mat_name);
245  }
246  warning("+++ printMaterial: Property materialName not set!");
247  return 0;
248 }
249 
251 int Geant4DetectorGeometryConstruction::printVolumeObj(const char* vol_path, PlacedVolume pv, int flg) {
252  if ( pv.isValid() ) {
253  const G4LogicalVolume* vol = 0;
254  auto& g4map = Geant4Mapping::instance().data();
255  auto pit = g4map.g4Placements.find(pv.ptr());
256  auto vit = g4map.g4Volumes.find(pv.volume());
257  warning("+++ printVolume: %s", vol_path);
258  if ( vit != g4map.g4Volumes.end() ) {
259  vol = (*vit).second;
260  auto* sol = vol->GetSolid();
261  const auto* mat = vol->GetMaterial();
262  const auto* ion = mat->GetIonisation();
263  Solid sh = pv.volume().solid();
264  if ( flg ) {
265  printP2("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
266  printP2("+++ Dump of GEANT4 solid: %s", vol_path);
267  }
268  std::stringstream output;
269  if ( flg ) {
270  output << mat;
271  if ( ion ) {
272  output << " MEE: ";
273  output << std::setprecision(12);
274  output << ion->GetMeanExcitationEnergy()/CLHEP::eV;
275  output << " [eV]";
276  }
277  else
278  output << " MEE: UNKNOWN";
279  }
280  if ( flg ) {
281  output << std::endl << *sol;
282  printP2("%s", output.str().c_str());
283  printP2("+++ Dump of ROOT solid: %s", vol_path);
284  sh->InspectShape();
285  if ( sh->IsA() == TGeoScaledShape::Class() ) {
286  TGeoScaledShape* scaled = (TGeoScaledShape*)sh.ptr();
287  const Double_t* scale = scaled->GetScale()->GetScale();
288  double dot = scale[0]*scale[1]*scale[2];
289  printP2("+++ TGeoScaledShape: %8.3g %8.3g %8.3g [%s]", scale[0], scale[1], scale[2],
290  dot > 0e0 ? "RIGHT handed" : "LEFT handed");
291  }
292  else if ( pit != g4map.g4Placements.end() ) {
293  const G4VPhysicalVolume* pl = (*pit).second;
294  const G4RotationMatrix* rot = pl->GetRotation();
295  const G4ThreeVector& tr = pl->GetTranslation();
296  G4Transform3D transform(rot ? *rot : G4RotationMatrix(), tr);
297  HepGeom::Scale3D sc;
298  HepGeom::Rotate3D rr;
299  G4Translate3D tt;
300  transform.getDecomposition(sc,rr,tt);
301  double dot = sc(0,0)*sc(1,1)*sc(2,2);
302  printP2("+++ TGeoShape: %8.3g %8.3g %8.3g [%s]", sc(0,0), sc(1,1), sc(2,2),
303  dot > 0e0 ? "RIGHT handed" : "LEFT handed");
304  }
305  const TGeoMatrix* matrix = pv->GetMatrix();
306  printP2("+++ TGeoMatrix: %s",
307  matrix->TestBit(TGeoMatrix::kGeoReflection) ? "LEFT handed" : "RIGHT handed");
308  printP2("+++ Shape: %s cubic volume: %8.3g mm^3 area: %8.3g mm^2",
309  sol->GetName().c_str(), sol->GetCubicVolume(), sol->GetSurfaceArea());
310  }
311  return 1;
312  }
313  else {
314  auto ai = g4map.g4AssemblyVolumes.find(pv.ptr());
315  if ( ai != g4map.g4AssemblyVolumes.end() ) {
316  Volume v = pv.volume();
317  warning("+++ printVolume: volume %s is an assembly...need to resolve imprint",vol_path);
318  for(Int_t i=0; i < v->GetNdaughters(); ++i) {
319  TGeoNode* dau_nod = v->GetNode(i);
320  std::string p = vol_path + std::string("/") + dau_nod->GetName();
321  printVolumeObj(p.c_str(), dau_nod, flg);
322  }
323  return 0;
324  }
325  }
326  warning("+++ printVolume: FAILED to find the volume %s in geant4 mapping...",vol_path);
327  return 0;
328  }
329  warning("+++ printVolume: FAILED to dump invalid volume",vol_path);
330  return 0;
331 }
332 
335  if ( vol_path ) {
336  auto physVol = resolve_path(vol_path);
337  if ( physVol.second.isValid() ) {
338  return printVolumeObj(vol_path, physVol.second, ~0x0);
339  }
340  }
341  warning("+++ printVolume: Property VolumePath not set. [Ignored]");
342  return 0;
343 }
344 
347  if ( vol_path ) {
348  auto [p, pv] = resolve_path(vol_path);
349  if ( pv.isValid() ) {
350  if ( printVolumeObj(p.c_str(), pv, ~0x0) ) {
351  TGeoVolume* vol = pv->GetVolume();
352  for(Int_t i=0; i < vol->GetNdaughters(); ++i) {
353  PlacedVolume dau_pv(vol->GetNode(i));
354  std::string path = (p + "/") + dau_pv.name();
355  if ( printVolumeTree(path.c_str()) ) {
356  }
357  }
358  }
359  return 1;
360  }
361  }
362  warning("+++ printVolume: Could not access Volume/DetElement '%s'", vol_path ? vol_path : "UNKNOWN");
363  return 0;
364 }
365 
367  if ( vol_path ) {
368  auto [p, pv] = resolve_path(vol_path);
369  if ( pv.isValid() ) {
370  if ( printVolumeObj(p.c_str(), pv, 0) ) {
371  TGeoVolume* vol = pv->GetVolume();
372  for(Int_t i=0; i < vol->GetNdaughters(); ++i) {
373  PlacedVolume dau_pv(vol->GetNode(i));
374  std::string path = (p + "/") + dau_pv.name();
375  if ( printVolTree(path.c_str()) ) {
376  }
377  }
378  }
379  return 1;
380  }
381  }
382  warning("+++ printVolume: Could not access Volume/DetElement '%s'", vol_path ? vol_path : "UNKNOWN");
383  return 0;
384 }
385 
388  if ( vol_path ) {
389  auto physVol = resolve_path(vol_path);
390  auto pv = physVol.second;
391  if ( pv.isValid() ) {
392  auto& g4map = Geant4Mapping::instance().data().g4Volumes;
393  auto it = g4map.find(pv.volume());
394  if ( it != g4map.end() ) {
395  const G4LogicalVolume* vol = (*it).second;
396  auto* g4_sol = vol->GetSolid();
397  Box rt_sol = pv.volume().solid();
398  printP2("Geant4 Shape: %s cubic volume: %8.3g mm^3 area: %8.3g mm^2",
399  g4_sol->GetName().c_str(), g4_sol->GetCubicVolume(), g4_sol->GetSurfaceArea());
400 #if G4VERSION_NUMBER>=1040
401  G4ThreeVector pMin, pMax;
402  double conv = (dd4hep::centimeter/CLHEP::centimeter)/2.0;
403  g4_sol->BoundingLimits(pMin,pMax);
404  printP2("Geant4 Bounding box extends: %8.3g %8.3g %8.3g",
405  (pMax.x()-pMin.x())*conv, (pMax.y()-pMin.y())*conv, (pMax.z()-pMin.z())*conv);
406 #endif
407  printP2("ROOT Bounding box dimensions: %8.3g %8.3g %8.3g",
408  rt_sol->GetDX(), rt_sol->GetDY(), rt_sol->GetDZ());
409 
410  return 1;
411  }
412  }
413  warning("+++ checkVolume: FAILED to find the volume %s from the top volume",vol_path);
414  }
415  warning("+++ checkVolume: Property VolumePath not set. [Ignored]");
416  return 0;
417 }
418 
421 #ifdef GEANT4_NO_GDML
422  warning("+++ writeGDML: GDML not found in the present Geant4 build! Output: %s not written", output);
423 #else
424  G4VPhysicalVolume* w = context()->world();
425  if ( output && ::strlen(output) > 0 && output != m_dumpGDML.c_str() )
426  m_dumpGDML = output;
427 
428  if ( !m_dumpGDML.empty() ) {
429  G4GDMLParser parser;
430  parser.Write(m_dumpGDML.c_str(), w);
431  info("+++ writeGDML: Wrote GDML file: %s", m_dumpGDML.c_str());
432  return 1;
433  }
434  else {
435  const char* gdml_dmp = ::getenv("DUMP_GDML");
436  if ( gdml_dmp ) {
437  G4GDMLParser parser;
438  parser.Write(gdml_dmp, w);
439  info("+++ writeGDML: Wrote GDML file: %s", gdml_dmp);
440  return 1;
441  }
442  }
443  warning("+++ writeGDML: Neither property DumpGDML nor environment DUMP_GDML set. No file written!");
444 #endif
445  return 0;
446 }
447 
448 void Geant4DetectorGeometryConstruction::printG4(const std::string& prefix, const G4VPhysicalVolume* g4pv) const {
449  std::string path = prefix + "/";
450  printP2("+++ GEANT4 volume: %s", prefix.c_str());
451  auto* g4v = g4pv->GetLogicalVolume();
452  for(size_t i=0, n=g4v->GetNoDaughters(); i<n; ++i) {
453  auto* dau = g4v->GetDaughter(i);
454  printG4(path + dau->GetName(), dau);
455  }
456 }
457 
459  if ( vol_path ) {
460  auto [p, pv] = resolve_path(vol_path);
461  if ( pv.isValid() ) {
462  auto& g4map = Geant4Mapping::instance().data().g4Placements;
463  auto it = g4map.find(pv);
464  if ( it != g4map.end() ) {
465  printG4(p, (*it).second);
466  }
467  return 1;
468  }
469  }
470  warning("+++ printVolume: Could not access Volume/DetElement '%s'", vol_path ? vol_path : "UNKNOWN");
471  return 0;
472 }
473 
477  m_control->addCall("writeGDML", "GDML: write geometry to file: '"+m_dumpGDML+
478  "' [uses argument - or - property DumpGDML]",
480  m_control->addCall("printVolume", "Print Geant4 volume properties [uses argument]",
482  m_control->addCall("printTree", "Print volume tree WITHOUT properties [uses argument]",
484  m_control->addCall("printG4Tree", "Print Geant4 volume tree [uses argument]",
486  m_control->addCall("printVolumeTree", "Print volume tree with properties [uses argument]",
488  m_control->addCall("checkVolume", "Check Geant4 volume properties [uses argument]",
490  m_control->addCall("printMaterial", "Print Geant4 material properties [uses argument]",
492 }
dd4hep::sim::Geant4HierarchyDump
Helper to dump Geant4 volume hierarchy.
Definition: Geant4HierarchyDump.h:34
dd4hep::sim::Geant4Converter::debugRegions
bool debugRegions
Property: Flag to debug regions during conversion mechanism.
Definition: Geant4Converter.h:47
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugElements
bool m_debugElements
Property: Flag to debug elements during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:44
dd4hep::sim::Geant4DetectorGeometryConstruction::printVolumeTree
int printVolumeTree(const char *vol_path)
Print volume tree with attributes.
Definition: Geant4DetectorGeometryConstruction.cpp:346
dd4hep::sim::Geant4Converter::debugMaterials
bool debugMaterials
Property: Flag to debug materials during conversion mechanism.
Definition: Geant4Converter.h:35
dd4hep::sim::Geant4Action::printP2
void printP2(const char *fmt,...) const
Support for messages with variable output level using output level+2.
Definition: Geant4Action.cpp:188
Geant4DetectorConstruction.h
dd4hep::Detector::world
virtual DetElement world() const =0
Return reference to the top-most (world) detector element.
dd4hep::sim::Geant4DetectorGeometryConstruction::m_dumpHierarchy
unsigned long m_dumpHierarchy
Property: Dump geometry hierarchy if not NULL. Flags can steer actions.
Definition: Geant4DetectorGeometryConstruction.cpp:36
dd4hep::sim::Geant4DetectorGeometryConstruction::printVolTree
int printVolTree(const char *vol_path)
Print volume tree WITHOUT attributes.
Definition: Geant4DetectorGeometryConstruction.cpp:366
dd4hep::sim::Geant4Converter
Geometry converter from dd4hep to Geant 4.
Definition: Geant4Converter.h:32
dd4hep::sim::Geant4Kernel::setWorld
void setWorld(G4VPhysicalVolume *volume)
Set the geometry world.
Definition: Geant4Kernel.cpp:262
v
View * v
Definition: MultiView.cpp:28
dd4hep::sim::Geant4Converter::debugLimits
bool debugLimits
Property: Flag to debug LimitSets during conversion mechanism.
Definition: Geant4Converter.h:49
Detector.h
dd4hep::sim::Geant4Converter::debugElements
bool debugElements
Property: Flag to debug elements during conversion mechanism.
Definition: Geant4Converter.h:37
dd4hep::sim::Geant4DetectorGeometryConstruction::installCommandMessenger
virtual void installCommandMessenger() override
Install command control messenger to write GDML file from command prompt.
Definition: Geant4DetectorGeometryConstruction.cpp:475
dd4hep::sim::Geant4Mapping::data
Geant4GeometryInfo & data() const
Access to the data pointer.
Definition: Geant4Mapping.h:65
Geant4HierarchyDump.h
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:164
dd4hep::sim::Geant4DetectorGeometryConstruction::~Geant4DetectorGeometryConstruction
virtual ~Geant4DetectorGeometryConstruction()
Default destructor.
Definition: Geant4DetectorGeometryConstruction.cpp:162
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugMaterials
bool m_debugMaterials
Property: Flag to debug materials during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:42
dd4hep::DetElement::placement
PlacedVolume placement() const
Access to the physical volume of this detector element.
Definition: DetElement.cpp:321
dd4hep::sim::Geant4DetectorGeometryConstruction::printG4
void printG4(const std::string &prefix, const G4VPhysicalVolume *g4pv) const
Definition: Geant4DetectorGeometryConstruction.cpp:448
dd4hep::detail::tools::placementPath
std::string placementPath(DetElement element)
Assemble the placement path from a given detector element to the world volume.
Definition: DetectorTools.cpp:283
dd4hep::sim::Geant4DetectorGeometryConstruction
Class to create Geant4 detector geometry from TGeo representation in memory.
Definition: Geant4DetectorGeometryConstruction.cpp:34
dd4hep::sim::Geant4GeometryInfo::g4Materials
Geant4GeometryMaps::MaterialMap g4Materials
Definition: Geant4GeometryInfo.h:112
dd4hep::sim::Geant4Converter::debugSurfaces
bool debugSurfaces
Property: Flag to debug surfaces during conversion mechanism.
Definition: Geant4Converter.h:51
dd4hep::Volume::solid
Solid solid() const
Access to Solid (Shape)
Definition: Volumes.cpp:1252
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:126
dd4hep::sim::Geant4DetectorGeometryConstruction::m_printSensitives
bool m_printSensitives
Property: Flag to dump all sensitives after the conversion procedure.
Definition: Geant4DetectorGeometryConstruction.cpp:63
dd4hep::sim::Geant4Converter::debugShapes
bool debugShapes
Property: Flag to debug shapes during conversion mechanism.
Definition: Geant4Converter.h:39
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
dd4hep::Solid_type< TGeoShape >
dd4hep::sim::Geant4DetectorGeometryConstruction::printVolumeObj
int printVolumeObj(const char *vol_path, PlacedVolume pv, int flg)
Print geant4 volume.
Definition: Geant4DetectorGeometryConstruction.cpp:251
dd4hep::sim::Geant4Mapping::instance
static Geant4Mapping & instance()
Possibility to define a singleton instance.
Definition: Geant4Mapping.cpp:36
dd4hep::sim::Geant4DetectorGeometryConstruction::printMaterial
int printMaterial(const char *mat_name)
Print geant4 material.
Definition: Geant4DetectorGeometryConstruction.cpp:222
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
DECLARE_GEANT4ACTION
#define DECLARE_GEANT4ACTION(name)
Plugin defintion to create Geant4Action objects.
Definition: Factories.h:210
dd4hep::sim::Geant4Action::warning
void warning(const char *fmt,...) const
Support of warning messages.
Definition: Geant4Action.cpp:223
dd4hep::sim::Geant4Context::world
G4VPhysicalVolume * world() const
Access to geometry world.
Definition: Geant4Context.cpp:62
dd4hep::sim::Geant4GeometryInfo::printLevel
PrintLevel printLevel
Definition: Geant4GeometryInfo.h:139
parser
dd4hepDOMParser * parser
Definition: DocumentHandler.cpp:158
dd4hep::sim::Geant4Kernel::detectorDescription
Detector & detectorDescription() const
Access to detector description.
Definition: Geant4Kernel.h:201
dd4hep::sim::Geant4DetectorConstructionContext::world
G4VPhysicalVolume * world
Reference to the world after construction.
Definition: Geant4DetectorConstruction.h:70
dd4hep::detail::tools::findElement
DetElement findElement(const Detector &description, const std::string &path)
Find DetElement as child of the top level volume by its absolute path.
Definition: DetectorTools.cpp:221
dd4hep::sim::Geant4Action::info
void info(const char *fmt,...) const
Support of info messages.
Definition: Geant4Action.cpp:215
dd4hep::sim::Geant4Converter::debugPlacements
bool debugPlacements
Property: Flag to debug placements during conversion mechanism.
Definition: Geant4Converter.h:43
Geant4UIMessenger.h
dd4hep::sim::Geant4DetectorConstructionContext
Geant4 detector construction context definition.
Definition: Geant4DetectorConstruction.h:61
dd4hep::sim::Geant4Converter::create
Geant4Converter & create(DetElement top)
Create geometry conversion.
Definition: Geant4Converter.cpp:1714
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:187
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugShapes
bool m_debugShapes
Property: Flag to debug shapes during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:46
dd4hep::sim::Geant4DetectorConstructionContext::description
Detector & description
Reference to geometry object.
Definition: Geant4DetectorConstruction.h:67
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:371
dd4hep::sim::Geant4DetectorGeometryConstruction::m_printPlacements
bool m_printPlacements
Property: Flag to dump all placements after the conversion procedure.
Definition: Geant4DetectorGeometryConstruction.cpp:61
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugReflections
bool m_debugReflections
Property: Flag to debug reflections during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:52
dd4hep::sim::Geant4Mapping
Geometry mapping from dd4hep to Geant 4.
Definition: Geant4Mapping.h:35
dd4hep::sim::Geant4DetectorGeometryConstruction::resolve_path
std::pair< std::string, PlacedVolume > resolve_path(const char *vol_path) const
Definition: Geant4DetectorGeometryConstruction.cpp:206
dd4hep::sim::Geant4GeometryInfo::g4Placements
Geant4GeometryMaps::PlacementMap g4Placements
Definition: Geant4GeometryInfo.h:115
DetectorTools.h
dd4hep::Callback
Definition of the generic callback structure for member functions.
Definition: Callback.h:37
dd4hep::sim::Geant4Action::declareProperty
Geant4Action & declareProperty(const std::string &nam, T &val)
Declare property.
Definition: Geant4Action.h:366
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition: InstanceCount.h:102
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugPlacements
bool m_debugPlacements
Property: Flag to debug placements during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:50
dd4hep::sim::Geant4DetectorGeometryConstruction::m_geoInfoPrintLevel
int m_geoInfoPrintLevel
Property: Printout level of info object.
Definition: Geant4DetectorGeometryConstruction.cpp:66
dd4hep::sim::Geant4Mapping::volumeManager
Geant4VolumeManager volumeManager() const
Access the volume manager.
Definition: Geant4Mapping.cpp:70
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugRegions
bool m_debugRegions
Property: Flag to debug regions during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:54
dd4hep::sim::Geant4DetectorGeometryConstruction::Geant4DetectorGeometryConstruction
Geant4DetectorGeometryConstruction(Geant4Context *ctxt, const std::string &nam)
Initializing constructor for DDG4.
Definition: Geant4DetectorGeometryConstruction.cpp:137
dd4hep::sim::Geant4Action::outputLevel
PrintLevel outputLevel() const
Access the output level.
Definition: Geant4Action.h:296
dd4hep::sim::Geant4Mapping::debugVolManager
long debugVolManager
Debug flag when populating the Geant4 volume manager (Option set by Geant4DetectorGeometryConstructio...
Definition: Geant4Mapping.h:45
dd4hep::sim::Geant4Converter::debugVolumes
bool debugVolumes
Property: Flag to debug volumes during conversion mechanism.
Definition: Geant4Converter.h:41
dd4hep::detail::tools::findNode
PlacedVolume findNode(PlacedVolume top_place, const std::string &place)
Find a given node in the hierarchy starting from the top node (absolute placement!...
Definition: DetectorTools.cpp:335
dd4hep::sim::Geant4Converter::printSensitives
bool printSensitives
Property: Flag to dump all sensitives after the conversion procedure.
Definition: Geant4Converter.h:56
dd4hep::sim::Geant4DetectorGeometryConstruction::checkVolume
int checkVolume(const char *vol_path)
Check geant4 volume.
Definition: Geant4DetectorGeometryConstruction.cpp:387
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugSurfaces
bool m_debugSurfaces
Property: Flag to debug regions during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:58
Factories.h
dd4hep::sim::Geant4DetectorGeometryConstruction::printVolume
int printVolume(const char *vol_path)
Print geant4 volume.
Definition: Geant4DetectorGeometryConstruction.cpp:334
dd4hep::sim::Geant4Action::m_control
Geant4UIMessenger * m_control
Control directory of this action.
Definition: Geant4Action.h:118
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: EDM4hepFileReader.cpp:46
dd4hep::sim::Geant4Context::kernel
Geant4Kernel & kernel() const
Access to the kernel object.
Definition: Geant4Context.h:233
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugLimits
bool m_debugLimits
Property: Flag to debug limit sets during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:56
dd4hep::Box
Class describing a box shape.
Definition: Shapes.h:295
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:151
dd4hep::sim::Geant4Mapping::attach
void attach(Geant4GeometryInfo *data)
Set a new data block.
Definition: Geant4Mapping.cpp:65
dd4hep::sim::Geant4Action::installCommandMessenger
virtual void installCommandMessenger()
Install command control messenger if wanted.
Definition: Geant4Action.cpp:121
dd4hep::sim::Geant4DetectorGeometryConstruction::constructGeo
void constructGeo(Geant4DetectorConstructionContext *ctxt) override
Geometry construction callback. Called at "Construct()".
Definition: Geant4DetectorGeometryConstruction.cpp:167
dd4hep::sim::Geant4DetectorGeometryConstruction::m_haveVolManager
bool m_haveVolManager
Property: Flag to instantiate Geant4 volume manager.
Definition: Geant4DetectorGeometryConstruction.cpp:40
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4Converter::debugReflections
bool debugReflections
Property: Flag to debug reflections during conversion mechanism.
Definition: Geant4Converter.h:45
dd4hep::sim::Geant4UIMessenger::addCall
void addCall(const std::string &name, const std::string &description, const Callback &cb, size_t npar=0)
Add a new callback structure.
Definition: Geant4UIMessenger.cpp:60
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::PlacedVolume::volume
Volume volume() const
Logical volume of this placement.
Definition: Volumes.cpp:468
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::sim::Geant4Action::always
void always(const char *fmt,...) const
Support of always printed messages.
Definition: Geant4Action.cpp:199
dd4hep::sim::Geant4DetectorGeometryConstruction::m_dumpGDML
std::string m_dumpGDML
Property: G4 GDML dump file name (default: empty. If non empty, dump)
Definition: Geant4DetectorGeometryConstruction.cpp:68
dd4hep::sim::Geant4DetectorGeometryConstruction::writeGDML
int writeGDML(const char *gdml_output)
Write GDML file.
Definition: Geant4DetectorGeometryConstruction.cpp:420
dd4hep::sim::Geant4HierarchyDump::dump
virtual void dump(const std::string &indent, const G4VPhysicalVolume *vol) const
Dump the volume hierarchy as it is known to geant 4.
Definition: Geant4HierarchyDump.cpp:79
Geant4Kernel.h
dd4hep::sim::Geant4Mapping::haveVolManager
bool haveVolManager
Disable building Geant4 voilume manager. Throw exception when accessed.
Definition: Geant4Mapping.h:47
dd4hep::sim::Geant4Mapping::detach
Geant4GeometryInfo * detach()
Release data and pass over the ownership.
Definition: Geant4Mapping.cpp:58
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugVolManager
long m_debugVolManager
Property: Flag to debug G4 volume manager population.
Definition: Geant4DetectorGeometryConstruction.cpp:38
dd4hep::sim::Geant4DetectorConstructionContext::geometry
Geant4GeometryInfo * geometry
The cached geometry information.
Definition: Geant4DetectorConstruction.h:72
dd4hep::sim::Geant4Action::enableUI
virtual void enableUI()
Enable and install UI messenger.
Definition: Geant4Action.cpp:134
dd4hep::sim::Geant4GeometryInfo::world
G4VPhysicalVolume * world() const
The world placement.
Definition: Geant4GeometryInfo.cpp:37
InstanceCount.h
dd4hep::sim::Geant4DetectorConstruction
Basic implementation of the Geant4 detector construction action.
Definition: Geant4DetectorConstruction.h:102
DD4hepUnits.h
dd4hep::sim::Geant4Converter::printPlacements
bool printPlacements
Property: Flag to dump all placements after the conversion procedure.
Definition: Geant4Converter.h:54
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugVolumes
bool m_debugVolumes
Property: Flag to debug volumes during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:48
Printout.h
Geant4Converter.h
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Geant4DetectorGeometryConstruction::printG4Tree
int printG4Tree(const char *vol_path)
Print geant4 volume tree.
Definition: Geant4DetectorGeometryConstruction.cpp:458
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:270
dd4hep::sim::Geant4GeometryInfo::g4Volumes
Geant4GeometryMaps::VolumeMap g4Volumes
Definition: Geant4GeometryInfo.h:114