Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:23

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     public:
0043       /// Initializing Constructor
0044       Geant4Mapping(const Detector& description);
0045 
0046       /// Standard destructor
0047       virtual ~Geant4Mapping();
0048 
0049       /// Possibility to define a singleton instance
0050       static Geant4Mapping& instance();
0051 
0052       /// Accesor to the Detector instance
0053       const Detector& detectorDescription() const {
0054         return m_detDesc;
0055       }
0056 
0057       /// Access to the data pointer
0058       Geant4GeometryInfo& data() const {
0059         return *m_dataPtr;
0060       }
0061 
0062       /// Access to the data pointer
0063       Geant4GeometryInfo* ptr() const {
0064         return m_dataPtr;
0065       }
0066 
0067       /// Create and attach new data block. Delete old data block if present.
0068       Geant4GeometryInfo& init();
0069 
0070       /// Release data and pass over the ownership
0071       Geant4GeometryInfo* detach();
0072 
0073       /// Set a new data block
0074       void attach(Geant4GeometryInfo* data);
0075 
0076       /// Access the volume manager
0077       Geant4VolumeManager volumeManager() const;
0078 
0079       /// Accessor to resolve geometry placements
0080       PlacedVolume placement(const G4VPhysicalVolume* node) const;
0081     };
0082   }    // End namespace sim
0083 }      // End namespace dd4hep
0084 
0085 #endif // DDG4_GEANT4MAPPING_H