File indexing completed on 2025-02-23 09:22:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #include "RE01SteppingAction.hh"
0032
0033 #include "RE01RegionInformation.hh"
0034 #include "RE01TrackInformation.hh"
0035
0036 #include "G4LogicalVolume.hh"
0037 #include "G4Region.hh"
0038 #include "G4Step.hh"
0039 #include "G4StepPoint.hh"
0040 #include "G4SteppingManager.hh"
0041 #include "G4Track.hh"
0042 #include "G4TrackStatus.hh"
0043 #include "G4VPhysicalVolume.hh"
0044
0045
0046 RE01SteppingAction::RE01SteppingAction() : G4UserSteppingAction()
0047 {
0048 ;
0049 }
0050
0051
0052 RE01SteppingAction::~RE01SteppingAction()
0053 {
0054 ;
0055 }
0056
0057
0058 void RE01SteppingAction::UserSteppingAction(const G4Step* theStep)
0059 {
0060
0061
0062
0063 G4Track* theTrack = theStep->GetTrack();
0064 if (theTrack->GetTrackStatus() != fAlive) {
0065 return;
0066 }
0067
0068
0069 G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
0070 G4LogicalVolume* thePreLV = thePrePoint->GetPhysicalVolume()->GetLogicalVolume();
0071 RE01RegionInformation* thePreRInfo =
0072 (RE01RegionInformation*)(thePreLV->GetRegion()->GetUserInformation());
0073 G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
0074 G4LogicalVolume* thePostLV = thePostPoint->GetPhysicalVolume()->GetLogicalVolume();
0075 RE01RegionInformation* thePostRInfo =
0076 (RE01RegionInformation*)(thePostLV->GetRegion()->GetUserInformation());
0077
0078
0079 if (!(thePreRInfo->IsCalorimeter()) && (thePostRInfo->IsCalorimeter())) {
0080
0081 RE01TrackInformation* trackInfo =
0082 static_cast<RE01TrackInformation*>(theTrack->GetUserInformation());
0083 if (trackInfo->GetSuspendedStepID() > -1) {
0084 if (fpSteppingManager->GetverboseLevel() > 0) {
0085 G4cout << "++++ This track had already been suspended at step #"
0086 << trackInfo->GetSuspendedStepID() << ". Tracking resumed." << G4endl;
0087 }
0088 }
0089 else {
0090 trackInfo->SetSuspendedStepID(theTrack->GetCurrentStepNumber());
0091 theTrack->SetTrackStatus(fSuspend);
0092 }
0093 }
0094 }