File indexing completed on 2025-01-18 09:14:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/InstanceCount.h>
0016 #include <DDG4/Geant4UserInitialization.h>
0017
0018 using namespace dd4hep::sim;
0019
0020
0021 Geant4UserInitialization::Geant4UserInitialization(Geant4Context* ctxt, const std::string& nam)
0022 : Geant4Action(ctxt, nam) {
0023 m_needsControl = false;
0024 InstanceCount::increment(this);
0025 }
0026
0027
0028 Geant4UserInitialization::~Geant4UserInitialization() {
0029 InstanceCount::decrement(this);
0030 }
0031
0032
0033 void Geant4UserInitialization::build() const {
0034 }
0035
0036
0037 void Geant4UserInitialization::buildMaster() const {
0038 }
0039
0040
0041 Geant4UserInitializationSequence::Geant4UserInitializationSequence(Geant4Context* ctxt, const std::string& nam)
0042 : Geant4UserInitialization(ctxt, nam) {
0043 m_needsControl = false;
0044 InstanceCount::increment(this);
0045 }
0046
0047
0048 Geant4UserInitializationSequence::~Geant4UserInitializationSequence() {
0049 InstanceCount::decrement(this);
0050 m_workerCalls.clear();
0051 m_masterCalls.clear();
0052 m_actors(&Geant4Action::release);
0053 m_actors.clear();
0054 }
0055
0056
0057 void Geant4UserInitializationSequence::adopt(Geant4UserInitialization* action) {
0058 if (action) {
0059 action->addRef();
0060 m_actors.add(action);
0061 return;
0062 }
0063 except("Attempt to add invalid actor!");
0064 }
0065
0066
0067 void Geant4UserInitializationSequence::build() const {
0068 m_actors(&Geant4UserInitialization::build);
0069 m_workerCalls();
0070 }
0071
0072
0073 void Geant4UserInitializationSequence::buildMaster() const {
0074 m_actors(&Geant4UserInitialization::buildMaster);
0075 m_masterCalls();
0076 }
0077
0078
0079 void Geant4UserInitializationSequence::updateContext(Geant4Context* ctxt) {
0080 m_context = ctxt;
0081 m_actors.updateContext(ctxt);
0082 }
0083