Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE01SteppingAction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 // $Id: RE01SteppingAction.cc 97671 2016-06-07 08:25:00Z gcosmo $
30 //
31 
32 #include "RE01SteppingAction.hh"
33 #include "RE01RegionInformation.hh"
34 #include "RE01TrackInformation.hh"
35 
36 #include "G4Track.hh"
37 #include "G4Step.hh"
38 #include "G4StepPoint.hh"
39 #include "G4TrackStatus.hh"
40 #include "G4VPhysicalVolume.hh"
41 #include "G4LogicalVolume.hh"
42 #include "G4Region.hh"
43 #include "G4SteppingManager.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 {;}
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 {;}
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 {
57  // Suspend a track if it is entering into the calorimeter
58 
59  // check if it is alive
60  G4Track * theTrack = theStep->GetTrack();
61  if(theTrack->GetTrackStatus()!=fAlive) { return; }
62 
63  // get region information
64  G4StepPoint * thePrePoint = theStep->GetPreStepPoint();
65  G4LogicalVolume * thePreLV =
66  thePrePoint->GetPhysicalVolume()->GetLogicalVolume();
67  RE01RegionInformation* thePreRInfo
69  G4StepPoint * thePostPoint = theStep->GetPostStepPoint();
70  G4LogicalVolume * thePostLV =
71  thePostPoint->GetPhysicalVolume()->GetLogicalVolume();
72  RE01RegionInformation* thePostRInfo
74 
75  // check if it is entering to the calorimeter volume
76  if(!(thePreRInfo->IsCalorimeter()) && (thePostRInfo->IsCalorimeter()))
77  {
78  // if the track had already been suspended at the previous step, let it go.
79  RE01TrackInformation* trackInfo
80  = static_cast<RE01TrackInformation*>(theTrack->GetUserInformation());
81  if(trackInfo->GetSuspendedStepID()>-1)
82  {
84  {
85  G4cout<<"++++ This track had already been suspended at step #"
86  <<trackInfo->GetSuspendedStepID()<<". Tracking resumed."
87  <<G4endl;
88  }
89  }
90  else
91  {
92  trackInfo->SetSuspendedStepID(theTrack->GetCurrentStepNumber());
93  theTrack->SetTrackStatus(fSuspend);
94  }
95  }
96 }
void SetTrackStatus(const G4TrackStatus aTrackStatus)
virtual void UserSteppingAction(const G4Step *)
Definition of the RE01TrackInformation class.
G4VUserRegionInformation * GetUserInformation() const
G4TrackStatus GetTrackStatus() const
G4Region * GetRegion() const
Definition of the RE01RegionInformation class.
G4VUserTrackInformation * GetUserInformation() const
G4StepPoint * GetPreStepPoint() const
G4GLOB_DLL std::ostream G4cout
G4int GetCurrentStepNumber() const
G4VPhysicalVolume * GetPhysicalVolume() const
G4SteppingManager * fpSteppingManager
Definition of the RE01SteppingAction class.
Definition: G4Step.hh:76
G4LogicalVolume * GetLogicalVolume() const
G4int GetSuspendedStepID() const
G4StepPoint * GetPostStepPoint() const
void SetSuspendedStepID(G4int i)
#define G4endl
Definition: G4ios.hh:61
G4Track * GetTrack() const