File indexing completed on 2025-01-18 09:14:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "DDG4/Geant4StackingAction.h"
0016
0017
0018 namespace dd4hep {
0019
0020
0021 namespace sim {
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 class TestStackingAction : public Geant4StackingAction {
0032 std::size_t m_calls_newStage { 0UL };
0033 std::size_t m_calls_prepare { 0UL };
0034 std::size_t m_calls_classify { 0UL };
0035
0036 public:
0037
0038 TestStackingAction(Geant4Context* context, const std::string& nam)
0039 : Geant4StackingAction(context, nam)
0040 {
0041 }
0042
0043 virtual ~TestStackingAction() {
0044 info("+++ Calls newStage: %ld prepare: %ld classifyNewTrack: %ld",
0045 m_calls_newStage, m_calls_prepare, m_calls_classify);
0046 }
0047
0048 virtual void newStage(G4StackManager* stackManager) override final {
0049 info("+++ [%ld] Calling newStage. StackManager: %p", m_calls_newStage, (void*)stackManager);
0050 ++m_calls_newStage;
0051 }
0052
0053 virtual void prepare(G4StackManager* stackManager) override final {
0054 info("+++ [%ld] Calling prepare. StackManager: %p", m_calls_prepare, (void*)stackManager);
0055 ++m_calls_prepare;
0056 }
0057
0058 virtual TrackClassification
0059 classifyNewTrack(G4StackManager* stackManager, const G4Track* track) override final {
0060 info("+++ [%ld] Calling classifyNewTrack. StackManager: %p Track: %p",
0061 m_calls_classify, (void*)stackManager, (void*)track);
0062 ++m_calls_classify;
0063 return { fKill };
0064 }
0065 };
0066 }
0067 }
0068
0069 #include "DDG4/Factories.h"
0070 DECLARE_GEANT4ACTION_NS(dd4hep::sim,TestStackingAction)