Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:45:05

0001 /** \file LaserSteppingVerbose.cc
0002  *
0003  *
0004  *  $Date: 2007/03/20 12:01:01 $
0005  *  $Revision: 1.2 $
0006  *  \author Maarten Thomas
0007  */
0008 
0009 #include "Alignment/LaserAlignmentSimulation/interface/LaserSteppingVerbose.h"
0010 #include "G4UnitsTable.hh"
0011 
0012 LaserSteppingVerbose::LaserSteppingVerbose() {}
0013 
0014 LaserSteppingVerbose::~LaserSteppingVerbose() {}
0015 
0016 void LaserSteppingVerbose::StepInfo() {
0017   //  G4cout << "<LaserSteppingVerbose::StepInfo()>: verboseLevel = " <<
0018   //  verboseLevel << endl;
0019 
0020   CopyState();
0021 
0022   G4int precision = G4cout.precision(3);
0023 
0024   if (verboseLevel >= 1) {
0025     if (verboseLevel >= 4)
0026       VerboseTrack();
0027     if (verboseLevel >= 3) {
0028       G4cout << G4endl;
0029       G4cout << std::setw(5) << "#Step#"
0030              << " " << std::setw(6) << "X"
0031              << "   " << std::setw(6) << "Y"
0032              << "   " << std::setw(6) << "Z"
0033              << "   " << std::setw(9) << "KineE"
0034              << "   " << std::setw(9) << "dEStep"
0035              << "   " << std::setw(10) << "StepLength"
0036              << " " << std::setw(10) << "TrackLength"
0037              << " " << std::setw(10) << "Volume"
0038              << " " << std::setw(10) << "Process" << G4endl;
0039 
0040       G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " " << std::setw(6)
0041              << G4BestUnit(fTrack->GetPosition().x(), "Length") << std::setw(6)
0042              << G4BestUnit(fTrack->GetPosition().y(), "Length") << std::setw(6)
0043              << G4BestUnit(fTrack->GetPosition().z(), "Length") << std::setw(6)
0044              << G4BestUnit(fTrack->GetKineticEnergy(), "Energy") << std::setw(6)
0045              << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << std::setw(6)
0046              << G4BestUnit(fStep->GetStepLength(), "Length") << std::setw(6)
0047              << G4BestUnit(fTrack->GetTrackLength(), "Length") << " ";
0048 
0049       if (fTrack->GetNextVolume() != nullptr) {
0050         G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0051       } else {
0052         G4cout << std::setw(10) << "OutOfWorld";
0053       }
0054 
0055       if (fStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
0056         G4cout << " " << std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
0057       } else {
0058         G4cout << "    UserLimit";
0059       }
0060 
0061       G4cout << G4endl;
0062 
0063       if (verboseLevel == 2) {
0064         // total number of secondaries
0065         G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt + fN2ndariesPostStepDoIt;
0066 
0067         if (tN2ndariesTot > 0) {
0068           G4cout << "   :---- List of Secondaries - "
0069                  << "#SpawnInStep = " << std::setw(3) << tN2ndariesTot << "(Rest = " << std::setw(2)
0070                  << fN2ndariesAtRestDoIt << ", Along = " << std::setw(2) << fN2ndariesAlongStepDoIt
0071                  << ", Post = " << std::setw(2) << fN2ndariesPostStepDoIt << "), "
0072                  << "#SpawnTotal = " << std::setw(3) << (*fSecondary).size() << " --------- " << G4endl;
0073 
0074           for (size_t lp1 = (*fSecondary).size() - tN2ndariesTot; lp1 < (*fSecondary).size(); lp1++) {
0075             G4cout << "   : " << std::setw(6) << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(), "Length")
0076                    << std::setw(6) << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") << std::setw(6)
0077                    << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") << std::setw(6)
0078                    << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") << std::setw(10)
0079                    << (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
0080             G4cout << G4endl;
0081           }
0082 
0083           G4cout << "   :----------------------"
0084                  << "--------------------------"
0085                  << "-- End of Secondaries Info --------------------------------- " << G4endl;
0086         }
0087       }
0088     }
0089   }
0090   G4cout.precision(precision);
0091 }
0092 
0093 void LaserSteppingVerbose::TrackingStarted() {
0094   CopyState();
0095 
0096   G4int precision = G4cout.precision(3);
0097   if (verboseLevel > 0) {
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) << "StepLength"
0105            << " " << std::setw(10) << "TrackLength"
0106            << " " << std::setw(10) << "Volume"
0107            << "  " << std::setw(10) << "Process " << G4endl;
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") << "   ";
0117 
0118     if (fTrack->GetNextVolume() != nullptr) {
0119       G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
0120     } else {
0121       G4cout << "OutOfWorld";
0122     }
0123 
0124     G4cout << "     initStep" << G4endl;
0125   }
0126   G4cout.precision(precision);
0127 }