Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-30 07:51:01

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 #include "SteppingVerbose.hh"
0030 
0031 #include "G4SteppingManager.hh"
0032 #include "G4UnitsTable.hh"
0033 
0034 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0035 void SteppingVerbose::StepInfo()
0036 {
0037   CopyState();
0038 
0039   G4int prec = G4cout.precision(3);
0040 
0041   if (verboseLevel >= 1) {
0042     if (verboseLevel >= 4) VerboseTrack();
0043     if (verboseLevel >= 3) {
0044       G4cout << G4endl;
0045       G4cout << std::setw(5) << "#Step#"
0046              << " " << std::setw(6) << "X"
0047              << "    " << std::setw(6) << "Y"
0048              << "    " << std::setw(6) << "Z"
0049              << "    " << std::setw(8) << "KineE"
0050              << "    " << std::setw(9) << "Velocity" << std::setw(9) << "dEStep"
0051              << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10)
0052              << "Volume"
0053              << "  " << std::setw(10) << "Process" << G4endl;
0054     }
0055 
0056     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0057            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0058            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0059            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0060            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0061            << G4BestUnit(fStep->GetPreStepPoint()->GetVelocity(), "Velocity") << std::setw(6)
0062            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0063            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0064            << G4BestUnit(fTrack->GetTrackLength(), "Length") << "  ";
0065 
0066     if (fTrack->GetNextVolume() != nullptr) {
0067       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0068     }
0069     else {
0070       G4cout << std::setw(10) << "OutOfWorld";
0071     }
0072 
0073     if (fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
0074       G4cout << "  " << std::setw(10)
0075              << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
0076     }
0077     else {
0078       G4cout << "   UserLimit";
0079     }
0080 
0081     G4cout << G4endl;
0082 
0083     if (verboseLevel == 2) {
0084       G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt + fN2ndariesPostStepDoIt;
0085       if (tN2ndariesTot > 0) {
0086         G4cout << "    :----- List of 2ndaries - "
0087                << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot << "(Rest=" << std::setw(2)
0088                << fN2ndariesAtRestDoIt << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
0089                << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt << "), "
0090                << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size() << " ---------------"
0091                << G4endl;
0092 
0093         for (size_t lp1 = (*fSecondary).size() - tN2ndariesTot; lp1 < (*fSecondary).size(); lp1++) {
0094           G4cout << "    : " << std::setw(6)
0095                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(), "Length") << std::setw(6)
0096                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") << std::setw(6)
0097                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") << std::setw(6)
0098                  << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") << std::setw(10)
0099                  << (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
0100           G4cout << G4endl;
0101         }
0102 
0103         G4cout << "    :-----------------------------"
0104                << "----------------------------------"
0105                << "-- EndOf2ndaries Info ---------------" << G4endl;
0106       }
0107     }
0108   }
0109   G4cout.precision(prec);
0110 }
0111 
0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0113 void SteppingVerbose::TrackingStarted()
0114 {
0115   CopyState();
0116   G4int prec = G4cout.precision(3);
0117   if (verboseLevel > 0) {
0118     G4cout << std::setw(5) << "Step#"
0119            << " " << std::setw(6) << "X"
0120            << "    " << std::setw(6) << "Y"
0121            << "    " << std::setw(6) << "Z"
0122            << "    " << std::setw(9) << "KineE"
0123            << "    " << std::setw(9) << "Velocity" << std::setw(9) << "dEStep" << std::setw(10)
0124            << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(13) << "Volume"
0125            << "  " << std::setw(10) << "Process" << G4endl;
0126 
0127     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0128            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0129            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0130            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0131            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0132            << G4BestUnit(fStep->GetPreStepPoint()->GetVelocity(), "Velocity") << std::setw(6)
0133            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0134            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0135            << G4BestUnit(fTrack->GetTrackLength(), "Length") << "  ";
0136 
0137     if (fTrack->GetNextVolume()) {
0138       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0139     }
0140     else {
0141       G4cout << std::setw(10) << "OutOfWorld";
0142     }
0143     G4cout << "    initStep" << G4endl;
0144   }
0145   G4cout.precision(prec);
0146 }
0147 
0148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......