4 // See the class description in the header file.
6 #include "TG4SteppingAction.h"
7 #include "TG4VSensitiveDetector.h"
8 #include "TG4Globals.h"
10 TG4SteppingAction::TG4SteppingAction() {
14 TG4SteppingAction::TG4SteppingAction(const TG4SteppingAction& right) {
16 TG4Globals::Exception("TG4SteppingAction is protected from copying.");
19 TG4SteppingAction::~TG4SteppingAction() {
26 TG4SteppingAction::operator=(const TG4SteppingAction &right)
28 // check assignement to self
29 if (this == &right) return *this;
31 TG4Globals::Exception("TG4SteppingAction is protected from assigning.");
38 void TG4SteppingAction::UserSteppingAction(const G4Step* step)
40 // Called by G4 kernel at the end of each step.
43 // call stepping action of derived class
46 // let sensitive detector process boundary step
47 // if crossing geometry border
48 // (this ensures compatibility with G3 that
49 // makes boundary step of zero length)
51 if (step->GetPostStepPoint()->GetStepStatus() == fGeomBoundary &&
52 step->GetTrack()->GetTrackStatus() == fAlive &&
53 step->GetTrack()->GetNextVolume() != 0) {
55 G4VSensitiveDetector* sd
56 = step->GetPostStepPoint()->GetPhysicalVolume()
57 ->GetLogicalVolume()->GetSensitiveDetector();
60 TG4VSensitiveDetector* tsd = dynamic_cast<TG4VSensitiveDetector*>(sd);
62 tsd->ProcessHitsOnBoundary((G4Step*)step);
64 G4String text = "TG4SteppingAction:::UserSteppingAction: \n";
65 text = text + " Unknown sensitive detector type";
66 TG4Globals::Exception(text);