File indexing completed on 2025-08-05 08:09:45
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "ActsExamples/Geant4/DetectorConstructionFactory.hpp"
0012 #include "ActsExamples/Geant4/RegionCreator.hpp"
0013
0014 #include <memory>
0015
0016 #include <G4VUserDetectorConstruction.hh>
0017
0018 class G4VPhysicalVolume;
0019
0020 namespace dd4hep {
0021 class Detector;
0022 }
0023 namespace ActsExamples {
0024
0025 namespace DD4hep {
0026 struct DD4hepDetector;
0027 }
0028
0029
0030 class DDG4DetectorConstruction final : public G4VUserDetectorConstruction {
0031 public:
0032 DDG4DetectorConstruction(
0033 std::shared_ptr<DD4hep::DD4hepDetector> detector,
0034 std::vector<std::shared_ptr<RegionCreator>> regionCreators = {});
0035 ~DDG4DetectorConstruction() final;
0036
0037
0038
0039
0040
0041
0042
0043
0044 G4VPhysicalVolume* Construct() final;
0045
0046 private:
0047
0048 std::shared_ptr<DD4hep::DD4hepDetector> m_detector;
0049
0050 std::vector<std::shared_ptr<RegionCreator>> m_regionCreators;
0051
0052 G4VPhysicalVolume* m_world = nullptr;
0053
0054
0055 dd4hep::Detector& dd4hepDetector() const;
0056 };
0057
0058 class DDG4DetectorConstructionFactory final
0059 : public DetectorConstructionFactory {
0060 public:
0061 DDG4DetectorConstructionFactory(
0062 std::shared_ptr<DD4hep::DD4hepDetector> detector,
0063 std::vector<std::shared_ptr<RegionCreator>> regionCreators = {});
0064 ~DDG4DetectorConstructionFactory() final;
0065
0066 std::unique_ptr<G4VUserDetectorConstruction> factorize() const override;
0067
0068 private:
0069
0070 std::shared_ptr<DD4hep::DD4hepDetector> m_detector;
0071
0072 std::vector<std::shared_ptr<RegionCreator>> m_regionCreators;
0073 };
0074
0075 }