Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SteppingVerbose.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 // $Id: SteppingVerbose.cc 71676 2013-06-20 13:15:08Z gcosmo $
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "SteppingVerbose.hh"
36 
37 #include "G4SteppingManager.hh"
38 #include "G4ParticleTypes.hh"
39 #include "G4UnitsTable.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
45 { }
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 {}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 {
56  CopyState();
57 
58  G4int prec = G4cout.precision(3);
59 
60  //Step zero
61  //
62  if( verboseLevel > 0 ){
63  G4cout << std::setw( 5) << "Step#" << " "
64  << std::setw( 6) << "X" << " "
65  << std::setw( 6) << "Y" << " "
66  << std::setw( 6) << "Z" << " "
67  << std::setw( 9) << "KineE" << " "
68  << std::setw( 9) << "dEStep" << " "
69  << std::setw(10) << "StepLeng"
70  << std::setw(10) << "TrakLeng"
71  << std::setw(10) << "Volume" << " "
72  << std::setw(10) << "Process" << G4endl;
73 
74  G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
75  << std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
76  << std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
77  << std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
78  << std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
79  << std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
80  << std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
81  << std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
82  << std::setw(10) << fTrack->GetVolume()->GetName()
83  << " initStep" << G4endl;
84  }
85  G4cout.precision(prec);
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 {
92  CopyState();
93 
94  G4int prec = G4cout.precision(3);
95 
96  if( verboseLevel >= 1 ){
97  if( verboseLevel >= 4 ) VerboseTrack();
98  if( verboseLevel >= 3 ){
99  G4cout << G4endl;
100  G4cout << std::setw( 5) << "#Step#" << " "
101  << std::setw( 6) << "X" << " "
102  << std::setw( 6) << "Y" << " "
103  << std::setw( 6) << "Z" << " "
104  << std::setw( 9) << "KineE" << " "
105  << std::setw( 9) << "dEStep" << " "
106  << std::setw(10) << "StepLeng"
107  << std::setw(10) << "TrakLeng"
108  << std::setw(10) << "Volume" << " "
109  << std::setw(10) << "Process" << G4endl;
110  }
111 
112  G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
113  << std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
114  << std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
115  << std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
116  << std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
117  << std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
118  << std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
119  << std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
120  << std::setw(10) << fTrack->GetVolume()->GetName();
121 
122  const G4VProcess* process
124  G4String procName = " UserLimit";
125  if (process) procName = process->GetProcessName();
126  if (fStepStatus == fWorldBoundary) procName = "OutOfWorld";
127  G4cout << " " << std::setw(10) << procName;
128  G4cout << G4endl;
129 
130  if (verboseLevel == 2) {
131  const std::vector<const G4Track*>* secondary
133  size_t nbtrk = (*secondary).size();
134  if (nbtrk) {
135  G4cout << "\n :----- List of secondaries ----------------" << G4endl;
136  G4cout.precision(4);
137  for (size_t lp=0; lp<(*secondary).size(); lp++) {
138  G4cout << " "
139  << std::setw(13)
140  << (*secondary)[lp]->GetDefinition()->GetParticleName()
141  << ": energy ="
142  << std::setw(6)
143  << G4BestUnit((*secondary)[lp]->GetKineticEnergy(),"Energy")
144  << " time ="
145  << std::setw(6)
146  << G4BestUnit((*secondary)[lp]->GetGlobalTime(),"Time");
147  G4cout << G4endl;
148  }
149 
150  G4cout << " :------------------------------------------\n" << G4endl;
151  }
152  }
153 
154  }
155  G4cout.precision(prec);
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void TrackingStarted()
G4double GetStepLength() const
double x() const
const G4ThreeVector & GetPosition() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
double z() const
static const double prec
Definition: RanecuEngine.cc:58
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4int GetCurrentStepNumber() const
const G4String & GetName() const
const std::vector< const G4Track * > * GetSecondaryInCurrentStep() const
Definition: G4Step.cc:193
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4double GetTotalEnergyDeposit() const
G4double GetTrackLength() const
const G4VProcess * GetProcessDefinedStep() const
virtual void StepInfo()
G4StepPoint * GetPostStepPoint() const
double y() const
G4VPhysicalVolume * GetVolume() const
#define G4endl
Definition: G4ios.hh:61