source: trunk/examples/extended/field/field01/src/F01SteppingVerbose.cc @ 1337

Last change on this file since 1337 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

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