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