Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file runAndEvent/RE01/src/RE01SteppingAct 26 /// \file runAndEvent/RE01/src/RE01SteppingAction.cc 27 /// \brief Implementation of the RE01SteppingA 27 /// \brief Implementation of the RE01SteppingAction class 28 // 28 // >> 29 // $Id: RE01SteppingAction.cc 97671 2016-06-07 08:25:00Z gcosmo $ 29 // 30 // 30 31 31 #include "RE01SteppingAction.hh" 32 #include "RE01SteppingAction.hh" 32 << 33 #include "RE01RegionInformation.hh" 33 #include "RE01RegionInformation.hh" 34 #include "RE01TrackInformation.hh" 34 #include "RE01TrackInformation.hh" 35 35 36 #include "G4LogicalVolume.hh" << 36 #include "G4Track.hh" 37 #include "G4Region.hh" << 38 #include "G4Step.hh" 37 #include "G4Step.hh" 39 #include "G4StepPoint.hh" 38 #include "G4StepPoint.hh" 40 #include "G4SteppingManager.hh" << 41 #include "G4Track.hh" << 42 #include "G4TrackStatus.hh" 39 #include "G4TrackStatus.hh" 43 #include "G4VPhysicalVolume.hh" 40 #include "G4VPhysicalVolume.hh" >> 41 #include "G4LogicalVolume.hh" >> 42 #include "G4Region.hh" >> 43 #include "G4SteppingManager.hh" 44 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 46 RE01SteppingAction::RE01SteppingAction() : G4U << 46 RE01SteppingAction::RE01SteppingAction() 47 { << 47 : G4UserSteppingAction() 48 ; << 48 {;} 49 } << 50 49 51 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 52 RE01SteppingAction::~RE01SteppingAction() 51 RE01SteppingAction::~RE01SteppingAction() 53 { << 52 {;} 54 ; << 55 } << 56 53 57 //....oooOO0OOooo........oooOO0OOooo........oo 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 58 void RE01SteppingAction::UserSteppingAction(co << 55 void RE01SteppingAction::UserSteppingAction(const G4Step * theStep) 59 { 56 { 60 // Suspend a track if it is entering into th 57 // Suspend a track if it is entering into the calorimeter 61 58 62 // check if it is alive 59 // check if it is alive 63 G4Track* theTrack = theStep->GetTrack(); << 60 G4Track * theTrack = theStep->GetTrack(); 64 if (theTrack->GetTrackStatus() != fAlive) { << 61 if(theTrack->GetTrackStatus()!=fAlive) { return; } 65 return; << 66 } << 67 62 68 // get region information 63 // get region information 69 G4StepPoint* thePrePoint = theStep->GetPreSt << 64 G4StepPoint * thePrePoint = theStep->GetPreStepPoint(); 70 G4LogicalVolume* thePreLV = thePrePoint->Get << 65 G4LogicalVolume * thePreLV = 71 RE01RegionInformation* thePreRInfo = << 66 thePrePoint->GetPhysicalVolume()->GetLogicalVolume(); 72 (RE01RegionInformation*)(thePreLV->GetRegi << 67 RE01RegionInformation* thePreRInfo 73 G4StepPoint* thePostPoint = theStep->GetPost << 68 = (RE01RegionInformation*)(thePreLV->GetRegion()->GetUserInformation()); 74 G4LogicalVolume* thePostLV = thePostPoint->G << 69 G4StepPoint * thePostPoint = theStep->GetPostStepPoint(); 75 RE01RegionInformation* thePostRInfo = << 70 G4LogicalVolume * thePostLV = 76 (RE01RegionInformation*)(thePostLV->GetReg << 71 thePostPoint->GetPhysicalVolume()->GetLogicalVolume(); >> 72 RE01RegionInformation* thePostRInfo >> 73 = (RE01RegionInformation*)(thePostLV->GetRegion()->GetUserInformation()); 77 74 78 // check if it is entering to the calorimete 75 // check if it is entering to the calorimeter volume 79 if (!(thePreRInfo->IsCalorimeter()) && (theP << 76 if(!(thePreRInfo->IsCalorimeter()) && (thePostRInfo->IsCalorimeter())) >> 77 { 80 // if the track had already been suspended 78 // if the track had already been suspended at the previous step, let it go. 81 RE01TrackInformation* trackInfo = << 79 RE01TrackInformation* trackInfo 82 static_cast<RE01TrackInformation*>(theTr << 80 = static_cast<RE01TrackInformation*>(theTrack->GetUserInformation()); 83 if (trackInfo->GetSuspendedStepID() > -1) << 81 if(trackInfo->GetSuspendedStepID()>-1) 84 if (fpSteppingManager->GetverboseLevel() << 82 { 85 G4cout << "++++ This track had already << 83 if(fpSteppingManager->GetverboseLevel()>0) 86 << trackInfo->GetSuspendedStepI << 84 { >> 85 G4cout<<"++++ This track had already been suspended at step #" >> 86 <<trackInfo->GetSuspendedStepID()<<". Tracking resumed." >> 87 <<G4endl; 87 } 88 } 88 } 89 } 89 else { << 90 else >> 91 { 90 trackInfo->SetSuspendedStepID(theTrack-> 92 trackInfo->SetSuspendedStepID(theTrack->GetCurrentStepNumber()); 91 theTrack->SetTrackStatus(fSuspend); 93 theTrack->SetTrackStatus(fSuspend); 92 } 94 } 93 } 95 } 94 } 96 } 95 97