![]() |
|
|||
File indexing completed on 2025-09-16 08:27:19
0001 //------------------------------- -*- C++ -*- -------------------------------// 0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details 0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0004 //---------------------------------------------------------------------------// 0005 //! \file accel/UserActionIntegration.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include "corecel/sys/Stopwatch.hh" 0010 0011 #include "IntegrationBase.hh" 0012 0013 class G4Event; 0014 class G4Track; 0015 0016 namespace celeritas 0017 { 0018 //---------------------------------------------------------------------------// 0019 0020 struct SetupOptions; 0021 0022 //---------------------------------------------------------------------------// 0023 /*! 0024 * Simple interface for G4VUserTrackingAction-based integration. 0025 * 0026 * This singleton integrates both thread-local and global data with the user 0027 * application. To use this class in your Geant4 application to offload tracks 0028 * to Celeritas: 0029 * 0030 * - Set up the \c Options before calling \c G4RunManager::Initialize 0031 * - Call \c BeginOfRunAction and \c EndOfRunAction from \c UserRunAction 0032 * - Call \c BeginOfEvent and \c EndOfEvent from \c UserEventAction 0033 * - Call \c PreUserTrackingAction from your \c UserTrackingAction 0034 * 0035 * The \c CELER_DISABLE environment variable, if set and non-empty, will 0036 * disable offloading so that Celeritas will not be built nor kill tracks. 0037 * 0038 * The method names correspond to methods in Geant4 User Actions and \em must 0039 * be called from all threads, both worker and master. 0040 * 0041 * \note Prefer to use \c celeritas::TrackingManagerIntegration instead of this 0042 * class, unless you need support for Geant4 earlier than 11.1. 0043 * 0044 * \todo Provide default minimal action initialization classes for user? 0045 */ 0046 class UserActionIntegration final : public IntegrationBase 0047 { 0048 public: 0049 // Access the singleton 0050 static UserActionIntegration& Instance(); 0051 0052 // Start the run 0053 void BeginOfRunAction(G4Run const* run) final; 0054 0055 // Send Celeritas the event ID 0056 void BeginOfEventAction(G4Event const* event); 0057 0058 // Send tracks to Celeritas if applicable and "StopAndKill" if so 0059 void PreUserTrackingAction(G4Track* track); 0060 0061 // Flush offloaded tracks from Celeritas 0062 void EndOfEventAction(G4Event const* event); 0063 0064 private: 0065 // Only allow the singleton to construct 0066 UserActionIntegration(); 0067 0068 Stopwatch get_event_time_; 0069 }; 0070 0071 //---------------------------------------------------------------------------// 0072 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |