Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 // 28 //-------------------------------------------- 29 // 30 // G4ITSteppingVerbose.cc 31 // 32 // Description: 33 // Implementation of the G4ITSteppingVerbo 34 // 35 //-------------------------------------------- 36 37 #include "G4ITSteppingVerbose.hh" 38 #include "G4ITStepProcessor.hh" 39 #include "G4SystemOfUnits.hh" 40 #include "G4StepStatus.hh" // Include from 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:" 83 for(std::size_t np = 0; np < MAXofAtRestLo 84 { 85 std::size_t npGPIL = MAXofAtRestLoops - 86 if((*fSelectedAtRestDoItVector)[npGPIL] 87 { 88 ++npt; 89 ptProcManager = (*fAtRestDoItVector)[( 90 G4cout << " # " << npt << " : " << p 91 << " (Forced)" << G4endl; 92 } 93 else if ( (*fSelectedAtRestDoItVector)[n 94 { 95 ++npt; 96 ptProcManager = (*fAtRestDoItVector)[( 97 G4cout << " # " << npt << " : " << p 98 << G4endl; 99 } 100 } 101 102 G4cout << " Generated secondries # : " < 103 104 if(fN2ndariesAtRestDoIt > 0) 105 { 106 G4cout << " -- List of secondaries gen 107 << "(x,y,z,kE,t,PID) --" << G4end 108 for(std::size_t lp1=(*fSecondary).size() 109 lp1<(*fSecondary).size(); ++lp1) 110 { 111 G4cout << " " 112 << std::setw( 9) 113 << G4BestUnit((*fSecondary)[lp1]->GetP 114 << std::setw( 9) 115 << G4BestUnit((*fSecondary)[lp1]->GetP 116 << std::setw( 9) 117 << G4BestUnit((*fSecondary)[lp1]->GetP 118 << std::setw( 9) 119 << G4BestUnit((*fSecondary)[lp1]->GetK 120 << std::setw( 9) 121 << G4BestUnit((*fSecondary)[lp1]->GetG 122 << std::setw(18) 123 << (*fSecondary)[lp1]->GetDefinition() 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 inv 151 G4cout << " ++List of invoked processes 152 153 for(std::size_t ci=0; ci<MAXofAlongStepLoo 154 { 155 ptProcManager = (*fAlongStepDoItVector)( 156 G4cout << " " << ci+1 << ") "; 157 if(ptProcManager != nullptr) 158 { 159 G4cout << ptProcManager->GetProcessNam 160 } 161 } 162 163 ShowStep(); 164 G4cout << G4endl; 165 G4cout << " ++List of secondaries gener 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()," 177 << std::setw( 9) 178 << G4BestUnit(lp1->GetPosition().y()," 179 << std::setw( 9) 180 << G4BestUnit(lp1->GetPosition().z()," 181 << std::setw( 9) 182 << G4BestUnit(lp1->GetKineticEnergy(), 183 << std::setw( 9) 184 << G4BestUnit(lp1->GetGlobalTime(),"Ti 185 << std::setw(18) 186 << lp1->GetDefinition()->GetParticleNa 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) || ( 208 || (fCondition == Conditionally) || (fC 209 || (fCondition == StronglyForced)) 210 { 211 212 G4int npt = 0; 213 G4cout << G4endl; 214 G4cout << " **PostStepDoIt (after all in 215 G4cout << " ++List of invoked process 216 217 for(std::size_t np = 0; np < MAXofPostSt 218 { 219 std::size_t npGPIL = MAXofPostStepLoop 220 if((*fSelectedPostStepDoItVector)[npGP 221 { 222 npt++; 223 ptProcManager = (*fPostStepDoItVecto 224 G4cout << " " << npt << ") " << 225 << " (Forced)" << G4endl; 226 } 227 else if ( (*fSelectedPostStepDoItVecto 228 { 229 npt++; 230 ptProcManager = (*fPostStepDoItVecto 231 G4cout << " " << npt << ") " 232 << ptProcManager->GetProcessName() < 233 } 234 } 235 236 ShowStep(); 237 G4cout << G4endl; 238 G4cout << " ++List of secondaries gen 239 << " No. of secodaries = " << (* 240 G4cout << " [Note]Secondaries from 241 242 if(!(*fSecondary).empty()) 243 { 244 for(auto lp1 : *fSecondary) 245 { 246 G4cout << " " << std::setw(9) 247 << G4BestUnit(lp1->GetPositio 248 << " " << std::setw(9) 249 << G4BestUnit(lp1->GetPositio 250 << " " << std::setw(9) 251 << G4BestUnit(lp1->GetPositio 252 << " " << std::setw(9) 253 << G4BestUnit(lp1->GetKinetic 254 << " " << std::setw(9) 255 << G4BestUnit(lp1->GetGlobalT 256 << " " << std::setw(18) 257 << lp1->GetDefinition()->GetP 258 << G4endl; 259 } 260 } 261 } 262 } 263 } 264 265 ///////////////////////////////////////// 266 void G4ITSteppingVerbose::StepInfoForLeadingTr 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" << " " << st 289 << std::setw( 8) << "Z" << " " 290 << std::setw( 9) << "KineE" << " " < 291 << std::setw(12) << "StepLeng" << " " << 292 << std::setw(12) << "NextVolume" << " " 293 #else 294 G4cout << std::setw( 5) << "#TrackID" << 295 << std::setw( 5) << "#Step#" << " " 296 << std::setw( 8) << "X(mm)" << " " << st 297 << std::setw( 8) << "Z(mm)" << " " 298 << std::setw( 9) << "KinE(MeV)" << " " < 299 << std::setw( 8) << "StepLeng" << " " << 300 << std::setw(11) << "NextVolume" << " " 301 #endif 302 } 303 G4cout << std::setw(5) << fTrack->GetTrack 304 << fTrack->GetCurrentStepNumber() < 305 << G4BestUnit(fTrack->GetPosition() 306 << std::setw(8) << G4BestUnit(fTrac 307 << " " << std::setw(8) 308 << G4BestUnit(fTrack->GetPosition() 309 << std::setw(9) << G4BestUnit(fTrac 310 << " " << std::setw(8) 311 << G4BestUnit(fStep->GetTotalEnergy 312 << std::setw(8) << G4BestUnit(fStep 313 << " " << std::setw(9) 314 << G4BestUnit(fTrack->GetTrackLengt 315 316 // Put cut comment here 317 if(fTrack->GetNextVolume() != nullptr) 318 { 319 G4cout << std::setw(11) << fTrack->GetNe 320 } 321 else 322 { 323 G4cout << std::setw(11) << "OutOfWorld" 324 } 325 if(fStep->GetPostStepPoint()->GetProcessDe 326 { 327 G4cout 328 << fStep->GetPostStepPoint()->GetPro 329 } 330 else 331 { 332 G4cout << "User Limit"; 333 } 334 335 G4cout << G4endl; 336 if(fVerboseLevel == 2) 337 { 338 G4int tN2ndariesTot = fN2ndariesAtRestDo 339 + fN2ndariesPostSt 340 if(tN2ndariesTot > 0) 341 { 342 G4cout << " :----- List of 2ndaries 343 << std::setw(3) << tN2ndariesTo 344 << fN2ndariesAtRestDoIt << ",Al 345 << fN2ndariesAlongStepDoIt << " 346 << fN2ndariesPostStepDoIt << ") 347 << std::setw(3) << (*fSecondary 348 << G4endl; 349 350 for(std::size_t lp1=(*fSecondary).size 351 lp1<(*fSecondary).size(); + 352 { 353 G4cout << " : " 354 << std::setw( 9) 355 << G4BestUnit((*fSecondary)[lp1]->Ge 356 << std::setw( 9) 357 << G4BestUnit((*fSecondary)[lp1]->Ge 358 << std::setw( 9) 359 << G4BestUnit((*fSecondary)[lp1]->Ge 360 << std::setw( 9) 361 << G4BestUnit((*fSecondary)[lp1]->Ge 362 << std::setw(18) 363 << (*fSecondary)[lp1]->GetDefinition 364 } 365 G4cout << " :---------------------- 366 << "-- EndOf2ndaries Info ------------ 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: 394 << std::setw( 8) << "Z" << " " 395 << std::setw( 9) << "KineE" << " " << 396 << std::setw(12) << "StepLeng" << " " << s 397 << std::setw(12) << "NextVolume" << " " << 398 #else 399 G4cout << std::setw( 5) << "#TrackID" << " 400 << std::setw( 5) << "#Step#" << " " 401 << std::setw( 8) << "X(mm)" << " " << std: 402 << std::setw( 8) << "Z(mm)" << " " 403 << std::setw( 9) << "KinE(MeV)" << " " << 404 << std::setw( 8) << "StepLeng" << " " << s 405 << std::setw(11) << "NextVolume" << " " << 406 #endif 407 } 408 G4cout << std::setw(5) << fTrack->GetTrackID 409 << fTrack->GetCurrentStepNumber() << 410 << G4BestUnit(fTrack->GetPosition().x 411 << std::setw(8) << G4BestUnit(fTrack- 412 << " " << std::setw(8) 413 << G4BestUnit(fTrack->GetPosition().z 414 << std::setw(9) << G4BestUnit(fTrack- 415 << " " << std::setw(8) 416 << G4BestUnit(fStep->GetTotalEnergyDe 417 << std::setw(8) << G4BestUnit(fStep-> 418 << std::setw(9) << G4BestUnit(fTrack- 419 << " "; 420 421 // Put cut comment here 422 if(fTrack->GetNextVolume() != nullptr) 423 { 424 G4cout << std::setw(11) << fTrack->GetNext 425 } 426 else 427 { 428 G4cout << std::setw(11) << "OutOfWorld" << 429 } 430 if(fStep->GetPostStepPoint()->GetProcessDefi 431 { 432 G4cout 433 << fStep->GetPostStepPoint()->GetProce 434 } 435 else 436 { 437 G4cout << "User Limit"; 438 } 439 G4cout << G4endl; 440 if(fVerboseLevel == 2) 441 { 442 G4int tN2ndariesTot = fN2ndariesAtRestDoIt 443 + fN2ndariesPostStep 444 if(tN2ndariesTot > 0) 445 { 446 G4cout << " :----- List of 2ndaries - 447 << std::setw(3) << tN2ndariesTot 448 << fN2ndariesAtRestDoIt << ",Alon 449 << fN2ndariesAlongStepDoIt << ",P 450 << fN2ndariesPostStepDoIt << "), 451 << std::setw(3) << (*fSecondary). 452 << G4endl; 453 454 for(std::size_t lp1=(*fSecondary).size() 455 lp1<(*fSecondary).size(); ++l 456 { 457 G4cout << " : " 458 << std::setw( 9) 459 << G4BestUnit((*fSecondary)[lp1]->GetP 460 << std::setw( 9) 461 << G4BestUnit((*fSecondary)[lp1]->GetP 462 << std::setw( 9) 463 << G4BestUnit((*fSecondary)[lp1]->GetP 464 << std::setw( 9) 465 << G4BestUnit((*fSecondary)[lp1]->GetK 466 << std::setw(18) 467 << (*fSecondary)[lp1]->GetDefinition() 468 } 469 G4cout << " :------------------------ 470 << "-- EndOf2ndaries Info -------------- 471 } 472 } 473 G4cout.precision(prec); 474 } 475 // Put cut comment here if( fStepStatus != fWo 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<< " >>DefinePhysicalStepL 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 Lengt 506 G4cout << " ++ProposedStep(UserLimit) = 507 << " : ProcName = User defined maximum all 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 ) = 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) = 562 << G4BestUnit(physIntLength, "Lengt 563 << fCurrentProcess->GetProcessName( 564 if(fGPILSelection == CandidateForSelection 565 { 566 G4cout << "CandidateForSelection)" << G4 567 } 568 else if(fGPILSelection==NotCandidateForSel 569 { 570 G4cout << "NotCandidateForSelection)" << 571 } 572 else 573 { 574 G4cout << "?!?)" << G4endl; 575 } 576 } 577 } 578 579 ////////////////////////////////////////////// 580 void G4ITSteppingVerbose::TrackingStarted(G4Tr 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" << " 596 // << std::setw(8) << "X" << " " 597 // << std::setw(8) << "Z" << " " 598 // << " " << std::setw(8) << "dE 599 // << "StepLeng" << " " << std::setw 600 // << std::setw(12) << "NextVolume" 601 // << G4endl; 602 //#else 603 // G4cout << std::setw(5) << "TrackID" << s 604 // << std::setw(8) << "X(mm)" << " " << std 605 // << std::setw(8) << "Z(mm)" << " " << std 606 // << " " << std::setw(8) << "dE(MeV)" << " 607 // << "StepLeng" << " " << std::setw(9) << 608 // << std::setw(11) << "NextVolume" << " " 609 // << G4endl; 610 //#endif 611 612 G4cout << "Start tracking : " 613 << GetIT(fTrack)->GetName() 614 << " (" << fTrack->GetTrackID() << 615 << std::setw(8) 616 << G4BestUnit(fTrack->GetPosition() 617 << std::setw(8) 618 << G4BestUnit(fTrack->GetPosition() 619 << std::setw(8) 620 << G4BestUnit(fTrack->GetPosition() 621 622 // G4cout << std::setw(5) << fTrack->GetTra 623 // << fTrack->GetCurrentStepNumber() 624 // << G4BestUnit(fTrack->GetPosition 625 // << std::setw(8) << G4BestUnit(fTr 626 // << " " << std::setw(8) 627 // << G4BestUnit(fTrack->GetPosition 628 // << std::setw(9) << G4BestUnit(fTr 629 // << " " << std::setw(8) 630 // << G4BestUnit(fStep->GetTotalEner 631 // << std::setw(8) << G4BestUnit(fSt 632 // << " " << std::setw(9) 633 // << G4BestUnit(fTrack->GetTrackLen 634 635 if(fTrack->GetNextVolume() != nullptr) 636 { 637 G4cout << std::setw(11) << fTrack->GetNe 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(G4Trac 650 ////////////////////////////////////////////// 651 { 652 if(fVerboseLevel <= 1) return; 653 654 G4cout << " * End tracking : " << " Partic 655 << track->GetDefinition()->GetParticl 656 << track->GetTrackID(); 657 658 if(track->GetNextVolume() != nullptr) 659 { 660 G4cout << std::setw(11) << track->GetNextV 661 } 662 663 G4cout << G4endl; 664 } 665 666 ////////////////////////////////////////////// 667 void G4ITSteppingVerbose::AlongStepDoItOneByOn 668 ////////////////////////////////////////////// 669 { 670 if(fVerboseLevel < 4) 671 { 672 return; 673 } 674 675 CopyState(); 676 677 G4cout << G4endl; 678 G4cout << " >>AlongStepDoIt (process by proc 679 << fCurrentProcess->GetProcessName() 680 681 ShowStep(); 682 G4cout << " " << "!Note! Safety of 683 << "after all DoIt invocations." << G 684 685 VerboseParticleChange(); 686 G4cout << G4endl; 687 688 G4cout << " ++List of secondaries generat 689 << " No. of secodaries = " << fN2nda 690 691 if(fN2ndariesAlongStepDoIt > 0) 692 { 693 for(std::size_t lp1 = (*fSecondary).size() 694 lp1 < (*fSecondary).size(); ++lp1) 695 { 696 G4cout << " " << std::setw(9) 697 << G4BestUnit((*fSecondary)[lp1]- 698 << " " << std::setw(9) 699 << G4BestUnit((*fSecondary)[lp1]- 700 << " " << std::setw(9) 701 << G4BestUnit((*fSecondary)[lp1]- 702 << " " << std::setw(9) 703 << G4BestUnit((*fSecondary)[lp1]- 704 << " " << std::setw(9) 705 << G4BestUnit((*fSecondary)[lp1]- 706 << std::setw(18) 707 << (*fSecondary)[lp1]->GetDefinit 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 proce 723 << fCurrentProcess->GetProcessName() 724 725 ShowStep(); 726 G4cout << G4endl; 727 VerboseParticleChange(); 728 G4cout << G4endl; 729 730 G4cout << " ++List of secondaries generat 731 << " No. of secodaries = " << fN2nda 732 733 if(fN2ndariesPostStepDoIt > 0) 734 { 735 for(std::size_t lp1 = (*fSecondary).size() 736 lp1 < (*fSecondary).size(); ++lp1) 737 { 738 G4cout << " " << std::setw(9) 739 << G4BestUnit((*fSecondary)[lp1]- 740 << " " << std::setw(9) 741 << G4BestUnit((*fSecondary)[lp1]- 742 << " " << std::setw(9) 743 << G4BestUnit((*fSecondary)[lp1]- 744 << " " << std::setw(9) 745 << G4BestUnit((*fSecondary)[lp1]- 746 << " " << std::setw(9) 747 << G4BestUnit((*fSecondary)[lp1]- 748 << std::setw(18) 749 << (*fSecondary)[lp1]->GetDefinit 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 " << G4 767 G4long prec = G4cout.precision(3); 768 769 G4cout << " --------------------------- 770 G4cout << " G4Track Information " << 771 G4cout << " --------------------------- 772 773 G4cout << " Step number : " < 774 << fTrack->GetCurrentStepNumber() << 775 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 776 G4cout << " Position - x : " < 777 << G4BestUnit(fTrack->GetPosition().x 778 G4cout << " Position - y : " < 779 << G4BestUnit(fTrack->GetPosition().y 780 G4cout << " Position - z : " < 781 << G4BestUnit(fTrack->GetPosition().z 782 G4cout << " Global Time : " < 783 << G4BestUnit(fTrack->GetGlobalTime() 784 G4cout << " Local Time : " < 785 << G4BestUnit(fTrack->GetLocalTime(), 786 #else 787 G4cout << " Position - x (mm) : " < 788 << fTrack->GetPosition().x() / mm << G4endl; 789 G4cout << " Position - y (mm) : " < 790 << fTrack->GetPosition().y() / mm << G4endl; 791 G4cout << " Position - z (mm) : " < 792 << fTrack->GetPosition().z() / mm << G4endl; 793 G4cout << " Global Time (ns) : " < 794 << fTrack->GetGlobalTime() / ns << G4endl; 795 G4cout << " Local Time (ns) : " < 796 << fTrack->GetLocalTime() / ns << G4endl; 797 #endif 798 G4cout << " Momentum Direct - x : " < 799 << fTrack->GetMomentumDirection().x() 800 G4cout << " Momentum Direct - y : " < 801 << fTrack->GetMomentumDirection().y() 802 G4cout << " Momentum Direct - z : " < 803 << fTrack->GetMomentumDirection().z() 804 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 805 G4cout << " Kinetic Energy : " 806 #else 807 G4cout << " Kinetic Energy (Me 808 #endif 809 << std::setw(20) 810 << G4BestUnit(fTrack->GetKineticEnerg 811 G4cout << " Polarization - x : " < 812 << fTrack->GetPolarization().x() << G 813 G4cout << " Polarization - y : " < 814 << fTrack->GetPolarization().y() << G 815 G4cout << " Polarization - z : " < 816 << fTrack->GetPolarization().z() << G 817 G4cout << " Track Length : " < 818 << G4BestUnit(fTrack->GetTrackLength( 819 G4cout << " Track ID # : " < 820 << fTrack->GetTrackID() << G4endl; 821 G4cout << " Parent Track ID # : " < 822 << fTrack->GetParentID() << G4endl; 823 G4cout << " Next Volume : " < 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 : " < 834 if(fTrack->GetTrackStatus() == fAlive) 835 { 836 G4cout << " Alive"; 837 } 838 else if(fTrack->GetTrackStatus() == fStopBut 839 { 840 G4cout << " StopButAlive"; 841 } 842 else if(fTrack->GetTrackStatus() == fStopAnd 843 { 844 G4cout << " StopAndKill"; 845 } 846 else if(fTrack->GetTrackStatus() == fKillTra 847 { 848 G4cout << " KillTrackAndSecondaries"; 849 } 850 else if(fTrack->GetTrackStatus() == fSuspend 851 { 852 G4cout << " Suspend"; 853 } 854 else if(fTrack->GetTrackStatus() == fPostpon 855 { 856 G4cout << " PostponeToNextEvent"; 857 } 858 G4cout << G4endl; 859 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 860 G4cout << " Vertex - x : " < 861 << G4BestUnit(fTrack->GetVertexPositi 862 G4cout << " Vertex - y : " < 863 << G4BestUnit(fTrack->GetVertexPositi 864 G4cout << " Vertex - z : " < 865 << G4BestUnit(fTrack->GetVertexPositi 866 #else 867 G4cout << " Vertex - x (mm) : " < 868 << fTrack->GetVertexPosition().x() / mm << G 869 G4cout << " Vertex - y (mm) : " < 870 << fTrack->GetVertexPosition().y() / mm << G 871 G4cout << " Vertex - z (mm) : " < 872 << fTrack->GetVertexPosition().z() / mm << G 873 #endif 874 G4cout << " Vertex - Px (MomDir): " < 875 << fTrack->GetVertexMomentumDirection 876 G4cout << " Vertex - Py (MomDir): " < 877 << fTrack->GetVertexMomentumDirection 878 G4cout << " Vertex - Pz (MomDir): " < 879 << fTrack->GetVertexMomentumDirection 880 #ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE 881 G4cout << " Vertex - KineE : " 882 #else 883 G4cout << " Vertex - KineE (Me 884 #endif 885 << std::setw(20) 886 << G4BestUnit(fTrack->GetVertexKineti 887 888 G4cout << " Creator Process : " < 889 if(fTrack->GetCreatorProcess() == nullptr) 890 { 891 G4cout << " Event Generator" << G4endl; 892 } 893 else 894 { 895 G4cout << fTrack->GetCreatorProcess()->Get 896 } 897 898 G4cout << " --------------------------- 899 900 G4cout.precision(prec); 901 } 902 903 ////////////////////////////////////////////// 904 void G4ITSteppingVerbose::VerboseParticleChang 905 ////////////////////////////////////////////// 906 { 907 if(fVerboseLevel == 0) 908 { 909 return; 910 } 911 // Show header 912 G4cout << G4endl; 913 G4cout << " ++G4ParticleChange Informatio 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 " << G4e 931 oldprc = G4cout.precision(16); 932 933 // Show G4Step specific information 934 G4cout << " Address of G4Track : " < 935 G4cout << " Step Length (mm) : " 936 << fStep->GetTrack()->GetStepLength() 937 G4cout << " Energy Deposit (MeV) : " < 938 << G4endl; 939 940 // Show G4StepPoint specific information 941 G4cout << " --------------------------- 942 << "----------------" << G4endl; 943 G4cout << " StepPoint Information " 944 << std::setw(20) << "PostStep" << G4e 945 G4cout << " --------------------------- 946 << "----------------" << G4endl; 947 G4cout << " Position - x (mm) : " 948 << fStep->GetPreStepPoint()->GetPosit 949 << fStep->GetPostStepPoint()->GetPosi 950 G4cout << " Position - y (mm) : " 951 << fStep->GetPreStepPoint()->GetPosit 952 << fStep->GetPostStepPoint()->GetPosi 953 G4cout << " Position - z (mm) : " 954 << fStep->GetPreStepPoint()->GetPosit 955 << fStep->GetPostStepPoint()->GetPosi 956 G4cout << " Global Time (ns) : " 957 << fStep->GetPreStepPoint()->GetGloba 958 << fStep->GetPostStepPoint()->GetGlob 959 G4cout << " Local Time (ns) : " 960 << fStep->GetPreStepPoint()->GetLocal 961 << fStep->GetPostStepPoint()->GetLoca 962 G4cout << " Proper Time (ns) : " 963 << fStep->GetPreStepPoint()->GetPrope 964 << fStep->GetPostStepPoint()->GetProp 965 G4cout << " Momentum Direct - x : " 966 << fStep->GetPreStepPoint()->GetMomen 967 << std::setw(20) 968 << fStep->GetPostStepPoint()->GetMome 969 G4cout << " Momentum Direct - y : " 970 << fStep->GetPreStepPoint()->GetMomen 971 << std::setw(20) 972 << fStep->GetPostStepPoint()->GetMome 973 G4cout << " Momentum Direct - z : " 974 << fStep->GetPreStepPoint()->GetMomen 975 << std::setw(20) 976 << fStep->GetPostStepPoint()->GetMome 977 G4cout << " Momentum - x (MeV/c): " 978 << fStep->GetPreStepPoint()->GetMomen 979 << fStep->GetPostStepPoint()->GetMome 980 G4cout << " Momentum - y (MeV/c): " 981 << fStep->GetPreStepPoint()->GetMomen 982 << fStep->GetPostStepPoint()->GetMome 983 G4cout << " Momentum - z (MeV/c): " 984 << fStep->GetPreStepPoint()->GetMomen 985 << fStep->GetPostStepPoint()->GetMome 986 G4cout << " Total Energy (MeV) : " 987 << fStep->GetPreStepPoint()->GetTotal 988 << fStep->GetPostStepPoint()->GetTota 989 G4cout << " Kinetic Energy (MeV): " 990 << fStep->GetPreStepPoint()->GetKinet 991 << fStep->GetPostStepPoint()->GetKine 992 G4cout << " Velocity (mm/ns) : " 993 << fStep->GetPreStepPoint()->GetVeloc 994 << fStep->GetPostStepPoint()->GetVelo 995 G4cout << " Volume Name : " 996 << fStep->GetPreStepPoint()->GetPhysi 997 if(fStep->GetPostStepPoint()->GetPhysicalVol 998 { 999 volName = fStep->GetPostStepPoint()->GetPh 1000 } 1001 else 1002 { 1003 volName = "OutOfWorld"; 1004 } 1005 G4cout << std::setw(20) << volName << G4end 1006 G4cout << " Safety (mm) : " 1007 << fStep->GetPreStepPoint()->GetSafe 1008 << fStep->GetPostStepPoint()->GetSaf 1009 G4cout << " Polarization - x : " 1010 << fStep->GetPreStepPoint()->GetPola 1011 << fStep->GetPostStepPoint()->GetPol 1012 G4cout << " Polarization - y : " 1013 << fStep->GetPreStepPoint()->GetPola 1014 << fStep->GetPostStepPoint()->GetPol 1015 G4cout << " Polarization - Z : " 1016 << fStep->GetPreStepPoint()->GetPola 1017 << fStep->GetPostStepPoint()->GetPol 1018 G4cout << " Weight : " 1019 << fStep->GetPreStepPoint()->GetWeig 1020 << fStep->GetPostStepPoint()->GetWei 1021 G4cout << " Step Status : " 1022 G4StepStatus tStepStatus = fStep->GetPreSte 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 Pro 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()->Ge 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 Pro 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()->GetProcessDefi 1069 { 1070 G4cout << std::setw(20) << "Undefined"; 1071 } 1072 else 1073 { 1074 G4cout 1075 << std::setw(20) 1076 << fStep->GetPreStepPoint()->GetProce 1077 } 1078 if(fStep->GetPostStepPoint()->GetProcessDef 1079 { 1080 G4cout << std::setw(20) << "Undefined"; 1081 } 1082 else 1083 { 1084 G4cout 1085 << std::setw(20) 1086 << fStep->GetPostStepPoint()->GetProc 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 ***" 1104 G4cout << std::setw(18) << left << "#Name" 1105 << std::setw(35) << "Position" << st 1106 << std::setw(25) << "Post step volum 1107 << G4endl; 1108 #ifdef USE_COLOR 1109 G4cout << RESET_COLOR; 1110 #endif 1111 } 1112 1113 void G4ITSteppingVerbose::PreStepVerbose(G4Tr 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)->GetNam 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->Ge 1138 G4VPhysicalVolume* volume(nullptr); 1139 1140 if(nextTouchable && ((volume = nextTouchabl 1141 { 1142 volumeName = volume->GetName(); 1143 1144 if(volume->IsParameterised() || volume->I 1145 { 1146 volumeName += " "; 1147 volumeName += (char)nextTouchable->GetR 1148 } 1149 } 1150 else 1151 { 1152 volumeName = "OutOfWorld"; 1153 } 1154 1155 G4cout << setw(18) << left << GetIT(track)- 1156 << track->GetTrackID() << std::setpr 1157 << G4String(G4BestUnit(track->GetPos 1158 << volumeName << setw(25) << "---" < 1159 1160 } 1161 1162 void G4ITSteppingVerbose::PostStepVerbose(G4T 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)- 1172 << track->GetTrackID() << std::setpr 1173 << G4String(G4BestUnit(track->GetPos 1174 << "---"; 1175 1176 G4TouchableHandle nextTouchable = track->Ge 1177 G4VPhysicalVolume* volume(nullptr); 1178 1179 if(nextTouchable && ((volume = nextTouchabl 1180 { 1181 G4String volumeName = volume->GetName(); 1182 1183 if(volume->IsParameterised() || volume->I 1184 { 1185 volumeName += " "; 1186 volumeName += (char)nextTouchable->GetR 1187 } 1188 1189 G4cout << setw(25) << volumeName; 1190 } 1191 else 1192 { 1193 G4cout << setw(25) << "OutOfWorld"; 1194 } 1195 if(track->GetStep()->GetPostStepPoint()->Ge 1196 { 1197 G4cout 1198 << setw(22) 1199 << track->GetStep()->GetPostStepPoint 1200 ->GetProcessName(); 1201 } 1202 else 1203 { 1204 G4cout << "---"; 1205 } 1206 G4cout << G4endl; 1207 1208 if(fVerboseLevel > 2) 1209 { 1210 const G4TrackVector* secondaries = nullpt 1211 if((secondaries = track->GetStep()->GetSe 1212 { 1213 if(!secondaries->empty()) 1214 { 1215 G4cout << "\t\t ---->"; 1216 for(const auto secondarie : *secondar 1217 { 1218 G4cout << GetIT(secondarie)->GetNam 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