|
||||
File indexing completed on 2025-01-18 09:14:17
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 #ifndef DDG4_GEANT4USERINITIALIZATION_H 0014 #define DDG4_GEANT4USERINITIALIZATION_H 0015 0016 // Framework include files 0017 #include <DDG4/Geant4Action.h> 0018 0019 // Forward declarations 0020 0021 /// Namespace for the AIDA detector description toolkit 0022 namespace dd4hep { 0023 0024 /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit 0025 namespace sim { 0026 0027 /// Base class to initialize a multi-threaded or single threaded Geant4 application 0028 /** 0029 * \author M.Frank 0030 * \version 1.0 0031 * \ingroup DD4HEP_SIMULATION 0032 */ 0033 class Geant4UserInitialization : public Geant4Action { 0034 protected: 0035 public: 0036 /// Standard constructor 0037 Geant4UserInitialization(Geant4Context* c, const std::string& nam); 0038 /// Default destructor 0039 virtual ~Geant4UserInitialization(); 0040 /// Callback function to build setup for the MT worker thread 0041 virtual void build() const; 0042 /// Callback function to build setup for the MT master thread 0043 virtual void buildMaster() const; 0044 }; 0045 0046 /// Class to orchestrate a modular initializion of a multi- or single threaded Geant4 application 0047 /** 0048 * \author M.Frank 0049 * \version 1.0 0050 * \ingroup DD4HEP_SIMULATION 0051 */ 0052 class Geant4UserInitializationSequence : public Geant4UserInitialization { 0053 protected: 0054 /// Callback sequence to initialize the thread master 0055 CallbackSequence m_masterCalls; 0056 /// Callback sequence to initialize worker elements 0057 CallbackSequence m_workerCalls; 0058 /// The list of action objects to be called 0059 Actors<Geant4UserInitialization> m_actors; 0060 0061 public: 0062 /// Standard constructor 0063 Geant4UserInitializationSequence(Geant4Context* c, const std::string& nam); 0064 /// Default destructor 0065 virtual ~Geant4UserInitializationSequence(); 0066 /// Register callback to setup worker. Types Q and T must be polymorph! 0067 template <typename Q, typename T> void build(Q* p, void (T::*f)()) { 0068 m_workerCalls.add(p, f); 0069 } 0070 /// Register callback to setup master. Types Q and T must be polymorph! 0071 template <typename Q, typename T> void buildMaster(Q* p, void (T::*f)()) { 0072 m_masterCalls.add(p, f); 0073 } 0074 /// Add an actor responding to all callbacks. Sequence takes ownership. 0075 void adopt(Geant4UserInitialization* action); 0076 0077 /// Set client context 0078 virtual void updateContext(Geant4Context* ctxt) override; 0079 /// Callback function to build setup for the MT worker thread 0080 virtual void build() const override; 0081 /// Callback function to build setup for the MT master thread 0082 virtual void buildMaster() const override; 0083 }; 0084 0085 } // End namespace sim 0086 } // End namespace dd4hep 0087 #endif // DDG4_GEANT4USERINITIALIZATION_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |