File indexing completed on 2025-01-18 09:55:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDG4_GEANT4TESTACTIONS_H
0014 #define DDG4_GEANT4TESTACTIONS_H
0015
0016
0017 #include <DDG4/Geant4Handle.h>
0018 #include <DDG4/Geant4Kernel.h>
0019 #include <DDG4/Geant4GeneratorAction.h>
0020 #include <DDG4/Geant4RunAction.h>
0021 #include <DDG4/Geant4EventAction.h>
0022 #include <DDG4/Geant4TrackingAction.h>
0023 #include <DDG4/Geant4SteppingAction.h>
0024 #include <DDG4/Geant4StackingAction.h>
0025 #include <DDG4/Geant4ActionPhase.h>
0026 #include <DDG4/Geant4SensDetAction.h>
0027
0028
0029 namespace dd4hep {
0030
0031
0032 namespace sim {
0033
0034
0035 namespace Test {
0036
0037
0038
0039
0040
0041
0042
0043 class Geant4TestBase {
0044 protected:
0045 int m_value1;
0046 double m_value2;
0047 std::string m_value3;
0048 std::string m_type;
0049 public:
0050
0051 Geant4TestBase(Geant4Action* action, const std::string& typ);
0052
0053 virtual ~Geant4TestBase();
0054 };
0055
0056
0057
0058
0059
0060
0061
0062 class Geant4TestGeneratorAction: public Geant4GeneratorAction, public Geant4TestBase {
0063 public:
0064
0065 Geant4TestGeneratorAction(Geant4Context* c, const std::string& n);
0066
0067 virtual ~Geant4TestGeneratorAction();
0068
0069 virtual void operator()(G4Event*);
0070 };
0071
0072
0073
0074
0075
0076
0077
0078 class Geant4TestRunAction: public Geant4RunAction, public Geant4TestBase {
0079 public:
0080
0081 Geant4TestRunAction(Geant4Context* c, const std::string& n);
0082
0083 virtual ~Geant4TestRunAction();
0084
0085 void begin(const G4Run*);
0086
0087 void end(const G4Run*);
0088
0089 void beginEvent(const G4Event*);
0090
0091 void endEvent(const G4Event*);
0092 };
0093
0094
0095
0096
0097
0098
0099
0100 class Geant4TestEventAction: public Geant4EventAction, public Geant4TestBase {
0101 public:
0102
0103 Geant4TestEventAction(Geant4Context* c, const std::string& n);
0104
0105 virtual ~Geant4TestEventAction();
0106
0107 virtual void begin(const G4Event*);
0108
0109 virtual void end(const G4Event*);
0110
0111 void beginRun(const G4Run*);
0112
0113 void endRun(const G4Run*);
0114 };
0115
0116
0117
0118
0119
0120
0121
0122
0123 class Geant4TestTrackAction: public Geant4TrackingAction, public Geant4TestBase {
0124 public:
0125
0126 Geant4TestTrackAction(Geant4Context* c, const std::string& n);
0127
0128 virtual ~Geant4TestTrackAction();
0129
0130 virtual void begin(const G4Track*) override;
0131
0132 virtual void end(const G4Track*) override;
0133 };
0134
0135
0136
0137
0138
0139
0140
0141 class Geant4TestStepAction: public Geant4SteppingAction, public Geant4TestBase {
0142 public:
0143
0144 Geant4TestStepAction(Geant4Context* c, const std::string& n);
0145
0146 virtual ~Geant4TestStepAction();
0147
0148 void operator()(const G4Step*, G4SteppingManager*) override;
0149 };
0150
0151
0152
0153
0154
0155
0156
0157 class Geant4TestStackAction: public Geant4StackingAction, public Geant4TestBase {
0158 public:
0159
0160 Geant4TestStackAction(Geant4Context* c, const std::string& n);
0161
0162 virtual ~Geant4TestStackAction();
0163
0164 virtual void newStage(G4StackManager*) override;
0165
0166 virtual void prepare(G4StackManager*) override;
0167
0168 virtual TrackClassification classifyNewTrack(G4StackManager*, const G4Track*) override;
0169 };
0170
0171
0172
0173
0174
0175
0176
0177 class Geant4TestSensitive: public Geant4Sensitive, public Geant4TestBase {
0178 protected:
0179 size_t m_collectionID;
0180 public:
0181
0182 Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, Detector& description);
0183
0184 virtual ~Geant4TestSensitive();
0185
0186 virtual void begin(G4HCofThisEvent*) override;
0187
0188 virtual void end(G4HCofThisEvent*) override;
0189
0190 virtual bool process(const G4Step*, G4TouchableHistory*) override;
0191 };
0192 }
0193 }
0194 }
0195
0196 #endif