DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geant4UserInitialization.h
Go to the documentation of this file.
1 // $Id$
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 #ifndef DD4HEP_DDG4_GEANT4USERINITIALIZATION_H
15 #define DD4HEP_DDG4_GEANT4USERINITIALIZATION_H
16 
17 // Framework include files
18 #include "DDG4/Geant4Action.h"
19 
20 // Forward declarations
21 
23 namespace DD4hep {
24 
26  namespace Simulation {
27 
29 
35  protected:
36  public:
38  Geant4UserInitialization(Geant4Context* c, const std::string& nam);
40  virtual ~Geant4UserInitialization();
42  virtual void build() const;
44  virtual void buildMaster() const;
45  };
46 
48 
54  protected:
60  Actors<Geant4UserInitialization> m_actors;
61 
62  public:
64  Geant4UserInitializationSequence(Geant4Context* c, const std::string& nam);
68  template <typename Q, typename T> void build(Q* p, void (T::*f)()) {
69  m_workerCalls.add(p, f);
70  }
72  template <typename Q, typename T> void buildMaster(Q* p, void (T::*f)()) {
73  m_masterCalls.add(p, f);
74  }
76  void adopt(Geant4UserInitialization* action);
77 
79  virtual void updateContext(Geant4Context* ctxt);
81  virtual void build() const;
83  virtual void buildMaster() const;
84  };
85 
86  } // End namespace Simulation
87 } // End namespace DD4hep
88 #endif // DD4HEP_DDG4_GEANT4USERINITIALIZATION_H
Actors< Geant4UserInitialization > m_actors
The list of action objects to be called.
Class to orchestrate a modular initializion of a multi- or single threaded Geant4 application...
virtual void build() const
Callback function to build setup for the MT worker thread.
void add(const Callback &cb, Location where)
Generically Add a new callback to the sequence depending on the location arguments.
Definition: Callback.h:362
Definition of an actor on sequences of callbacks.
Definition: Callback.h:334
void build(Q *p, void(T::*f)())
Register callback to setup worker. Types Q and T must be polymorph!
CallbackSequence m_masterCalls
Callback sequence to initialize the thread master.
CallbackSequence m_workerCalls
Callback sequence to initialize worker elements.
virtual void buildMaster() const
Callback function to build setup for the MT master thread.
Geant4UserInitializationSequence(Geant4Context *c, const std::string &nam)
Standard constructor.
void adopt(Geant4UserInitialization *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Base class to initialize a multi-threaded or single threaded Geant4 application.
Geant4UserInitialization(Geant4Context *c, const std::string &nam)
Standard constructor.
virtual void updateContext(Geant4Context *ctxt)
Set client context.
virtual void build() const
Callback function to build setup for the MT worker thread.
Generic context to extend user, run and event information.
void buildMaster(Q *p, void(T::*f)())
Register callback to setup master. Types Q and T must be polymorph!
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:91
virtual void buildMaster() const
Callback function to build setup for the MT master thread.