Skip to content

Commit

Permalink
HKG4StackingAction is now its own tool. Doing this proves that we can…
Browse files Browse the repository at this point in the history
… get pointers to classes from the G4RunManager, as long as they are const
  • Loading branch information
tdealtry committed Apr 26, 2024
1 parent e796360 commit 0f0505e
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ hk_check_dependencies()
# Add your tools here
hk_add_tool(WCSim_exe)
hk_add_tool(HKG4TrackingAction)
hk_add_tool(HKG4StackingAction)

option(WCSIM_Check_Geometry_Overlaps
"Toggle WCSim to save photon scattering and reflection history"
Expand Down
33 changes: 33 additions & 0 deletions HKG4StackingAction/HKG4StackingAction.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "HKG4StackingAction.h"

using namespace HK::Ghost::G4;

HKG4StackingAction::HKG4StackingAction() : Tool() {}

bool HKG4StackingAction::Initialise(std::string configfile, DataModel& data) {

if(configfile != "")
m_variables.Initialise(configfile);
// m_variables.Print();

m_data = &data;
m_log = m_data->Log;

if(!m_variables.Get("verbose", m_verbose))
m_verbose = 1;

m_p_UI = G4UImanager::GetUIpointer();
m_data->m_p_run_manager->SetUserAction(new WCSimStackingAction(static_cast<const WCSimDetectorConstruction*>(m_data->m_p_run_manager->GetUserDetectorConstruction())));

return true;
}

bool HKG4StackingAction::Execute() {

return true;
}

bool HKG4StackingAction::Finalise() {

return true;
}
46 changes: 46 additions & 0 deletions HKG4StackingAction/HKG4StackingAction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef HKG4StackingAction_H
#define HKG4StackingAction_H

#include <iostream>
#include <string>

#include <DataModel.h>
#include "Tool.h"

#include "G4UImanager.hh"

#include "WCSimStackingAction.hh"

/**
* \class HKG4StackingAction
*
* This is a blank template for a Tool used by the script to generate a new custom tool. Please fill out the
* description and author information.
*
* $Author: B.Richards $
* $Date: 2019/05/28 10:44:00 $
*/

namespace HK {
namespace Ghost {
namespace G4 {
class HKG4StackingAction : public Tool {

public:

HKG4StackingAction(); ///< Simple constructor
bool Initialise(std::string configfile,
DataModel& data); ///< Initialise Function for setting up Tool resources. @param
///< configfile The path and name of the dynamic configuration file
///< to read in. @param data A reference to the transient data
///< class used to pass information between Tools.
bool Execute(); ///< Execute function used to perform Tool purpose.
bool Finalise(); ///< Finalise funciton used to clean up resources.

private:
G4UImanager* m_p_UI;
};
} // namespace G4
} // namespace Ghost
} // namespace HK
#endif
1 change: 1 addition & 0 deletions HKG4StackingAction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# HKG4StackingAction
2 changes: 1 addition & 1 deletion WCSim_exe/WCSim_exe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bool WCSim_exe::Initialise(std::string configfile, DataModel& data) {
m_data->m_p_run_manager->SetUserAction(new WCSimEventAction(myRunAction, WCSimdetector, myGeneratorAction));
//m_data->m_p_run_manager->SetUserAction(new WCSimTrackingAction);

m_data->m_p_run_manager->SetUserAction(new WCSimStackingAction(WCSimdetector));
//m_data->m_p_run_manager->SetUserAction(new WCSimStackingAction(WCSimdetector));

m_data->m_p_run_manager->SetUserAction(new WCSimSteppingAction(myRunAction, WCSimdetector));

Expand Down

0 comments on commit 0f0505e

Please sign in to comment.