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
Geant4SteppingAction.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation for LCD
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 DD4HEP_DDG4_GEANT4STEPPINGACTION_H
14 #define DD4HEP_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 Simulation {
28 
29  // Forward declarations
30  class Geant4SteppingAction;
31  class Geant4SharedSteppingAction;
32  class Geant4SteppingActionSequence;
33 
35 
41  public:
43  public:
47  Geant4SteppingAction(Geant4Context* context, const std::string& name);
49  virtual ~Geant4SteppingAction();
51  virtual void operator()(const G4Step* step, G4SteppingManager* mgr);
52  };
53 
55 
68  protected:
71  public:
75  Geant4SharedSteppingAction(Geant4Context* context, const std::string& nam);
79  virtual void configureFiber(Geant4Context* thread_context);
81  virtual void use(Geant4SteppingAction* action);
83  virtual void operator()(const G4Step* step, G4SteppingManager* mgr);
84  };
85 
87 
102  protected:
106  Actors<Geant4SteppingAction> m_actors;
107 
108  public:
116  virtual void updateContext(Geant4Context* ctxt);
118  virtual void configureFiber(Geant4Context* thread_context);
120  Geant4SteppingAction* get(const std::string& name) const;
122  template <typename Q, typename T>
123  void call(Q* p, void (T::*f)(const G4Step*, G4SteppingManager*)) {
124  m_calls.add(p, f);
125  }
127  void adopt(Geant4SteppingAction* action);
129  virtual void operator()(const G4Step* step, G4SteppingManager* mgr);
130  };
131 
132  } // End namespace Simulation
133 } // End namespace DD4hep
134 
135 #endif // DD4HEP_DDG4_GEANT4STEPPINGACTION_H
Concrete implementation of the Geant4 stepping action sequence.
Geant4SharedSteppingAction(const Geant4SteppingAction &copy)=delete
Inhibit copy constructor.
virtual ~Geant4SteppingAction()
Default destructor.
virtual ~Geant4SharedSteppingAction()
Default destructor.
CallbackSequence m_calls
Callback sequence for user stepping action calls.
Implementation of the Geant4 shared stepping action.
void call(Q *p, void(T::*f)(const G4Step *, G4SteppingManager *))
Register stepping action callback. Types Q and T must be polymorph!
void add(const Callback &cb, Location where)
Generically Add a new callback to the sequence depending on the location arguments.
Definition: Callback.h:362
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition of an actor on sequences of callbacks.
Definition: Callback.h:334
virtual void updateContext(Geant4Context *ctxt)
Set or update client context.
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:261
const std::string & name() const
Access name of the action.
Definition: Geant4Action.h:271
Concrete implementation of the Geant4 stepping action sequence.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
virtual void configureFiber(Geant4Context *thread_context)
Set or update client for the use in a new thread fiber.
Geant4SteppingAction(const Geant4SteppingAction &copy)=delete
Inhibit copy constructor.
virtual ~Geant4SteppingActionSequence()
Default destructor.
virtual void operator()(const G4Step *step, G4SteppingManager *mgr)
User stepping callback.
void adopt(Geant4SteppingAction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Geant4SteppingActionSequence(const Geant4SteppingAction &copy)=delete
Inhibit copy constructor.
Geant4SteppingAction * m_action
Reference to the shared action.
virtual void use(Geant4SteppingAction *action)
Underlying object to be used during the execution of this thread.
Actors< Geant4SteppingAction > m_actors
The list of action objects to be called.
Generic context to extend user, run and event information.
virtual void operator()(const G4Step *step, G4SteppingManager *mgr)
User stepping callback.
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:91
virtual void operator()(const G4Step *step, G4SteppingManager *mgr)
User stepping callback.