Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: eAST physics list plugin for npsim #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions src/east/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

find_package(east)

dd4hep_add_plugin(eASTPhysicsListPlugin
SOURCES
src/eASTPhysicsListPlugin.cxx
INCLUDES $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
USES DD4hep::DDCore DD4hep::DDG4 east::eASTPhysicsListBase
)

install(TARGETS eASTPhysicsListPlugin
EXPORT NPDetTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
44 changes: 44 additions & 0 deletions src/east/src/eASTPhysicsListPlugin.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Framework include files
#include <DD4hep/Printout.h>
#include <DD4hep/InstanceCount.h>
#include <DDG4/Factories.h>
#include <DDG4/Geant4Random.h>
#include <DDG4/Geant4Context.h>
#include <DDG4/Geant4InputHandling.h>
#include <DDG4/Geant4Action.h>
#include <DDG4/Geant4PhysicsList.h>

// eAST include files
#include <eAST/eASTPhysicsList.hh>

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 */