From b9cdb003baf186fd18ab3ec16940bc397290c1d7 Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Mon, 12 Aug 2019 16:10:29 +0800
Subject: [PATCH] WIP: Enable all user actions.

---
 Simulation/DetSimAna/src/ExampleAnaElemTool.cpp | 10 ++++++----
 Simulation/DetSimCore/src/EventAction.cpp       | 12 ++++++++----
 Simulation/DetSimCore/src/RunAction.cpp         |  7 ++++++-
 Simulation/DetSimCore/src/SteppingAction.cpp    |  4 +++-
 Simulation/DetSimCore/src/TrackingAction.cpp    |  8 ++++++--
 5 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp
index adf41ea9..569c968c 100644
--- a/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp
+++ b/Simulation/DetSimAna/src/ExampleAnaElemTool.cpp
@@ -1,20 +1,22 @@
 #include "ExampleAnaElemTool.h"
 
+#include "G4Event.hh"
+
 DECLARE_COMPONENT(ExampleAnaElemTool)
 
 void
 ExampleAnaElemTool::BeginOfRunAction(const G4Run*) {
-
+    G4cout << "Begin Run of detector simultion..." << G4endl;
 }
 
 void
 ExampleAnaElemTool::EndOfRunAction(const G4Run*) {
-
+    G4cout << "End Run of detector simultion..." << G4endl;
 }
 
 void
-ExampleAnaElemTool::BeginOfEventAction(const G4Event*) {
-
+ExampleAnaElemTool::BeginOfEventAction(const G4Event* anEvent) {
+    msg() << "Event " << anEvent->GetEventID() << endmsg;
 }
 
 void
diff --git a/Simulation/DetSimCore/src/EventAction.cpp b/Simulation/DetSimCore/src/EventAction.cpp
index bbe00357..fd8bb347 100644
--- a/Simulation/DetSimCore/src/EventAction.cpp
+++ b/Simulation/DetSimCore/src/EventAction.cpp
@@ -11,12 +11,16 @@ EventAction::~EventAction() {
 }
 
 void
-EventAction::BeginOfEventAction(const G4Event*) {
-
+EventAction::BeginOfEventAction(const G4Event* anEvent) {
+    for (auto ana: m_anaelemtools) {
+        ana->BeginOfEventAction(anEvent);
+    }
 }
 
 void
-EventAction::EndOfEventAction(const G4Event*) {
-
+EventAction::EndOfEventAction(const G4Event* anEvent) {
+    for (auto ana: m_anaelemtools) {
+        ana->EndOfEventAction(anEvent);
+    }
 }
 
diff --git a/Simulation/DetSimCore/src/RunAction.cpp b/Simulation/DetSimCore/src/RunAction.cpp
index 81699bdd..4bf8c5bd 100644
--- a/Simulation/DetSimCore/src/RunAction.cpp
+++ b/Simulation/DetSimCore/src/RunAction.cpp
@@ -15,13 +15,18 @@ RunAction::~RunAction() {
 void 
 RunAction::BeginOfRunAction(const G4Run* aRun)
 {
+    for (auto ana: m_anaelemtools) {
+        ana->BeginOfRunAction(aRun);
+    }
 
 }
 
 void
 RunAction::EndOfRunAction(const G4Run* aRun)
 {
-
+    for (auto ana: m_anaelemtools) {
+        ana->EndOfRunAction(aRun);
+    }
 }
 
 
diff --git a/Simulation/DetSimCore/src/SteppingAction.cpp b/Simulation/DetSimCore/src/SteppingAction.cpp
index 30ef20f6..4445ee9b 100644
--- a/Simulation/DetSimCore/src/SteppingAction.cpp
+++ b/Simulation/DetSimCore/src/SteppingAction.cpp
@@ -11,6 +11,8 @@ SteppingAction::~SteppingAction() {
 
 void
 SteppingAction::UserSteppingAction(const G4Step* aStep) {
-
+    for (auto ana: m_anaelemtools) {
+        ana->UserSteppingAction(aStep);
+    }
 }
 
diff --git a/Simulation/DetSimCore/src/TrackingAction.cpp b/Simulation/DetSimCore/src/TrackingAction.cpp
index 89b6d1ee..42949d2e 100644
--- a/Simulation/DetSimCore/src/TrackingAction.cpp
+++ b/Simulation/DetSimCore/src/TrackingAction.cpp
@@ -12,12 +12,16 @@ TrackingAction::~TrackingAction() {
 
 void
 TrackingAction::PreUserTrackingAction(const G4Track* aTrack) {
-
+    for (auto ana: m_anaelemtools) {
+        ana->PreUserTrackingAction(aTrack);
+    }
 }
 
 void
 TrackingAction::PostUserTrackingAction(const G4Track* aTrack) {
-
+    for (auto ana: m_anaelemtools) {
+        ana->PostUserTrackingAction(aTrack);
+    }
 }
 
 
-- 
GitLab