Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-15 08:15:12

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include <DDG4/Geant4GeometryInfo.h>
0016 #include <DDG4/Geant4AssemblyVolume.h>
0017 #include <DD4hep/Printout.h>
0018 
0019 // Geant4 include files
0020 #include <G4VPhysicalVolume.hh>
0021 
0022 using namespace dd4hep::sim;
0023 
0024 /// Default constructor
0025 Geant4GeometryInfo::Geant4GeometryInfo()
0026   : TNamed("Geant4GeometryInfo", "Geant4GeometryInfo"), m_world(0), printLevel(DEBUG), valid(false) {
0027 }
0028 
0029 /// Default destructor
0030 Geant4GeometryInfo::~Geant4GeometryInfo() {
0031   for( auto& a : g4AssemblyVolumes )
0032     delete a.second;
0033   g4AssemblyVolumes.clear();
0034 }
0035 
0036 /// The world placement
0037 G4VPhysicalVolume* Geant4GeometryInfo::world() const   {
0038   if ( m_world ) return m_world;
0039   except("Geant4GeometryInfo", "Attempt to access invalid world placement");
0040   return m_world;
0041 }
0042 
0043 /// Set the world placement
0044 void Geant4GeometryInfo::setWorld(const TGeoNode* node)    {
0045   Geant4GeometryMaps::PlacementMap::const_iterator g4it = g4Placements.find(node);
0046   G4VPhysicalVolume* g4 = (g4it == g4Placements.end()) ? 0 : (*g4it).second;
0047   if (!g4) {
0048     except("Geant4GeometryInfo", "Attempt to SET invalid world placement");
0049   }
0050   m_world = g4;
0051 }