source: trunk/examples/advanced/lAr_calorimeter/src/FCALSteppingVerbose.cc @ 1288

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

update to geant4.9.3

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