ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE01SteppingAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RE01SteppingAction.cc
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 //
30 
31 #include "RE01SteppingAction.hh"
32 #include "RE01RegionInformation.hh"
33 #include "RE01TrackInformation.hh"
34 
35 #include "G4Track.hh"
36 #include "G4Step.hh"
37 #include "G4StepPoint.hh"
38 #include "G4TrackStatus.hh"
39 #include "G4VPhysicalVolume.hh"
40 #include "G4LogicalVolume.hh"
41 #include "G4Region.hh"
42 #include "G4SteppingManager.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 {;}
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 {;}
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 {
56  // Suspend a track if it is entering into the calorimeter
57 
58  // check if it is alive
59  G4Track * theTrack = theStep->GetTrack();
60  if(theTrack->GetTrackStatus()!=fAlive) { return; }
61 
62  // get region information
63  G4StepPoint * thePrePoint = theStep->GetPreStepPoint();
64  G4LogicalVolume * thePreLV =
65  thePrePoint->GetPhysicalVolume()->GetLogicalVolume();
66  RE01RegionInformation* thePreRInfo
68  G4StepPoint * thePostPoint = theStep->GetPostStepPoint();
69  G4LogicalVolume * thePostLV =
70  thePostPoint->GetPhysicalVolume()->GetLogicalVolume();
71  RE01RegionInformation* thePostRInfo
73 
74  // check if it is entering to the calorimeter volume
75  if(!(thePreRInfo->IsCalorimeter()) && (thePostRInfo->IsCalorimeter()))
76  {
77  // if the track had already been suspended at the previous step, let it go.
78  RE01TrackInformation* trackInfo
79  = static_cast<RE01TrackInformation*>(theTrack->GetUserInformation());
80  if(trackInfo->GetSuspendedStepID()>-1)
81  {
83  {
84  G4cout<<"++++ This track had already been suspended at step #"
85  <<trackInfo->GetSuspendedStepID()<<". Tracking resumed."
86  <<G4endl;
87  }
88  }
89  else
90  {
91  trackInfo->SetSuspendedStepID(theTrack->GetCurrentStepNumber());
92  theTrack->SetTrackStatus(fSuspend);
93  }
94  }
95 }