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