diff --git a/Simulation/DetSimCore/src/DetSimAlg.cpp b/Simulation/DetSimCore/src/DetSimAlg.cpp index 70dde30cd133d2a7c77493b64526f53da424c223..49eeedab573b3c28006fa3f01123ffdaefda4011 100644 --- a/Simulation/DetSimCore/src/DetSimAlg.cpp +++ b/Simulation/DetSimCore/src/DetSimAlg.cpp @@ -41,6 +41,7 @@ DetSimAlg::initialize() { } // Detector Construction + m_root_detelem = ToolHandle<IDetElemTool>(m_root_det_elem.value()); runmgr->SetUserInitialization(new DetectorConstruction()); // Physics List G4VUserPhysicsList *physicsList = nullptr; diff --git a/Simulation/DetSimCore/src/DetSimAlg.h b/Simulation/DetSimCore/src/DetSimAlg.h index 08ee2489f09b4920c4aa00ab5514afd45230f550..ff484969a9cca814e35f7ea77981ae07b549f8a5 100644 --- a/Simulation/DetSimCore/src/DetSimAlg.h +++ b/Simulation/DetSimCore/src/DetSimAlg.h @@ -10,6 +10,7 @@ #include <DetSimInterface/IDetSimSvc.h> #include <DetSimInterface/IAnaElemTool.h> +#include <DetSimInterface/IDetElemTool.h> class DetSimAlg: public Algorithm { public: @@ -22,6 +23,7 @@ public: private: SmartIF<IDetSimSvc> m_detsimsvc; ToolHandleArray<IAnaElemTool> m_anaelemtools; + ToolHandle<IDetElemTool> m_root_detelem; private: @@ -32,6 +34,7 @@ private: Gaudi::Property<std::string> m_physics_lists_name{this, "PhysicsList", "QGSP_BERT"}; Gaudi::Property<std::vector<std::string>> m_ana_elems{this, "AnaElems"}; + Gaudi::Property<std::string> m_root_det_elem{this, "RootDetElem"}; private: diff --git a/Simulation/DetSimInterface/DetSimInterface/IDetElemTool.h b/Simulation/DetSimInterface/DetSimInterface/IDetElemTool.h new file mode 100644 index 0000000000000000000000000000000000000000..37a361792f574cf806da98c23a0b25d705de5978 --- /dev/null +++ b/Simulation/DetSimInterface/DetSimInterface/IDetElemTool.h @@ -0,0 +1,25 @@ +#ifndef IDetElemTool_h +#define IDetElemTool_h + +// IDetElemTool is used to wrap the construction of G4LogicalVolume. +// Please note that the placement of logical volume is fixed in the code. +// If necessary, another IDetElemPosTool can be used to produce the positions +// of the daughters. +// IDetElemTool should represent the high level detectors/modules. + +#include "GaudiKernel/IAlgTool.h" + +class G4LogicalVolume; + +class IDetElemTool: virtual public IAlgTool { +public: + DeclareInterfaceID(IDetElemTool, 0, 1); + + virtual ~IDetElemTool() {} + + // return the constructed detector + virtual G4LogicalVolume* getLV() = 0; + +}; + +#endif