From 1384e8ce48127c34d49ee91730470f88d43f7970 Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Wed, 11 Dec 2024 23:23:55 -0500 Subject: [PATCH 01/10] Add option to build with celeritas --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7095e914..9900a1bf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ math(EXPR DD4HEP_HIGH_MEM_POOL_DEPTH "${HOST_RAM_MB} / 2000" OUTPUT_FORMAT DECIM option(DD4HEP_USE_XERCESC "Enable 'Detector Builders' based on XercesC" OFF) option(DD4HEP_USE_GEANT4 "Enable the simulation part based on Geant4" OFF) +option(DD4HEP_USE_CELERITAS "Enable offloading tracks to Celeritas" OFF) option(DD4HEP_IGNORE_GEANT4_TLS "Ignore the tls flag Geant4 was compiled with" OFF) option(DD4HEP_USE_GEAR "Build gear wrapper for backward compatibility" OFF) option(DD4HEP_USE_LCIO "Build lcio extensions" OFF) @@ -154,6 +155,10 @@ if(DD4HEP_USE_GEANT4) SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "") endif() +if(DD4HEP_USE_CELERITAS) + find_package(Celeritas REQUIRED) +endif() + if(DD4HEP_USE_LCIO) find_package(LCIO REQUIRED CONFIG) DD4HEP_SETUP_LCIO_TARGETS() From 5cb88c5d56c6caefd5b89f77979a3f6398e525a7 Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Thu, 12 Dec 2024 13:07:05 -0500 Subject: [PATCH 02/10] First attempt at using G4VTrackingManager method for celeritas offload --- DDG4/include/DDG4/Celeritas.h | 31 ++++++++++ DDG4/include/DDG4/Geant4PhysicsList.h | 2 + DDG4/src/Celeritas.cpp | 87 +++++++++++++++++++++++++++ DDG4/src/Geant4PhysicsList.cpp | 12 ++++ 4 files changed, 132 insertions(+) create mode 100644 DDG4/include/DDG4/Celeritas.h create mode 100644 DDG4/src/Celeritas.cpp diff --git a/DDG4/include/DDG4/Celeritas.h b/DDG4/include/DDG4/Celeritas.h new file mode 100644 index 000000000..0d2c39128 --- /dev/null +++ b/DDG4/include/DDG4/Celeritas.h @@ -0,0 +1,31 @@ +#ifndef Celeritas_h +#define Celeritas_h 1 + +#include +#include + +namespace celeritas +{ + class LocalTransporter; + struct SetupOptions; + class SharedParams; + + class EMPhysicsConstructor final : public G4EmStandardPhysics + { + public: + using G4EmStandardPhysics::G4EmStandardPhysics; + + void ConstructProcess() override; + }; +} + +// Global shared setup options +celeritas::SetupOptions& CelerSetupOptions(); +// Shared data and GPU setup +celeritas::SharedParams& CelerSharedParams(); +// Thread-local transporter +celeritas::LocalTransporter& CelerLocalTransporter(); +// Thread-local offload +celeritas::SimpleOffload& CelerSimpleOffload(); + +#endif diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index 2ea7fb758..6ec0ab9b6 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -292,6 +292,8 @@ namespace dd4hep { virtual void enable(G4VUserPhysicsList* physics); /// Extend physics list from factory: G4VUserPhysicsList* extensionList(); + /// Activate Celeritas tracking offload within EM physics constructor + G4VUserPhysicsList* activateCeleritas(); }; } // End namespace sim diff --git a/DDG4/src/Celeritas.cpp b/DDG4/src/Celeritas.cpp new file mode 100644 index 000000000..ceae1fbe1 --- /dev/null +++ b/DDG4/src/Celeritas.cpp @@ -0,0 +1,87 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace celeritas; + +// Global shared setup options +SetupOptions& CelerSetupOptions() +{ + static SetupOptions options = [] { + // Construct setup options the first time CelerSetupOptions is invoked + SetupOptions so; + + // Set along-step factory + so.make_along_step = celeritas::UniformAlongStepFactory(); + // NOTE: these numbers are appropriate for CPU execution + so.max_num_tracks = 1024; + // This will eventually go + so.max_num_events = 100000; + so.initializer_capacity = 1024 * 128; + // Celeritas does not support EmStandard MSC physics above 100 MeV + so.ignore_processes = {"CoulombScat"}; + + // Use Celeritas "hit processor" to call back to Geant4 SDs. + so.sd.enabled = false; + + // Only call back for nonzero energy depositions: this is currently a + // global option for all detectors, so if any SDs extract data from tracks + // with no local energy deposition over the step, it must be set to false. + so.sd.ignore_zero_deposition = false; + + // Using the pre-step point, reconstruct the G4 touchable handle. + so.sd.locate_touchable = true; + + // Pre-step time is used + so.sd.pre.global_time = true; + return so; + }(); + return options; +} + +// Shared data and GPU setup +SharedParams& CelerSharedParams() +{ + static SharedParams sp; + return sp; +} + +// Thread-local transporter +LocalTransporter& CelerLocalTransporter() +{ + static G4ThreadLocal LocalTransporter lt; + return lt; +} + +// Thread-local offload interface +SimpleOffload& CelerSimpleOffload() +{ + static G4ThreadLocal SimpleOffload so; + return so; +} + +void EMPhysicsConstructor::ConstructProcess() +{ + CELER_LOG_LOCAL(status) << "Setting up tracking manager offload"; + G4EmStandardPhysics::ConstructProcess(); + + // Add Celeritas tracking manager to electron, positron, gamma. + auto* celer_tracking = new TrackingManagerOffload( + &CelerSharedParams(), &CelerLocalTransporter()); + + G4Electron::Definition()->SetTrackingManager(celer_tracking); + G4Positron::Definition()->SetTrackingManager(celer_tracking); + G4Gamma::Definition()->SetTrackingManager(celer_tracking); +} diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index 5db15f983..3ecd47cd4 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -19,6 +19,7 @@ #include #include #include +#include // Geant4 include files #include @@ -374,6 +375,17 @@ G4VUserPhysicsList* Geant4PhysicsListActionSequence::extensionList() { return physics; } +G4VUserPhysicsList* Geant4PhysicsListActionSequence::activateCeleritas() { + G4VModularPhysicsList* physics = ( m_extends.empty() ) + ? new EmptyPhysics() + : G4PhysListFactory().GetReferencePhysList(m_extends); + +physics->ReplacePhysics(new celeritas::EMPhysicsConstructor); + +return physics; +} + + /// Install command control messenger if wanted void Geant4PhysicsListActionSequence::installCommandMessenger() { control()->addCall("dump", "Dump content of " + name(), Callback(this).make(&Geant4PhysicsListActionSequence::dump)); From 464cac25cae9405ceb1bc86fab3212e46cb46e2e Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Thu, 12 Dec 2024 13:38:04 -0500 Subject: [PATCH 03/10] Remove obsolete celeritas configuration parameter Co-authored-by: Seth R. Johnson --- DDG4/src/Celeritas.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/DDG4/src/Celeritas.cpp b/DDG4/src/Celeritas.cpp index ceae1fbe1..a33215e7f 100644 --- a/DDG4/src/Celeritas.cpp +++ b/DDG4/src/Celeritas.cpp @@ -27,8 +27,6 @@ SetupOptions& CelerSetupOptions() so.make_along_step = celeritas::UniformAlongStepFactory(); // NOTE: these numbers are appropriate for CPU execution so.max_num_tracks = 1024; - // This will eventually go - so.max_num_events = 100000; so.initializer_capacity = 1024 * 128; // Celeritas does not support EmStandard MSC physics above 100 MeV so.ignore_processes = {"CoulombScat"}; From 48b26f956d398d90fb2e093e22297d9a0e31e464 Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Thu, 12 Dec 2024 14:41:32 -0500 Subject: [PATCH 04/10] Move definitions under dd4hep::sim namespace --- DDG4/include/DDG4/Celeritas.h | 31 +++++++++++++++++++------------ DDG4/src/Celeritas.cpp | 23 ++++++++++++----------- DDG4/src/Geant4PhysicsList.cpp | 2 +- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/DDG4/include/DDG4/Celeritas.h b/DDG4/include/DDG4/Celeritas.h index 0d2c39128..09f99532f 100644 --- a/DDG4/include/DDG4/Celeritas.h +++ b/DDG4/include/DDG4/Celeritas.h @@ -4,8 +4,12 @@ #include #include -namespace celeritas -{ +/// Namespace for the AIDA detector description toolkit +namespace dd4hep { + + /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit + namespace sim { + class LocalTransporter; struct SetupOptions; class SharedParams; @@ -17,15 +21,18 @@ namespace celeritas void ConstructProcess() override; }; -} - -// Global shared setup options -celeritas::SetupOptions& CelerSetupOptions(); -// Shared data and GPU setup -celeritas::SharedParams& CelerSharedParams(); -// Thread-local transporter -celeritas::LocalTransporter& CelerLocalTransporter(); -// Thread-local offload -celeritas::SimpleOffload& CelerSimpleOffload(); + + // Global shared setup options + celeritas::SetupOptions& CelerSetupOptions(); + // Shared data and GPU setup + celeritas::SharedParams& CelerSharedParams(); + // Thread-local transporter + celeritas::LocalTransporter& CelerLocalTransporter(); + // Thread-local offload + celeritas::SimpleOffload& CelerSimpleOffload(); + + } /* End namespace sim */ +} /* End namespace dd4hep*/ + #endif diff --git a/DDG4/src/Celeritas.cpp b/DDG4/src/Celeritas.cpp index a33215e7f..d8f045675 100644 --- a/DDG4/src/Celeritas.cpp +++ b/DDG4/src/Celeritas.cpp @@ -14,14 +14,15 @@ #include -using namespace celeritas; + +using namespace dd4hep::sim; // Global shared setup options -SetupOptions& CelerSetupOptions() +celeritas::SetupOptions& CelerSetupOptions() { - static SetupOptions options = [] { + static celeritas::SetupOptions options = [] { // Construct setup options the first time CelerSetupOptions is invoked - SetupOptions so; + celeritas::SetupOptions so; // Set along-step factory so.make_along_step = celeritas::UniformAlongStepFactory(); @@ -50,23 +51,23 @@ SetupOptions& CelerSetupOptions() } // Shared data and GPU setup -SharedParams& CelerSharedParams() +celeritas::SharedParams& CelerSharedParams() { - static SharedParams sp; + static celeritas::SharedParams sp; return sp; } // Thread-local transporter -LocalTransporter& CelerLocalTransporter() +celeritas::LocalTransporter& CelerLocalTransporter() { - static G4ThreadLocal LocalTransporter lt; + static G4ThreadLocal celeritas::LocalTransporter lt; return lt; } // Thread-local offload interface -SimpleOffload& CelerSimpleOffload() +celeritas::SimpleOffload& CelerSimpleOffload() { - static G4ThreadLocal SimpleOffload so; + static G4ThreadLocal celeritas::SimpleOffload so; return so; } @@ -76,7 +77,7 @@ void EMPhysicsConstructor::ConstructProcess() G4EmStandardPhysics::ConstructProcess(); // Add Celeritas tracking manager to electron, positron, gamma. - auto* celer_tracking = new TrackingManagerOffload( + auto* celer_tracking = new celeritas::TrackingManagerOffload( &CelerSharedParams(), &CelerLocalTransporter()); G4Electron::Definition()->SetTrackingManager(celer_tracking); diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index 3ecd47cd4..13d10bf2b 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -380,7 +380,7 @@ G4VUserPhysicsList* Geant4PhysicsListActionSequence::activateCeleritas() { ? new EmptyPhysics() : G4PhysListFactory().GetReferencePhysList(m_extends); -physics->ReplacePhysics(new celeritas::EMPhysicsConstructor); +physics->ReplacePhysics(new EMPhysicsConstructor); return physics; } From e9cc08bce62227fa4182741c5c2a9802fedd167c Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Thu, 12 Dec 2024 21:50:51 -0500 Subject: [PATCH 05/10] Link Celeritas libraries --- DDG4/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index 0a341469d..b3efd54f9 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -25,6 +25,8 @@ target_link_libraries(DDG4 PUBLIC DD4hep::DDCore Geant4::Interface + Celeritas::corecel + Celeritas::accel ) # #Ensure our own includes come before those of the system From 905a87977a9e3061359b55ee1aae2d90b1b8aca3 Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Thu, 12 Dec 2024 22:23:09 -0500 Subject: [PATCH 06/10] Change to test if it compiles with the celeritas configuration function definitions placed outside the dd4hep::sim namespace --- DDG4/include/DDG4/Celeritas.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/DDG4/include/DDG4/Celeritas.h b/DDG4/include/DDG4/Celeritas.h index 09f99532f..9f9327417 100644 --- a/DDG4/include/DDG4/Celeritas.h +++ b/DDG4/include/DDG4/Celeritas.h @@ -10,10 +10,6 @@ namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit namespace sim { - class LocalTransporter; - struct SetupOptions; - class SharedParams; - class EMPhysicsConstructor final : public G4EmStandardPhysics { public: @@ -21,18 +17,17 @@ namespace dd4hep { void ConstructProcess() override; }; - - // Global shared setup options - celeritas::SetupOptions& CelerSetupOptions(); - // Shared data and GPU setup - celeritas::SharedParams& CelerSharedParams(); - // Thread-local transporter - celeritas::LocalTransporter& CelerLocalTransporter(); - // Thread-local offload - celeritas::SimpleOffload& CelerSimpleOffload(); } /* End namespace sim */ } /* End namespace dd4hep*/ +// Global shared setup options +celeritas::SetupOptions& CelerSetupOptions(); +// Shared data and GPU setup +celeritas::SharedParams& CelerSharedParams(); +// Thread-local transporter +celeritas::LocalTransporter& CelerLocalTransporter(); +// Thread-local offload +celeritas::SimpleOffload& CelerSimpleOffload(); #endif From 7d49231fd932025e48c13e49a0013162ca4bd6ba Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Fri, 13 Dec 2024 09:52:46 -0500 Subject: [PATCH 07/10] Move Celeritas files into its own directory --- DDG4/CMakeLists.txt | 14 ++++++++++++-- DDG4/{src => celeritas}/Celeritas.cpp | 0 DDG4/{include/DDG4 => celeritas}/Celeritas.h | 0 DDG4/src/Geant4PhysicsList.cpp | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) rename DDG4/{src => celeritas}/Celeritas.cpp (100%) rename DDG4/{include/DDG4 => celeritas}/Celeritas.h (100%) diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index b3efd54f9..3bbd6e46d 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -25,8 +25,6 @@ target_link_libraries(DDG4 PUBLIC DD4hep::DDCore Geant4::Interface - Celeritas::corecel - Celeritas::accel ) # #Ensure our own includes come before those of the system @@ -104,6 +102,18 @@ IF(TARGET LCIO::lcio) ENDIF() +IF(DD4HEP_USE_CELERITAS) + + dd4hep_add_plugin(DDG4Celeritas + SOURCES celeritas/*.cpp + INCLUDES $ + USES DD4hep::DDG4 Celeritas::accel Celeritas::corecel + ) + install(TARGETS DDG4Celeritas EXPORT DD4hep LIBRARY DESTINATION lib) + set_target_properties(DDG4Celeritas PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) + +ENDIF() + IF(TARGET EDM4HEP::edm4hep) dd4hep_add_plugin(DDG4EDM4HEP SOURCES edm4hep/*.cpp diff --git a/DDG4/src/Celeritas.cpp b/DDG4/celeritas/Celeritas.cpp similarity index 100% rename from DDG4/src/Celeritas.cpp rename to DDG4/celeritas/Celeritas.cpp diff --git a/DDG4/include/DDG4/Celeritas.h b/DDG4/celeritas/Celeritas.h similarity index 100% rename from DDG4/include/DDG4/Celeritas.h rename to DDG4/celeritas/Celeritas.h diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index 13d10bf2b..fef5a7000 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include // Geant4 include files #include From c25f07ff4ff2b3b9ae3bce1eebb9534237917567 Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Fri, 13 Dec 2024 10:31:18 -0500 Subject: [PATCH 08/10] New class inheriting from Geant4PhysicsListAction to separate out celeritas pieces from DDG4 --- DDG4/celeritas/Celeritas.cpp | 20 +++++++++++++++++++- DDG4/celeritas/Celeritas.h | 15 ++++++++++++++- DDG4/include/DDG4/Geant4PhysicsList.h | 2 -- DDG4/src/Geant4PhysicsList.cpp | 12 ------------ 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/DDG4/celeritas/Celeritas.cpp b/DDG4/celeritas/Celeritas.cpp index d8f045675..457894ac5 100644 --- a/DDG4/celeritas/Celeritas.cpp +++ b/DDG4/celeritas/Celeritas.cpp @@ -1,4 +1,4 @@ -#include +#include "Celeritas.h" #include #include @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include @@ -84,3 +86,19 @@ void EMPhysicsConstructor::ConstructProcess() G4Positron::Definition()->SetTrackingManager(celer_tracking); G4Gamma::Definition()->SetTrackingManager(celer_tracking); } + +struct EmptyPhysics : public G4VModularPhysicsList { + EmptyPhysics() = default; // Default constructor, does nothing + virtual ~EmptyPhysics() = default; // Virtual destructor, does nothing +}; + +G4VUserPhysicsList* CeleritasPhysicsListActionSequence::activateCeleritas() { + G4VModularPhysicsList* physics = ( m_extends.empty() ) + ? new EmptyPhysics() + : G4PhysListFactory().GetReferencePhysList(m_extends); + +physics->ReplacePhysics(new EMPhysicsConstructor); + +return physics; +} + diff --git a/DDG4/celeritas/Celeritas.h b/DDG4/celeritas/Celeritas.h index 9f9327417..97b8ddd68 100644 --- a/DDG4/celeritas/Celeritas.h +++ b/DDG4/celeritas/Celeritas.h @@ -1,6 +1,7 @@ #ifndef Celeritas_h #define Celeritas_h 1 +#include #include #include @@ -9,7 +10,7 @@ namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit namespace sim { - + class EMPhysicsConstructor final : public G4EmStandardPhysics { public: @@ -18,6 +19,18 @@ namespace dd4hep { void ConstructProcess() override; }; + class CeleritasPhysicsListActionSequence : public + Geant4PhysicsListActionSequence { + + public: + /// Standard constructor + CeleritasPhysicsListActionSequence(Geant4Context* context, const std::string& nam); + /// Default destructor + virtual ~CeleritasPhysicsListActionSequence(); + + G4VUserPhysicsList* activateCeleritas(); + }; + } /* End namespace sim */ } /* End namespace dd4hep*/ diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index 6ec0ab9b6..2ea7fb758 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -292,8 +292,6 @@ namespace dd4hep { virtual void enable(G4VUserPhysicsList* physics); /// Extend physics list from factory: G4VUserPhysicsList* extensionList(); - /// Activate Celeritas tracking offload within EM physics constructor - G4VUserPhysicsList* activateCeleritas(); }; } // End namespace sim diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index fef5a7000..5db15f983 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -19,7 +19,6 @@ #include #include #include -#include // Geant4 include files #include @@ -375,17 +374,6 @@ G4VUserPhysicsList* Geant4PhysicsListActionSequence::extensionList() { return physics; } -G4VUserPhysicsList* Geant4PhysicsListActionSequence::activateCeleritas() { - G4VModularPhysicsList* physics = ( m_extends.empty() ) - ? new EmptyPhysics() - : G4PhysListFactory().GetReferencePhysList(m_extends); - -physics->ReplacePhysics(new EMPhysicsConstructor); - -return physics; -} - - /// Install command control messenger if wanted void Geant4PhysicsListActionSequence::installCommandMessenger() { control()->addCall("dump", "Dump content of " + name(), Callback(this).make(&Geant4PhysicsListActionSequence::dump)); From 2fb110eafae125fa193f679798f0eb3303fb801b Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Fri, 13 Dec 2024 10:37:56 -0500 Subject: [PATCH 09/10] Improve formatting. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9900a1bf3..f5c89fe20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,7 @@ math(EXPR DD4HEP_HIGH_MEM_POOL_DEPTH "${HOST_RAM_MB} / 2000" OUTPUT_FORMAT DECIM option(DD4HEP_USE_XERCESC "Enable 'Detector Builders' based on XercesC" OFF) option(DD4HEP_USE_GEANT4 "Enable the simulation part based on Geant4" OFF) -option(DD4HEP_USE_CELERITAS "Enable offloading tracks to Celeritas" OFF) +option(DD4HEP_USE_CELERITAS "Enable offloading tracks to Celeritas" OFF) option(DD4HEP_IGNORE_GEANT4_TLS "Ignore the tls flag Geant4 was compiled with" OFF) option(DD4HEP_USE_GEAR "Build gear wrapper for backward compatibility" OFF) option(DD4HEP_USE_LCIO "Build lcio extensions" OFF) From 5ec880e273e2d27fd2045d134c32075587060744 Mon Sep 17 00:00:00 2001 From: SAKIB RAHMAN Date: Fri, 13 Dec 2024 11:08:52 -0500 Subject: [PATCH 10/10] Moving configuration functions under dd4hep::sim scope --- DDG4/celeritas/Celeritas.cpp | 8 ++++---- DDG4/celeritas/Celeritas.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/DDG4/celeritas/Celeritas.cpp b/DDG4/celeritas/Celeritas.cpp index 457894ac5..1134c79ed 100644 --- a/DDG4/celeritas/Celeritas.cpp +++ b/DDG4/celeritas/Celeritas.cpp @@ -20,7 +20,7 @@ using namespace dd4hep::sim; // Global shared setup options -celeritas::SetupOptions& CelerSetupOptions() +celeritas::SetupOptions& dd4hep::sim::CelerSetupOptions() { static celeritas::SetupOptions options = [] { // Construct setup options the first time CelerSetupOptions is invoked @@ -53,21 +53,21 @@ celeritas::SetupOptions& CelerSetupOptions() } // Shared data and GPU setup -celeritas::SharedParams& CelerSharedParams() +celeritas::SharedParams& dd4hep::sim::CelerSharedParams() { static celeritas::SharedParams sp; return sp; } // Thread-local transporter -celeritas::LocalTransporter& CelerLocalTransporter() +celeritas::LocalTransporter& dd4hep::sim::CelerLocalTransporter() { static G4ThreadLocal celeritas::LocalTransporter lt; return lt; } // Thread-local offload interface -celeritas::SimpleOffload& CelerSimpleOffload() +celeritas::SimpleOffload& dd4hep::sim::CelerSimpleOffload() { static G4ThreadLocal celeritas::SimpleOffload so; return so; diff --git a/DDG4/celeritas/Celeritas.h b/DDG4/celeritas/Celeritas.h index 97b8ddd68..fe4282e3e 100644 --- a/DDG4/celeritas/Celeritas.h +++ b/DDG4/celeritas/Celeritas.h @@ -11,6 +11,15 @@ namespace dd4hep { /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit namespace sim { + // Global shared setup options + celeritas::SetupOptions& CelerSetupOptions(); + // Shared data and GPU setup + celeritas::SharedParams& CelerSharedParams(); + // Thread-local transporter + celeritas::LocalTransporter& CelerLocalTransporter(); + // Thread-local offload + celeritas::SimpleOffload& CelerSimpleOffload(); + class EMPhysicsConstructor final : public G4EmStandardPhysics { public: @@ -34,13 +43,4 @@ namespace dd4hep { } /* End namespace sim */ } /* End namespace dd4hep*/ -// Global shared setup options -celeritas::SetupOptions& CelerSetupOptions(); -// Shared data and GPU setup -celeritas::SharedParams& CelerSharedParams(); -// Thread-local transporter -celeritas::LocalTransporter& CelerLocalTransporter(); -// Thread-local offload -celeritas::SimpleOffload& CelerSimpleOffload(); - #endif