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