source: trunk/examples/novice/gemc/src/ExN03SteppingVerbose.cc @ 893

Last change on this file since 893 was 807, checked in by garnier, 16 years ago

update

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