DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4ActionContainer.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_GEANT4ACTIONCONTAINER_H
14 #define DDG4_GEANT4ACTIONCONTAINER_H
15 
16 // Framework include files
17 #include <DD4hep/Printout.h>
18 #include <DDG4/Geant4Action.h>
19 #include <DDG4/Geant4Primitives.h>
20 
21 // C/C++ include files
22 #include <map>
23 #include <string>
24 #include <typeinfo>
25 
27 namespace dd4hep {
28 
30  namespace sim {
31 
32  // Forward declarations
33  class Geant4Context;
34  class Geant4Action;
35  class Geant4RunAction;
36  class Geant4EventAction;
37  class Geant4SteppingAction;
38  class Geant4TrackingAction;
39  class Geant4StackingAction;
40  class Geant4GeneratorAction;
41  class Geant4PhysicsList;
42  class Geant4RunActionSequence;
43  class Geant4EventActionSequence;
44  class Geant4SteppingActionSequence;
45  class Geant4TrackingActionSequence;
46  class Geant4StackingActionSequence;
47  class Geant4GeneratorActionSequence;
48  class Geant4PhysicsListActionSequence;
49  class Geant4DetectorConstructionSequence;
50  class Geant4UserInitializationSequence;
51  class Geant4SensDetActionSequence;
52  class Geant4SensDetSequences;
53 
55 
61  protected:
62 
64  Geant4Context* m_context { nullptr };
65 
80 
87 
89  template <typename C> bool registerSequence(C*& seq, const std::string& name);
90 
93 
95  virtual ~Geant4ActionContainer();
96 
98  void setContext(Geant4Context* ctxt);
99 
100  public:
103 
105  virtual int terminate();
106 
111  return *generatorAction(true);
112  }
113 
115  Geant4RunActionSequence* runAction(bool create);
118  return *runAction(true);
119  }
120 
125  return *eventAction(true);
126  }
127 
132  return *steppingAction(true);
133  }
134 
139  return *trackingAction(true);
140  }
141 
146  return *stackingAction(true);
147  }
148 
153  return *detectorConstruction(true);
154  }
155 
159  Geant4SensDetActionSequence* sensitiveAction(const std::string& name);
160 
165  return *physicsList(true);
166  }
171  return *userInitialization(true);
172  }
173  };
174 
175  } // End namespace sim
176 } // End namespace dd4hep
177 #endif // DDG4_GEANT4ACTIONCONTAINER_H
dd4hep::sim::Geant4ActionContainer::m_stackingAction
Geant4StackingActionSequence * m_stackingAction
Reference to the Geant4 stacking action.
Definition: Geant4ActionContainer.h:77
Geant4Primitives.h
dd4hep::sim::Geant4UserInitializationSequence
Class to orchestrate a modular initializion of a multi- or single threaded Geant4 application.
Definition: Geant4UserInitialization.h:52
dd4hep::sim::Geant4ActionContainer::registerSequence
bool registerSequence(C *&seq, const std::string &name)
Helper to register an action sequence.
Definition: Geant4ActionContainer.cpp:75
dd4hep::sim::Geant4StackingActionSequence
Concrete implementation of the Geant4 stacking action sequence.
Definition: Geant4StackingAction.h:128
dd4hep::sim::Geant4ActionContainer::m_context
Geant4Context * m_context
Geant4 worker context (thread specific)
Definition: Geant4ActionContainer.h:64
dd4hep::sim::Geant4ActionContainer::sensitiveAction
Geant4SensDetActionSequence * sensitiveAction(const std::string &name)
Access to the sensitive detector action from the actioncontainer object.
Definition: Geant4ActionContainer.cpp:139
dd4hep::sim::Geant4ActionContainer::Geant4ActionContainer
Geant4ActionContainer(Geant4Context *ctxt=0)
Standard constructor.
Definition: Geant4ActionContainer.cpp:38
dd4hep::sim::Geant4ActionContainer::m_steppingAction
Geant4SteppingActionSequence * m_steppingAction
Reference to the Geant4 step action.
Definition: Geant4ActionContainer.h:75
dd4hep::sim::Geant4ActionContainer::detectorConstruction
Geant4DetectorConstructionSequence & detectorConstruction()
Access detector construcion action sequence (geometry+sensitives+field)
Definition: Geant4ActionContainer.h:152
dd4hep::sim::Geant4ActionContainer::userInitialization
Geant4UserInitializationSequence & userInitialization()
Access to the user initialization object.
Definition: Geant4ActionContainer.h:170
dd4hep::sim::Geant4ActionContainer::workerContext
Geant4Context * workerContext()
Thread's Geant4 execution context.
Definition: Geant4ActionContainer.cpp:65
dd4hep::sim::Geant4ActionContainer::physicsList
Geant4PhysicsListActionSequence & physicsList()
Access to the physics list.
Definition: Geant4ActionContainer.h:164
dd4hep::sim::Geant4TrackingActionSequence
Concrete implementation of the Geant4 tracking action sequence.
Definition: Geant4TrackingAction.h:114
dd4hep::sim::Geant4ActionContainer::stackingAction
Geant4StackingActionSequence & stackingAction()
Access stacking action sequence.
Definition: Geant4ActionContainer.h:145
dd4hep::sim::Geant4ActionContainer::m_runAction
Geant4RunActionSequence * m_runAction
Reference to the Geant4 run action.
Definition: Geant4ActionContainer.h:69
dd4hep::sim::Geant4ActionContainer::eventAction
Geant4EventActionSequence & eventAction()
Access run action sequence.
Definition: Geant4ActionContainer.h:124
dd4hep::sim::Geant4GeneratorActionSequence
Concrete implementation of the Geant4 generator action sequence.
Definition: Geant4GeneratorAction.h:115
dd4hep::sim::Geant4ActionContainer::setContext
void setContext(Geant4Context *ctxt)
Set the thread's context.
Definition: Geant4ActionContainer.cpp:71
dd4hep::sim::Geant4ActionContainer::trackingAction
Geant4TrackingActionSequence & trackingAction()
Access tracking action sequence.
Definition: Geant4ActionContainer.h:138
dd4hep::sim::Geant4ActionContainer::m_constructionAction
Geant4DetectorConstructionSequence * m_constructionAction
Reference to the Geant4 detector construction sequence.
Definition: Geant4ActionContainer.h:79
dd4hep::sim::Geant4ActionContainer::m_userInit
Geant4UserInitializationSequence * m_userInit
Reference to the user initialization object.
Definition: Geant4ActionContainer.h:86
dd4hep::sim::Geant4RunActionSequence
Concrete basic implementation of the Geant4 run action sequencer.
Definition: Geant4RunAction.h:117
dd4hep::sim::Geant4SensDetSequences
Geant4SensDetSequences: class to access groups of sensitive actions.
Definition: Geant4SensDetAction.h:464
dd4hep::sim::Geant4PhysicsListActionSequence
The implementation of the single Geant4 physics list action sequence.
Definition: Geant4PhysicsList.h:223
dd4hep::sim::Geant4ActionContainer::runAction
Geant4RunActionSequence & runAction()
Access run action sequence.
Definition: Geant4ActionContainer.h:117
dd4hep::sim::Geant4DetectorConstructionSequence
Concrete basic implementation of the Geant4 detector construction sequencer.
Definition: Geant4DetectorConstruction.h:135
dd4hep::sim::Geant4ActionContainer::steppingAction
Geant4SteppingActionSequence & steppingAction()
Access stepping action sequence.
Definition: Geant4ActionContainer.h:131
dd4hep::sim::Geant4ActionContainer::terminate
virtual int terminate()
Terminate all associated action instances.
Definition: Geant4ActionContainer.cpp:51
dd4hep::sim::Geant4ActionContainer::m_eventAction
Geant4EventActionSequence * m_eventAction
Reference to the Geant4 event action.
Definition: Geant4ActionContainer.h:71
dd4hep::sim::Geant4SensDetActionSequence
The sequencer to host Geant4 sensitive actions called if particles interact with sensitive elements.
Definition: Geant4SensDetAction.h:317
dd4hep::sim::Geant4ActionContainer
Class, which allows all Geant4Action to be stored.
Definition: Geant4ActionContainer.h:60
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4ActionContainer::m_sensDetActions
Geant4SensDetSequences * m_sensDetActions
Reference to the Geant4 sensitive action sequences.
Definition: Geant4ActionContainer.h:82
dd4hep::sim::Geant4ActionContainer::m_generatorAction
Geant4GeneratorActionSequence * m_generatorAction
Reference to the Geant4 primary generator action.
Definition: Geant4ActionContainer.h:67
dd4hep::sim::Geant4ActionContainer::m_physicsList
Geant4PhysicsListActionSequence * m_physicsList
Reference to the Geant4 physics list.
Definition: Geant4ActionContainer.h:84
dd4hep::sim::Geant4ActionContainer::generatorAction
Geant4GeneratorActionSequence & generatorAction()
Access generator action sequence.
Definition: Geant4ActionContainer.h:110
dd4hep::sim::Geant4EventActionSequence
Concrete implementation of the Geant4 event action sequence.
Definition: Geant4EventAction.h:124
dd4hep::sim::Geant4ActionContainer::sensitiveActions
Geant4SensDetSequences & sensitiveActions() const
Access to the sensitive detector sequences from the actioncontainer object.
Definition: Geant4ActionContainer.cpp:134
dd4hep::sim::Geant4ActionContainer::m_trackingAction
Geant4TrackingActionSequence * m_trackingAction
Reference to the Geant4 track action.
Definition: Geant4ActionContainer.h:73
dd4hep::sim::Geant4SteppingActionSequence
Concrete implementation of the Geant4 stepping action sequence.
Definition: Geant4SteppingAction.h:104
Printout.h
dd4hep::sim::Geant4ActionContainer::~Geant4ActionContainer
virtual ~Geant4ActionContainer()
Default destructor.
Definition: Geant4ActionContainer.cpp:45
Geant4Action.h
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201