Geant4 Cross Reference |
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 // 27 /// \file field/field04/src/F04SteppingVerbose.cc 28 /// \brief Implementation of the F04SteppingVerbose class 29 // 30 31 #include "F04SteppingVerbose.hh" 32 33 #include "G4UnitsTable.hh" 34 35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 36 37 F04SteppingVerbose::F04SteppingVerbose() 38 { 39 G4VSteppingVerbose::SetSilent(1); 40 } 41 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 44 void F04SteppingVerbose::StepInfo() 45 { 46 CopyState(); 47 48 G4int prec = G4cout.precision(8); 49 50 if (fTrack->GetDefinition()->GetParticleName() == "proton") return; 51 // if (fTrack->GetDefinition()->GetParticleName() == "pi+") return; 52 // if (fTrack->GetDefinition()->GetParticleName() == "mu+") return; 53 if (fTrack->GetDefinition()->GetParticleName() == "e+") return; 54 55 if (verboseLevel >= 1) { 56 if (verboseLevel >= 4) VerboseTrack(); 57 if (verboseLevel >= 3) { 58 G4cout << G4endl; 59 G4cout << std::setw(5) << "#Step#" 60 << " " << std::setw(10) << "X" 61 << " " << std::setw(10) << "Y" 62 << " " << std::setw(10) << "Z" 63 << " " << std::setw(10) << "KineE" 64 << " " << std::setw(10) << "dEStep" 65 << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10) 66 << "NextVolu" << std::setw(10) << "Process" << std::setw(10) << "Dir_x" 67 << " " << std::setw(10) << "Dir_y" 68 << " " << std::setw(10) << "Dir_z" 69 << " " << G4endl; 70 } 71 72 G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(10) 73 << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(10) 74 << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(10) 75 << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(10) 76 << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(10) 77 << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(10) 78 << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(10) 79 << G4BestUnit(fTrack->GetTrackLength(), "Length"); 80 81 if (fTrack->GetNextVolume() != nullptr) { 82 G4cout << std::setw(10) << fTrack->GetVolume()->GetName(); 83 } 84 else { 85 G4cout << std::setw(10) << "OutOfWorld"; 86 } 87 88 if (fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) { 89 G4cout << " " << std::setw(10) 90 << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); 91 } 92 else { 93 G4cout << " UserLimit"; 94 } 95 96 // G4cout << std::setw(12) << 97 // G4BestUnit(fTrack->GetMomentumDirection().x(),"Length") 98 // << std::setw(12) << 99 // G4BestUnit(fTrack->GetMomentumDirection().y(),"Length") 100 // << std::setw(12) << 101 // G4BestUnit(fTrack->GetMomentumDirection().z(),"Length"); 102 103 G4cout << G4endl; 104 105 if (verboseLevel == 2) { 106 G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt + fN2ndariesPostStepDoIt; 107 if (tN2ndariesTot > 0) { 108 G4cout << " :----- List of 2ndaries - " 109 << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot << "(Rest=" << std::setw(2) 110 << fN2ndariesAtRestDoIt << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt 111 << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt << "), " 112 << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size() << " ---------------" 113 << G4endl; 114 115 for (size_t lp1 = (*fSecondary).size() - tN2ndariesTot; lp1 < (*fSecondary).size(); lp1++) { 116 G4cout << " : " << std::setw(6) 117 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(), "Length") << std::setw(6) 118 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") << std::setw(6) 119 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") << std::setw(6) 120 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") << std::setw(10) 121 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName(); 122 G4cout << G4endl; 123 } 124 125 G4cout << " :-----------------------------" 126 << "----------------------------------" 127 << "-- EndOf2ndaries Info ---------------" << G4endl; 128 } 129 } 130 } 131 G4cout.precision(prec); 132 } 133 134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 135 136 void F04SteppingVerbose::TrackingStarted() 137 { 138 CopyState(); 139 140 G4int prec = G4cout.precision(3); 141 142 if (fTrack->GetDefinition()->GetParticleName() == "proton") return; 143 // if (fTrack->GetDefinition()->GetParticleName() == "pi+") return; 144 // if (fTrack->GetDefinition()->GetParticleName() == "mu+") return; 145 if (fTrack->GetDefinition()->GetParticleName() == "e+") return; 146 147 G4cout << G4endl; 148 G4cout << "*******************************************************" 149 << "**************************************************" << G4endl; 150 G4cout << "* G4Track Information: " 151 << " Particle = " << fTrack->GetDefinition()->GetParticleName() << "," 152 << " Track ID = " << fTrack->GetTrackID() << "," 153 << " Parent ID = " << fTrack->GetParentID() << G4endl; 154 G4cout << "*******************************************************" 155 << "**************************************************" << G4endl; 156 G4cout << G4endl; 157 158 if (verboseLevel > 0) { 159 G4cout << std::setw(5) << "Step#" 160 << " " << std::setw(6) << "X" 161 << " " << std::setw(6) << "Y" 162 << " " << std::setw(6) << "Z" 163 << " " << std::setw(9) << "KineE" 164 << " " << std::setw(9) << "dEStep" 165 << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10) 166 << "Volume" 167 << " " << std::setw(10) << "Process" << G4endl; 168 169 G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6) 170 << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6) 171 << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6) 172 << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6) 173 << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6) 174 << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6) 175 << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6) 176 << G4BestUnit(fTrack->GetTrackLength(), "Length"); 177 178 if (fTrack->GetNextVolume()) { 179 G4cout << std::setw(10) << fTrack->GetVolume()->GetName(); 180 } 181 else { 182 G4cout << std::setw(10) << "OutOfWorld"; 183 } 184 G4cout << " initStep" << G4endl; 185 } 186 G4cout.precision(prec); 187 } 188