Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 08:29:18

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 F04SteppingVerbose.cc
0027 /// \brief Implementation of the F04SteppingVerbose class
0028 
0029 #include "F04SteppingVerbose.hh"
0030 
0031 #include "G4UnitsTable.hh"
0032 
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 F04SteppingVerbose::F04SteppingVerbose()
0036 {
0037   G4VSteppingVerbose::SetSilent(1);
0038 }
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 void F04SteppingVerbose::StepInfo()
0043 {
0044   CopyState();
0045 
0046   G4int prec = G4cout.precision(8);
0047 
0048   if (fTrack->GetDefinition()->GetParticleName() == "proton") return;
0049   //  if (fTrack->GetDefinition()->GetParticleName() == "pi+") return;
0050   //  if (fTrack->GetDefinition()->GetParticleName() == "mu+") return;
0051   if (fTrack->GetDefinition()->GetParticleName() == "e+") return;
0052 
0053   if (verboseLevel >= 1) {
0054     if (verboseLevel >= 4) VerboseTrack();
0055     if (verboseLevel >= 3) {
0056       G4cout << G4endl;
0057       G4cout << std::setw(5) << "#Step#"
0058              << " " << std::setw(10) << "X"
0059              << "    " << std::setw(10) << "Y"
0060              << "    " << std::setw(10) << "Z"
0061              << "    " << std::setw(10) << "KineE"
0062              << " " << std::setw(10) << "dEStep"
0063              << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10)
0064              << "NextVolu" << std::setw(10) << "Process" << std::setw(10) << "Dir_x"
0065              << "    " << std::setw(10) << "Dir_y"
0066              << "    " << std::setw(10) << "Dir_z"
0067              << "    " << G4endl;
0068     }
0069 
0070     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(10)
0071            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(10)
0072            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(10)
0073            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(10)
0074            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(10)
0075            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(10)
0076            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(10)
0077            << G4BestUnit(fTrack->GetTrackLength(), "Length");
0078 
0079     if (fTrack->GetNextVolume() != nullptr) {
0080       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0081     }
0082     else {
0083       G4cout << std::setw(10) << "OutOfWorld";
0084     }
0085 
0086     if (fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
0087       G4cout << "  " << std::setw(10)
0088              << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
0089     }
0090     else {
0091       G4cout << "   UserLimit";
0092     }
0093 
0094     //    G4cout << std::setw(12) <<
0095     //                    G4BestUnit(fTrack->GetMomentumDirection().x(),"Length")
0096     //           << std::setw(12) <<
0097     //                    G4BestUnit(fTrack->GetMomentumDirection().y(),"Length")
0098     //           << std::setw(12) <<
0099     //                    G4BestUnit(fTrack->GetMomentumDirection().z(),"Length");
0100 
0101     G4cout << G4endl;
0102 
0103     if (verboseLevel == 2) {
0104       G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt + fN2ndariesPostStepDoIt;
0105       if (tN2ndariesTot > 0) {
0106         G4cout << "    :----- List of 2ndaries - "
0107                << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot << "(Rest=" << std::setw(2)
0108                << fN2ndariesAtRestDoIt << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
0109                << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt << "), "
0110                << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size() << " ---------------"
0111                << G4endl;
0112 
0113         for (size_t lp1 = (*fSecondary).size() - tN2ndariesTot; lp1 < (*fSecondary).size(); lp1++) {
0114           G4cout << "    : " << std::setw(6)
0115                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(), "Length") << std::setw(6)
0116                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") << std::setw(6)
0117                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") << std::setw(6)
0118                  << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") << std::setw(10)
0119                  << (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
0120           G4cout << G4endl;
0121         }
0122 
0123         G4cout << "    :-----------------------------"
0124                << "----------------------------------"
0125                << "-- EndOf2ndaries Info ---------------" << G4endl;
0126       }
0127     }
0128   }
0129   G4cout.precision(prec);
0130 }
0131 
0132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0133 
0134 void F04SteppingVerbose::TrackingStarted()
0135 {
0136   CopyState();
0137 
0138   G4int prec = G4cout.precision(3);
0139 
0140   if (fTrack->GetDefinition()->GetParticleName() == "proton") return;
0141   //  if (fTrack->GetDefinition()->GetParticleName() == "pi+") return;
0142   //  if (fTrack->GetDefinition()->GetParticleName() == "mu+") return;
0143   if (fTrack->GetDefinition()->GetParticleName() == "e+") return;
0144 
0145   G4cout << G4endl;
0146   G4cout << "*******************************************************"
0147          << "**************************************************" << G4endl;
0148   G4cout << "* G4Track Information: "
0149          << "  Particle = " << fTrack->GetDefinition()->GetParticleName() << ","
0150          << "   Track ID = " << fTrack->GetTrackID() << ","
0151          << "   Parent ID = " << fTrack->GetParentID() << G4endl;
0152   G4cout << "*******************************************************"
0153          << "**************************************************" << G4endl;
0154   G4cout << G4endl;
0155 
0156   if (verboseLevel > 0) {
0157     G4cout << std::setw(5) << "Step#"
0158            << " " << std::setw(6) << "X"
0159            << "    " << std::setw(6) << "Y"
0160            << "    " << std::setw(6) << "Z"
0161            << "    " << std::setw(9) << "KineE"
0162            << " " << std::setw(9) << "dEStep"
0163            << " " << std::setw(10) << "StepLeng" << std::setw(10) << "TrakLeng" << std::setw(10)
0164            << "Volume"
0165            << "  " << std::setw(10) << "Process" << G4endl;
0166 
0167     G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0168            << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0169            << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0170            << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0171            << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0172            << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0173            << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0174            << G4BestUnit(fTrack->GetTrackLength(), "Length");
0175 
0176     if (fTrack->GetNextVolume()) {
0177       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0178     }
0179     else {
0180       G4cout << std::setw(10) << "OutOfWorld";
0181     }
0182     G4cout << "    initStep" << G4endl;
0183   }
0184   G4cout.precision(prec);
0185 }