Loading...
Searching...
No Matches
VG01SteppingVerboseWithDir.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//
26//s
27/// \file VG01SteppingVerboseWithDir.cc
28/// \brief Implementation of the VG01SteppingVerboseWithDir class
29
30// Author : J. Apostolakis, (EP/SFT CERN) 2019-21
31//
32// Refines the existing G4SteppingVerbose, adding:
33// - direction of particle
34// - safety (at step's start point)
35
37#include "G4SteppingManager.hh"
38
39#include "G4UnitsTable.hh"
40
41//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
42
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
55{
56 G4cout << G4endl;
57 G4cout << std::setw( 5) << "Step#" << " "
58 << std::setw( 9) << "X (mm)" << " "
59 << std::setw( 9) << "Y (mm)" << " "
60 << std::setw( 9) << "Z (mm)" << " "
61 << std::setw(11) << "Ek (MeV)" << " "
62 << std::setw( 8) << "dE (MeV)" << " "
63 << std::setw( 7) << "Step(mm)" << " "
64 << std::setw(12) << "Track(mm)" << " "
65 << std::setw( 7) << "Safety(mm)" << " | "
66 << std::setw(11) << " Dir.x " << " "
67 << std::setw(11) << " Dir.y " << " "
68 << std::setw(11) << " Dir.z " << " | "
69 << std::setw(15) << "Material"
70 << std::setw(14) << "Process"
71 << std::setw(15) << "NextVolu"
72 << G4endl;
73}
74
75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76
78{
79 CopyState();
80
81 G4int prec = G4cout.precision(6);
82
83 if( verboseLevel >= 1 ){
84 if( verboseLevel >= 4 ) VerboseTrack();
85 if( verboseLevel >= 3 ){ Banner(); }
86
87 G4cout << std::setw( 5)<<fTrack->GetCurrentStepNumber() << " "
88 << std::setw( 9)<<fTrack->GetPosition().x() / CLHEP::mm << " "
89 << std::setw( 9)<<fTrack->GetPosition().y() / CLHEP::mm << " "
90 << std::setw( 9)<<fTrack->GetPosition().z() / CLHEP::mm << " " // << " Ek = "
91 << std::setw(11)<<fTrack->GetKineticEnergy() / CLHEP::MeV << " ";
92 G4cout.precision(3);
93 G4cout << std::setw( 8)<<fStep->GetTotalEnergyDeposit() / CLHEP::MeV << " "
94 << std::setw( 7)<<fStep->GetStepLength() / CLHEP::mm << " ";
95 G4cout.precision(6);
96 G4cout << std::setw(12)<<fTrack->GetTrackLength() / CLHEP::mm << " ";
97
98 G4cout.precision(5);
99 G4StepPoint* preStepPt= fTrack->GetStep()->GetPreStepPoint();
100 if( preStepPt != nullptr ) {
101 G4double safety = preStepPt->GetSafety();
102 G4cout << std::setw( 8) << ( (safety > 1.0e-9) ? safety : 0.0 ) << " ";
103 } else {
104 G4cout << std::setw( 8) << "-0.0_(N/A)" << " ";
105 }
106
107
108 G4cout << "| ";
109 G4cout << std::setw(11)<<fTrack->GetMomentumDirection().x() << " "
110 << std::setw(11)<<fTrack->GetMomentumDirection().y() << " "
111 << std::setw(11)<<fTrack->GetMomentumDirection().z() << " | ";
112
113 G4cout << std::setw(15) << fTrack->GetMaterial()->GetName() << " ";
114 G4VProcess const* pds= fStep->GetPostStepPoint()->GetProcessDefinedStep();
115 G4cout << std::setw(14) << ( ( pds != nullptr) ? pds->GetProcessName() :
116 G4String( "User Limit") ) << " ";
117 // if( fStepStatus != fWorldBoundary){
118 if( fTrack->GetNextVolume() != nullptr ) {
119 G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
120 G4cout << std::setw( 4) << fTrack->GetNextVolume()->GetCopyNo();
121 } else {
122 G4cout << std::setw(10) << "OutOfWorld";
123 }
124
125 G4cout << " ";
126
127 G4cout << G4endl;
128
129 if( verboseLevel == 2 ){
130 G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
131 fN2ndariesAlongStepDoIt +
132 fN2ndariesPostStepDoIt;
133 if(tN2ndariesTot>0){
134 G4cout << " :----- List of 2ndaries - "
135 << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
136 << "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
137 << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
138 << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
139 << "), "
140 << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
141 << " ---------------"
142 << G4endl;
143
144 for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
145 lp1<(*fSecondary).size(); lp1++){
146 G4cout << " : "
147 << std::setw(8)
148 << (*fSecondary)[lp1]->GetPosition().x() / CLHEP::mm << " "
149 << std::setw(8)
150 << (*fSecondary)[lp1]->GetPosition().y() / CLHEP::mm << " "
151 << std::setw(8)
152 << (*fSecondary)[lp1]->GetPosition().z() / CLHEP::mm << " "
153 << std::setw(8)
154 << (*fSecondary)[lp1]->GetKineticEnergy() / CLHEP::MeV << " "
155 << std::setw(10)
156 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << " ";
157 G4cout << G4endl;
158 }
159
160 G4cout << " :-----------------------------"
161 << "----------------------------------"
162 << "-- EndOf2ndaries Info ---------------"
163 << G4endl;
164 }
165 }
166
167 }
168 G4cout.precision(prec);
169 // G4cout<< "exit VG01SteppingVerboseWithDir::StepInfo " <<G4endl;
170}
171
172//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
173
175{
176 CopyState();
177 G4int prec = G4cout.precision(6);
178 if( verboseLevel > 0 ){
179
180 Banner();
181
182 G4cout << std::setw( 5)<<fTrack->GetCurrentStepNumber() << " "
183 << std::setw( 9)<<fTrack->GetPosition().x() / CLHEP::mm << " "
184 << std::setw( 9)<<fTrack->GetPosition().y() / CLHEP::mm << " "
185 << std::setw( 9)<<fTrack->GetPosition().z() / CLHEP::mm << " " // << " E_0 = "
186 << std::setw(11)<<fTrack->GetKineticEnergy() / CLHEP::MeV << " ";
187 // << " ( = " << std::setw(8) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy") << " ) "
188 G4cout.precision(3);
189 G4cout << std::setw( 8) << fStep->GetTotalEnergyDeposit() / CLHEP::MeV << " "
190 << std::setw( 7) << fStep->GetStepLength() / CLHEP::mm << " ";
191 G4cout.precision(6);
192 G4cout << std::setw(12) << fTrack->GetTrackLength() / CLHEP::mm << " ";
193
194 G4Step const* step= fTrack->GetStep();
195 G4StepPoint const * preStepPt= nullptr;
196 if( step != nullptr )
197 preStepPt =fTrack->GetStep()->GetPreStepPoint();
198 if( preStepPt != nullptr ) {
199 G4double safety = preStepPt->GetSafety();
200 G4cout << std::setw( 8) << ( (safety > 1.0e-9) ? safety : 0.0 ) << " ";
201 } else {
202 G4cout << std::setw( 8) << "N/A" << " ";
203 }
204 G4cout << "| ";
205 G4cout << std::setw(11) << fTrack->GetMomentumDirection().x() << " "
206 << std::setw(11) << fTrack->GetMomentumDirection().y() << " "
207 << std::setw(11) << fTrack->GetMomentumDirection().z() << " | ";
208
209 // Material and volume name
210 if(fTrack->GetVolume()){
211 G4Material* material = fTrack->GetVolume()->GetLogicalVolume()->GetMaterial();
212 if( material != nullptr ){
213 G4cout << std::setw(15) << material->GetName() << " ";
214 }
215 else {
216 G4cout << std::setw(15) << "No-Material" << " ";
217 }
218 G4cout << std::setw(14) << "initStep" << " ";
219 G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
220 G4cout << std::setw( 4) << fTrack->GetVolume()->GetCopyNo() << " (initial Volume)";
221
222 } else {
223 G4cout << std::setw(10) << "No-Material" << " ";
224 G4cout << std::setw(14) << "initStep" << " ";
225 G4cout << std::setw(10) << "OutOfWorld" << " ";
226 }
227 // fTrack->GetMaterial() fails at track start !!!!
228 G4cout << G4endl;
229 }
230 G4cout.precision(prec);
231}
Definition of the VG01SteppingVerboseWithDir class.

Applications | User Support | Publications | Collaboration