DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4SteppingAction.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDG4_GEANT4STEPPINGACTION_H
14 #define DDG4_GEANT4STEPPINGACTION_H
15 
16 // Framework include files
17 #include <DDG4/Geant4Action.h>
18 
19 // Forward declarations
20 class G4SteppingManager;
21 class G4Step;
22 
24 namespace dd4hep {
25 
27  namespace sim {
28 
29  // Forward declarations
30  class Geant4SteppingAction;
31  class Geant4SharedSteppingAction;
32  class Geant4SteppingActionSequence;
33 
35 
41  public:
45 
46  public:
48  Geant4SteppingAction(Geant4Context* context, const std::string& name);
50  virtual ~Geant4SteppingAction();
52  virtual void operator()(const G4Step* step, G4SteppingManager* mgr);
53  };
54 
56 
69  protected:
72 
75 
76  public:
78  Geant4SharedSteppingAction(Geant4Context* context, const std::string& nam);
82  virtual void configureFiber(Geant4Context* thread_context) override;
84  virtual void use(Geant4SteppingAction* action);
86  virtual void operator()(const G4Step* step, G4SteppingManager* mgr) override;
87  };
88 
90 
105  protected:
110 
113 
114  public:
120  virtual void updateContext(Geant4Context* ctxt) override;
122  virtual void configureFiber(Geant4Context* thread_context) override;
124  Geant4SteppingAction* get(const std::string& name) const;
126  template <typename Q, typename T>
127  void call(Q* p, void (T::*f)(const G4Step*, G4SteppingManager*)) {
128  m_calls.add(p, f);
129  }
131  void adopt(Geant4SteppingAction* action);
133  virtual void operator()(const G4Step* step, G4SteppingManager* mgr);
134  };
135 
136  } // End namespace sim
137 } // End namespace dd4hep
138 
139 #endif // DDG4_GEANT4STEPPINGACTION_H
dd4hep::sim::Geant4SteppingAction::shared_type
Geant4SharedSteppingAction shared_type
Definition: Geant4SteppingAction.h:42
dd4hep::sim::Geant4SteppingAction
Concrete implementation of the Geant4 stepping action sequence.
Definition: Geant4SteppingAction.h:40
dd4hep::sim::Geant4SteppingActionSequence::~Geant4SteppingActionSequence
virtual ~Geant4SteppingActionSequence()
Default destructor.
Definition: Geant4SteppingAction.cpp:89
dd4hep::sim::Geant4SteppingActionSequence::get
Geant4SteppingAction * get(const std::string &name) const
Get an action by name.
Definition: Geant4SteppingAction.cpp:108
dd4hep::sim::Geant4SteppingAction::Geant4SteppingAction
Geant4SteppingAction(Geant4Context *context, const std::string &name)
Standard constructor.
Definition: Geant4SteppingAction.cpp:28
dd4hep::sim::Geant4SteppingActionSequence::m_actors
Actors< Geant4SteppingAction > m_actors
The list of action objects to be called.
Definition: Geant4SteppingAction.h:109
dd4hep::sim::Geant4SharedSteppingAction::operator()
virtual void operator()(const G4Step *step, G4SteppingManager *mgr) override
User stepping callback.
Definition: Geant4SteppingAction.cpp:72
dd4hep::CallbackSequence::add
void add(const Callback &cb, Location where)
Generically Add a new callback to the sequence depending on the location arguments.
Definition: Callback.h:367
dd4hep::sim::Geant4SteppingActionSequence::configureFiber
virtual void configureFiber(Geant4Context *thread_context) override
Set or update client for the use in a new thread fiber.
Definition: Geant4SteppingAction.cpp:97
dd4hep::sim::Geant4SteppingAction::DDG4_DEFINE_ACTION_CONSTRUCTORS
DDG4_DEFINE_ACTION_CONSTRUCTORS(Geant4SteppingAction)
Define standard assignments and constructors.
dd4hep::sim::Geant4SteppingAction::operator()
virtual void operator()(const G4Step *step, G4SteppingManager *mgr)
User stepping callback.
Definition: Geant4SteppingAction.cpp:39
dd4hep::sim::Geant4SteppingActionSequence::Geant4SteppingActionSequence
Geant4SteppingActionSequence(Geant4Context *context, const std::string &name)
Standard constructor.
Definition: Geant4SteppingAction.cpp:82
dd4hep::sim::Geant4SharedSteppingAction::Geant4SharedSteppingAction
Geant4SharedSteppingAction(Geant4Context *context, const std::string &nam)
Standard constructor.
Definition: Geant4SteppingAction.cpp:43
dd4hep::sim::Geant4SteppingActionSequence::m_calls
CallbackSequence m_calls
Callback sequence for user stepping action calls.
Definition: Geant4SteppingAction.h:107
dd4hep::sim::Geant4SharedSteppingAction::configureFiber
virtual void configureFiber(Geant4Context *thread_context) override
Set or update client for the use in a new thread fiber.
Definition: Geant4SteppingAction.cpp:67
dd4hep::CallbackSequence
Definition of an actor on sequences of callbacks.
Definition: Callback.h:339
dd4hep::sim::Geant4SharedSteppingAction::~Geant4SharedSteppingAction
virtual ~Geant4SharedSteppingAction()
Default destructor.
Definition: Geant4SteppingAction.cpp:50
dd4hep::sim::Geant4SharedSteppingAction
Implementation of the Geant4 shared stepping action.
Definition: Geant4SteppingAction.h:68
dd4hep::sim::Geant4Action
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:113
dd4hep::sim::Geant4Action::name
const std::string & name() const
Access name of the action.
Definition: Geant4Action.h:280
dd4hep::sim::Geant4SteppingActionSequence::call
void call(Q *p, void(T::*f)(const G4Step *, G4SteppingManager *))
Register stepping action callback. Types Q and T must be polymorph!
Definition: Geant4SteppingAction.h:127
dd4hep::sim::Geant4SteppingActionSequence::updateContext
virtual void updateContext(Geant4Context *ctxt) override
Set or update client context.
Definition: Geant4SteppingAction.cpp:102
dd4hep::sim::Geant4SteppingActionSequence::operator()
virtual void operator()(const G4Step *step, G4SteppingManager *mgr)
User stepping callback.
Definition: Geant4SteppingAction.cpp:113
dd4hep::sim::Geant4SteppingAction::~Geant4SteppingAction
virtual ~Geant4SteppingAction()
Default destructor.
Definition: Geant4SteppingAction.cpp:34
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4SharedSteppingAction::DDG4_DEFINE_ACTION_CONSTRUCTORS
DDG4_DEFINE_ACTION_CONSTRUCTORS(Geant4SharedSteppingAction)
Define standard assignments and constructors.
dd4hep::sim::Geant4Action::Actors
Actor class to manipulate action groups.
Definition: Geant4Action.h:168
dd4hep::sim::Geant4SharedSteppingAction::use
virtual void use(Geant4SteppingAction *action)
Underlying object to be used during the execution of this thread.
Definition: Geant4SteppingAction.cpp:56
dd4hep::sim::Geant4SteppingActionSequence::DDG4_DEFINE_ACTION_CONSTRUCTORS
DDG4_DEFINE_ACTION_CONSTRUCTORS(Geant4SteppingActionSequence)
Define standard assignments and constructors.
dd4hep::sim::Geant4SteppingActionSequence::adopt
void adopt(Geant4SteppingAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4SteppingAction.cpp:119
dd4hep::sim::Geant4SteppingActionSequence
Concrete implementation of the Geant4 stepping action sequence.
Definition: Geant4SteppingAction.h:104
dd4hep::sim::Geant4SharedSteppingAction::m_action
Geant4SteppingAction * m_action
Reference to the shared action.
Definition: Geant4SteppingAction.h:71
Geant4Action.h
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:270