Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:29

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include <DD4hep/InstanceCount.h>
0016 #include <DDG4/Geant4UserInitialization.h>
0017 
0018 using namespace dd4hep::sim;
0019 
0020 /// Standard constructor
0021 Geant4UserInitialization::Geant4UserInitialization(Geant4Context* ctxt, const std::string& nam)
0022   : Geant4Action(ctxt, nam) {
0023   m_needsControl = false;
0024   InstanceCount::increment(this);
0025 }
0026 
0027 /// Default destructor
0028 Geant4UserInitialization::~Geant4UserInitialization() {
0029   InstanceCount::decrement(this);
0030 }
0031 
0032 /// Callback function to build setup for the MT worker thread
0033 void Geant4UserInitialization::build()  const  {
0034 }
0035 
0036 /// Callback function to build setup for the MT master thread
0037 void Geant4UserInitialization::buildMaster()  const  {
0038 }
0039 
0040 /// Standard constructor
0041 Geant4UserInitializationSequence::Geant4UserInitializationSequence(Geant4Context* ctxt, const std::string& nam)
0042   : Geant4UserInitialization(ctxt, nam) {
0043   m_needsControl = false;
0044   InstanceCount::increment(this);
0045 }
0046 
0047 /// Default destructor
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 /// Add an actor responding to all callbacks. Sequence takes ownership.
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 /// Callback function to build setup for the MT worker thread
0067 void Geant4UserInitializationSequence::build()  const  {
0068   m_actors(&Geant4UserInitialization::build);
0069   m_workerCalls();
0070 }
0071 
0072 /// Callback function to build setup for the MT master thread
0073 void Geant4UserInitializationSequence::buildMaster()  const  {
0074   m_actors(&Geant4UserInitialization::buildMaster);
0075   m_masterCalls();
0076 }
0077 
0078 /// Set client context
0079 void Geant4UserInitializationSequence::updateContext(Geant4Context* ctxt)   {
0080   m_context = ctxt;
0081   m_actors.updateContext(ctxt);
0082 }
0083