From b3ed1078585dfa840af967491abdc39b7afe9806 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 7 Aug 2023 12:25:06 -0500 Subject: [PATCH] feat: eAST physics list plugin for npsim --- CMakeLists.txt | 8 +++++ src/east/CMakeLists.txt | 18 +++++++++++ src/east/src/eASTPhysicsListPlugin.cxx | 44 ++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 src/east/CMakeLists.txt create mode 100644 src/east/src/eASTPhysicsListPlugin.cxx diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d0e6ea..241d94c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,10 @@ endif() # libfmt find_package(fmt REQUIRED) +# eAST +find_package(east) +message(STATUS "Found eAST: ${east_DIR}") + #----------------------------------------- # add the library sub directories add_subdirectory(src/plugins) @@ -82,6 +86,10 @@ add_subdirectory(src/geocad) add_subdirectory(src/config) add_subdirectory(src/tools) +if(TARGET east::eASTPhysicsListBase) + add_subdirectory(src/east) +endif() + #---------------------------------------------------------------------------- # Install and export targets install(EXPORT NPDetTargets diff --git a/src/east/CMakeLists.txt b/src/east/CMakeLists.txt new file mode 100644 index 0000000..ba61081 --- /dev/null +++ b/src/east/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.12 FATAL_ERROR) + +find_package(east) + +dd4hep_add_plugin(eASTPhysicsListPlugin + SOURCES + src/eASTPhysicsListPlugin.cxx + INCLUDES $ + USES DD4hep::DDCore DD4hep::DDG4 east::eASTPhysicsListBase +) + +install(TARGETS eASTPhysicsListPlugin + EXPORT NPDetTargets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) diff --git a/src/east/src/eASTPhysicsListPlugin.cxx b/src/east/src/eASTPhysicsListPlugin.cxx new file mode 100644 index 0000000..a5d1516 --- /dev/null +++ b/src/east/src/eASTPhysicsListPlugin.cxx @@ -0,0 +1,44 @@ +// Framework include files +#include +#include +#include +#include +#include +#include +#include +#include + +// eAST include files +#include + +namespace dd4hep { + namespace sim { + + // Wrapper for eASTPhysicsList + class eASTPhysicsListPlugin : public G4VPhysicsConstructor { + protected: + /// Reference to eAST physics list object + eASTPhysicsList* m_eASTPhysicsList{nullptr}; + + public: + /// Standard constructor + eASTPhysicsListPlugin() + : G4VPhysicsConstructor() { + m_eASTPhysicsList = new eASTPhysicsList(); + }; + /// Default destructor + virtual ~eASTPhysicsListPlugin() = default; + + virtual void ConstructParticle() { + m_eASTPhysicsList->ConstructParticle(); + }; + virtual void ConstructProcess() { + m_eASTPhysicsList->ConstructProcess(); + } + }; + + DECLARE_GEANT4_PHYSICS(eASTPhysicsListPlugin) + + } /* End namespace sim */ +} /* End namespace dd4hep */ +