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 // 28 //--------------------------------------------------------------- 29 // 30 // G4ITSteppingVerbose.cc 31 // 32 // Description: 33 // Implementation of the G4ITSteppingVerbose class 34 // 35 //--------------------------------------------------------------- 36 37 #include "G4ITSteppingVerbose.hh" 38 #include "G4ITStepProcessor.hh" 39 #include "G4SystemOfUnits.hh" 40 #include "G4StepStatus.hh" // Include from 'tracking' 41 42 #include "G4IT.hh" 43 #include "G4IosFlagsSaver.hh" 44 45 #define G4_USE_G4BESTUNIT_FOR_VERBOSE 1 46 47 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 48 #include "G4UnitsTable.hh" 49 #else 50 #define G4BestUnit(a,b) a 51 #endif 52 53 using namespace std; 54 55 G4ITSteppingVerbose::G4ITSteppingVerbose() 56 = default; 57 58 G4ITSteppingVerbose::~G4ITSteppingVerbose() 59 = default; 60 61 ////////////////////////////////////////////////// 62 void G4ITSteppingVerbose::NewStep() 63 ////////////////////////////////////////////////// 64 { 65 } 66 67 ////////////////////////////////////////////////// 68 void G4ITSteppingVerbose::AtRestDoItInvoked() 69 ////////////////////////////////////////////////// 70 { 71 if(fVerboseLevel == 0) 72 { 73 return; 74 } 75 76 G4VProcess* ptProcManager; 77 CopyState(); 78 79 if(fVerboseLevel >= 3) 80 { 81 G4int npt = 0; 82 G4cout << " **List of AtRestDoIt invoked:" << G4endl; 83 for(std::size_t np = 0; np < MAXofAtRestLoops; ++np) 84 { 85 std::size_t npGPIL = MAXofAtRestLoops - np - 1; 86 if((*fSelectedAtRestDoItVector)[npGPIL] == 2) 87 { 88 ++npt; 89 ptProcManager = (*fAtRestDoItVector)[(G4int)np]; 90 G4cout << " # " << npt << " : " << ptProcManager->GetProcessName() 91 << " (Forced)" << G4endl; 92 } 93 else if ( (*fSelectedAtRestDoItVector)[npGPIL] == 1 ) 94 { 95 ++npt; 96 ptProcManager = (*fAtRestDoItVector)[(G4int)np]; 97 G4cout << " # " << npt << " : " << ptProcManager->GetProcessName() 98 << G4endl; 99 } 100 } 101 102 G4cout << " Generated secondries # : " << fN2ndariesAtRestDoIt << G4endl; 103 104 if(fN2ndariesAtRestDoIt > 0) 105 { 106 G4cout << " -- List of secondaries generated : " 107 << "(x,y,z,kE,t,PID) --" << G4endl; 108 for(std::size_t lp1=(*fSecondary).size()-fN2ndariesAtRestDoIt; 109 lp1<(*fSecondary).size(); ++lp1) 110 { 111 G4cout << " " 112 << std::setw( 9) 113 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length") << " " 114 << std::setw( 9) 115 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length") << " " 116 << std::setw( 9) 117 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length") << " " 118 << std::setw( 9) 119 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy") << " " 120 << std::setw( 9) 121 << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time") << " " 122 << std::setw(18) 123 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl; 124 } 125 } 126 } 127 128 if(fVerboseLevel >= 4) 129 { 130 ShowStep(); 131 G4cout << G4endl; 132 } 133 } 134 ///////////////////////////////////////////////////// 135 void G4ITSteppingVerbose::AlongStepDoItAllDone() 136 ///////////////////////////////////////////////////// 137 { 138 if(fVerboseLevel == 0) 139 { 140 return; 141 } 142 143 G4VProcess* ptProcManager; 144 145 CopyState(); 146 147 if(fVerboseLevel >= 3) 148 { 149 G4cout << G4endl; 150 G4cout << " >>AlongStepDoIt (after all invocations):" << G4endl; 151 G4cout << " ++List of invoked processes " << G4endl; 152 153 for(std::size_t ci=0; ci<MAXofAlongStepLoops; ++ci) 154 { 155 ptProcManager = (*fAlongStepDoItVector)((G4int)ci); 156 G4cout << " " << ci+1 << ") "; 157 if(ptProcManager != nullptr) 158 { 159 G4cout << ptProcManager->GetProcessName() << G4endl; 160 } 161 } 162 163 ShowStep(); 164 G4cout << G4endl; 165 G4cout << " ++List of secondaries generated " 166 << "(x,y,z,kE,t,PID):" 167 << " No. of secodaries = " 168 << (*fSecondary).size() << G4endl; 169 170 if(!(*fSecondary).empty()) 171 { 172 for(auto lp1 : *fSecondary) 173 { 174 G4cout << " " 175 << std::setw( 9) 176 << G4BestUnit(lp1->GetPosition().x(),"Length") << " " 177 << std::setw( 9) 178 << G4BestUnit(lp1->GetPosition().y(),"Length") << " " 179 << std::setw( 9) 180 << G4BestUnit(lp1->GetPosition().z(),"Length") << " " 181 << std::setw( 9) 182 << G4BestUnit(lp1->GetKineticEnergy(),"Energy") << " " 183 << std::setw( 9) 184 << G4BestUnit(lp1->GetGlobalTime(),"Time") << " " 185 << std::setw(18) 186 << lp1->GetDefinition()->GetParticleName() << G4endl; 187 } 188 } 189 } 190 } 191 //////////////////////////////////////////////////// 192 void G4ITSteppingVerbose::PostStepDoItAllDone() 193 //////////////////////////////////////////////////// 194 { 195 if(fVerboseLevel == 0) 196 { 197 return; 198 } 199 200 G4VProcess* ptProcManager; 201 202 CopyState(); 203 204 if(fVerboseLevel >= 3) 205 { 206 207 if((fStepStatus == fPostStepDoItProc) || (fCondition == Forced) 208 || (fCondition == Conditionally) || (fCondition == ExclusivelyForced) 209 || (fCondition == StronglyForced)) 210 { 211 212 G4int npt = 0; 213 G4cout << G4endl; 214 G4cout << " **PostStepDoIt (after all invocations):" << G4endl; 215 G4cout << " ++List of invoked processes " << G4endl; 216 217 for(std::size_t np = 0; np < MAXofPostStepLoops; ++np) 218 { 219 std::size_t npGPIL = MAXofPostStepLoops - np - 1; 220 if((*fSelectedPostStepDoItVector)[npGPIL] == 2) 221 { 222 npt++; 223 ptProcManager = (*fPostStepDoItVector)[(G4int)np]; 224 G4cout << " " << npt << ") " << ptProcManager->GetProcessName() 225 << " (Forced)" << G4endl; 226 } 227 else if ( (*fSelectedPostStepDoItVector)[npGPIL] == 1) 228 { 229 npt++; 230 ptProcManager = (*fPostStepDoItVector)[(G4int)np]; 231 G4cout << " " << npt << ") " 232 << ptProcManager->GetProcessName() << G4endl; 233 } 234 } 235 236 ShowStep(); 237 G4cout << G4endl; 238 G4cout << " ++List of secondaries generated " << "(x,y,z,kE,t,PID):" 239 << " No. of secodaries = " << (*fSecondary).size() << G4endl; 240 G4cout << " [Note]Secondaries from AlongStepDoIt included." << G4endl; 241 242 if(!(*fSecondary).empty()) 243 { 244 for(auto lp1 : *fSecondary) 245 { 246 G4cout << " " << std::setw(9) 247 << G4BestUnit(lp1->GetPosition().x(), "Length") 248 << " " << std::setw(9) 249 << G4BestUnit(lp1->GetPosition().y(), "Length") 250 << " " << std::setw(9) 251 << G4BestUnit(lp1->GetPosition().z(), "Length") 252 << " " << std::setw(9) 253 << G4BestUnit(lp1->GetKineticEnergy(), "Energy") 254 << " " << std::setw(9) 255 << G4BestUnit(lp1->GetGlobalTime(), "Time") 256 << " " << std::setw(18) 257 << lp1->GetDefinition()->GetParticleName() 258 << G4endl; 259 } 260 } 261 } 262 } 263 } 264 265 ///////////////////////////////////////// 266 void G4ITSteppingVerbose::StepInfoForLeadingTrack() 267 ///////////////////////////////////////// 268 { 269 if(fVerboseLevel == 0) 270 { 271 return; 272 } 273 274 if(fVerboseLevel < 2) 275 { 276 CopyState(); 277 G4long prec = G4cout.precision(3); 278 // G4cout.precision(16); 279 280 if(fVerboseLevel >= 4) VerboseTrack(); 281 if(fVerboseLevel >= 3) 282 { 283 G4cout << G4endl; 284 G4cout << "StepInfo" << G4endl; 285 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 286 G4cout << std::setw( 5) << "#TrackID" << " " 287 << std::setw( 5) << "#Step#" << " " 288 << std::setw( 8) << "X" << " " << std::setw( 8) << "Y" << " " 289 << std::setw( 8) << "Z" << " " 290 << std::setw( 9) << "KineE" << " " << std::setw( 8) << "dE" << " " 291 << std::setw(12) << "StepLeng" << " " << std::setw(12) << "TrackLeng" << " " 292 << std::setw(12) << "NextVolume" << " " << std::setw( 8) << "ProcName" << G4endl; 293 #else 294 G4cout << std::setw( 5) << "#TrackID" << " " 295 << std::setw( 5) << "#Step#" << " " 296 << std::setw( 8) << "X(mm)" << " " << std::setw( 8) << "Y(mm)" << " " 297 << std::setw( 8) << "Z(mm)" << " " 298 << std::setw( 9) << "KinE(MeV)" << " " << std::setw( 8) << "dE(MeV)" << " " 299 << std::setw( 8) << "StepLeng" << " " << std::setw( 9) << "TrackLeng" << " " 300 << std::setw(11) << "NextVolume" << " " << std::setw( 8) << "ProcName" << G4endl; 301 #endif 302 } 303 G4cout << std::setw(5) << fTrack->GetTrackID() << " " << std::setw(5) 304 << fTrack->GetCurrentStepNumber() << " " << std::setw(8) 305 << G4BestUnit(fTrack->GetPosition().x(), "Length") << " " 306 << std::setw(8) << G4BestUnit(fTrack->GetPosition().y(), "Length") 307 << " " << std::setw(8) 308 << G4BestUnit(fTrack->GetPosition().z(), "Length") << " " 309 << std::setw(9) << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") 310 << " " << std::setw(8) 311 << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << " " 312 << std::setw(8) << G4BestUnit(fStep->GetStepLength(), "Length") 313 << " " << std::setw(9) 314 << G4BestUnit(fTrack->GetTrackLength(), "Length") << " "; 315 316 // Put cut comment here 317 if(fTrack->GetNextVolume() != nullptr) 318 { 319 G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() << " "; 320 } 321 else 322 { 323 G4cout << std::setw(11) << "OutOfWorld" << " "; 324 } 325 if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) 326 { 327 G4cout 328 << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); 329 } 330 else 331 { 332 G4cout << "User Limit"; 333 } 334 335 G4cout << G4endl; 336 if(fVerboseLevel == 2) 337 { 338 G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt 339 + fN2ndariesPostStepDoIt; 340 if(tN2ndariesTot > 0) 341 { 342 G4cout << " :----- List of 2ndaries - " << "#SpawnInStep=" 343 << std::setw(3) << tN2ndariesTot << "(Rest=" << std::setw(2) 344 << fN2ndariesAtRestDoIt << ",Along=" << std::setw(2) 345 << fN2ndariesAlongStepDoIt << ",Post=" << std::setw(2) 346 << fN2ndariesPostStepDoIt << "), " << "#SpawnTotal=" 347 << std::setw(3) << (*fSecondary).size() << " ---------------" 348 << G4endl; 349 350 for(std::size_t lp1=(*fSecondary).size()-tN2ndariesTot; 351 lp1<(*fSecondary).size(); ++lp1) 352 { 353 G4cout << " : " 354 << std::setw( 9) 355 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " " 356 << std::setw( 9) 357 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length")<< " " 358 << std::setw( 9) 359 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length") << " " 360 << std::setw( 9) 361 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy")<< " " 362 << std::setw(18) 363 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl; 364 } 365 G4cout << " :-----------------------------" << "----------------------------------" 366 << "-- EndOf2ndaries Info ---------------" << G4endl; 367 } 368 } 369 G4cout.precision(prec); 370 } 371 } 372 ///////////////////////////////////////// 373 void G4ITSteppingVerbose::StepInfo() 374 ///////////////////////////////////////// 375 { 376 if(fVerboseLevel < 2) 377 { 378 return; 379 } 380 381 CopyState(); 382 G4long prec = G4cout.precision(3); 383 // G4cout.precision(16); 384 385 if(fVerboseLevel >= 4) VerboseTrack(); 386 if(fVerboseLevel >= 3) 387 { 388 G4cout << G4endl; 389 G4cout << "StepInfo" << G4endl; 390 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 391 G4cout << std::setw( 5) << "#TrackID" << " " 392 << std::setw( 5) << "#Step#" << " " 393 << std::setw( 8) << "X" << " " << std::setw( 8) << "Y" << " " 394 << std::setw( 8) << "Z" << " " 395 << std::setw( 9) << "KineE" << " " << std::setw( 8) << "dE" << " " 396 << std::setw(12) << "StepLeng" << " " << std::setw(12) << "TrackLeng" << " " 397 << std::setw(12) << "NextVolume" << " " << std::setw( 8) << "ProcName" << G4endl; 398 #else 399 G4cout << std::setw( 5) << "#TrackID" << " " 400 << std::setw( 5) << "#Step#" << " " 401 << std::setw( 8) << "X(mm)" << " " << std::setw( 8) << "Y(mm)" << " " 402 << std::setw( 8) << "Z(mm)" << " " 403 << std::setw( 9) << "KinE(MeV)" << " " << std::setw( 8) << "dE(MeV)" << " " 404 << std::setw( 8) << "StepLeng" << " " << std::setw( 9) << "TrackLeng" << " " 405 << std::setw(11) << "NextVolume" << " " << std::setw( 8) << "ProcName" << G4endl; 406 #endif 407 } 408 G4cout << std::setw(5) << fTrack->GetTrackID() << " " << std::setw(5) 409 << fTrack->GetCurrentStepNumber() << " " << std::setw(8) 410 << G4BestUnit(fTrack->GetPosition().x(), "Length") << " " 411 << std::setw(8) << G4BestUnit(fTrack->GetPosition().y(), "Length") 412 << " " << std::setw(8) 413 << G4BestUnit(fTrack->GetPosition().z(), "Length") << " " 414 << std::setw(9) << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") 415 << " " << std::setw(8) 416 << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << " " 417 << std::setw(8) << G4BestUnit(fStep->GetStepLength(), "Length") << " " 418 << std::setw(9) << G4BestUnit(fTrack->GetTrackLength(), "Length") 419 << " "; 420 421 // Put cut comment here 422 if(fTrack->GetNextVolume() != nullptr) 423 { 424 G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() << " "; 425 } 426 else 427 { 428 G4cout << std::setw(11) << "OutOfWorld" << " "; 429 } 430 if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) 431 { 432 G4cout 433 << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); 434 } 435 else 436 { 437 G4cout << "User Limit"; 438 } 439 G4cout << G4endl; 440 if(fVerboseLevel == 2) 441 { 442 G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt 443 + fN2ndariesPostStepDoIt; 444 if(tN2ndariesTot > 0) 445 { 446 G4cout << " :----- List of 2ndaries - " << "#SpawnInStep=" 447 << std::setw(3) << tN2ndariesTot << "(Rest=" << std::setw(2) 448 << fN2ndariesAtRestDoIt << ",Along=" << std::setw(2) 449 << fN2ndariesAlongStepDoIt << ",Post=" << std::setw(2) 450 << fN2ndariesPostStepDoIt << "), " << "#SpawnTotal=" 451 << std::setw(3) << (*fSecondary).size() << " ---------------" 452 << G4endl; 453 454 for(std::size_t lp1=(*fSecondary).size()-tN2ndariesTot; 455 lp1<(*fSecondary).size(); ++lp1) 456 { 457 G4cout << " : " 458 << std::setw( 9) 459 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " " 460 << std::setw( 9) 461 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length")<< " " 462 << std::setw( 9) 463 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length") << " " 464 << std::setw( 9) 465 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy")<< " " 466 << std::setw(18) 467 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl; 468 } 469 G4cout << " :-----------------------------" << "----------------------------------" 470 << "-- EndOf2ndaries Info ---------------" << G4endl; 471 } 472 } 473 G4cout.precision(prec); 474 } 475 // Put cut comment here if( fStepStatus != fWorldBoundary){ 476 477 //////////////////////////////////////////// 478 void G4ITSteppingVerbose::DPSLStarted() 479 //////////////////////////////////////////// 480 { 481 if(fVerboseLevel == 0) 482 { 483 return; 484 } 485 CopyState(); 486 487 if(fVerboseLevel > 5) 488 { 489 G4cout << G4endl<< " >>DefinePhysicalStepLength (List of proposed StepLengths): " << G4endl; 490 } 491 } 492 ////////////////////////////////////////////// 493 void G4ITSteppingVerbose::DPSLUserLimit() 494 ////////////////////////////////////////////// 495 { 496 if(fVerboseLevel == 0) 497 { 498 return; 499 } 500 CopyState(); 501 502 if(fVerboseLevel > 5) 503 { 504 G4cout << G4endl<< G4endl; 505 G4cout << "=== Defined Physical Step Length (DPSL)" << G4endl; 506 G4cout << " ++ProposedStep(UserLimit) = " << std::setw( 9) << physIntLength 507 << " : ProcName = User defined maximum allowed Step" << G4endl; 508 } 509 } 510 ///////////////////////////////////////////// 511 void G4ITSteppingVerbose::DPSLPostStep() 512 ///////////////////////////////////////////// 513 { 514 if(fVerboseLevel == 0) 515 { 516 return; 517 } 518 519 if(fVerboseLevel > 5) 520 { 521 CopyState(); 522 523 G4cout << " ++ProposedStep(PostStep ) = " << std::setw(9) 524 << physIntLength << " : ProcName = " 525 << fCurrentProcess->GetProcessName() << " ("; 526 if(fCondition == ExclusivelyForced) 527 { 528 G4cout << "ExclusivelyForced)" << G4endl; 529 } 530 else if(fCondition==StronglyForced) 531 { 532 G4cout << "StronglyForced)" << G4endl; 533 } 534 else if(fCondition==Conditionally) 535 { 536 G4cout << "Conditionally)" << G4endl; 537 } 538 else if(fCondition==Forced) 539 { 540 G4cout << "Forced)" << G4endl; 541 } 542 else 543 { 544 G4cout << "No ForceCondition)" << G4endl; 545 } 546 } 547 } 548 ///////////////////////////////////////////// 549 void G4ITSteppingVerbose::DPSLAlongStep() 550 ///////////////////////////////////////////// 551 { 552 if(fVerboseLevel == 0) 553 { 554 return; 555 } 556 557 if(fVerboseLevel > 5) 558 { 559 CopyState(); 560 561 G4cout << " ++ProposedStep(AlongStep) = " << std::setw(9) 562 << G4BestUnit(physIntLength, "Length") << " : ProcName = " 563 << fCurrentProcess->GetProcessName() << " ("; 564 if(fGPILSelection == CandidateForSelection) 565 { 566 G4cout << "CandidateForSelection)" << G4endl; 567 } 568 else if(fGPILSelection==NotCandidateForSelection) 569 { 570 G4cout << "NotCandidateForSelection)" << G4endl; 571 } 572 else 573 { 574 G4cout << "?!?)" << G4endl; 575 } 576 } 577 } 578 579 //////////////////////////////////////////////// 580 void G4ITSteppingVerbose::TrackingStarted(G4Track* track) 581 //////////////////////////////////////////////// 582 { 583 if(fVerboseLevel <= 1) 584 { 585 return; 586 } 587 588 G4long prec = G4cout.precision(3); 589 if(fVerboseLevel > 0) 590 { 591 fTrack = track; 592 fStep = track->GetStep(); 593 594 //#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 595 // G4cout << std::setw(5) << "TrackID" << " " << std::setw(5) << "Step#" << " " 596 // << std::setw(8) << "X" << " " << std::setw(8) << "Y" << " " 597 // << std::setw(8) << "Z" << " " << std::setw(9) << "KineE" 598 // << " " << std::setw(8) << "dE" << " " << std::setw(12) 599 // << "StepLeng" << " " << std::setw(12) << "TrackLeng" << " " 600 // << std::setw(12) << "NextVolume" << " " << std::setw(8) << "ProcName" 601 // << G4endl; 602 //#else 603 // G4cout << std::setw(5) << "TrackID" << std::setw(5) << "Step#" << " " 604 // << std::setw(8) << "X(mm)" << " " << std::setw(8) << "Y(mm)" << " " 605 // << std::setw(8) << "Z(mm)" << " " << std::setw(9) << "KinE(MeV)" 606 // << " " << std::setw(8) << "dE(MeV)" << " " << std::setw(8) 607 // << "StepLeng" << " " << std::setw(9) << "TrackLeng" << " " 608 // << std::setw(11) << "NextVolume" << " " << std::setw(8) << "ProcName" 609 // << G4endl; 610 //#endif 611 612 G4cout << "Start tracking : " 613 << GetIT(fTrack)->GetName() 614 << " (" << fTrack->GetTrackID() << ") from position " 615 << std::setw(8) 616 << G4BestUnit(fTrack->GetPosition().x(), "Length") << " " 617 << std::setw(8) 618 << G4BestUnit(fTrack->GetPosition().y(), "Length") << " " 619 << std::setw(8) 620 << G4BestUnit(fTrack->GetPosition().z(), "Length") << " "; 621 622 // G4cout << std::setw(5) << fTrack->GetTrackID() << std::setw(5) 623 // << fTrack->GetCurrentStepNumber() << " " << std::setw(8) 624 // << G4BestUnit(fTrack->GetPosition().x(), "Length") << " " 625 // << std::setw(8) << G4BestUnit(fTrack->GetPosition().y(), "Length") 626 // << " " << std::setw(8) 627 // << G4BestUnit(fTrack->GetPosition().z(), "Length") << " " 628 // << std::setw(9) << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") 629 // << " " << std::setw(8) 630 // << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << " " 631 // << std::setw(8) << G4BestUnit(fStep->GetStepLength(), "Length") 632 // << " " << std::setw(9) 633 // << G4BestUnit(fTrack->GetTrackLength(), "Length") << " "; 634 635 if(fTrack->GetNextVolume() != nullptr) 636 { 637 G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() << " "; 638 } 639 else 640 { 641 G4cout << std::setw(11) << "OutOfWorld" << " "; 642 } 643 G4cout << "initStep" << G4endl; 644 } 645 G4cout.precision(prec); 646 } 647 648 //////////////////////////////////////////////// 649 void G4ITSteppingVerbose::TrackingEnded(G4Track* track) 650 //////////////////////////////////////////////// 651 { 652 if(fVerboseLevel <= 1) return; 653 654 G4cout << " * End tracking : " << " Particle : " 655 << track->GetDefinition()->GetParticleName() << "," << " Track ID : " 656 << track->GetTrackID(); 657 658 if(track->GetNextVolume() != nullptr) 659 { 660 G4cout << std::setw(11) << track->GetNextVolume()->GetName() << " "; 661 } 662 663 G4cout << G4endl; 664 } 665 666 ////////////////////////////////////////////////////// 667 void G4ITSteppingVerbose::AlongStepDoItOneByOne() 668 ////////////////////////////////////////////////////// 669 { 670 if(fVerboseLevel < 4) 671 { 672 return; 673 } 674 675 CopyState(); 676 677 G4cout << G4endl; 678 G4cout << " >>AlongStepDoIt (process by process): " << " Process Name = " 679 << fCurrentProcess->GetProcessName() << G4endl; 680 681 ShowStep(); 682 G4cout << " " << "!Note! Safety of PostStep is only valid " 683 << "after all DoIt invocations." << G4endl; 684 685 VerboseParticleChange(); 686 G4cout << G4endl; 687 688 G4cout << " ++List of secondaries generated " << "(x,y,z,kE,t,PID):" 689 << " No. of secodaries = " << fN2ndariesAlongStepDoIt << G4endl; 690 691 if(fN2ndariesAlongStepDoIt > 0) 692 { 693 for(std::size_t lp1 = (*fSecondary).size() - fN2ndariesAlongStepDoIt; 694 lp1 < (*fSecondary).size(); ++lp1) 695 { 696 G4cout << " " << std::setw(9) 697 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(), "Length") 698 << " " << std::setw(9) 699 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") 700 << " " << std::setw(9) 701 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") 702 << " " << std::setw(9) 703 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") 704 << " " << std::setw(9) 705 << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(), "Time") << " " 706 << std::setw(18) 707 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl; 708 } 709 } 710 } 711 ////////////////////////////////////////////////////// 712 void G4ITSteppingVerbose::PostStepDoItOneByOne() 713 ////////////////////////////////////////////////////// 714 { 715 if(fVerboseLevel < 4) 716 { 717 return; 718 } 719 720 CopyState(); 721 G4cout << G4endl; 722 G4cout << " >>PostStepDoIt (process by process): " << " Process Name = " 723 << fCurrentProcess->GetProcessName() << G4endl; 724 725 ShowStep(); 726 G4cout << G4endl; 727 VerboseParticleChange(); 728 G4cout << G4endl; 729 730 G4cout << " ++List of secondaries generated " << "(x,y,z,kE,t,PID):" 731 << " No. of secodaries = " << fN2ndariesPostStepDoIt << G4endl; 732 733 if(fN2ndariesPostStepDoIt > 0) 734 { 735 for(std::size_t lp1 = (*fSecondary).size() - fN2ndariesPostStepDoIt; 736 lp1 < (*fSecondary).size(); ++lp1) 737 { 738 G4cout << " " << std::setw(9) 739 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(), "Length") 740 << " " << std::setw(9) 741 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") 742 << " " << std::setw(9) 743 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") 744 << " " << std::setw(9) 745 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") 746 << " " << std::setw(9) 747 << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(), "Time") << " " 748 << std::setw(18) 749 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl; 750 } 751 } 752 } 753 754 ////////////////////////////////////// 755 void G4ITSteppingVerbose::VerboseTrack() 756 ////////////////////////////////////// 757 { 758 if(fVerboseLevel == 0) 759 { 760 return; 761 } 762 763 CopyState(); 764 // Show header 765 G4cout << G4endl; 766 G4cout << " ++G4Track Information " << G4endl; 767 G4long prec = G4cout.precision(3); 768 769 G4cout << " -----------------------------------------------" << G4endl; 770 G4cout << " G4Track Information " << std::setw(20) << G4endl; 771 G4cout << " -----------------------------------------------" << G4endl; 772 773 G4cout << " Step number : " << std::setw(20) 774 << fTrack->GetCurrentStepNumber() << G4endl; 775 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 776 G4cout << " Position - x : " << std::setw(20) 777 << G4BestUnit(fTrack->GetPosition().x(), "Length") << G4endl; 778 G4cout << " Position - y : " << std::setw(20) 779 << G4BestUnit(fTrack->GetPosition().y(), "Length") << G4endl; 780 G4cout << " Position - z : " << std::setw(20) 781 << G4BestUnit(fTrack->GetPosition().z(), "Length") << G4endl; 782 G4cout << " Global Time : " << std::setw(20) 783 << G4BestUnit(fTrack->GetGlobalTime(), "Time") << G4endl; 784 G4cout << " Local Time : " << std::setw(20) 785 << G4BestUnit(fTrack->GetLocalTime(), "Time") << G4endl; 786 #else 787 G4cout << " Position - x (mm) : " << std::setw(20) 788 << fTrack->GetPosition().x() / mm << G4endl; 789 G4cout << " Position - y (mm) : " << std::setw(20) 790 << fTrack->GetPosition().y() / mm << G4endl; 791 G4cout << " Position - z (mm) : " << std::setw(20) 792 << fTrack->GetPosition().z() / mm << G4endl; 793 G4cout << " Global Time (ns) : " << std::setw(20) 794 << fTrack->GetGlobalTime() / ns << G4endl; 795 G4cout << " Local Time (ns) : " << std::setw(20) 796 << fTrack->GetLocalTime() / ns << G4endl; 797 #endif 798 G4cout << " Momentum Direct - x : " << std::setw(20) 799 << fTrack->GetMomentumDirection().x() << G4endl; 800 G4cout << " Momentum Direct - y : " << std::setw(20) 801 << fTrack->GetMomentumDirection().y() << G4endl; 802 G4cout << " Momentum Direct - z : " << std::setw(20) 803 << fTrack->GetMomentumDirection().z() << G4endl; 804 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 805 G4cout << " Kinetic Energy : " 806 #else 807 G4cout << " Kinetic Energy (MeV): " 808 #endif 809 << std::setw(20) 810 << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << G4endl; 811 G4cout << " Polarization - x : " << std::setw(20) 812 << fTrack->GetPolarization().x() << G4endl; 813 G4cout << " Polarization - y : " << std::setw(20) 814 << fTrack->GetPolarization().y() << G4endl; 815 G4cout << " Polarization - z : " << std::setw(20) 816 << fTrack->GetPolarization().z() << G4endl; 817 G4cout << " Track Length : " << std::setw(20) 818 << G4BestUnit(fTrack->GetTrackLength(), "Length") << G4endl; 819 G4cout << " Track ID # : " << std::setw(20) 820 << fTrack->GetTrackID() << G4endl; 821 G4cout << " Parent Track ID # : " << std::setw(20) 822 << fTrack->GetParentID() << G4endl; 823 G4cout << " Next Volume : " << std::setw(20); 824 if(fTrack->GetNextVolume() != nullptr) 825 { 826 G4cout << fTrack->GetNextVolume()->GetName() << " "; 827 } 828 else 829 { 830 G4cout << "OutOfWorld" << " "; 831 } 832 G4cout << G4endl; 833 G4cout << " Track Status : " << std::setw(20); 834 if(fTrack->GetTrackStatus() == fAlive) 835 { 836 G4cout << " Alive"; 837 } 838 else if(fTrack->GetTrackStatus() == fStopButAlive) 839 { 840 G4cout << " StopButAlive"; 841 } 842 else if(fTrack->GetTrackStatus() == fStopAndKill) 843 { 844 G4cout << " StopAndKill"; 845 } 846 else if(fTrack->GetTrackStatus() == fKillTrackAndSecondaries) 847 { 848 G4cout << " KillTrackAndSecondaries"; 849 } 850 else if(fTrack->GetTrackStatus() == fSuspend) 851 { 852 G4cout << " Suspend"; 853 } 854 else if(fTrack->GetTrackStatus() == fPostponeToNextEvent) 855 { 856 G4cout << " PostponeToNextEvent"; 857 } 858 G4cout << G4endl; 859 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 860 G4cout << " Vertex - x : " << std::setw(20) 861 << G4BestUnit(fTrack->GetVertexPosition().x(), "Length") << G4endl; 862 G4cout << " Vertex - y : " << std::setw(20) 863 << G4BestUnit(fTrack->GetVertexPosition().y(), "Length") << G4endl; 864 G4cout << " Vertex - z : " << std::setw(20) 865 << G4BestUnit(fTrack->GetVertexPosition().z(), "Length") << G4endl; 866 #else 867 G4cout << " Vertex - x (mm) : " << std::setw(20) 868 << fTrack->GetVertexPosition().x() / mm << G4endl; 869 G4cout << " Vertex - y (mm) : " << std::setw(20) 870 << fTrack->GetVertexPosition().y() / mm << G4endl; 871 G4cout << " Vertex - z (mm) : " << std::setw(20) 872 << fTrack->GetVertexPosition().z() / mm << G4endl; 873 #endif 874 G4cout << " Vertex - Px (MomDir): " << std::setw(20) 875 << fTrack->GetVertexMomentumDirection().x() << G4endl; 876 G4cout << " Vertex - Py (MomDir): " << std::setw(20) 877 << fTrack->GetVertexMomentumDirection().y() << G4endl; 878 G4cout << " Vertex - Pz (MomDir): " << std::setw(20) 879 << fTrack->GetVertexMomentumDirection().z() << G4endl; 880 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 881 G4cout << " Vertex - KineE : " 882 #else 883 G4cout << " Vertex - KineE (MeV): " 884 #endif 885 << std::setw(20) 886 << G4BestUnit(fTrack->GetVertexKineticEnergy(), "Energy") << G4endl; 887 888 G4cout << " Creator Process : " << std::setw(20); 889 if(fTrack->GetCreatorProcess() == nullptr) 890 { 891 G4cout << " Event Generator" << G4endl; 892 } 893 else 894 { 895 G4cout << fTrack->GetCreatorProcess()->GetProcessName() << G4endl; 896 } 897 898 G4cout << " -----------------------------------------------" << G4endl; 899 900 G4cout.precision(prec); 901 } 902 903 /////////////////////////////////////////////// 904 void G4ITSteppingVerbose::VerboseParticleChange() 905 /////////////////////////////////////////////// 906 { 907 if(fVerboseLevel == 0) 908 { 909 return; 910 } 911 // Show header 912 G4cout << G4endl; 913 G4cout << " ++G4ParticleChange Information " << G4endl; 914 fParticleChange->DumpInfo(); 915 } 916 ///////////////////////////////////////// 917 void G4ITSteppingVerbose::ShowStep() const 918 //////////////////////////////////////// 919 { 920 if(fVerboseLevel == 0) 921 { 922 return; 923 } 924 925 G4String volName; 926 G4long oldprc; 927 928 // Show header 929 G4cout << G4endl; 930 G4cout << " ++G4Step Information " << G4endl; 931 oldprc = G4cout.precision(16); 932 933 // Show G4Step specific information 934 G4cout << " Address of G4Track : " << fStep->GetTrack() << G4endl; 935 G4cout << " Step Length (mm) : " 936 << fStep->GetTrack()->GetStepLength() << G4endl; 937 G4cout << " Energy Deposit (MeV) : " << fStep->GetTotalEnergyDeposit() 938 << G4endl; 939 940 // Show G4StepPoint specific information 941 G4cout << " -------------------------------------------------------" 942 << "----------------" << G4endl; 943 G4cout << " StepPoint Information " << std::setw(20) << "PreStep" 944 << std::setw(20) << "PostStep" << G4endl; 945 G4cout << " -------------------------------------------------------" 946 << "----------------" << G4endl; 947 G4cout << " Position - x (mm) : " << std::setw(20) 948 << fStep->GetPreStepPoint()->GetPosition().x() << std::setw(20) 949 << fStep->GetPostStepPoint()->GetPosition().x() << G4endl; 950 G4cout << " Position - y (mm) : " << std::setw(20) 951 << fStep->GetPreStepPoint()->GetPosition().y() << std::setw(20) 952 << fStep->GetPostStepPoint()->GetPosition().y() << G4endl; 953 G4cout << " Position - z (mm) : " << std::setw(20) 954 << fStep->GetPreStepPoint()->GetPosition().z() << std::setw(20) 955 << fStep->GetPostStepPoint()->GetPosition().z() << G4endl; 956 G4cout << " Global Time (ns) : " << std::setw(20) 957 << fStep->GetPreStepPoint()->GetGlobalTime() << std::setw(20) 958 << fStep->GetPostStepPoint()->GetGlobalTime() << G4endl; 959 G4cout << " Local Time (ns) : " << std::setw(20) 960 << fStep->GetPreStepPoint()->GetLocalTime() << std::setw(20) 961 << fStep->GetPostStepPoint()->GetLocalTime() << G4endl; 962 G4cout << " Proper Time (ns) : " << std::setw(20) 963 << fStep->GetPreStepPoint()->GetProperTime() << std::setw(20) 964 << fStep->GetPostStepPoint()->GetProperTime() << G4endl; 965 G4cout << " Momentum Direct - x : " << std::setw(20) 966 << fStep->GetPreStepPoint()->GetMomentumDirection().x() 967 << std::setw(20) 968 << fStep->GetPostStepPoint()->GetMomentumDirection().x() << G4endl; 969 G4cout << " Momentum Direct - y : " << std::setw(20) 970 << fStep->GetPreStepPoint()->GetMomentumDirection().y() 971 << std::setw(20) 972 << fStep->GetPostStepPoint()->GetMomentumDirection().y() << G4endl; 973 G4cout << " Momentum Direct - z : " << std::setw(20) 974 << fStep->GetPreStepPoint()->GetMomentumDirection().z() 975 << std::setw(20) 976 << fStep->GetPostStepPoint()->GetMomentumDirection().z() << G4endl; 977 G4cout << " Momentum - x (MeV/c): " << std::setw(20) 978 << fStep->GetPreStepPoint()->GetMomentum().x() << std::setw(20) 979 << fStep->GetPostStepPoint()->GetMomentum().x() << G4endl; 980 G4cout << " Momentum - y (MeV/c): " << std::setw(20) 981 << fStep->GetPreStepPoint()->GetMomentum().y() << std::setw(20) 982 << fStep->GetPostStepPoint()->GetMomentum().y() << G4endl; 983 G4cout << " Momentum - z (MeV/c): " << std::setw(20) 984 << fStep->GetPreStepPoint()->GetMomentum().z() << std::setw(20) 985 << fStep->GetPostStepPoint()->GetMomentum().z() << G4endl; 986 G4cout << " Total Energy (MeV) : " << std::setw(20) 987 << fStep->GetPreStepPoint()->GetTotalEnergy() << std::setw(20) 988 << fStep->GetPostStepPoint()->GetTotalEnergy() << G4endl; 989 G4cout << " Kinetic Energy (MeV): " << std::setw(20) 990 << fStep->GetPreStepPoint()->GetKineticEnergy() << std::setw(20) 991 << fStep->GetPostStepPoint()->GetKineticEnergy() << G4endl; 992 G4cout << " Velocity (mm/ns) : " << std::setw(20) 993 << fStep->GetPreStepPoint()->GetVelocity() << std::setw(20) 994 << fStep->GetPostStepPoint()->GetVelocity() << G4endl; 995 G4cout << " Volume Name : " << std::setw(20) 996 << fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName(); 997 if(fStep->GetPostStepPoint()->GetPhysicalVolume() != nullptr) 998 { 999 volName = fStep->GetPostStepPoint()->GetPhysicalVolume()->GetName(); 1000 } 1001 else 1002 { 1003 volName = "OutOfWorld"; 1004 } 1005 G4cout << std::setw(20) << volName << G4endl; 1006 G4cout << " Safety (mm) : " << std::setw(20) 1007 << fStep->GetPreStepPoint()->GetSafety() << std::setw(20) 1008 << fStep->GetPostStepPoint()->GetSafety() << G4endl; 1009 G4cout << " Polarization - x : " << std::setw(20) 1010 << fStep->GetPreStepPoint()->GetPolarization().x() << std::setw(20) 1011 << fStep->GetPostStepPoint()->GetPolarization().x() << G4endl; 1012 G4cout << " Polarization - y : " << std::setw(20) 1013 << fStep->GetPreStepPoint()->GetPolarization().y() << std::setw(20) 1014 << fStep->GetPostStepPoint()->GetPolarization().y() << G4endl; 1015 G4cout << " Polarization - Z : " << std::setw(20) 1016 << fStep->GetPreStepPoint()->GetPolarization().z() << std::setw(20) 1017 << fStep->GetPostStepPoint()->GetPolarization().z() << G4endl; 1018 G4cout << " Weight : " << std::setw(20) 1019 << fStep->GetPreStepPoint()->GetWeight() << std::setw(20) 1020 << fStep->GetPostStepPoint()->GetWeight() << G4endl; 1021 G4cout << " Step Status : "; 1022 G4StepStatus tStepStatus = fStep->GetPreStepPoint()->GetStepStatus(); 1023 if(tStepStatus == fGeomBoundary) 1024 { 1025 G4cout << std::setw(20) << "Geom Limit"; 1026 } 1027 else if(tStepStatus == fAlongStepDoItProc) 1028 { 1029 G4cout << std::setw(20) << "AlongStep Proc."; 1030 } 1031 else if(tStepStatus == fPostStepDoItProc) 1032 { 1033 G4cout << std::setw(20) << "PostStep Proc"; 1034 } 1035 else if(tStepStatus == fAtRestDoItProc) 1036 { 1037 G4cout << std::setw(20) << "AtRest Proc"; 1038 } 1039 else if(tStepStatus == fUndefined) 1040 { 1041 G4cout << std::setw(20) << "Undefined"; 1042 } 1043 1044 tStepStatus = fStep->GetPostStepPoint()->GetStepStatus(); 1045 if(tStepStatus == fGeomBoundary) 1046 { 1047 G4cout << std::setw(20) << "Geom Limit"; 1048 } 1049 else if(tStepStatus == fAlongStepDoItProc) 1050 { 1051 G4cout << std::setw(20) << "AlongStep Proc."; 1052 } 1053 else if(tStepStatus == fPostStepDoItProc) 1054 { 1055 G4cout << std::setw(20) << "PostStep Proc"; 1056 } 1057 else if(tStepStatus == fAtRestDoItProc) 1058 { 1059 G4cout << std::setw(20) << "AtRest Proc"; 1060 } 1061 else if(tStepStatus == fUndefined) 1062 { 1063 G4cout << std::setw(20) << "Undefined"; 1064 } 1065 1066 G4cout << G4endl; 1067 G4cout << " Process defined Step: "; 1068 if(fStep->GetPreStepPoint()->GetProcessDefinedStep() == nullptr) 1069 { 1070 G4cout << std::setw(20) << "Undefined"; 1071 } 1072 else 1073 { 1074 G4cout 1075 << std::setw(20) 1076 << fStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName(); 1077 } 1078 if(fStep->GetPostStepPoint()->GetProcessDefinedStep() == nullptr) 1079 { 1080 G4cout << std::setw(20) << "Undefined"; 1081 } 1082 else 1083 { 1084 G4cout 1085 << std::setw(20) 1086 << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); 1087 } 1088 G4cout.precision(oldprc); 1089 1090 G4cout << G4endl; 1091 G4cout << " -------------------------------------------------------" 1092 << "----------------" << G4endl; 1093 } 1094 1095 void G4ITSteppingVerbose::DoItStarted() 1096 { 1097 if(fVerboseLevel <= 0) return; 1098 1099 G4IosFlagsSaver ios_saver(G4cout); 1100 #ifdef USE_COLOR 1101 G4cout << LIGHT_RED; 1102 #endif 1103 G4cout << "*** G4ITStepProcessor::DoIt ***" << G4endl; 1104 G4cout << std::setw(18) << left << "#Name" << std::setw(15) << "trackID" 1105 << std::setw(35) << "Position" << std::setw(25) << "Pre step volume" 1106 << std::setw(25) << "Post step volume" << std::setw(22) << "Process" 1107 << G4endl; 1108 #ifdef USE_COLOR 1109 G4cout << RESET_COLOR; 1110 #endif 1111 } 1112 1113 void G4ITSteppingVerbose::PreStepVerbose(G4Track* track) 1114 { 1115 if(fVerboseLevel <= 0) return; 1116 1117 G4IosFlagsSaver ios_saver(G4cout); 1118 1119 ///// 1120 // PRE STEP VERBOSE 1121 1122 #ifdef DEBUG 1123 #ifdef USE_COLOR 1124 G4cout << LIGHT_RED; 1125 #endif 1126 G4cout << "*DoIt* " << GetIT(track)->GetName() 1127 << " ID: " << track->GetTrackID() 1128 << " at time : " << track->GetGlobalTime() 1129 << G4endl; 1130 #ifdef USE_COLOR 1131 G4cout << RESET_COLOR; 1132 #endif 1133 #endif 1134 1135 G4String volumeName; 1136 1137 G4TouchableHandle nextTouchable = track->GetNextTouchableHandle(); 1138 G4VPhysicalVolume* volume(nullptr); 1139 1140 if(nextTouchable && ((volume = nextTouchable->GetVolume()) != nullptr)) 1141 { 1142 volumeName = volume->GetName(); 1143 1144 if(volume->IsParameterised() || volume->IsReplicated()) 1145 { 1146 volumeName += " "; 1147 volumeName += (char)nextTouchable->GetReplicaNumber(); 1148 } 1149 } 1150 else 1151 { 1152 volumeName = "OutOfWorld"; 1153 } 1154 1155 G4cout << setw(18) << left << GetIT(track)->GetName() << setw(15) 1156 << track->GetTrackID() << std::setprecision(3) << setw(35) 1157 << G4String(G4BestUnit(track->GetPosition(), "Length")) << setw(25) 1158 << volumeName << setw(25) << "---" << G4endl; 1159 1160 } 1161 1162 void G4ITSteppingVerbose::PostStepVerbose(G4Track* track) 1163 { 1164 if(fVerboseLevel <= 0) return; 1165 1166 G4IosFlagsSaver ios_saver(G4cout); 1167 1168 ///// 1169 // POST STEP VERBOSE 1170 1171 G4cout << setw(18) << left << GetIT(track)->GetName() << setw(15) 1172 << track->GetTrackID() << std::setprecision(3) << setw(35) 1173 << G4String(G4BestUnit(track->GetPosition(), "Length")) << setw(25) 1174 << "---"; 1175 1176 G4TouchableHandle nextTouchable = track->GetNextTouchableHandle(); 1177 G4VPhysicalVolume* volume(nullptr); 1178 1179 if(nextTouchable && ((volume = nextTouchable->GetVolume()) != nullptr)) 1180 { 1181 G4String volumeName = volume->GetName(); 1182 1183 if(volume->IsParameterised() || volume->IsReplicated()) 1184 { 1185 volumeName += " "; 1186 volumeName += (char)nextTouchable->GetReplicaNumber(); 1187 } 1188 1189 G4cout << setw(25) << volumeName; 1190 } 1191 else 1192 { 1193 G4cout << setw(25) << "OutOfWorld"; 1194 } 1195 if(track->GetStep()->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) 1196 { 1197 G4cout 1198 << setw(22) 1199 << track->GetStep()->GetPostStepPoint()->GetProcessDefinedStep() 1200 ->GetProcessName(); 1201 } 1202 else 1203 { 1204 G4cout << "---"; 1205 } 1206 G4cout << G4endl; 1207 1208 if(fVerboseLevel > 2) 1209 { 1210 const G4TrackVector* secondaries = nullptr; 1211 if((secondaries = track->GetStep()->GetSecondary()) != nullptr) 1212 { 1213 if(!secondaries->empty()) 1214 { 1215 G4cout << "\t\t ---->"; 1216 for(const auto secondarie : *secondaries) 1217 { 1218 G4cout << GetIT(secondarie)->GetName() << "(" 1219 << secondarie->GetTrackID() << ")" << " "; 1220 } 1221 G4cout << G4endl; 1222 } 1223 } 1224 } 1225 1226 G4cout << G4endl; 1227 } 1228 1229 void G4ITSteppingVerbose::AtRestDoItOneByOne() 1230 { 1231 CopyState(); 1232 1233 G4cout << " Invoke at rest process : " 1234 << fCurrentProcess->GetProcessName() 1235 << G4endl; 1236 } 1237