File indexing completed on 2025-12-18 09:32:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include "VG01SteppingVerboseWithDir.hh"
0037
0038 #include "G4SteppingManager.hh"
0039 #include "G4UnitsTable.hh"
0040
0041
0042
0043 VG01SteppingVerboseWithDir::VG01SteppingVerboseWithDir() : G4SteppingVerbose() {}
0044
0045
0046
0047 VG01SteppingVerboseWithDir::~VG01SteppingVerboseWithDir() {}
0048
0049
0050
0051 void VG01SteppingVerboseWithDir::Banner()
0052 {
0053 G4cout << G4endl;
0054 G4cout << std::setw(5) << "Step#"
0055 << " " << std::setw(9) << "X (mm)"
0056 << " " << std::setw(9) << "Y (mm)"
0057 << " " << std::setw(9) << "Z (mm)"
0058 << " " << std::setw(11) << "Ek (MeV)"
0059 << " " << std::setw(8) << "dE (MeV)"
0060 << " " << std::setw(7) << "Step(mm)"
0061 << " " << std::setw(12) << "Track(mm)"
0062 << " " << std::setw(7) << "Safety(mm)"
0063 << " | " << std::setw(11) << " Dir.x "
0064 << " " << std::setw(11) << " Dir.y "
0065 << " " << std::setw(11) << " Dir.z "
0066 << " | " << std::setw(15) << "Material" << std::setw(14) << "Process" << std::setw(15)
0067 << "NextVolu" << G4endl;
0068 }
0069
0070
0071
0072 void VG01SteppingVerboseWithDir::StepInfo()
0073 {
0074 CopyState();
0075
0076 G4int prec = G4cout.precision(6);
0077
0078 if (verboseLevel >= 1) {
0079 if (verboseLevel >= 4) VerboseTrack();
0080 if (verboseLevel >= 3) {
0081 Banner();
0082 }
0083
0084 G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(9)
0085 << fTrack->GetPosition().x() / CLHEP::mm << " " << std::setw(9)
0086 << fTrack->GetPosition().y() / CLHEP::mm << " " << std::setw(9)
0087 << fTrack->GetPosition().z() / CLHEP::mm << " "
0088 << std::setw(11) << fTrack->GetKineticEnergy() / CLHEP::MeV << " ";
0089 G4cout.precision(3);
0090 G4cout << std::setw(8) << fStep->GetTotalEnergyDeposit() / CLHEP::MeV << " " << std::setw(7)
0091 << fStep->GetStepLength() / CLHEP::mm << " ";
0092 G4cout.precision(6);
0093 G4cout << std::setw(12) << fTrack->GetTrackLength() / CLHEP::mm << " ";
0094
0095 G4cout.precision(5);
0096 G4StepPoint* preStepPt = fTrack->GetStep()->GetPreStepPoint();
0097 if (preStepPt != nullptr) {
0098 G4double safety = preStepPt->GetSafety();
0099 G4cout << std::setw(8) << ((safety > 1.0e-9) ? safety : 0.0) << " ";
0100 }
0101 else {
0102 G4cout << std::setw(8) << "-0.0_(N/A)"
0103 << " ";
0104 }
0105
0106 G4cout << "| ";
0107 G4cout << std::setw(11) << fTrack->GetMomentumDirection().x() << " " << std::setw(11)
0108 << fTrack->GetMomentumDirection().y() << " " << std::setw(11)
0109 << fTrack->GetMomentumDirection().z() << " | ";
0110
0111 G4cout << std::setw(15) << fTrack->GetMaterial()->GetName() << " ";
0112 G4VProcess const* pds = fStep->GetPostStepPoint()->GetProcessDefinedStep();
0113 G4cout << std::setw(14) << ((pds != nullptr) ? pds->GetProcessName() : G4String("User Limit"))
0114 << " ";
0115
0116 if (fTrack->GetNextVolume() != nullptr) {
0117 G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
0118 G4cout << std::setw(4) << fTrack->GetNextVolume()->GetCopyNo();
0119 }
0120 else {
0121 G4cout << std::setw(10) << "OutOfWorld";
0122 }
0123
0124 G4cout << " ";
0125
0126 G4cout << G4endl;
0127
0128 if (verboseLevel == 2) {
0129 G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt + fN2ndariesPostStepDoIt;
0130 if (tN2ndariesTot > 0) {
0131 G4cout << " :----- List of 2ndaries - "
0132 << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot << "(Rest=" << std::setw(2)
0133 << fN2ndariesAtRestDoIt << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
0134 << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt << "), "
0135 << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size() << " ---------------"
0136 << G4endl;
0137
0138 for (size_t lp1 = (*fSecondary).size() - tN2ndariesTot; lp1 < (*fSecondary).size(); lp1++) {
0139 G4cout << " : " << std::setw(8) << (*fSecondary)[lp1]->GetPosition().x() / CLHEP::mm
0140 << " " << std::setw(8) << (*fSecondary)[lp1]->GetPosition().y() / CLHEP::mm << " "
0141 << std::setw(8) << (*fSecondary)[lp1]->GetPosition().z() / CLHEP::mm << " "
0142 << std::setw(8) << (*fSecondary)[lp1]->GetKineticEnergy() / CLHEP::MeV << " "
0143 << std::setw(10) << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << " ";
0144 G4cout << G4endl;
0145 }
0146
0147 G4cout << " :-----------------------------"
0148 << "----------------------------------"
0149 << "-- EndOf2ndaries Info ---------------" << G4endl;
0150 }
0151 }
0152 }
0153 G4cout.precision(prec);
0154
0155 }
0156
0157
0158
0159 void VG01SteppingVerboseWithDir::TrackingStarted()
0160 {
0161 CopyState();
0162 G4int prec = G4cout.precision(6);
0163 if (verboseLevel > 0) {
0164 Banner();
0165
0166 G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(9)
0167 << fTrack->GetPosition().x() / CLHEP::mm << " " << std::setw(9)
0168 << fTrack->GetPosition().y() / CLHEP::mm << " " << std::setw(9)
0169 << fTrack->GetPosition().z() / CLHEP::mm << " "
0170 << std::setw(11) << fTrack->GetKineticEnergy() / CLHEP::MeV << " ";
0171
0172 G4cout.precision(3);
0173 G4cout << std::setw(8) << fStep->GetTotalEnergyDeposit() / CLHEP::MeV << " " << std::setw(7)
0174 << fStep->GetStepLength() / CLHEP::mm << " ";
0175 G4cout.precision(6);
0176 G4cout << std::setw(12) << fTrack->GetTrackLength() / CLHEP::mm << " ";
0177
0178 G4Step const* step = fTrack->GetStep();
0179 G4StepPoint const* preStepPt = nullptr;
0180 if (step != nullptr) preStepPt = fTrack->GetStep()->GetPreStepPoint();
0181 if (preStepPt != nullptr) {
0182 G4double safety = preStepPt->GetSafety();
0183 G4cout << std::setw(8) << ((safety > 1.0e-9) ? safety : 0.0) << " ";
0184 }
0185 else {
0186 G4cout << std::setw(8) << "N/A"
0187 << " ";
0188 }
0189 G4cout << "| ";
0190 G4cout << std::setw(11) << fTrack->GetMomentumDirection().x() << " " << std::setw(11)
0191 << fTrack->GetMomentumDirection().y() << " " << std::setw(11)
0192 << fTrack->GetMomentumDirection().z() << " | ";
0193
0194
0195 if (fTrack->GetVolume()) {
0196 G4Material* material = fTrack->GetVolume()->GetLogicalVolume()->GetMaterial();
0197 if (material != nullptr) {
0198 G4cout << std::setw(15) << material->GetName() << " ";
0199 }
0200 else {
0201 G4cout << std::setw(15) << "No-Material"
0202 << " ";
0203 }
0204 G4cout << std::setw(14) << "initStep"
0205 << " ";
0206 G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0207 G4cout << std::setw(4) << fTrack->GetVolume()->GetCopyNo() << " (initial Volume)";
0208 }
0209 else {
0210 G4cout << std::setw(10) << "No-Material"
0211 << " ";
0212 G4cout << std::setw(14) << "initStep"
0213 << " ";
0214 G4cout << std::setw(10) << "OutOfWorld"
0215 << " ";
0216 }
0217
0218 G4cout << G4endl;
0219 }
0220 G4cout.precision(prec);
0221 }