source: trunk/examples/extended/field/field04/src/F04SteppingVerbose.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 7.8 KB
RevLine 
[807]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//
27//
28
29#include "G4UnitsTable.hh"
30
31#include "F04SteppingVerbose.hh"
32
33F04SteppingVerbose::F04SteppingVerbose()
34{
35 G4VSteppingVerbose::SetSilent(1);
36}
37
38F04SteppingVerbose::~F04SteppingVerbose()
39{}
40
41void F04SteppingVerbose::StepInfo()
42{
43 CopyState();
44
45 G4int prec = G4cout.precision(8);
46
47 if (fTrack->GetDefinition()->GetParticleName() == "proton") return;
48// if (fTrack->GetDefinition()->GetParticleName() == "pi+") return;
49// if (fTrack->GetDefinition()->GetParticleName() == "mu+") return;
50 if (fTrack->GetDefinition()->GetParticleName() == "e+") return;
51
52 if( verboseLevel >= 1 ){
53 if( verboseLevel >= 4 ) VerboseTrack();
54 if( verboseLevel >= 3 ){
55 G4cout << G4endl;
56 G4cout << std::setw( 5) << "#Step#" << " "
57 << std::setw(10) << "X" << " "
58 << std::setw(10) << "Y" << " "
59 << std::setw(10) << "Z" << " "
60 << std::setw(10) << "KineE" << " "
61 << std::setw(10) << "dEStep" << " "
62 << std::setw(10) << "StepLeng"
63 << std::setw(10) << "TrakLeng"
64 << std::setw(10) << "NextVolu"
65 << std::setw(10) << "Process"
66 << std::setw(10) << "Dir_x" << " "
67 << std::setw(10) << "Dir_y" << " "
68 << std::setw(10) << "Dir_z" << " "
69 << G4endl;
70 }
71
72 G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
73 << std::setw(10) << G4BestUnit(fTrack->GetPosition().x(),"Length")
74 << std::setw(10) << G4BestUnit(fTrack->GetPosition().y(),"Length")
75 << std::setw(10) << G4BestUnit(fTrack->GetPosition().z(),"Length")
76 << std::setw(10) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
77 << std::setw(10) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
78 << std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
79 << std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
80
81 if( fTrack->GetNextVolume() != 0 ) {
82 G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
83 } else {
84 G4cout << std::setw(10) << "OutOfWorld";
85 }
86
87 if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
88 G4cout << " "
89 << std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
90 ->GetProcessName();
91 } else {
92 G4cout << " UserLimit";
93 }
94
95// G4cout << std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().x(),"Length")
96// << std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().y(),"Length")
97// << std::setw(12) << G4BestUnit(fTrack->GetMomentumDirection().z(),"Length");
98
99 G4cout << G4endl;
100
101 if( verboseLevel == 2 ){
102 G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
103 fN2ndariesAlongStepDoIt +
104 fN2ndariesPostStepDoIt;
105 if(tN2ndariesTot>0){
106 G4cout << " :----- List of 2ndaries - "
107 << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
108 << "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
109 << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
110 << ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
111 << "), "
112 << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
113 << " ---------------"
114 << G4endl;
115
116 for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
117 lp1<(*fSecondary).size(); lp1++){
118 G4cout << " : "
119 << std::setw(6)
120 << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
121 << std::setw(6)
122 << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
123 << std::setw(6)
124 << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
125 << std::setw(6)
126 << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
127 << std::setw(10)
128 << (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
129 G4cout << G4endl;
130 }
131
132 G4cout << " :-----------------------------"
133 << "----------------------------------"
134 << "-- EndOf2ndaries Info ---------------"
135 << G4endl;
136 }
137 }
138
139 }
140 G4cout.precision(prec);
141}
142
143void F04SteppingVerbose::TrackingStarted()
144{
145 CopyState();
146
147 G4int prec = G4cout.precision(3);
148
149 if (fTrack->GetDefinition()->GetParticleName() == "proton") return;
150// if (fTrack->GetDefinition()->GetParticleName() == "pi+") return;
151// if (fTrack->GetDefinition()->GetParticleName() == "mu+") return;
152 if (fTrack->GetDefinition()->GetParticleName() == "e+") return;
153
154 G4cout << G4endl;
155 G4cout << "*******************************************************"
156 << "**************************************************"
157 << G4endl;
158 G4cout << "* G4Track Information: "
159 << " Particle = " << fTrack->GetDefinition()->GetParticleName()
160 << ","
161 << " Track ID = " << fTrack->GetTrackID()
162 << ","
163 << " Parent ID = " << fTrack->GetParentID()
164 << G4endl;
165 G4cout << "*******************************************************"
166 << "**************************************************"
167 << G4endl;
168 G4cout << G4endl;
169
170 if( verboseLevel > 0 ){
171
172 G4cout << std::setw( 5) << "Step#" << " "
173 << std::setw( 6) << "X" << " "
174 << std::setw( 6) << "Y" << " "
175 << std::setw( 6) << "Z" << " "
176 << std::setw( 9) << "KineE" << " "
177 << std::setw( 9) << "dEStep" << " "
178 << std::setw(10) << "StepLeng"
179 << std::setw(10) << "TrakLeng"
180 << std::setw(10) << "Volume" << " "
181 << std::setw(10) << "Process" << G4endl;
182
183 G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
184 << std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
185 << std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
186 << std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
187 << std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
188 << std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
189 << std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
190 << std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
191
192 if(fTrack->GetNextVolume()){
193 G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
194 } else {
195 G4cout << std::setw(10) << "OutOfWorld";
196 }
197 G4cout << " initStep" << G4endl;
198 }
199 G4cout.precision(prec);
200}
Note: See TracBrowser for help on using the repository browser.