DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4TestActions.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_GEANT4TESTACTIONS_H
14 #define DDG4_GEANT4TESTACTIONS_H
15 
16 // Framework include files
17 #include <DDG4/Geant4Handle.h>
18 #include <DDG4/Geant4Kernel.h>
20 #include <DDG4/Geant4RunAction.h>
21 #include <DDG4/Geant4EventAction.h>
25 #include <DDG4/Geant4ActionPhase.h>
27 
29 namespace dd4hep {
30 
32  namespace sim {
33 
35  namespace Test {
36 
38 
44  protected:
45  int m_value1;
46  double m_value2;
47  std::string m_value3;
48  std::string m_type;
49  public:
51  Geant4TestBase(Geant4Action* action, const std::string& typ);
53  virtual ~Geant4TestBase();
54  };
55 
57 
63  public:
65  Geant4TestGeneratorAction(Geant4Context* c, const std::string& n);
69  virtual void operator()(G4Event*) override;
70  };
71 
73 
79  public:
81  Geant4TestRunAction(Geant4Context* c, const std::string& n);
83  virtual ~Geant4TestRunAction();
85  void begin(const G4Run*) override;
87  void end(const G4Run*) override;
89  void beginEvent(const G4Event*);
91  void endEvent(const G4Event*);
92  };
93 
95 
101  public:
103  Geant4TestEventAction(Geant4Context* c, const std::string& n);
105  virtual ~Geant4TestEventAction();
107  virtual void begin(const G4Event*) override;
109  virtual void end(const G4Event*) override;
111  void beginRun(const G4Run*);
113  void endRun(const G4Run*);
114  };
115 
117 
124  public:
126  Geant4TestTrackAction(Geant4Context* c, const std::string& n);
128  virtual ~Geant4TestTrackAction();
130  virtual void begin(const G4Track*) override;
132  virtual void end(const G4Track*) override;
133  };
134 
136 
142  public:
144  Geant4TestStepAction(Geant4Context* c, const std::string& n);
146  virtual ~Geant4TestStepAction();
148  void operator()(const G4Step*, G4SteppingManager*) override;
149  };
150 
152 
158  public:
160  Geant4TestStackAction(Geant4Context* c, const std::string& n);
162  virtual ~Geant4TestStackAction();
164  virtual void newStage(G4StackManager*) override;
166  virtual void prepare(G4StackManager*) override;
168  virtual TrackClassification classifyNewTrack(G4StackManager*, const G4Track*) override;
169  };
170 
172 
178  protected:
180  public:
182  Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, Detector& description);
184  virtual ~Geant4TestSensitive();
186  virtual void begin(G4HCofThisEvent*) override;
188  virtual void end(G4HCofThisEvent*) override;
190  virtual bool process(const G4Step*, G4TouchableHistory*) override;
191  };
192  } // End namespace Test
193  } // End namespace sim
194 } // End namespace dd4hep
195 
196 #endif // DDG4_GEANT4TESTACTIONS_H
dd4hep::sim::Test::Geant4TestStepAction::operator()
void operator()(const G4Step *, G4SteppingManager *) override
User stepping callback.
Definition: Geant4TestActions.cpp:183
dd4hep::sim::Test::Geant4TestStepAction
Example stepping action doing nothing, but print.
Definition: Geant4TestActions.h:141
dd4hep::sim::Test::Geant4TestBase::m_type
std::string m_type
Definition: Geant4TestActions.h:48
dd4hep::sim::Test::Geant4TestEventAction::end
virtual void end(const G4Event *) override
End-of-event callback.
Definition: Geant4TestActions.cpp:125
dd4hep::sim::Geant4SteppingAction
Concrete implementation of the Geant4 stepping action sequence.
Definition: Geant4SteppingAction.h:40
dd4hep::sim::Test::Geant4TestGeneratorAction
Example generator action doing nothing, but print.
Definition: Geant4TestActions.h:62
dd4hep::sim::Test::Geant4TestEventAction::Geant4TestEventAction
Geant4TestEventAction(Geant4Context *c, const std::string &n)
Standard constructor with initializing arguments.
Definition: Geant4TestActions.cpp:107
dd4hep::sim::Test::Geant4TestStepAction::Geant4TestStepAction
Geant4TestStepAction(Geant4Context *c, const std::string &n)
Standard constructor with initializing arguments.
Definition: Geant4TestActions.cpp:173
dd4hep::sim::Test::Geant4TestBase::m_value1
int m_value1
Definition: Geant4TestActions.h:45
dd4hep::sim::Test::Geant4TestTrackAction::begin
virtual void begin(const G4Track *) override
Begin-of-tracking callback.
Definition: Geant4TestActions.cpp:157
Geant4Handle.h
dd4hep::sim::Test::Geant4TestRunAction::begin
void begin(const G4Run *) override
begin-of-run callback
Definition: Geant4TestActions.cpp:83
dd4hep::sim::Test::Geant4TestBase::Geant4TestBase
Geant4TestBase(Geant4Action *action, const std::string &typ)
Standard constructor.
Definition: Geant4TestActions.cpp:41
Geant4SensDetAction.h
Geant4TrackingAction.h
dd4hep::sim::Test::Geant4TestSensitive::~Geant4TestSensitive
virtual ~Geant4TestSensitive()
Default destructor.
Definition: Geant4TestActions.cpp:223
dd4hep::sim::Test::Geant4TestEventAction::endRun
void endRun(const G4Run *)
End-of-run callback.
Definition: Geant4TestActions.cpp:140
Geant4RunAction.h
Geant4EventAction.h
dd4hep::sim::Test::Geant4TestEventAction
Example event action doing nothing, but print.
Definition: Geant4TestActions.h:100
dd4hep::sim::Test::Geant4TestStackAction::prepare
virtual void prepare(G4StackManager *) override
Preparation callback.
Definition: Geant4TestActions.cpp:202
Geant4SteppingAction.h
dd4hep::sim::Test::Geant4TestStackAction::newStage
virtual void newStage(G4StackManager *) override
New-stage callback.
Definition: Geant4TestActions.cpp:198
dd4hep::sim::Test::Geant4TestRunAction
Example run action doing nothing, but print.
Definition: Geant4TestActions.h:78
dd4hep::sim::Test::Geant4TestStackAction::classifyNewTrack
virtual TrackClassification classifyNewTrack(G4StackManager *, const G4Track *) override
Return TrackClassification with enum G4ClassificationOfNewTrack or NoTrackClassification.
Definition: Geant4TestActions.cpp:206
dd4hep::sim::Test::Geant4TestTrackAction::~Geant4TestTrackAction
virtual ~Geant4TestTrackAction()
Default destructor.
Definition: Geant4TestActions.cpp:153
dd4hep::sim::Test::Geant4TestRunAction::~Geant4TestRunAction
virtual ~Geant4TestRunAction()
Default destructor.
Definition: Geant4TestActions.cpp:78
dd4hep::sim::Geant4EventAction
Concrete basic implementation of the Geant4 event action.
Definition: Geant4EventAction.h:53
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::sim::Test::Geant4TestRunAction::beginEvent
void beginEvent(const G4Event *)
begin-of-event callback
Definition: Geant4TestActions.cpp:95
Geant4GeneratorAction.h
dd4hep::sim::Test::Geant4TestStepAction::~Geant4TestStepAction
virtual ~Geant4TestStepAction()
Default destructor.
Definition: Geant4TestActions.cpp:179
dd4hep::sim::Test::Geant4TestBase::m_value2
double m_value2
Definition: Geant4TestActions.h:46
dd4hep::sim::Test::Geant4TestEventAction::begin
virtual void begin(const G4Event *) override
begin-of-event callback
Definition: Geant4TestActions.cpp:117
Geant4StackingAction.h
dd4hep::sim::Test::Geant4TestRunAction::endEvent
void endEvent(const G4Event *)
End-of-event callback.
Definition: Geant4TestActions.cpp:101
dd4hep::sim::Test::Geant4TestSensitive::Geant4TestSensitive
Geant4TestSensitive(Geant4Context *c, const std::string &n, DetElement det, Detector &description)
Standard constructor with initializing arguments.
Definition: Geant4TestActions.cpp:215
dd4hep::sim::Test::Geant4TestStackAction::Geant4TestStackAction
Geant4TestStackAction(Geant4Context *c, const std::string &n)
Standard constructor with initializing arguments.
Definition: Geant4TestActions.cpp:188
dd4hep::sim::Geant4GeneratorAction
Concrete implementation of the Geant4 generator action base class.
Definition: Geant4GeneratorAction.h:47
dd4hep::sim::Test::Geant4TestGeneratorAction::~Geant4TestGeneratorAction
virtual ~Geant4TestGeneratorAction()
Default destructor.
Definition: Geant4TestActions.cpp:61
dd4hep::sim::Test::Geant4TestTrackAction
Example tracking action doing nothing, but print.
Definition: Geant4TestActions.h:123
dd4hep::sim::Test::Geant4TestGeneratorAction::operator()
virtual void operator()(G4Event *) override
Callback to generate primary particles.
Definition: Geant4TestActions.cpp:66
dd4hep::sim::Geant4Action
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:113
dd4hep::sim::Test::Geant4TestBase::~Geant4TestBase
virtual ~Geant4TestBase()
Default destructor.
Definition: Geant4TestActions.cpp:49
dd4hep::sim::Test::Geant4TestRunAction::Geant4TestRunAction
Geant4TestRunAction(Geant4Context *c, const std::string &n)
Standard constructor with initializing arguments.
Definition: Geant4TestActions.cpp:72
dd4hep::sim::Test::Geant4TestSensitive::end
virtual void end(G4HCofThisEvent *) override
End-of-tracking callback.
Definition: Geant4TestActions.cpp:236
dd4hep::sim::Test::Geant4TestGeneratorAction::Geant4TestGeneratorAction
Geant4TestGeneratorAction(Geant4Context *c, const std::string &n)
Standard constructor with initializing arguments.
Definition: Geant4TestActions.cpp:55
dd4hep::sim::Test::Geant4TestEventAction::~Geant4TestEventAction
virtual ~Geant4TestEventAction()
Default destructor.
Definition: Geant4TestActions.cpp:113
dd4hep::sim::Geant4TrackingAction
Default base class for all geant 4 tracking actions used in DDG4.
Definition: Geant4TrackingAction.h:41
dd4hep::sim::TrackClassification
Definition: Geant4StackingAction.h:39
dd4hep::sim::Test::Geant4TestSensitive::begin
virtual void begin(G4HCofThisEvent *) override
Begin-of-tracking callback.
Definition: Geant4TestActions.cpp:228
dd4hep::sim::Test::Geant4TestRunAction::end
void end(const G4Run *) override
End-of-run callback.
Definition: Geant4TestActions.cpp:89
dd4hep::sim::Geant4RunAction
Concrete basic implementation of the Geant4 run action base class.
Definition: Geant4RunAction.h:45
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::sim::Test::Geant4TestEventAction::beginRun
void beginRun(const G4Run *)
begin-of-run callback
Definition: Geant4TestActions.cpp:133
dd4hep::sim::Test::Geant4TestTrackAction::end
virtual void end(const G4Track *) override
End-of-tracking callback.
Definition: Geant4TestActions.cpp:165
dd4hep::sim::Test::Geant4TestSensitive::process
virtual bool process(const G4Step *, G4TouchableHistory *) override
Method for generating hit(s) using the information of G4Step object.
Definition: Geant4TestActions.cpp:244
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::sim::Geant4StackingAction
Concrete implementation of the Geant4 stacking action base class.
Definition: Geant4StackingAction.h:52
Geant4Kernel.h
dd4hep::sim::Geant4Sensitive
The base class for Geant4 sensitive detector actions implemented by users.
Definition: Geant4SensDetAction.h:121
dd4hep::sim::Test::Geant4TestBase::m_value3
std::string m_value3
Definition: Geant4TestActions.h:47
dd4hep::sim::Test::Geant4TestStackAction::~Geant4TestStackAction
virtual ~Geant4TestStackAction()
Default destructor.
Definition: Geant4TestActions.cpp:194
dd4hep::sim::Test::Geant4TestStackAction
Example stacking action doing nothing, but print.
Definition: Geant4TestActions.h:157
dd4hep::sim::Test::Geant4TestSensitive
Example sensitve detector action doing nothing, but print.
Definition: Geant4TestActions.h:177
dd4hep::sim::Test::Geant4TestBase
Common base class for test action.
Definition: Geant4TestActions.h:43
Geant4ActionPhase.h
dd4hep::sim::Test::Geant4TestSensitive::m_collectionID
size_t m_collectionID
Definition: Geant4TestActions.h:179
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Test::Geant4TestTrackAction::Geant4TestTrackAction
Geant4TestTrackAction(Geant4Context *c, const std::string &n)
Standard constructor with initializing arguments.
Definition: Geant4TestActions.cpp:147