Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 09:10:08

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 #ifndef DDG4_GEANT4MAPPING_H
0014 #define DDG4_GEANT4MAPPING_H
0015 
0016 // Framework include files
0017 #include <DD4hep/Detector.h>
0018 #include <DD4hep/Volumes.h>
0019 #include <DD4hep/GeoHandler.h>
0020 #include <DDG4/Geant4GeometryInfo.h>
0021 #include <DDG4/Geant4VolumeManager.h>
0022 
0023 /// Namespace for the AIDA detector description toolkit
0024 namespace dd4hep {
0025 
0026   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0027   namespace sim {
0028 
0029     /// Geometry mapping from dd4hep to Geant 4.
0030     /**
0031      *  \author  M.Frank
0032      *  \version 1.0
0033      *  \ingroup DD4HEP_SIMULATION
0034      */
0035     class Geant4Mapping: public detail::GeoHandlerTypes {
0036     protected:
0037       const Detector&     m_detDesc;
0038       Geant4GeometryInfo* m_dataPtr;
0039       
0040       /// When resolving pointers, we must check for the validity of the data block
0041       void checkValidity() const;
0042 
0043     public:
0044       /// Debug flag when populating the Geant4 volume manager (Option set by Geant4DetectorGeometryConstruction)
0045       long                debugVolManager {     0 };
0046       /// Disable building Geant4 voilume manager. Throw exception when accessed.
0047       bool                haveVolManager  {  true };
0048       
0049     public:
0050       /// Initializing Constructor
0051       Geant4Mapping(const Detector& description);
0052 
0053       /// Standard destructor
0054       virtual ~Geant4Mapping();
0055 
0056       /// Possibility to define a singleton instance
0057       static Geant4Mapping& instance();
0058 
0059       /// Accesor to the Detector instance
0060       const Detector& detectorDescription() const {
0061         return m_detDesc;
0062       }
0063 
0064       /// Access to the data pointer
0065       Geant4GeometryInfo& data() const {
0066         return *m_dataPtr;
0067       }
0068 
0069       /// Access to the data pointer
0070       Geant4GeometryInfo* ptr() const {
0071         return m_dataPtr;
0072       }
0073 
0074       /// Create and attach new data block. Delete old data block if present.
0075       Geant4GeometryInfo& init();
0076 
0077       /// Release data and pass over the ownership
0078       Geant4GeometryInfo* detach();
0079 
0080       /// Set a new data block
0081       void attach(Geant4GeometryInfo* data);
0082 
0083       /// Access the volume manager
0084       Geant4VolumeManager volumeManager() const;
0085 
0086       /// Accessor to resolve geometry placements
0087       PlacedVolume placement(const G4VPhysicalVolume* node) const;
0088     };
0089   }    // End namespace sim
0090 }      // End namespace dd4hep
0091 
0092 #endif // DDG4_GEANT4MAPPING_H