Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:19

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