File indexing completed on 2025-10-30 08:01:07
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 #include "SteppingVerbose.hh"
0033 
0034 #include "G4SteppingManager.hh"
0035 #include "G4UnitsTable.hh"
0036 
0037 
0038 void SteppingVerbose::StepInfo()
0039 {
0040   CopyState();
0041 
0042   G4int prec = G4cout.precision(3);
0043 
0044   if (verboseLevel >= 1) {
0045     if (verboseLevel >= 4) VerboseTrack();
0046     if (verboseLevel >= 3) {
0047       G4cout << G4endl;
0048       G4cout << std::setw(5) << "#Step#"
0049              << " " << std::setw(6) << "X"
0050              << "    " << std::setw(6) << "Y"
0051              << "    " << std::setw(6) << "Z"
0052              << "    " << std::setw(8) << "KineE"
0053              << "    " << std::setw(9) << "Velocity" << std::setw(9) << "dEStep"
0054              << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10)
0055              << "Volume"
0056              << "  " << std::setw(10) << "Process" << G4endl;
0057     }
0058 
0059     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0060            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0061            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0062            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0063            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0064            << G4BestUnit(fStep->GetPreStepPoint()->GetVelocity(), "Velocity") << std::setw(6)
0065            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0066            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0067            << G4BestUnit(fTrack->GetTrackLength(), "Length") << "  ";
0068 
0069     if (fTrack->GetNextVolume() != nullptr) {
0070       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0071     }
0072     else {
0073       G4cout << std::setw(10) << "OutOfWorld";
0074     }
0075 
0076     if (fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
0077       G4cout << "  " << std::setw(10)
0078              << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
0079     }
0080     else {
0081       G4cout << "   UserLimit";
0082     }
0083 
0084     G4cout << G4endl;
0085 
0086     if (verboseLevel == 2) {
0087       G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt + fN2ndariesPostStepDoIt;
0088       if (tN2ndariesTot > 0) {
0089         G4cout << "    :----- List of 2ndaries - "
0090                << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot << "(Rest=" << std::setw(2)
0091                << fN2ndariesAtRestDoIt << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
0092                << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt << "), "
0093                << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size() << " ---------------"
0094                << G4endl;
0095 
0096         for (size_t lp1 = (*fSecondary).size() - tN2ndariesTot; lp1 < (*fSecondary).size(); lp1++) {
0097           G4cout << "    : " << std::setw(6)
0098                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(), "Length") << std::setw(6)
0099                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") << std::setw(6)
0100                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") << std::setw(6)
0101                  << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") << std::setw(10)
0102                  << (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
0103           G4cout << G4endl;
0104         }
0105 
0106         G4cout << "    :-----------------------------"
0107                << "----------------------------------"
0108                << "-- EndOf2ndaries Info ---------------" << G4endl;
0109       }
0110     }
0111   }
0112   G4cout.precision(prec);
0113 }
0114 
0115 
0116 void SteppingVerbose::TrackingStarted()
0117 {
0118   CopyState();
0119   G4int prec = G4cout.precision(3);
0120   if (verboseLevel > 0) {
0121     G4cout << std::setw(5) << "Step#"
0122            << " " << std::setw(6) << "X"
0123            << "    " << std::setw(6) << "Y"
0124            << "    " << std::setw(6) << "Z"
0125            << "    " << std::setw(9) << "KineE"
0126            << "    " << std::setw(9) << "Velocity" << std::setw(9) << "dEStep" << std::setw(10)
0127            << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(13) << "Volume"
0128            << "  " << std::setw(10) << "Process" << G4endl;
0129 
0130     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0131            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0132            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0133            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0134            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0135            << G4BestUnit(fStep->GetPreStepPoint()->GetVelocity(), "Velocity") << std::setw(6)
0136            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0137            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0138            << G4BestUnit(fTrack->GetTrackLength(), "Length") << "  ";
0139 
0140     if (fTrack->GetNextVolume()) {
0141       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0142     }
0143     else {
0144       G4cout << std::setw(10) << "OutOfWorld";
0145     }
0146     G4cout << "    initStep" << G4endl;
0147   }
0148   G4cout.precision(prec);
0149 }
0150 
0151