DD4hep  1.30.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  bool m_debugMaterials = false;
40  bool m_debugElements = false;
42  bool m_debugShapes = false;
44  bool m_debugVolumes = false;
46  bool m_debugPlacements = false;
48  bool m_debugReflections = false;
50  bool m_debugRegions = false;
52  bool m_debugLimits = false;
54  bool m_debugSurfaces = false;
55 
57  bool m_printPlacements = false;
59  bool m_printSensitives = false;
60 
64  std::string m_dumpGDML;
65 
67  int writeGDML(const char* gdml_output);
69  int printVolumeObj(const char* vol_path, PlacedVolume pv, int flg);
71  int printVolumeTree(const char* vol_path);
73  int printVolTree(const char* vol_path);
75  int printG4Tree(const char* vol_path);
77  int printVolume(const char* vol_path);
79  int checkVolume(const char* vol_path);
81  int printMaterial(const char* mat_name);
82 
83  std::pair<std::string, PlacedVolume> resolve_path(const char* vol_path) const;
84  void printG4(const std::string& prefix, const G4VPhysicalVolume* g4pv) const;
85 
86  public:
88  Geant4DetectorGeometryConstruction(Geant4Context* ctxt, const std::string& nam);
94  virtual void installCommandMessenger() override;
95  };
96  } // End namespace sim
97 } // End namespace dd4hep
98 
99 
100 // Framework include files
101 #include <DD4hep/InstanceCount.h>
102 #include <DD4hep/DetectorTools.h>
103 #include <DD4hep/DD4hepUnits.h>
104 #include <DD4hep/Printout.h>
105 #include <DD4hep/Detector.h>
106 
108 #include <DDG4/Geant4UIMessenger.h>
109 #include <DDG4/Geant4Converter.h>
110 #include <DDG4/Geant4Kernel.h>
111 #include <DDG4/Factories.h>
112 
113 #include <TGeoScaledShape.h>
114 
115 // Geant4 include files
116 #include <G4LogicalVolume.hh>
117 #include <G4PVPlacement.hh>
118 #include <G4Material.hh>
119 #include <G4Version.hh>
120 #include <G4VSolid.hh>
121 #include <CLHEP/Units/SystemOfUnits.h>
122 
123 #ifndef GEANT4_NO_GDML
124 #include <G4GDMLParser.hh>
125 #endif
126 
127 #include <cmath>
128 
129 using namespace dd4hep::sim;
131 
134 : Geant4DetectorConstruction(ctxt,nam)
135 {
136  declareProperty("DebugMaterials", m_debugMaterials);
137  declareProperty("DebugElements", m_debugElements);
138  declareProperty("DebugShapes", m_debugShapes);
139  declareProperty("DebugVolumes", m_debugVolumes);
140  declareProperty("DebugPlacements", m_debugPlacements);
141  declareProperty("DebugReflections", m_debugReflections);
142  declareProperty("DebugRegions", m_debugRegions);
143  declareProperty("DebugLimits", m_debugLimits);
144  declareProperty("DebugSurfaces", m_debugSurfaces);
145 
146  declareProperty("PrintPlacements", m_printPlacements);
147  declareProperty("PrintSensitives", m_printSensitives);
148  declareProperty("GeoInfoPrintLevel", m_geoInfoPrintLevel = DEBUG);
149 
150  declareProperty("DumpHierarchy", m_dumpHierarchy);
151  declareProperty("DumpGDML", m_dumpGDML="");
153 }
154 
158 }
159 
163  DetElement world = ctxt->description.world();
164  Geant4Converter conv(ctxt->description, outputLevel());
167  conv.debugShapes = m_debugShapes;
173  conv.debugLimits = m_debugLimits;
176 
177  ctxt->geometry = conv.create(world).detach();
178  ctxt->geometry->printLevel = outputLevel();
179  g4map.attach(ctxt->geometry);
180  G4VPhysicalVolume* w = ctxt->geometry->world();
181  // Save away the reference to the world volume
182  context()->kernel().setWorld(w);
183  // Create Geant4 volume manager only if not yet available
184  g4map.volumeManager();
185  if ( m_dumpHierarchy != 0 ) {
187  dmp.dump("",w);
188  }
189  ctxt->world = w;
190  if ( !m_dumpGDML.empty() ) writeGDML(m_dumpGDML.c_str());
191  else if ( ::getenv("DUMP_GDML") ) writeGDML(::getenv("DUMP_GDML"));
192  enableUI();
193 }
194 
195 std::pair<std::string, dd4hep::PlacedVolume>
197  std::string p = vol_path;
199  PlacedVolume top = det.world().placement();
201  if ( !pv.isValid() ) {
203  if ( de.isValid() ) {
204  pv = de.placement();
206  }
207  }
208  return make_pair(p,pv);
209 }
210 
213  if ( mat_name ) {
214  auto& g4map = Geant4Mapping::instance().data().g4Materials;
215  for ( auto it = g4map.begin(); it != g4map.end(); ++it ) {
216  const auto* mat = (*it).second;
217  if ( mat->GetName() == mat_name ) {
218  std::stringstream output;
219  const auto* ion = mat->GetIonisation();
220  printP2("+++ Dump of GEANT4 material: %s", mat_name);
221  output << mat;
222  if ( ion ) {
223  output << " MEE: ";
224  output << std::setprecision(12);
225  output << ion->GetMeanExcitationEnergy()/CLHEP::eV;
226  output << " [eV]";
227  }
228  else
229  output << " MEE: UNKNOWN";
230  always("+++ printMaterial: \n%s\n", output.str().c_str());
231  return 1;
232  }
233  }
234  warning("+++ printMaterial: FAILED to find the material %s", mat_name);
235  }
236  warning("+++ printMaterial: Property materialName not set!");
237  return 0;
238 }
239 
241 int Geant4DetectorGeometryConstruction::printVolumeObj(const char* vol_path, PlacedVolume pv, int flg) {
242  if ( pv.isValid() ) {
243  const G4LogicalVolume* vol = 0;
244  auto& g4map = Geant4Mapping::instance().data();
245  auto pit = g4map.g4Placements.find(pv.ptr());
246  auto vit = g4map.g4Volumes.find(pv.volume());
247  warning("+++ printVolume: %s", vol_path);
248  if ( vit != g4map.g4Volumes.end() ) {
249  vol = (*vit).second;
250  auto* sol = vol->GetSolid();
251  const auto* mat = vol->GetMaterial();
252  const auto* ion = mat->GetIonisation();
253  Solid sh = pv.volume().solid();
254  if ( flg ) {
255  printP2("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
256  printP2("+++ Dump of GEANT4 solid: %s", vol_path);
257  }
258  std::stringstream output;
259  if ( flg ) {
260  output << mat;
261  if ( ion ) {
262  output << " MEE: ";
263  output << std::setprecision(12);
264  output << ion->GetMeanExcitationEnergy()/CLHEP::eV;
265  output << " [eV]";
266  }
267  else
268  output << " MEE: UNKNOWN";
269  }
270  if ( flg ) {
271  output << std::endl << *sol;
272  printP2("%s", output.str().c_str());
273  printP2("+++ Dump of ROOT solid: %s", vol_path);
274  sh->InspectShape();
275  if ( sh->IsA() == TGeoScaledShape::Class() ) {
276  TGeoScaledShape* scaled = (TGeoScaledShape*)sh.ptr();
277  const Double_t* scale = scaled->GetScale()->GetScale();
278  double dot = scale[0]*scale[1]*scale[2];
279  printP2("+++ TGeoScaledShape: %8.3g %8.3g %8.3g [%s]", scale[0], scale[1], scale[2],
280  dot > 0e0 ? "RIGHT handed" : "LEFT handed");
281  }
282  else if ( pit != g4map.g4Placements.end() ) {
283  const G4VPhysicalVolume* pl = (*pit).second;
284  const G4RotationMatrix* rot = pl->GetRotation();
285  const G4ThreeVector& tr = pl->GetTranslation();
286  G4Transform3D transform(rot ? *rot : G4RotationMatrix(), tr);
287  HepGeom::Scale3D sc;
288  HepGeom::Rotate3D rr;
289  G4Translate3D tt;
290  transform.getDecomposition(sc,rr,tt);
291  double dot = sc(0,0)*sc(1,1)*sc(2,2);
292  printP2("+++ TGeoShape: %8.3g %8.3g %8.3g [%s]", sc(0,0), sc(1,1), sc(2,2),
293  dot > 0e0 ? "RIGHT handed" : "LEFT handed");
294  }
295  const TGeoMatrix* matrix = pv->GetMatrix();
296  printP2("+++ TGeoMatrix: %s",
297  matrix->TestBit(TGeoMatrix::kGeoReflection) ? "LEFT handed" : "RIGHT handed");
298  printP2("+++ Shape: %s cubic volume: %8.3g mm^3 area: %8.3g mm^2",
299  sol->GetName().c_str(), sol->GetCubicVolume(), sol->GetSurfaceArea());
300  }
301  return 1;
302  }
303  else {
304  auto ai = g4map.g4AssemblyVolumes.find(pv.ptr());
305  if ( ai != g4map.g4AssemblyVolumes.end() ) {
306  Volume v = pv.volume();
307  warning("+++ printVolume: volume %s is an assembly...need to resolve imprint",vol_path);
308  for(Int_t i=0; i < v->GetNdaughters(); ++i) {
309  TGeoNode* dau_nod = v->GetNode(i);
310  std::string p = vol_path + std::string("/") + dau_nod->GetName();
311  printVolumeObj(p.c_str(), dau_nod, flg);
312  }
313  return 0;
314  }
315  }
316  warning("+++ printVolume: FAILED to find the volume %s in geant4 mapping...",vol_path);
317  return 0;
318  }
319  warning("+++ printVolume: FAILED to dump invalid volume",vol_path);
320  return 0;
321 }
322 
325  if ( vol_path ) {
326  auto physVol = resolve_path(vol_path);
327  if ( physVol.second.isValid() ) {
328  return printVolumeObj(vol_path, physVol.second, ~0x0);
329  }
330  }
331  warning("+++ printVolume: Property VolumePath not set. [Ignored]");
332  return 0;
333 }
334 
337  if ( vol_path ) {
338  auto [p, pv] = resolve_path(vol_path);
339  if ( pv.isValid() ) {
340  if ( printVolumeObj(p.c_str(), pv, ~0x0) ) {
341  TGeoVolume* vol = pv->GetVolume();
342  for(Int_t i=0; i < vol->GetNdaughters(); ++i) {
343  PlacedVolume dau_pv(vol->GetNode(i));
344  std::string path = (p + "/") + dau_pv.name();
345  if ( printVolumeTree(path.c_str()) ) {
346  }
347  }
348  }
349  return 1;
350  }
351  }
352  warning("+++ printVolume: Could not access Volume/DetElement '%s'", vol_path ? vol_path : "UNKNOWN");
353  return 0;
354 }
355 
357  if ( vol_path ) {
358  auto [p, pv] = resolve_path(vol_path);
359  if ( pv.isValid() ) {
360  if ( printVolumeObj(p.c_str(), pv, 0) ) {
361  TGeoVolume* vol = pv->GetVolume();
362  for(Int_t i=0; i < vol->GetNdaughters(); ++i) {
363  PlacedVolume dau_pv(vol->GetNode(i));
364  std::string path = (p + "/") + dau_pv.name();
365  if ( printVolTree(path.c_str()) ) {
366  }
367  }
368  }
369  return 1;
370  }
371  }
372  warning("+++ printVolume: Could not access Volume/DetElement '%s'", vol_path ? vol_path : "UNKNOWN");
373  return 0;
374 }
375 
378  if ( vol_path ) {
379  auto physVol = resolve_path(vol_path);
380  auto pv = physVol.second;
381  if ( pv.isValid() ) {
382  auto& g4map = Geant4Mapping::instance().data().g4Volumes;
383  auto it = g4map.find(pv.volume());
384  if ( it != g4map.end() ) {
385  const G4LogicalVolume* vol = (*it).second;
386  auto* g4_sol = vol->GetSolid();
387  Box rt_sol = pv.volume().solid();
388  printP2("Geant4 Shape: %s cubic volume: %8.3g mm^3 area: %8.3g mm^2",
389  g4_sol->GetName().c_str(), g4_sol->GetCubicVolume(), g4_sol->GetSurfaceArea());
390 #if G4VERSION_NUMBER>=1040
391  G4ThreeVector pMin, pMax;
392  double conv = (dd4hep::centimeter/CLHEP::centimeter)/2.0;
393  g4_sol->BoundingLimits(pMin,pMax);
394  printP2("Geant4 Bounding box extends: %8.3g %8.3g %8.3g",
395  (pMax.x()-pMin.x())*conv, (pMax.y()-pMin.y())*conv, (pMax.z()-pMin.z())*conv);
396 #endif
397  printP2("ROOT Bounding box dimensions: %8.3g %8.3g %8.3g",
398  rt_sol->GetDX(), rt_sol->GetDY(), rt_sol->GetDZ());
399 
400  return 1;
401  }
402  }
403  warning("+++ checkVolume: FAILED to find the volume %s from the top volume",vol_path);
404  }
405  warning("+++ checkVolume: Property VolumePath not set. [Ignored]");
406  return 0;
407 }
408 
411 #ifdef GEANT4_NO_GDML
412  warning("+++ writeGDML: GDML not found in the present Geant4 build! Output: %s not written", output);
413 #else
414  G4VPhysicalVolume* w = context()->world();
415  if ( output && ::strlen(output) > 0 && output != m_dumpGDML.c_str() )
416  m_dumpGDML = output;
417 
418  if ( !m_dumpGDML.empty() ) {
419  G4GDMLParser parser;
420  parser.Write(m_dumpGDML.c_str(), w);
421  info("+++ writeGDML: Wrote GDML file: %s", m_dumpGDML.c_str());
422  return 1;
423  }
424  else {
425  const char* gdml_dmp = ::getenv("DUMP_GDML");
426  if ( gdml_dmp ) {
427  G4GDMLParser parser;
428  parser.Write(gdml_dmp, w);
429  info("+++ writeGDML: Wrote GDML file: %s", gdml_dmp);
430  return 1;
431  }
432  }
433  warning("+++ writeGDML: Neither property DumpGDML nor environment DUMP_GDML set. No file written!");
434 #endif
435  return 0;
436 }
437 
438 void Geant4DetectorGeometryConstruction::printG4(const std::string& prefix, const G4VPhysicalVolume* g4pv) const {
439  std::string path = prefix + "/";
440  printP2("+++ GEANT4 volume: %s", prefix.c_str());
441  auto* g4v = g4pv->GetLogicalVolume();
442  for(size_t i=0, n=g4v->GetNoDaughters(); i<n; ++i) {
443  auto* dau = g4v->GetDaughter(i);
444  printG4(path + dau->GetName(), dau);
445  }
446 }
447 
449  if ( vol_path ) {
450  auto [p, pv] = resolve_path(vol_path);
451  if ( pv.isValid() ) {
452  auto& g4map = Geant4Mapping::instance().data().g4Placements;
453  auto it = g4map.find(pv);
454  if ( it != g4map.end() ) {
455  printG4(p, (*it).second);
456  }
457  return 1;
458  }
459  }
460  warning("+++ printVolume: Could not access Volume/DetElement '%s'", vol_path ? vol_path : "UNKNOWN");
461  return 0;
462 }
463 
467  m_control->addCall("writeGDML", "GDML: write geometry to file: '"+m_dumpGDML+
468  "' [uses argument - or - property DumpGDML]",
470  m_control->addCall("printVolume", "Print Geant4 volume properties [uses argument]",
472  m_control->addCall("printTree", "Print volume tree WITHOUT properties [uses argument]",
474  m_control->addCall("printG4Tree", "Print Geant4 volume tree [uses argument]",
476  m_control->addCall("printVolumeTree", "Print volume tree with properties [uses argument]",
478  m_control->addCall("checkVolume", "Check Geant4 volume properties [uses argument]",
480  m_control->addCall("printMaterial", "Print Geant4 material properties [uses argument]",
482 }
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:40
dd4hep::sim::Geant4DetectorGeometryConstruction::printVolumeTree
int printVolumeTree(const char *vol_path)
Print volume tree with attributes.
Definition: Geant4DetectorGeometryConstruction.cpp:336
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:356
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:465
dd4hep::sim::Geant4Mapping::data
Geant4GeometryInfo & data() const
Access to the data pointer.
Definition: Geant4Mapping.h:58
Geant4HierarchyDump.h
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:173
dd4hep::sim::Geant4DetectorGeometryConstruction::~Geant4DetectorGeometryConstruction
virtual ~Geant4DetectorGeometryConstruction()
Default destructor.
Definition: Geant4DetectorGeometryConstruction.cpp:156
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugMaterials
bool m_debugMaterials
Property: Flag to debug materials during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:38
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:438
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:276
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:114
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:1223
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::sim::Geant4DetectorGeometryConstruction::m_printSensitives
bool m_printSensitives
Property: Flag to dump all sensitives after the conversion procedure.
Definition: Geant4DetectorGeometryConstruction.cpp:59
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:241
dd4hep::sim::Geant4Mapping::instance
static Geant4Mapping & instance()
Possibility to define a singleton instance.
Definition: Geant4Mapping.cpp:35
dd4hep::sim::Geant4DetectorGeometryConstruction::printMaterial
int printMaterial(const char *mat_name)
Print geant4 material.
Definition: Geant4DetectorGeometryConstruction.cpp:212
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:141
parser
dd4hepDOMParser * parser
Definition: DocumentHandler.cpp:159
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:214
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:1663
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugShapes
bool m_debugShapes
Property: Flag to debug shapes during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:42
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:378
dd4hep::sim::Geant4DetectorGeometryConstruction::m_printPlacements
bool m_printPlacements
Property: Flag to dump all placements after the conversion procedure.
Definition: Geant4DetectorGeometryConstruction.cpp:57
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugReflections
bool m_debugReflections
Property: Flag to debug reflections during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:48
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:196
dd4hep::sim::Geant4GeometryInfo::g4Placements
Geant4GeometryMaps::PlacementMap g4Placements
Definition: Geant4GeometryInfo.h:117
DetectorTools.h
dd4hep::Callback
Definition of the generic callback structure for member functions.
Definition: Callback.h:38
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:46
dd4hep::sim::Geant4DetectorGeometryConstruction::m_geoInfoPrintLevel
int m_geoInfoPrintLevel
Property: Printout level of info object.
Definition: Geant4DetectorGeometryConstruction.cpp:62
dd4hep::sim::Geant4Mapping::volumeManager
Geant4VolumeManager volumeManager() const
Access the volume manager.
Definition: Geant4Mapping.cpp:69
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugRegions
bool m_debugRegions
Property: Flag to debug regions during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:50
dd4hep::sim::Geant4DetectorGeometryConstruction::Geant4DetectorGeometryConstruction
Geant4DetectorGeometryConstruction(Geant4Context *ctxt, const std::string &nam)
Initializing constructor for DDG4.
Definition: Geant4DetectorGeometryConstruction.cpp:133
dd4hep::sim::Geant4Action::outputLevel
PrintLevel outputLevel() const
Access the output level.
Definition: Geant4Action.h:296
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:328
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:377
dd4hep::sim::Geant4DetectorGeometryConstruction::m_debugSurfaces
bool m_debugSurfaces
Property: Flag to debug regions during conversion mechanism.
Definition: Geant4DetectorGeometryConstruction.cpp:54
Factories.h
dd4hep::sim::Geant4DetectorGeometryConstruction::printVolume
int printVolume(const char *vol_path)
Print geant4 volume.
Definition: Geant4DetectorGeometryConstruction.cpp:324
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: Geant4Output2EDM4hep.cpp:49
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:52
dd4hep::Box
Class describing a box shape.
Definition: Shapes.h:294
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:153
dd4hep::sim::Geant4Mapping::attach
void attach(Geant4GeometryInfo *data)
Set a new data block.
Definition: Geant4Mapping.cpp:64
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:161
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:452
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:64
dd4hep::sim::Geant4DetectorGeometryConstruction::writeGDML
int writeGDML(const char *gdml_output)
Write GDML file.
Definition: Geant4DetectorGeometryConstruction.cpp:410
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::detach
Geant4GeometryInfo * detach()
Release data and pass over the ownership.
Definition: Geant4Mapping.cpp:57
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:52
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:44
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:448
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:270
dd4hep::sim::Geant4GeometryInfo::g4Volumes
Geant4GeometryMaps::VolumeMap g4Volumes
Definition: Geant4GeometryInfo.h:116