DD4hep  1.31.0
Detector Description Toolkit for High Energy Physics
Geant4GeometryInfo.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 : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
17 #include <DD4hep/Printout.h>
18 
19 // Geant4 include files
20 #include <G4VPhysicalVolume.hh>
21 
22 using namespace dd4hep::sim;
23 
26  : TNamed("Geant4GeometryInfo", "Geant4GeometryInfo"), m_world(0), printLevel(DEBUG), valid(false) {
27 }
28 
31  for( auto& a : g4AssemblyVolumes )
32  delete a.second;
33  g4AssemblyVolumes.clear();
34 }
35 
37 G4VPhysicalVolume* Geant4GeometryInfo::world() const {
38  if ( m_world ) return m_world;
39  except("Geant4GeometryInfo", "Attempt to access invalid world placement");
40  return m_world;
41 }
42 
44 void Geant4GeometryInfo::setWorld(const TGeoNode* node) {
45  Geant4GeometryMaps::PlacementMap::const_iterator g4it = g4Placements.find(node);
46  G4VPhysicalVolume* g4 = (g4it == g4Placements.end()) ? 0 : (*g4it).second;
47  if (!g4) {
48  except("Geant4GeometryInfo", "Attempt to SET invalid world placement");
49  }
50  m_world = g4;
51 }
Geant4GeometryInfo.h
dd4hep::sim::Geant4GeometryInfo::g4AssemblyVolumes
Geant4GeometryMaps::AssemblyMap g4AssemblyVolumes
Definition: Geant4GeometryInfo.h:116
dd4hep::sim::Geant4GeometryInfo::Geant4GeometryInfo
Geant4GeometryInfo()
Default constructor.
Definition: Geant4GeometryInfo.cpp:25
dd4hep::sim::Geant4GeometryInfo::setWorld
void setWorld(const TGeoNode *node)
Set the world volume.
Definition: Geant4GeometryInfo.cpp:44
dd4hep::sim::Geant4GeometryInfo::~Geant4GeometryInfo
virtual ~Geant4GeometryInfo()
Default destructor.
Definition: Geant4GeometryInfo.cpp:30
Geant4AssemblyVolume.h
dd4hep::sim::Geant4GeometryInfo::g4Placements
Geant4GeometryMaps::PlacementMap g4Placements
Definition: Geant4GeometryInfo.h:115
TNamed
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:37
dd4hep::sim::Geant4GeometryInfo::m_world
G4VPhysicalVolume * m_world
Definition: Geant4GeometryInfo.h:138
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: EDM4hepFileReader.cpp:41
dd4hep::sim::Geant4GeometryInfo::world
G4VPhysicalVolume * world() const
The world placement.
Definition: Geant4GeometryInfo.cpp:37
valid
unsigned char valid
Definition: AlignmentsCalculator.cpp:69
Printout.h