![]() |
Precalibrated Ion Beam Identification Detector Simulation 1.0
A pilot study detector simulation, written in C++ with Geant4.
|
00001 00002 #include "SteppingVerbose.hh" 00003 00004 #include "G4SteppingManager.hh" 00005 #include "G4UnitsTable.hh" 00006 00007 SteppingVerbose::SteppingVerbose() 00008 {} 00009 00010 SteppingVerbose::~SteppingVerbose() 00011 {} 00012 00013 void SteppingVerbose::StepInfo() 00014 { 00015 CopyState(); 00016 00017 G4int prec = G4cout.precision(3); 00018 00019 if( verboseLevel >= 1 ){ 00020 if( verboseLevel >= 4 ) VerboseTrack(); 00021 if( verboseLevel >= 3 ){ 00022 G4cout << G4endl; 00023 G4cout << std::setw( 5) << "#Step#" << " " 00024 << std::setw( 6) << "X" << " " 00025 << std::setw( 6) << "Y" << " " 00026 << std::setw( 6) << "Z" << " " 00027 << std::setw( 9) << "KineE" << " " 00028 << std::setw( 9) << "dEStep" << " " 00029 << std::setw(10) << "StepLeng" 00030 << std::setw(10) << "TrakLeng" 00031 << std::setw(10) << "Volume" << " " 00032 << std::setw(10) << "Process" << G4endl; 00033 } 00034 00035 G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " 00036 << std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length") 00037 << std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length") 00038 << std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length") 00039 << std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy") 00040 << std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy") 00041 << std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length") 00042 << std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length") 00043 << " "; 00044 00045 // if( fStepStatus != fWorldBoundary){ 00046 if( fTrack->GetNextVolume() != 0 ) { 00047 G4cout << std::setw(10) << fTrack->GetVolume()->GetName(); 00048 } else { 00049 G4cout << std::setw(10) << "OutOfWorld"; 00050 } 00051 00052 if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){ 00053 G4cout << " " 00054 << std::setw(10) 00055 << fStep->GetPostStepPoint()->GetProcessDefinedStep() 00056 ->GetProcessName(); 00057 } else { 00058 G4cout << " UserLimit"; 00059 } 00060 00061 G4cout << G4endl; 00062 00063 if( verboseLevel == 2 ){ 00064 G4int tN2ndariesTot = fN2ndariesAtRestDoIt + 00065 fN2ndariesAlongStepDoIt + 00066 fN2ndariesPostStepDoIt; 00067 if(tN2ndariesTot>0){ 00068 G4cout << " :----- List of 2ndaries - " 00069 << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot 00070 << "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt 00071 << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt 00072 << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt 00073 << "), " 00074 << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size() 00075 << " ---------------" 00076 << G4endl; 00077 00078 for(size_t lp1=(*fSecondary).size()-tN2ndariesTot; 00079 lp1<(*fSecondary).size(); lp1++){ 00080 G4cout << " : " 00081 << std::setw(6) 00082 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length") 00083 << std::setw(6) 00084 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length") 00085 << std::setw(6) 00086 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length") 00087 << std::setw(6) 00088 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy") 00089 << std::setw(10) 00090 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName(); 00091 G4cout << G4endl; 00092 } 00093 00094 G4cout << " :-----------------------------" 00095 << "----------------------------------" 00096 << "-- EndOf2ndaries Info ---------------" 00097 << G4endl; 00098 } 00099 } 00100 00101 } 00102 G4cout.precision(prec); 00103 } 00104 00105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00106 00107 void SteppingVerbose::TrackingStarted() 00108 { 00109 00110 CopyState(); 00111 G4int prec = G4cout.precision(3); 00112 if( verboseLevel > 0 ){ 00113 00114 G4cout << std::setw( 5) << "Step#" << " " 00115 << std::setw( 6) << "X" << " " 00116 << std::setw( 6) << "Y" << " " 00117 << std::setw( 6) << "Z" << " " 00118 << std::setw( 9) << "KineE" << " " 00119 << std::setw( 9) << "dEStep" << " " 00120 << std::setw(10) << "StepLeng" 00121 << std::setw(10) << "TrakLeng" 00122 << std::setw(10) << "Volume" << " " 00123 << std::setw(10) << "Process" << G4endl; 00124 00125 G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " " 00126 << std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length") 00127 << std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length") 00128 << std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length") 00129 << std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy") 00130 << std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy") 00131 << std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length") 00132 << std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length") 00133 << " "; 00134 00135 if(fTrack->GetNextVolume()){ 00136 G4cout << std::setw(10) << fTrack->GetVolume()->GetName(); 00137 } else { 00138 G4cout << "OutOfWorld"; 00139 } 00140 G4cout << " initStep" << G4endl; 00141 } 00142 G4cout.precision(prec); 00143 } 00144 00145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......