source: trunk/source/tracking/src/G4SteppingVerbose.cc @ 1340

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

update ti head

File size: 34.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: G4SteppingVerbose.cc,v 1.24 2010/07/19 13:41:21 gcosmo Exp $
28// GEANT4 tag $Name: tracking-V09-03-08 $
29//
30//---------------------------------------------------------------
31//
32// G4SteppingVerbose.cc
33//
34// Description:
35//    Implementation of  the G4SteppingVerbose class
36// Contact:
37//   Questions and comments to this code should be sent to
38//     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
39//     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
40//
41//---------------------------------------------------------------
42
43#include "G4SteppingVerbose.hh"
44#include "G4SteppingManager.hh"
45
46#include "G4VSensitiveDetector.hh"    // Include from 'hits/digi'
47#include "G4StepStatus.hh"    // Include from 'tracking'
48
49///#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
50
51#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
52#include "G4UnitsTable.hh"
53#else
54#define G4BestUnit(a,b) a
55#endif
56
57//////////////////////////////////////////////////
58G4SteppingVerbose::G4SteppingVerbose()
59//////////////////////////////////////////////////
60{
61#ifdef G4_TRACKING_DEBUG
62   G4cout << "G4SteppingVerbose has instantiated" << G4endl;
63#endif
64}
65
66//////////////////////////////////////////////////
67G4SteppingVerbose::~G4SteppingVerbose()
68//////////////////////////////////////////////////
69{
70}
71
72//////////////////////////////////////////////////
73void G4SteppingVerbose::NewStep()
74//////////////////////////////////////////////////
75{
76}
77
78//////////////////////////////////////////////////
79void G4SteppingVerbose::AtRestDoItInvoked()
80//////////////////////////////////////////////////
81 {
82   if(Silent==1){ return; }
83
84   G4VProcess* ptProcManager;
85   CopyState();
86
87   if(verboseLevel >= 3 ){     
88     G4int npt=0;
89     G4cout << " **List of AtRestDoIt invoked:" << G4endl;
90     for(size_t np=0; np < MAXofAtRestLoops; np++){
91       size_t npGPIL = MAXofAtRestLoops-np-1;
92       if( (*fSelectedAtRestDoItVector)[npGPIL] == 2 ){
93               npt++;               
94               ptProcManager = (*fAtRestDoItVector)[np];
95               G4cout << "   # " << npt << " : " 
96                      << ptProcManager->GetProcessName() 
97                      << " (Forced)" << G4endl;
98       } else if ( (*fSelectedAtRestDoItVector)[npGPIL] == 1 ){
99               npt++;               
100               ptProcManager = (*fAtRestDoItVector)[np];
101               G4cout << "   # " << npt << " : "  << ptProcManager->GetProcessName() << G4endl;
102       }
103     }
104     
105     G4cout << "   Generated secondries # : " << fN2ndariesAtRestDoIt << G4endl;
106     
107     if( fN2ndariesAtRestDoIt > 0 ){
108       G4cout << "   -- List of secondaries generated : " << "(x,y,z,kE,t,PID) --" << G4endl; 
109       for( size_t lp1=(*fSecondary).size()-fN2ndariesAtRestDoIt;
110                   lp1<(*fSecondary).size(); lp1++) {
111         G4cout << "      "
112                << std::setw( 9)
113                << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length") << " "
114                << std::setw( 9)
115                << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length") << " "
116                << std::setw( 9)
117                << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length") << " "
118                << std::setw( 9)
119                << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy") << " "
120                << std::setw( 9)
121                << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time") << " "
122                << std::setw(18)
123                << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl;
124       }
125     }
126   }
127   
128   if( verboseLevel >= 4 ){ 
129     ShowStep();
130     G4cout << G4endl;
131   }
132}
133/////////////////////////////////////////////////////
134void G4SteppingVerbose::AlongStepDoItAllDone()
135/////////////////////////////////////////////////////
136{
137   if(Silent==1){ return; }
138
139   G4VProcess* ptProcManager;
140
141   CopyState();
142
143   if(verboseLevel >= 3){ 
144      G4cout << G4endl;
145      G4cout << " >>AlongStepDoIt (after all invocations):" << G4endl;
146      G4cout << "    ++List of invoked processes " << G4endl;
147
148      for(size_t ci=0; ci<MAXofAlongStepLoops; ci++){
149          ptProcManager = (*fAlongStepDoItVector)(ci);
150          G4cout << "      " << ci+1 << ") ";
151          if(ptProcManager != 0){
152             G4cout << ptProcManager->GetProcessName() << G4endl;
153          }
154      }
155
156      ShowStep();
157      G4cout << G4endl;
158      G4cout << "    ++List of secondaries generated " 
159             << "(x,y,z,kE,t,PID):"
160             << "  No. of secodaries = " 
161             << (*fSecondary).size() << G4endl;
162
163      if((*fSecondary).size()>0){
164         for(size_t lp1=0; lp1<(*fSecondary).size(); lp1++){
165           G4cout << "      "
166                  << std::setw( 9)
167                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")  << " "
168                  << std::setw( 9)
169                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")  << " "
170                  << std::setw( 9)
171                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")  << " "
172                  << std::setw( 9)
173                  << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy") << " "
174                  << std::setw( 9)
175                  << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time")      << " "
176                  << std::setw(18)
177                  << (*fSecondary)[lp1]->GetDefinition()->GetParticleName()      << G4endl;
178               }
179            }
180   }
181}
182////////////////////////////////////////////////////
183void G4SteppingVerbose::PostStepDoItAllDone()
184////////////////////////////////////////////////////
185{
186   if(Silent==1){ return; }
187
188   G4VProcess* ptProcManager;
189
190   CopyState();
191
192   if( (fStepStatus == fPostStepDoItProc) |
193       (fCondition  == Forced)            |
194       (fCondition  == Conditionally)     |
195       (fCondition  == ExclusivelyForced) |
196       (fCondition  == StronglyForced) ){
197
198     if(verboseLevel >= 3){
199        G4int npt=0;
200        G4cout << G4endl;
201        G4cout << " **PostStepDoIt (after all invocations):" << G4endl;
202        G4cout << "    ++List of invoked processes " << G4endl;
203
204        for(size_t np=0; np < MAXofPostStepLoops; np++){
205           size_t npGPIL = MAXofPostStepLoops-np-1;
206           if( (*fSelectedPostStepDoItVector)[npGPIL] == 2){
207             npt++;
208             ptProcManager = (*fPostStepDoItVector)[np];
209             G4cout << "      " << npt << ") "
210                    << ptProcManager->GetProcessName()
211                    << " (Forced)" << G4endl;
212           } else if ( (*fSelectedPostStepDoItVector)[npGPIL] == 1){
213             npt++;
214             ptProcManager = (*fPostStepDoItVector)[np];
215             G4cout << "      " << npt << ") " << ptProcManager->GetProcessName() << G4endl;
216           }
217        }
218
219        ShowStep();
220        G4cout << G4endl;
221        G4cout << "    ++List of secondaries generated "
222               << "(x,y,z,kE,t,PID):"
223               << "  No. of secodaries = "
224               << (*fSecondary).size() << G4endl;
225        G4cout << "      [Note]Secondaries from AlongStepDoIt included." << G4endl;
226
227        if((*fSecondary).size()>0){
228          for(size_t lp1=0; lp1<(*fSecondary).size(); lp1++){
229            G4cout  << "      "
230                    << std::setw( 9)
231                    << G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length") << " "
232                    << std::setw( 9)
233                    << G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length") << " "
234                    << std::setw( 9)
235                    << G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length") << " "
236                    << std::setw( 9)
237                    << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy") << " "
238                    << std::setw( 9)
239                    << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime() , "Time") << " "
240                    << std::setw(18)
241                    << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl;
242          }
243        }
244     }
245   }
246}
247
248/////////////////////////////////////////
249void G4SteppingVerbose::StepInfo()
250/////////////////////////////////////////
251{
252   if(Silent==1){ return; }
253   if(SilentStepInfo==1){ return; }
254
255  CopyState();
256  G4cout.precision(16); 
257  G4int prec = G4cout.precision(3);
258
259  if( verboseLevel >= 1 ){
260    if( verboseLevel >= 4 ) VerboseTrack();
261    if( verboseLevel >= 3 ){
262      G4cout << G4endl;
263#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE     
264      G4cout << std::setw( 5) << "#Step#" << " "
265             << std::setw( 8) << "X"      << "     " << std::setw( 8) << "Y"      << "     " 
266             << std::setw( 8) << "Z"      << "     "
267             << std::setw( 9) << "KineE"  << "     " << std::setw( 8) << "dE"     << "     " 
268             << std::setw(12) << "StepLeng"   << " " << std::setw(12) << "TrackLeng"  << " "
269             << std::setw(12) << "NextVolume" << " " << std::setw( 8) << "ProcName"   << G4endl;               
270#else
271      G4cout << std::setw( 5) << "#Step#"      << " "
272             << std::setw( 8) << "X(mm)"      << " " << std::setw( 8) << "Y(mm)"      << " " 
273             << std::setw( 8) << "Z(mm)"      << " "
274             << std::setw( 9) << "KinE(MeV)"  << " " << std::setw( 8) << "dE(MeV)"    << " " 
275             << std::setw( 8) << "StepLeng"   << " " << std::setw( 9) << "TrackLeng"  << " " 
276             << std::setw(11) << "NextVolume" << " " << std::setw( 8) << "ProcName"   << G4endl;
277#endif       
278    }
279    G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
280                 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().x() , "Length") << " "
281                 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().y() , "Length") << " "
282                 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().z() , "Length") << " "
283                 << std::setw( 9) << G4BestUnit(fTrack->GetKineticEnergy() , "Energy") << " "
284                 << std::setw( 8) << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << " "
285                 << std::setw( 8) << G4BestUnit(fStep->GetStepLength() , "Length") << " "
286                 << std::setw( 9) << G4BestUnit(fTrack->GetTrackLength() , "Length") << " ";
287
288    // Put cut comment here
289    if( fTrack->GetNextVolume() != 0 ) { 
290      G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() << " ";
291    } else {
292      G4cout << std::setw(11) << "OutOfWorld" << " ";
293    }
294    if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
295      G4cout << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
296    } else {
297      G4cout << "User Limit";
298    }
299    G4cout << G4endl;
300    if( verboseLevel == 2 )
301    {
302      G4int tN2ndariesTot = fN2ndariesAtRestDoIt + fN2ndariesAlongStepDoIt + fN2ndariesPostStepDoIt;
303      if(tN2ndariesTot>0){
304        G4cout << "    :----- List of 2ndaries - "
305                     << "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
306                     << "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
307                     << ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
308                     << ",Post="  << std::setw(2) << fN2ndariesPostStepDoIt
309                     << "), "
310                     << "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
311                     << " ---------------"
312                     << G4endl;
313
314              for(size_t lp1=(*fSecondary).size()-tN2ndariesTot; lp1<(*fSecondary).size(); lp1++){
315                G4cout << "    : "
316                             << std::setw( 9)
317                             << G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
318                             << std::setw( 9)
319                             << G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length")<< " "
320                             << std::setw( 9)
321                             << G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length") << " "
322                             << std::setw( 9)
323                             << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy")<< " "
324                             << std::setw(18)
325                             << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl;
326              }
327              G4cout << "    :-----------------------------" << "----------------------------------"
328                     << "-- EndOf2ndaries Info ---------------"  << G4endl;
329      }
330    }
331  }
332  G4cout.precision(prec);
333}
334// Put cut comment here if( fStepStatus != fWorldBoundary){
335
336////////////////////////////////////////////
337void G4SteppingVerbose::DPSLStarted()
338////////////////////////////////////////////
339{
340   if(Silent==1){ return; }
341  CopyState();
342
343  if( verboseLevel > 5 ){
344    G4cout << G4endl << " >>DefinePhysicalStepLength (List of proposed StepLengths): "  << G4endl;
345  }
346}
347//////////////////////////////////////////////
348void G4SteppingVerbose::DPSLUserLimit()
349//////////////////////////////////////////////
350{
351   if(Silent==1){ return; }
352  CopyState();
353
354  if( verboseLevel > 5 ){
355    G4cout << G4endl << G4endl;
356    G4cout << "=== Defined Physical Step Length (DPSL)"             << G4endl;
357    G4cout << "    ++ProposedStep(UserLimit) = " << std::setw( 9) << physIntLength
358                 << " : ProcName = User defined maximum allowed Step"     << G4endl;
359  }
360}
361/////////////////////////////////////////////
362void G4SteppingVerbose::DPSLPostStep()
363/////////////////////////////////////////////
364{
365  if(Silent==1){ return; }
366  CopyState();
367
368  if( verboseLevel > 5 ){
369    G4cout << "    ++ProposedStep(PostStep ) = " << std::setw( 9) << physIntLength
370           << " : ProcName = " << fCurrentProcess->GetProcessName() << " (";
371    if(fCondition==ExclusivelyForced){
372      G4cout << "ExclusivelyForced)" << G4endl;
373    }
374    else if(fCondition==StronglyForced){
375      G4cout << "StronglyForced)" << G4endl;
376    }
377    else if(fCondition==Conditionally){
378      G4cout << "Conditionally)" << G4endl;
379    }
380    else if(fCondition==Forced){
381      G4cout << "Forced)" << G4endl;
382    }
383    else{
384      G4cout << "No ForceCondition)" << G4endl;
385    }
386  }
387}
388/////////////////////////////////////////////
389void G4SteppingVerbose::DPSLAlongStep()
390/////////////////////////////////////////////
391{
392  if(Silent==1){ return; }
393  CopyState();
394
395  if( verboseLevel > 5 ){
396    G4cout << "    ++ProposedStep(AlongStep) = " 
397           << std::setw( 9) << G4BestUnit(physIntLength , "Length")
398           << " : ProcName = "
399           << fCurrentProcess->GetProcessName() 
400           << " (";
401    if(fGPILSelection==CandidateForSelection){
402      G4cout << "CandidateForSelection)" << G4endl;
403    }
404    else if(fGPILSelection==NotCandidateForSelection){
405      G4cout << "NotCandidateForSelection)" << G4endl;
406    }
407    else{
408      G4cout << "?!?)" << G4endl;
409    }
410  }
411}
412
413
414////////////////////////////////////////////////
415void G4SteppingVerbose::TrackingStarted()
416////////////////////////////////////////////////
417{
418  if(Silent==1){ return; }
419
420  CopyState();
421
422  G4int prec = G4cout.precision(3);
423  if( verboseLevel > 0 ){
424
425#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
426    G4cout << std::setw( 5) << "Step#"  << " "
427           << std::setw( 8) << "X"      << "     "
428                 << std::setw( 8) << "Y"      << "     " 
429                 << std::setw( 8) << "Z"      << "     "
430                 << std::setw( 9) << "KineE"  << "     "
431                 << std::setw( 8) << "dE"     << "     " 
432                 << std::setw(12) << "StepLeng"   << " " 
433                 << std::setw(12) << "TrackLeng"  << " "
434                 << std::setw(12) << "NextVolume" << " "
435                 << std::setw( 8) << "ProcName"   << G4endl;         
436#else
437    G4cout << std::setw( 5) << "Step#"      << " "
438                 << std::setw( 8) << "X(mm)"      << " "
439                 << std::setw( 8) << "Y(mm)"      << " " 
440                 << std::setw( 8) << "Z(mm)"      << " "
441                 << std::setw( 9) << "KinE(MeV)"  << " "
442                 << std::setw( 8) << "dE(MeV)"    << " " 
443                 << std::setw( 8) << "StepLeng"   << " " 
444                 << std::setw( 9) << "TrackLeng"  << " "
445                 << std::setw(11) << "NextVolume" << " "
446                 << std::setw( 8) << "ProcName"   << G4endl;         
447#endif
448
449    G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
450                 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().x(),"Length")<< " "
451                 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().y(),"Length") << " "
452                 << std::setw( 8) << G4BestUnit(fTrack->GetPosition().z(),"Length")<< " "
453                 << std::setw( 9) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")<< " "
454                 << std::setw( 8) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy") << " "
455                 << std::setw( 8) << G4BestUnit(fStep->GetStepLength(),"Length")<< " "
456                 << std::setw( 9) << G4BestUnit(fTrack->GetTrackLength(),"Length") << " ";
457
458    if(fTrack->GetNextVolume()){
459      G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() << " ";
460    } else {
461      G4cout << std::setw(11) << "OutOfWorld" << " ";
462    }
463    G4cout << "initStep" << G4endl;
464  }
465  G4cout.precision(prec);
466}
467//////////////////////////////////////////////////////
468void G4SteppingVerbose::AlongStepDoItOneByOne()
469//////////////////////////////////////////////////////
470{ 
471  if(Silent==1){ return; }
472
473  CopyState();
474
475  if(verboseLevel >= 4){ 
476    G4cout << G4endl;
477    G4cout << " >>AlongStepDoIt (process by process): "
478           << "   Process Name = " 
479           << fCurrentProcess->GetProcessName() << G4endl;
480
481    ShowStep();
482    G4cout << "          "
483                 << "!Note! Safety of PostStep is only valid "
484                 << "after all DoIt invocations."
485                 << G4endl; 
486
487    VerboseParticleChange();   
488    G4cout << G4endl;
489
490    G4cout << "    ++List of secondaries generated " 
491                 << "(x,y,z,kE,t,PID):"
492                 << "  No. of secodaries = " 
493                 << fN2ndariesAlongStepDoIt << G4endl;
494
495    if(fN2ndariesAlongStepDoIt>0){
496       for(size_t lp1=(*fSecondary).size()-fN2ndariesAlongStepDoIt; lp1<(*fSecondary).size(); lp1++){
497          G4cout  << "      "
498                  << std::setw( 9)
499                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
500                  << std::setw( 9)
501                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length")<< " "
502                  << std::setw( 9)
503                  << G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length")<< " "
504                  << std::setw( 9)
505                  << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy")<< " "
506                  << std::setw( 9)
507                  << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime() , "Time")<< " "
508                  << std::setw(18)
509                  << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl;
510             }
511          }
512  }
513}
514//////////////////////////////////////////////////////
515void G4SteppingVerbose::PostStepDoItOneByOne()
516//////////////////////////////////////////////////////
517{
518  if(Silent==1){ return; }
519
520  CopyState();
521
522  if(verboseLevel >= 4){ 
523    G4cout << G4endl;
524    G4cout << " >>PostStepDoIt (process by process): "
525           << "   Process Name = " 
526           << fCurrentProcess->GetProcessName() << G4endl;
527
528    ShowStep();
529    G4cout << G4endl;
530    VerboseParticleChange();   
531    G4cout << G4endl;
532
533    G4cout << "    ++List of secondaries generated " 
534           << "(x,y,z,kE,t,PID):"
535           << "  No. of secodaries = " 
536           << fN2ndariesPostStepDoIt << G4endl;
537
538    if(fN2ndariesPostStepDoIt>0){
539      for(size_t lp1=(*fSecondary).size()-fN2ndariesPostStepDoIt; lp1<(*fSecondary).size(); lp1++){
540         G4cout << "      "
541                << std::setw( 9)
542                << G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
543                << std::setw( 9)
544                << G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") << " "
545                << std::setw( 9)
546                << G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") << " "
547                << std::setw( 9)
548                << G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") << " "
549                << std::setw( 9)
550                << G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(), "Time") << " "
551                << std::setw(18)
552                << (*fSecondary)[lp1]->GetDefinition()->GetParticleName() << G4endl;
553            }
554    }
555  }
556}
557
558
559//////////////////////////////////////
560void G4SteppingVerbose::VerboseTrack()
561//////////////////////////////////////
562{
563  if(Silent==1){ return; }
564
565  CopyState();
566// Show header
567  G4cout << G4endl;
568  G4cout << "    ++G4Track Information " << G4endl;
569  G4int prec = G4cout.precision(3);
570
571
572  G4cout << "      -----------------------------------------------" 
573       << G4endl;
574  G4cout << "        G4Track Information  " << std::setw(20) << G4endl;
575  G4cout << "      -----------------------------------------------" 
576       << G4endl;
577
578  G4cout << "        Step number         : " 
579       << std::setw(20) << fTrack->GetCurrentStepNumber()
580       << G4endl; 
581#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
582  G4cout << "        Position - x        : " 
583       << std::setw(20) << G4BestUnit(fTrack->GetPosition().x(), "Length")
584       << G4endl; 
585  G4cout << "        Position - y        : " 
586       << std::setw(20) << G4BestUnit(fTrack->GetPosition().y(), "Length")
587       << G4endl; 
588  G4cout << "        Position - z        : " 
589       << std::setw(20) << G4BestUnit(fTrack->GetPosition().z(), "Length")
590       << G4endl;
591  G4cout << "        Global Time         : " 
592       << std::setw(20) << G4BestUnit(fTrack->GetGlobalTime(), "Time")
593       << G4endl;
594  G4cout << "        Local Time          : " 
595       << std::setw(20) << G4BestUnit(fTrack->GetLocalTime(), "Time")
596       << G4endl;
597#else
598  G4cout << "        Position - x (mm)   : " 
599       << std::setw(20) << fTrack->GetPosition().x() /mm
600       << G4endl; 
601  G4cout << "        Position - y (mm)   : " 
602       << std::setw(20) << fTrack->GetPosition().y() /mm
603       << G4endl; 
604  G4cout << "        Position - z (mm)   : " 
605       << std::setw(20) << fTrack->GetPosition().z() /mm
606       << G4endl;
607  G4cout << "        Global Time (ns)    : " 
608       << std::setw(20) << fTrack->GetGlobalTime() /ns
609       << G4endl;
610  G4cout << "        Local Time (ns)     : " 
611       << std::setw(20) << fTrack->GetLocalTime() /ns
612       << G4endl;
613#endif
614  G4cout << "        Momentum Direct - x : " 
615       << std::setw(20) << fTrack->GetMomentumDirection().x()
616       << G4endl;
617  G4cout << "        Momentum Direct - y : " 
618       << std::setw(20) << fTrack->GetMomentumDirection().y()
619       << G4endl;
620  G4cout << "        Momentum Direct - z : " 
621       << std::setw(20) << fTrack->GetMomentumDirection().z()
622       << G4endl;
623#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
624  G4cout << "        Kinetic Energy      : " 
625#else
626  G4cout << "        Kinetic Energy (MeV): " 
627#endif
628       << std::setw(20) << G4BestUnit(fTrack->GetKineticEnergy(), "Energy")
629       << G4endl;
630  G4cout << "        Polarization - x    : " 
631       << std::setw(20) << fTrack->GetPolarization().x()
632       << G4endl;
633  G4cout << "        Polarization - y    : " 
634       << std::setw(20) << fTrack->GetPolarization().y()
635       << G4endl;
636  G4cout << "        Polarization - z    : " 
637       << std::setw(20) << fTrack->GetPolarization().z()
638       << G4endl;
639  G4cout << "        Track Length        : " 
640       << std::setw(20) << G4BestUnit(fTrack->GetTrackLength(), "Length")
641       << G4endl;
642  G4cout << "        Track ID #          : " 
643       << std::setw(20) << fTrack->GetTrackID()
644       << G4endl;
645  G4cout << "        Parent Track ID #   : " 
646       << std::setw(20) << fTrack->GetParentID()
647       << G4endl;
648  G4cout << "        Next Volume         : " 
649       << std::setw(20);
650       if( fTrack->GetNextVolume() != 0 ) { 
651         G4cout << fTrack->GetNextVolume()->GetName() << " ";
652       } else {
653         G4cout << "OutOfWorld" << " ";
654       }
655       G4cout << G4endl;
656  G4cout << "        Track Status        : " 
657       << std::setw(20);
658       if( fTrack->GetTrackStatus() == fAlive ){
659         G4cout << " Alive";
660       } else if( fTrack->GetTrackStatus() == fStopButAlive ){
661           G4cout << " StopButAlive";
662       } else if( fTrack->GetTrackStatus() == fStopAndKill ){
663           G4cout << " StopAndKill";
664       } else if( fTrack->GetTrackStatus() == fKillTrackAndSecondaries ){
665           G4cout << " KillTrackAndSecondaries";
666       } else if( fTrack->GetTrackStatus() == fSuspend ){
667           G4cout << " Suspend";
668       } else if( fTrack->GetTrackStatus() == fPostponeToNextEvent ){
669           G4cout << " PostponeToNextEvent";
670       }
671       G4cout << G4endl;
672#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
673  G4cout << "        Vertex - x          : " 
674       << std::setw(20) << G4BestUnit(fTrack->GetVertexPosition().x(),"Length")
675       << G4endl; 
676  G4cout << "        Vertex - y          : " 
677       << std::setw(20) << G4BestUnit(fTrack->GetVertexPosition().y(),"Length")
678       << G4endl; 
679  G4cout << "        Vertex - z          : " 
680       << std::setw(20) << G4BestUnit(fTrack->GetVertexPosition().z(),"Length")
681       << G4endl;
682#else
683  G4cout << "        Vertex - x (mm)     : " 
684       << std::setw(20) << fTrack->GetVertexPosition().x()/mm
685       << G4endl; 
686  G4cout << "        Vertex - y (mm)     : " 
687       << std::setw(20) << fTrack->GetVertexPosition().y()/mm
688       << G4endl; 
689  G4cout << "        Vertex - z (mm)     : " 
690       << std::setw(20) << fTrack->GetVertexPosition().z()/mm
691       << G4endl;
692#endif
693  G4cout << "        Vertex - Px (MomDir): " 
694       << std::setw(20) << fTrack->GetVertexMomentumDirection().x()
695       << G4endl;
696  G4cout << "        Vertex - Py (MomDir): " 
697       << std::setw(20) << fTrack->GetVertexMomentumDirection().y()
698       << G4endl;
699  G4cout << "        Vertex - Pz (MomDir): " 
700       << std::setw(20) << fTrack->GetVertexMomentumDirection().z()
701       << G4endl;
702#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
703  G4cout << "        Vertex - KineE      : " 
704#else
705  G4cout << "        Vertex - KineE (MeV): " 
706#endif
707       << std::setw(20) << G4BestUnit(fTrack->GetVertexKineticEnergy(),"Energy")
708       << G4endl;
709 
710  G4cout << "        Creator Process     : " 
711       << std::setw(20);
712  if( fTrack->GetCreatorProcess() == 0){
713    G4cout << " Event Generator" << G4endl;
714  } else {
715    G4cout << fTrack->GetCreatorProcess()->GetProcessName() << G4endl;
716  }
717
718  G4cout << "      -----------------------------------------------" 
719       << G4endl;
720       
721 G4cout.precision(prec);     
722}
723
724
725///////////////////////////////////////////////
726void G4SteppingVerbose::VerboseParticleChange()
727///////////////////////////////////////////////
728{
729  if(Silent==1){ return; }
730// Show header
731  G4cout << G4endl;
732  G4cout << "    ++G4ParticleChange Information " << G4endl;
733  fParticleChange->DumpInfo();
734}
735/////////////////////////////////////////
736void G4SteppingVerbose::ShowStep() const
737////////////////////////////////////////
738{
739  if(Silent==1){ return; }
740   G4String volName;
741   G4int oldprc;
742
743// Show header
744   G4cout << G4endl;
745   G4cout << "    ++G4Step Information " << G4endl;
746   oldprc = G4cout.precision(16);
747
748// Show G4Step specific information
749   G4cout << "      Address of G4Track    : " << fStep->GetTrack() << G4endl;
750   G4cout << "      Step Length (mm)      : " << fStep->GetTrack()->GetStepLength() << G4endl;
751   G4cout << "      Energy Deposit (MeV)  : " << fStep->GetTotalEnergyDeposit() << G4endl;
752
753// Show G4StepPoint specific information
754   G4cout << "      -------------------------------------------------------" 
755        << "----------------" <<  G4endl;
756   G4cout << "        StepPoint Information  " << std::setw(20) << "PreStep" 
757                                             << std::setw(20) << "PostStep" << G4endl;
758   G4cout << "      -------------------------------------------------------" 
759        << "----------------" <<  G4endl;
760   G4cout << "         Position - x (mm)   : " 
761        << std::setw(20) << fStep->GetPreStepPoint()->GetPosition().x() 
762        << std::setw(20) << fStep->GetPostStepPoint()->GetPosition().x() << G4endl;
763   G4cout << "         Position - y (mm)   : " 
764        << std::setw(20) << fStep->GetPreStepPoint()->GetPosition().y() 
765        << std::setw(20) << fStep->GetPostStepPoint()->GetPosition().y() << G4endl;
766   G4cout << "         Position - z (mm)   : " 
767        << std::setw(20) << fStep->GetPreStepPoint()->GetPosition().z() 
768        << std::setw(20) << fStep->GetPostStepPoint()->GetPosition().z() << G4endl;
769   G4cout << "         Global Time (ns)    : " 
770        << std::setw(20) << fStep->GetPreStepPoint()->GetGlobalTime()
771        << std::setw(20) << fStep->GetPostStepPoint()->GetGlobalTime() << G4endl;
772   G4cout << "         Local Time (ns)     : " 
773        << std::setw(20) << fStep->GetPreStepPoint()->GetLocalTime() 
774        << std::setw(20) << fStep->GetPostStepPoint()->GetLocalTime() << G4endl;
775   G4cout << "         Proper Time (ns)    : " 
776        << std::setw(20) << fStep->GetPreStepPoint()->GetProperTime()
777        << std::setw(20) << fStep->GetPostStepPoint()->GetProperTime() << G4endl;
778   G4cout << "         Momentum Direct - x : " 
779        << std::setw(20) << fStep->GetPreStepPoint()->GetMomentumDirection().x()
780        << std::setw(20) << fStep->GetPostStepPoint()->GetMomentumDirection().x() << G4endl;
781   G4cout << "         Momentum Direct - y : " 
782        << std::setw(20) << fStep->GetPreStepPoint()->GetMomentumDirection().y()
783        << std::setw(20) << fStep->GetPostStepPoint()->GetMomentumDirection().y() << G4endl;
784   G4cout << "         Momentum Direct - z : " 
785        << std::setw(20) << fStep->GetPreStepPoint()->GetMomentumDirection().z()
786        << std::setw(20) << fStep->GetPostStepPoint()->GetMomentumDirection().z() << G4endl;
787   G4cout << "         Momentum - x (MeV/c): " 
788        << std::setw(20) << fStep->GetPreStepPoint()->GetMomentum().x()
789        << std::setw(20) << fStep->GetPostStepPoint()->GetMomentum().x() << G4endl;
790   G4cout << "         Momentum - y (MeV/c): " 
791        << std::setw(20) << fStep->GetPreStepPoint()->GetMomentum().y()
792        << std::setw(20) << fStep->GetPostStepPoint()->GetMomentum().y() << G4endl;
793   G4cout << "         Momentum - z (MeV/c): " 
794        << std::setw(20) << fStep->GetPreStepPoint()->GetMomentum().z()
795        << std::setw(20) << fStep->GetPostStepPoint()->GetMomentum().z() << G4endl;
796   G4cout << "         Total Energy (MeV)  : " 
797        << std::setw(20) << fStep->GetPreStepPoint()->GetTotalEnergy()
798        << std::setw(20) << fStep->GetPostStepPoint()->GetTotalEnergy() << G4endl;
799   G4cout << "         Kinetic Energy (MeV): " 
800        << std::setw(20) << fStep->GetPreStepPoint()->GetKineticEnergy()
801        << std::setw(20) << fStep->GetPostStepPoint()->GetKineticEnergy() << G4endl;
802   G4cout << "         Velocity (mm/ns)    : " 
803        << std::setw(20) << fStep->GetPreStepPoint()->GetVelocity()
804        << std::setw(20) << fStep->GetPostStepPoint()->GetVelocity() << G4endl;
805   G4cout << "         Volume Name         : "
806        << std::setw(20) << fStep->GetPreStepPoint()->GetPhysicalVolume()->GetName();
807   if (fStep->GetPostStepPoint()->GetPhysicalVolume())
808   {
809      volName = fStep->GetPostStepPoint()->GetPhysicalVolume()->GetName();
810   }
811   else
812   {
813      volName = "OutOfWorld";
814   }
815   G4cout << std::setw(20) << volName << G4endl;
816   G4cout << "         Safety (mm)         : " 
817        << std::setw(20) << fStep->GetPreStepPoint()->GetSafety()
818        << std::setw(20) << fStep->GetPostStepPoint()->GetSafety() << G4endl;
819   G4cout << "         Polarization - x    : " 
820        << std::setw(20) << fStep->GetPreStepPoint()->GetPolarization().x()
821        << std::setw(20) << fStep->GetPostStepPoint()->GetPolarization().x() << G4endl;
822   G4cout << "         Polarization - y    : " 
823        << std::setw(20) << fStep->GetPreStepPoint()->GetPolarization().y()
824        << std::setw(20) << fStep->GetPostStepPoint()->GetPolarization().y() << G4endl;
825   G4cout << "         Polarization - Z    : " 
826        << std::setw(20) << fStep->GetPreStepPoint()->GetPolarization().z()
827        << std::setw(20) << fStep->GetPostStepPoint()->GetPolarization().z() << G4endl;
828   G4cout << "         Weight              : " 
829        << std::setw(20) << fStep->GetPreStepPoint()->GetWeight()
830        << std::setw(20) << fStep->GetPostStepPoint()->GetWeight() << G4endl;
831   G4cout << "         Step Status         : " ;
832        G4StepStatus  tStepStatus = fStep->GetPreStepPoint()->GetStepStatus();
833        if( tStepStatus == fGeomBoundary ){
834           G4cout << std::setw(20) << "Geom Limit";
835        } else if ( tStepStatus == fAlongStepDoItProc ){
836          G4cout << std::setw(20) << "AlongStep Proc.";
837        } else if ( tStepStatus == fPostStepDoItProc ){
838           G4cout << std::setw(20) << "PostStep Proc";
839        } else if ( tStepStatus == fAtRestDoItProc ){
840           G4cout << std::setw(20) << "AtRest Proc";
841        } else if ( tStepStatus == fUndefined ){
842           G4cout << std::setw(20) << "Undefined";
843        }
844
845        tStepStatus = fStep->GetPostStepPoint()->GetStepStatus();
846        if( tStepStatus == fGeomBoundary ){
847           G4cout << std::setw(20) << "Geom Limit";
848        } else if ( tStepStatus == fAlongStepDoItProc ){
849           G4cout << std::setw(20) << "AlongStep Proc.";
850        } else if ( tStepStatus == fPostStepDoItProc ){
851           G4cout << std::setw(20) << "PostStep Proc";
852        } else if ( tStepStatus == fAtRestDoItProc ){
853           G4cout << std::setw(20) << "AtRest Proc";
854        } else if ( tStepStatus == fUndefined ){
855           G4cout << std::setw(20) << "Undefined";
856        }
857
858        G4cout << G4endl;
859        G4cout << "         Process defined Step: " ;
860        if( fStep->GetPreStepPoint()->GetProcessDefinedStep() == 0 ){
861           G4cout << std::setw(20) << "Undefined";
862        } else {
863           G4cout << std::setw(20) << fStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
864        }
865        if( fStep->GetPostStepPoint()->GetProcessDefinedStep() == 0){
866           G4cout << std::setw(20) << "Undefined";
867        } else {
868           G4cout << std::setw(20) << fStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); 
869        }
870   G4cout.precision(oldprc);
871
872   G4cout << G4endl;
873   G4cout << "      -------------------------------------------------------" 
874        << "----------------" << G4endl;
875}
876
877
Note: See TracBrowser for help on using the repository browser.