Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:06:54

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file SteppingVerbose.cc
0027 /// \brief Implementation of the SteppingVerbose class
0028 
0029 // This example is provided by the Geant4-DNA collaboration
0030 // Any report or published results obtained using the Geant4-DNA software
0031 // shall cite the following Geant4-DNA collaboration publications:
0032 // Med. Phys. 45 (2018) e722-e739
0033 // Phys. Med. 31 (2015) 861-874
0034 // Med. Phys. 37 (2010) 4692-4708
0035 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
0036 //
0037 // The Geant4-DNA web site is available at http://geant4-dna.org
0038 //
0039 
0040 #include "SteppingVerbose.hh"
0041 
0042 #include "G4UnitsTable.hh"
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 SteppingVerbose::SteppingVerbose() : G4SteppingVerbose() {}
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 SteppingVerbose::~SteppingVerbose() {}
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 void SteppingVerbose::TrackingStarted()
0055 {
0056   CopyState();
0057 
0058   G4int prec = G4cout.precision(3);
0059 
0060   // Step zero
0061 
0062   if (verboseLevel > 0) {
0063     G4cout << std::setw(5) << "Step#"
0064            << " " << std::setw(6) << "X"
0065            << "    " << std::setw(6) << "Y"
0066            << "    " << std::setw(6) << "Z"
0067            << "    " << std::setw(9) << "KineE"
0068            << " " << std::setw(9) << "dEStep"
0069            << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10)
0070            << "Volume"
0071            << "  " << std::setw(10) << "Process" << G4endl;
0072 
0073     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0074            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0075            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0076            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0077            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0078            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0079            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0080            << G4BestUnit(fTrack->GetTrackLength(), "Length") << std::setw(10)
0081            << fTrack->GetVolume()->GetName() << "   initStep" << G4endl;
0082   }
0083   G4cout.precision(prec);
0084 }
0085 
0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0087 
0088 void SteppingVerbose::StepInfo()
0089 {
0090   CopyState();
0091 
0092   G4int prec = G4cout.precision(3);
0093 
0094   if (verboseLevel >= 1) {
0095     if (verboseLevel >= 4) VerboseTrack();
0096     if (verboseLevel >= 3) {
0097       G4cout << G4endl;
0098       G4cout << std::setw(5) << "#Step#"
0099              << " " << std::setw(6) << "X"
0100              << "    " << std::setw(6) << "Y"
0101              << "    " << std::setw(6) << "Z"
0102              << "    " << std::setw(9) << "KineE"
0103              << " " << std::setw(9) << "dEStep"
0104              << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10)
0105              << "Volume"
0106              << "  " << std::setw(10) << "Process" << G4endl;
0107     }
0108 
0109     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0110            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0111            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0112            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0113            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0114            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0115            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0116            << G4BestUnit(fTrack->GetTrackLength(), "Length") << std::setw(10)
0117            << fTrack->GetVolume()->GetName();
0118 
0119     const G4VProcess* process = fStep->GetPostStepPoint()->GetProcessDefinedStep();
0120     G4String procName = " UserLimit";
0121     if (process) procName = process->GetProcessName();
0122     if (fStepStatus == fWorldBoundary) procName = "OutOfWorld";
0123     G4cout << "   " << std::setw(10) << procName;
0124     G4cout << G4endl;
0125 
0126     if (verboseLevel == 2) {
0127       const std::vector<const G4Track*>* secondary = fStep->GetSecondaryInCurrentStep();
0128       size_t nbtrk = (*secondary).size();
0129       if (nbtrk) {
0130         G4cout << "\n    :----- List of secondaries ----------------" << G4endl;
0131         G4cout.precision(4);
0132         for (size_t lp = 0; lp < (*secondary).size(); lp++) {
0133           G4cout << "   " << std::setw(13) << (*secondary)[lp]->GetDefinition()->GetParticleName()
0134                  << ":  energy =" << std::setw(6)
0135                  << G4BestUnit((*secondary)[lp]->GetKineticEnergy(), "Energy")
0136                  << "  time =" << std::setw(6)
0137                  << G4BestUnit((*secondary)[lp]->GetGlobalTime(), "Time");
0138           G4cout << G4endl;
0139         }
0140 
0141         G4cout << "    :------------------------------------------\n" << G4endl;
0142       }
0143     }
0144   }
0145   G4cout.precision(prec);
0146 }