BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesSteppingAction.cc
Go to the documentation of this file.
1
3#include "G4StepPoint.hh"
4#include "G4ThreeVector.hh"
5#include "G4Track.hh"
6
7#include "G4SystemOfUnits.hh"
8#include "G4UnitsTable.hh"
9#include "G4VProcess.hh"
10
12
14
15void BesSteppingAction::UserSteppingAction( const G4Step* currentStep ) {
16
17 G4StepPoint* postStep = currentStep->GetPostStepPoint();
18 G4ThreeVector currentPosition = postStep->GetPosition();
19 G4Track* currentTrack = currentStep->GetTrack();
20 if ( std::abs( currentPosition.x() ) > 263.5 * cm ||
21 std::abs( currentPosition.y() ) > 263.5 * cm ||
22 std::abs( currentPosition.z() ) > 287.5 * cm )
23 {
24 G4cout << "Out of World!!!" << G4endl;
25 currentTrack->SetTrackStatus( fKillTrackAndSecondaries );
26 }
27 else if ( currentTrack->GetCurrentStepNumber() >= 20000 )
28 {
29 G4cout << "StepNumber>=20000 !!!" << G4endl;
30 currentTrack->SetTrackStatus( fKillTrackAndSecondaries );
31 }
32 /* G4cout.precision(15);
33 G4cout<<"#Step# "<<currentTrack->GetCurrentStepNumber()<<" pName
34 "<<currentTrack->GetDefinition()->GetParticleName()<<" prex prey prez
35 "<<currentStep->GetPreStepPoint()->GetPosition().x()/mm<<"
36 "<<currentStep->GetPreStepPoint()->GetPosition().y()/mm<<"
37 "<<currentStep->GetPreStepPoint()->GetPosition().z()/mm<<G4endl; G4cout<<"prepx prepy
38 prepz "<<currentStep->GetPreStepPoint()->GetMomentum().x()/GeV<<"
39 "<<currentStep->GetPreStepPoint()->GetMomentum().y()/GeV<<"
40 "<<currentStep->GetPreStepPoint()->GetMomentum().z()/GeV<<G4endl; G4cout<<"post step postx
41 posty postz "<<postStep->GetPosition().x()/mm<<" "<<postStep->GetPosition().y()/mm<<"
42 "<<postStep->GetPosition().z()/mm<<G4endl; G4cout<<"postpx postpy postpz
43 "<<postStep->GetMomentum().x()/GeV<<" "<<postStep->GetMomentum().y()/GeV<<"
44 "<<postStep->GetMomentum().z()/GeV<<G4endl; G4cout << G4endl; G4cout << std::setw( 5) <<
45 "#Step#" << " "
46 << std::setw( 9) << "pName" << " "
47 << std::setw( 6) << "X" << " "
48 << std::setw( 6) << "Y" << " "
49 << std::setw( 6) << "Z" << " "
50 << std::setw( 9) << "KineE" << " "
51 << std::setw( 9) << "dEStep" << " "
52 << std::setw(10) << "StepLeng"
53 << std::setw(10) << "Volume" << " "
54 << std::setw(10) << "Process"
55 << G4endl;
56
57
58 G4cout << std::setw(5) << currentTrack->GetCurrentStepNumber() << " "
59 << std::setw(9) << currentTrack->GetDefinition()->GetParticleName()
60 << std::setw(6) << G4BestUnit(currentTrack->GetPosition().x(),"Length")
61 << std::setw(6) << G4BestUnit(currentTrack->GetPosition().y(),"Length")
62 << std::setw(6) << G4BestUnit(currentTrack->GetPosition().z(),"Length")
63 << std::setw(6) << G4BestUnit(currentTrack->GetKineticEnergy(),"Energy")
64 << std::setw(6) << G4BestUnit(currentStep->GetTotalEnergyDeposit(),"Energy")
65 << std::setw(6) << G4BestUnit(currentStep->GetStepLength(),"Length");
66 if( currentTrack->GetNextVolume() != 0 ) {
67 G4cout << std::setw(10) << currentTrack->GetVolume()->GetName();
68 } else {
69 G4cout << std::setw(10) << "OutOfWorld";
70 }
71
72 if(currentStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
73 G4cout << " "
74 << std::setw(10) << currentStep->GetPostStepPoint()->GetProcessDefinedStep()
75 ->GetProcessName();
76 } else {
77 G4cout << " UserLimit";
78 }
79
80 G4cout << G4endl;
81 HepRandom::showEngineStatus();
82 */
83}
void UserSteppingAction(const G4Step *)