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