ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SteppingVerbose.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SteppingVerbose.cc
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 //
26 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publications:
29 // Med. Phys. 37 (2010) 4692-4708
30 // Phys. Med. 31 (2015) 861-874
31 // The Geant4-DNA web site is available at http://geant4-dna.org
32 //
35 
36 #include "SteppingVerbose.hh"
37 
38 #include "G4SteppingManager.hh"
39 #include "G4ParticleTypes.hh"
40 #include "G4UnitsTable.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
46 {}
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
51 {}
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 {
57  CopyState();
58 
59  G4int prec = G4cout.precision(3);
60 
61  //Step zero
62  //
63  if( verboseLevel > 0 ){
64  G4cout << std::setw( 5) << "Step#" << " "
65  << std::setw( 6) << "X" << " "
66  << std::setw( 6) << "Y" << " "
67  << std::setw( 6) << "Z" << " "
68  << std::setw( 9) << "KineE" << " "
69  << std::setw( 9) << "dEStep" << " "
70  << std::setw(10) << "StepLeng"
71  << std::setw(10) << "TrakLeng"
72  << std::setw(10) << "Volume" << " "
73  << std::setw(10) << "Process" << G4endl;
74 
75  G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
76  << std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
77  << std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
78  << std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
79  << std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
80  << std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
81  << std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
82  << std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
83  << std::setw(10) << fTrack->GetVolume()->GetName()
84  << " initStep" << G4endl;
85  }
86  G4cout.precision(prec);
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
92 {
93  CopyState();
94 
95  G4int prec = G4cout.precision(3);
96 
97  if( verboseLevel >= 1 ){
98  if( verboseLevel >= 4 ) VerboseTrack();
99  if( verboseLevel >= 3 ){
100  G4cout << G4endl;
101  G4cout << std::setw( 5) << "#Step#" << " "
102  << std::setw( 6) << "X" << " "
103  << std::setw( 6) << "Y" << " "
104  << std::setw( 6) << "Z" << " "
105  << std::setw( 9) << "KineE" << " "
106  << std::setw( 9) << "dEStep" << " "
107  << std::setw(10) << "StepLeng"
108  << std::setw(10) << "TrakLeng"
109  << std::setw(10) << "Volume" << " "
110  << std::setw(10) << "Process" << G4endl;
111  }
112 
113  G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
114  << std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
115  << std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
116  << std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
117  << std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
118  << std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
119  << std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
120  << std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
121  << std::setw(10) << fTrack->GetVolume()->GetName();
122 
123  const G4VProcess* process
125  G4String procName = " UserLimit";
126  if (process) procName = process->GetProcessName();
127  if (fStepStatus == fWorldBoundary) procName = "OutOfWorld";
128  G4cout << " " << std::setw(10) << procName;
129  G4cout << G4endl;
130 
131  if (verboseLevel == 2) {
132  const std::vector<const G4Track*>* secondary
134  size_t nbtrk = (*secondary).size();
135  if (nbtrk) {
136  G4cout << "\n :----- List of secondaries ----------------" << G4endl;
137  G4cout.precision(4);
138  for (size_t lp=0; lp<(*secondary).size(); lp++) {
139  G4cout << " "
140  << std::setw(13)
141  << (*secondary)[lp]->GetDefinition()->GetParticleName()
142  << ": energy ="
143  << std::setw(6)
144  << G4BestUnit((*secondary)[lp]->GetKineticEnergy(),"Energy")
145  << " time ="
146  << std::setw(6)
147  << G4BestUnit((*secondary)[lp]->GetGlobalTime(),"Time");
148  G4cout << G4endl;
149  }
150 
151  G4cout << " :------------------------------------------\n" << G4endl;
152  }
153  }
154 
155  }
156  G4cout.precision(prec);
157 }