Skip to content
Snippets Groups Projects
Commit 6ffd160e authored by Wouter Deconinck's avatar Wouter Deconinck Committed by MarkusFrankATcernch
Browse files

feat: add Geant4TestStackAction

parent 1ad0cf2e
No related branches found
No related tags found
No related merge requests found
......@@ -148,6 +148,26 @@ namespace dd4hep {
void operator()(const G4Step*, G4SteppingManager*) override;
};
/// Example stacking action doing nothing, but print
/**
* \author M.Frank
* \version 1.0
* \ingroup DD4HEP_SIMULATION
*/
class Geant4TestStackAction: public Geant4StackingAction, public Geant4TestBase {
public:
/// Standard constructor with initializing arguments
Geant4TestStackAction(Geant4Context* c, const std::string& n);
/// Default destructor
virtual ~Geant4TestStackAction();
/// New-stage callback
virtual void newStage(G4StackManager*) override;
/// Preparation callback
virtual void prepare(G4StackManager*) override;
/// Return TrackClassification with enum G4ClassificationOfNewTrack or NoTrackClassification
virtual TrackClassification classifyNewTrack(G4StackManager*, const G4Track*) override;
};
/// Example sensitve detector action doing nothing, but print
/**
* \author M.Frank
......
......@@ -139,7 +139,7 @@ DECLARE_GEANT4ACTION(Geant4TestRunAction)
DECLARE_GEANT4ACTION(Geant4TestEventAction)
DECLARE_GEANT4ACTION(Geant4TestStepAction)
DECLARE_GEANT4ACTION(Geant4TestTrackAction)
//DECLARE_GEANT4ACTION(Geant4TestStackingAction)
DECLARE_GEANT4ACTION(Geant4TestStackAction)
DECLARE_GEANT4ACTION(Geant4TestGeneratorAction)
DECLARE_GEANT4SENSITIVE(Geant4TestSensitive)
DECLARE_GEANT4SENSITIVE(Geant4TestSensitiveTracker)
......
......@@ -183,6 +183,33 @@ void Geant4TestStepAction::operator()(const G4Step*, G4SteppingManager*) {
PRINT("%s> calling operator()", m_type.c_str());
}
/// Standard constructor with initializing arguments
Geant4TestStackAction::Geant4TestStackAction(Geant4Context* c, const std::string& n)
: Geant4StackingAction(c, n), Geant4TestBase(this, "Geant4TestStackAction") {
InstanceCount::increment(this);
}
/// Default destructor
Geant4TestStackAction::~Geant4TestStackAction() {
InstanceCount::decrement(this);
}
/// New-stage callback
void Geant4TestStackAction::newStage(G4StackManager*) {
PRINT("%s> calling newStage()", m_type.c_str());
}
/// Preparation callback
void Geant4TestStackAction::prepare(G4StackManager*) {
PRINT("%s> calling prepare()", m_type.c_str());
}
/// Return TrackClassification with enum G4ClassificationOfNewTrack or NoTrackClassification
TrackClassification Geant4TestStackAction::classifyNewTrack(G4StackManager*, const G4Track* trk) {
PRINT("%s> calling classifyNewTrack(track=%d, parent=%d, position=(%f,%f,%f) Context: run=%p evt=%p)",
m_type.c_str(), trk->GetTrackID(),
trk->GetParentID(), trk->GetPosition().x(), trk->GetPosition().y(), trk->GetPosition().z(),
&context()->run(), &context()->event());
return TrackClassification();
}
/// Standard constructor with initializing arguments
Geant4TestSensitive::Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, Detector& description)
: Geant4Sensitive(c, n, det, description), Geant4TestBase(this, "Geant4TestSensitive") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment