Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
# $Id: GNUmakefile,v 2.2 1998/11/18 17:46:01 kurasige Exp $
# ----------------------------------------------------------
# GNUmakefile for tracking library. Katsuya Amako, 5/9/95.
# ----------------------------------------------------------
name := G4tracking
ifndef G4INSTALL
G4INSTALL = ../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/solids/CSG/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/digits+hits/detector/include \
-I$(G4BASE)/digits+hits/hits/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include
include $(G4INSTALL)/config/common.gmk
.PHONY: global
global: lib
+105
View File
@@ -0,0 +1,105 @@
$Id: History,v 2.5 1998/11/25 06:12:53 tsasaki Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 25, 98 T.Sasaki (tracking-00-04-03)
- Fix to G4SteppingManager.cc to set proper 2ndary numbers.
Nov 17 ,98 H.Kurashige (tracking-00-04-01)
- Fixed treatment of safety in case of ApplyCuts flag is ON
August 25, 98 G.Cosmo (tracking-00-02-01)
- Minor fix to G4SteppingManager.hh, G4SteppingVerbose.hh
and G4TrackVector.hh.
Angle brackets should be used for inclusion of RW classes!
July 1, 98 K. Amako
- Tag for tracking-00-07-02. This includes the following features.
- Because J. Apostolakis changed the way to calcluate safety in the
transportation AlongStepGPIL, the way to set safety of the PostStepPoint
was modified. Except the first step, the safety of the PreStepPoint
is also valid in this scheme.
- The coherent energy cut scheme is implemented. This means that
the energy of a secondary particle is checked against the energy
cut value and also safety. Also the 'GoodForTracking' flag is
checked. A warning message will be issued if a secondary particle
has illegal status (i.e. below energy cut and 'GoodForTracking' is off).
Because processes don't set properly the 'GoodForTracking' yet, this
waning message is temporary suppressed in the current tag.
June 22, 98 J.Apostolakis
- Added fix to implementation of new scheme of 'Safety'.
June 16, 98 P.Urban -- recorded by J. Apostolakis
- Added changes for tracking optimisation. (Merged from branch)
- tagged tracking-00-06-03.
June 11, 98 G.Cosmo (tracking-00-06-02)
- Tagged tracking-00-06-02.
Includes changes by P.Mora de Freitas and M.Asai which were missing in
the previous tag.
June 6, 98 M.Asai
- GNUmakefile is modified to correspond to the new "digits+hits" structure.
Jun 3, 98 P.Mora de Freitas/M.Verderi
- Implement new scheme of 'Safety' where it becomes the 'range within
the assumptions of all processes are valid'. In the G4SteppingManager
GetPIL loop the safety becomes "competitive" like the step limitation.
This means that at the begining of every step the G4SteppingManager
will initialize it to DBLMAX and that processes can only decrease it.
May 22, 98 T.Sasaki
- Verbose codes are separated from SteppingManager. 2 files are aded.
April 21, 98 G.Cosmo (tracking-00-05-01)
- Tagged.
April 12, 98 H.Kuraashige
- Implement new scheme of 'Particle Change'. Please see
particle_change.asc in geant4alpha/documents/particles+matter/.
G4SteppingManager.hh, .cc have been modified.
April 9, 98 G.Cosmo
- Porting on DEC-cxx 6.0.
Removed meaningless usage of "const" qualifier from functions
return type for basic types by value. Modified files: G4Trajectory.hh
March 18, 1998 K. Amako
Add following information to G4Track:
1.Momentum direction at the start point (vertex position) of the track
2.Kinetic energy at the start point (vertex position) of the track
3.Pointer to the process which created the current track
Due to this, the following files have modififed and committed.
1.NewDesignDoc.txt
2.G4Track.hh, G4Track.cc
3.G4SteppingManager.cc
January 29, 97 K. Amako
Following changes have been done and committed/tagged to cvs.
Tag# is tracking-00-03-01.
- G4SteppingManager.cc: Corrected so that the verbose
'AlongStepDoItAllDone' is invokded after the 'safety' update.
- G4SteppingManager.cc: Added a comment in the 'G4Step Information'
table of the verbose output of 'AlongStepDoIt (process by process)'
so that 'safety' value in it is not updated yet.
- G4TrackingMessanger.cc: Help for verbose has been updated.
December 19, 97 G. Cosmo - (alpha03)
- Created.
@@ -0,0 +1,531 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SteppingManager.hh,v 2.4 1998/08/26 01:55:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4SteppingManager.hh
//
// Description:
// This class represents the manager who steers to move the give
// particle from the TrackingManger by one Step.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
// modified for new ParticleChange 12 Mar. 1998 H.Kurashige
#include <rw/tvordvec.h> // Include from 'RogueWave'
class G4SteppingManager;
#ifndef G4SteppingManager_h
#define G4SteppingManager_h 1
#include "G4ios.hh" // Include from 'system'
#include <iomanip.h> // Include from 'system'
#include "globals.hh" // Include from 'global'
#include "Randomize.hh" // Include from 'global'
#include "G4Navigator.hh" // Include from 'geometry'
#include "G4LogicalVolume.hh" // Include from 'geometry'
#include "G4VPhysicalVolume.hh" // Include from 'geometry'
//#include "G4VSensitiveDetector.hh" // Include from 'hits/digi'
class G4VSensitiveDetector;
#include "G4ProcessManager.hh" // Include from 'piim'
//#include "G4DynamicParticleVector.hh" // Include from 'piim'
//#include "G4Hit.hh" // Include from 'Hit/dig'
#include "G4Track.hh" // Include from 'tracking'
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'tracking'
#include "G4UserSteppingAction.hh" // Include from 'tracking'
#include "G4Step.hh" // Include from 'tracking'
#include "G4StepPoint.hh" // Include from 'tracking'
#include "G4SteppingVerbose.hh" // Include from 'tracking'
#include "G4VTouchable.hh" // Include from 'geometry'
#include "G4TouchableHistory.hh" // Include from 'geometry'
// must be changed in elegant way
static const G4int SIZEofSelectedDoIt=100;
// RogueWave Tools.h++
typedef RWTValOrderedVector<G4int>
G4SelectedAtRestDoItVector;
typedef RWTValOrderedVector<G4int>
G4SelectedAlongStepDoItVector;
typedef RWTValOrderedVector<G4int>
G4SelectedPostStepDoItVector;
///////////////////////
class G4SteppingManager
///////////////////////
{
//--------
public:
//--------
// Constructor/Destructor
G4SteppingManager();
// SteppingManger should be dynamically persistent, therefore
// you need to invoke new() when you call this constructor.
// "Secodary track vector" will be dynamically created by this
// cosntructor. "G4UserSteppingAction" will be also constructed
// in this constructor, and "this" pointer will be passed to
// "G4UserSteppingAction".
~G4SteppingManager();
// Get/Set functions
G4TrackVector* GetSecondary() const;
void SetUserAction(G4UserSteppingAction* apAction);
G4Track* GetTrack() const;
void SetVerboseLevel(G4int vLevel);
G4Step* GetStep() const;
// Other member functions
G4StepStatus Stepping();
// Steers to move the give particle from the TrackingManger
// by one Step.
void SetInitialStep(G4Track* valueTrack);
// Sets up initial track information (enegry, position, etc) to
// the PreStepPoint of the G4Step. This funciton has to be called
// just once before the stepping loop in the "TrackingManager".
void GetProcessNumber();
// Get methods
G4double GetPhysicalStep();
G4double GetGeometricalStep();
G4double GetCorrectedStep();
G4bool GetPreStepPointIsGeom();
G4bool GetFirstStep();
G4StepStatus GetfStepStatus();
G4double GetTempInitVelocity();
G4double GetTempVelocity();
G4double GetMass();
G4double GetsumEnergyChange();
G4VParticleChange* GetfParticleChange();
G4Track* GetfTrack();
G4TrackVector* GetfSecondary();
G4Step* GetfStep();
G4StepPoint* GetfPreStepPoint();
G4StepPoint* GetfPostStepPoint();
G4VPhysicalVolume* GetfCurrentVolume();
G4VSensitiveDetector* GetfSensitive();
G4VProcess* GetfCurrentProcess();
G4ProcessVector* GetfAtRestDoItVector();
G4ProcessVector* GetfAlongStepDoItVector();
G4ProcessVector* GetfPostStepDoItVector();
G4ProcessVector* GetfAlongStepGetPhysIntVector();
G4ProcessVector* GetfPostStepGetPhysIntVector();
G4ProcessVector* GetfAtRestGetPhysIntVector();
G4double GetcurrentMinimumStep();
G4double GetnumberOfInteractionLengthLeft();
size_t GetfAtRestDoItProcTriggered();
size_t GetfAlongStepDoItProcTriggered();
size_t GetfPostStepDoItProcTriggered();
G4int GetfN2ndariesAtRestDoIt();
G4int GetfN2ndariesAlongStepDoIt();
G4int GetfN2ndariesPostStepDoIt();
G4Navigator* GetfNavigator();
G4int GetverboseLevel();
size_t GetMAXofAtRestLoops();
size_t GetMAXofAlongStepLoops();
size_t GetMAXofPostStepLoops();
G4SelectedAtRestDoItVector* GetfSelectedAtRestDoItVector();
G4SelectedAlongStepDoItVector* GetfSelectedAlongStepDoItVector();
G4SelectedPostStepDoItVector* GetfSelectedPostStepDoItVector();
G4double GetfPreviousStepSize();
G4VTouchable* GetfTouchable1();
G4VTouchable* GetfTouchable2();
G4bool GetfIsTouchable1Free();
G4bool GetfIsTouchable2Free();
G4SteppingControl GetStepControlFlag();
G4Navigator GetNavigator();
G4UserSteppingAction* GetUserAction();
G4double GetphysIntLength();
G4ForceCondition GetfCondition();
G4GPILSelection GetfGPILSelection();
//---------
private:
//---------
// Member functions
void DefinePhysicalStepLength();
// Calculate corresponding physical length from the mean free path
// left for each discrete phyiscs process. The minimum allowable
// Step for each continious process will be also calculated.
void InvokeAtRestDoItProcs();
void InvokeAlongStepDoItProcs();
void InvokePostStepDoItProcs();
void SetNavigator(G4Navigator* value);
G4double CalculateSafety();
// Return the estimated safety value at the PostStepPoint
G4VTouchable* GetFreeTouchable();
// Get Touchable which is free, i.e. not assigined to Track/StepPoint
// If no free touchable is availabe, the NULL will be returned
// Once you get a Touchable, it will be set to NotFree.
void SetAnotherTouchableFree(G4VTouchable* value);
// Set the partner of the given Touchable to be free. For example,
// the argument has fTouchable1, then fTouchable2 will be set to
// free. The state of fTouchable1 is intact.
// Member data
G4UserSteppingAction* fUserSteppingAction;
G4SteppingVerbose* fVerbose;
G4double PhysicalStep;
G4double GeometricalStep;
G4double CorrectedStep;
G4bool PreStepPointIsGeom;
G4bool FirstStep;
G4StepStatus fStepStatus;
G4double TempInitVelocity;
G4double TempVelocity;
G4double Mass;
G4double sumEnergyChange;
G4VParticleChange* fParticleChange;
G4Track* fTrack;
G4TrackVector* fSecondary;
G4Step* fStep;
G4StepPoint* fPreStepPoint;
G4StepPoint* fPostStepPoint;
G4VPhysicalVolume* fCurrentVolume;
G4VSensitiveDetector* fSensitive;
G4VProcess* fCurrentProcess;
// The pointer to the process of which DoIt or
// GetPhysicalInteractionLength has been just executed.
G4ProcessVector* fAtRestDoItVector;
G4ProcessVector* fAlongStepDoItVector;
G4ProcessVector* fPostStepDoItVector;
G4ProcessVector* fAtRestGetPhysIntVector;
G4ProcessVector* fAlongStepGetPhysIntVector;
G4ProcessVector* fPostStepGetPhysIntVector;
size_t MAXofAtRestLoops;
size_t MAXofAlongStepLoops;
size_t MAXofPostStepLoops;
G4double currentMinimumStep;
G4double numberOfInteractionLengthLeft;
size_t fAtRestDoItProcTriggered;
size_t fAlongStepDoItProcTriggered;
size_t fPostStepDoItProcTriggered;
G4int fN2ndariesAtRestDoIt;
G4int fN2ndariesAlongStepDoIt;
G4int fN2ndariesPostStepDoIt;
// These are the numbers of secondaries generated by the process
// just executed.
G4Navigator *fNavigator;
G4int verboseLevel;
G4SelectedAtRestDoItVector *fSelectedAtRestDoItVector;
G4SelectedAlongStepDoItVector *fSelectedAlongStepDoItVector;
G4SelectedPostStepDoItVector *fSelectedPostStepDoItVector;
G4double fPreviousStepSize;
G4VTouchable* fTouchable1;
G4VTouchable* fTouchable2;
G4bool fIsTouchable1Free;
G4bool fIsTouchable2Free;
G4SteppingControl StepControlFlag;
G4double proposedSafety;
// This keeps the minimum safety value proposed by AlongStepGPILs.
G4ThreeVector endpointSafOrigin;
G4double endpointSafety;
// To get the true safety value at the PostStepPoint, you have
// to subtract the distance to 'endpointSafOrigin' from this value.
G4double physIntLength;
G4ForceCondition fCondition;
G4GPILSelection fGPILSelection;
// Above three variables are for the method
// DefinePhysicalStepLength(). To pass these information to
// the method Verbose, they are kept at here. Need a more
// elegant mechanism.
};
//*******************************************************************
//
// Inline function
//
//*******************************************************************
inline G4double G4SteppingManager::GetPhysicalStep(){
return PhysicalStep;
}
inline G4double G4SteppingManager::GetGeometricalStep(){
return GeometricalStep;
}
inline G4double G4SteppingManager::GetCorrectedStep(){
return CorrectedStep;
}
inline G4bool G4SteppingManager::GetPreStepPointIsGeom(){
return PreStepPointIsGeom;
}
inline G4bool G4SteppingManager::GetFirstStep(){
return FirstStep;
}
inline G4StepStatus G4SteppingManager::GetfStepStatus(){
return fStepStatus;
}
inline G4double G4SteppingManager::GetTempInitVelocity(){
return TempInitVelocity;
}
inline G4double G4SteppingManager::GetTempVelocity(){
return TempVelocity;
}
inline G4double G4SteppingManager::GetMass(){
return Mass;
}
inline G4double G4SteppingManager::GetsumEnergyChange(){
return sumEnergyChange;
}
inline G4VParticleChange* G4SteppingManager::GetfParticleChange(){
return fParticleChange;
}
inline G4Track* G4SteppingManager::GetfTrack(){
return fTrack;
}
inline G4TrackVector* G4SteppingManager::GetfSecondary(){
return fSecondary;
}
inline G4Step* G4SteppingManager::GetfStep(){
return fStep;
}
inline G4StepPoint* G4SteppingManager::GetfPreStepPoint(){
return fPreStepPoint;
}
inline G4StepPoint* G4SteppingManager::GetfPostStepPoint(){
return fPostStepPoint;
}
inline G4VPhysicalVolume* G4SteppingManager::GetfCurrentVolume(){
return fCurrentVolume;
}
inline G4VSensitiveDetector* G4SteppingManager::GetfSensitive(){
return fSensitive;
}
inline G4VProcess* G4SteppingManager::GetfCurrentProcess(){
return fCurrentProcess;
}
inline G4ProcessVector* G4SteppingManager::GetfAtRestDoItVector(){
return fAtRestDoItVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAlongStepDoItVector(){
return fAlongStepDoItVector;
}
inline G4ProcessVector* G4SteppingManager::GetfPostStepDoItVector(){
return fPostStepDoItVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAtRestGetPhysIntVector(){
return fAtRestGetPhysIntVector;
}
inline G4ProcessVector* G4SteppingManager::GetfAlongStepGetPhysIntVector(){
return fAlongStepGetPhysIntVector;
}
inline G4ProcessVector* G4SteppingManager::GetfPostStepGetPhysIntVector(){
return fPostStepGetPhysIntVector;
}
inline size_t G4SteppingManager::GetMAXofAtRestLoops(){
return MAXofAtRestLoops;
}
inline size_t G4SteppingManager::GetMAXofAlongStepLoops(){
return MAXofAlongStepLoops;
}
inline size_t G4SteppingManager::GetMAXofPostStepLoops(){
return MAXofPostStepLoops;
}
inline G4double G4SteppingManager::GetcurrentMinimumStep(){
return currentMinimumStep;
}
inline G4double G4SteppingManager::GetnumberOfInteractionLengthLeft(){
return numberOfInteractionLengthLeft;
}
inline size_t G4SteppingManager::GetfAtRestDoItProcTriggered(){
return fAtRestDoItProcTriggered;
}
inline size_t G4SteppingManager::GetfAlongStepDoItProcTriggered(){
return fAtRestDoItProcTriggered;
}
inline size_t G4SteppingManager::GetfPostStepDoItProcTriggered(){
return fPostStepDoItProcTriggered;
}
inline G4int G4SteppingManager::GetfN2ndariesAtRestDoIt(){
return fN2ndariesAtRestDoIt;
}
inline G4int G4SteppingManager::GetfN2ndariesAlongStepDoIt(){
return fN2ndariesAlongStepDoIt;
}
inline G4int G4SteppingManager::GetfN2ndariesPostStepDoIt(){
return fN2ndariesPostStepDoIt;
}
inline G4Navigator* G4SteppingManager::GetfNavigator(){
return fNavigator;
}
inline G4int G4SteppingManager::GetverboseLevel(){
return verboseLevel;
}
inline G4SelectedAtRestDoItVector* G4SteppingManager::GetfSelectedAtRestDoItVector(){
return fSelectedAtRestDoItVector;
}
inline G4SelectedAlongStepDoItVector* G4SteppingManager::GetfSelectedAlongStepDoItVector(){
return fSelectedAlongStepDoItVector;
}
inline G4SelectedPostStepDoItVector* G4SteppingManager::GetfSelectedPostStepDoItVector(){
return fSelectedPostStepDoItVector;
}
inline G4double G4SteppingManager::GetfPreviousStepSize(){
return fPreviousStepSize;
}
inline G4VTouchable* G4SteppingManager::GetfTouchable1(){
return fTouchable1;
}
inline G4VTouchable* G4SteppingManager::GetfTouchable2(){
return fTouchable2;
}
inline G4bool G4SteppingManager::GetfIsTouchable1Free(){
return fIsTouchable1Free;
}
inline G4bool G4SteppingManager::GetfIsTouchable2Free(){
return fIsTouchable2Free;
}
inline G4SteppingControl G4SteppingManager::GetStepControlFlag(){
return StepControlFlag;
}
inline G4double G4SteppingManager::GetphysIntLength(){
return physIntLength;
}
inline G4ForceCondition G4SteppingManager::GetfCondition(){
return fCondition;
}
inline G4GPILSelection G4SteppingManager::GetfGPILSelection(){
return fGPILSelection;
}
inline G4TrackVector* G4SteppingManager::GetSecondary() const {
return fSecondary;
}
inline void G4SteppingManager::SetNavigator(G4Navigator* value){
fNavigator = value;
}
inline void G4SteppingManager::SetUserAction(G4UserSteppingAction* apAction){
if (fUserSteppingAction) delete fUserSteppingAction;
fUserSteppingAction = apAction;
}
inline G4UserSteppingAction* G4SteppingManager::GetUserAction(){
return fUserSteppingAction;
}
inline G4Track* G4SteppingManager::GetTrack() const {
return fTrack;
}
inline void G4SteppingManager::SetVerboseLevel(G4int vLevel){
verboseLevel = vLevel;
}
inline G4Step* G4SteppingManager::GetStep() const {
return fStep;
}
inline G4double G4SteppingManager::CalculateSafety(){
return max( endpointSafety -
(endpointSafOrigin - fPostStepPoint->GetPosition()).mag(),
0.);
}
inline G4VTouchable* G4SteppingManager::GetFreeTouchable(){
if(fIsTouchable1Free){
fIsTouchable1Free = false;
return fTouchable1;
}
else if(fIsTouchable2Free){
fIsTouchable2Free = false;
return fTouchable2;
}
else {
return NULL;
}
}
inline void G4SteppingManager::SetAnotherTouchableFree(G4VTouchable* value){
if(value == fTouchable1){
fIsTouchable2Free = true;
}
else if(value == fTouchable2){
fIsTouchable1Free = true;
}
}
#include "G4SteppingManager.icc"
#endif
@@ -0,0 +1,549 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SteppingManager.icc,v 2.5 1998/11/18 17:46:43 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4SteppingManager.icc
//
// Description:
// This class represents the manager who steers to move the give
// particle from the TrackingManger by one Step.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#include "G4UImanager.hh"
#include "G4ForceCondition.hh"
#include "G4GPILSelection.hh"
#include "G4SteppingControl.hh"
#include "G4TransportationManager.hh"
#include "G4UserLimits.hh"
#include "G4EnergyLossTables.hh"
/////////////////////////////////////////////////
inline void G4SteppingManager::GetProcessNumber()
/////////////////////////////////////////////////
{
G4ProcessManager* pm= fTrack->GetDefinition()->GetProcessManager();
// AtRestDoits
MAXofAtRestLoops = pm->GetAtRestProcessVector()->entries();
fAtRestDoItVector = pm->GetAtRestProcessVector(typeDoIt);
fAtRestGetPhysIntVector = pm->GetAtRestProcessVector(typeGPIL);
// AlongStepDoits
MAXofAlongStepLoops = pm->GetAlongStepProcessVector()->entries();
fAlongStepDoItVector = pm->GetAlongStepProcessVector(typeDoIt);
fAlongStepGetPhysIntVector = pm->GetAlongStepProcessVector(typeGPIL);
// PostStepDoits
MAXofPostStepLoops = pm->GetPostStepProcessVector()->entries();
fPostStepDoItVector = pm->GetPostStepProcessVector(typeDoIt);
fPostStepGetPhysIntVector = pm->GetPostStepProcessVector(typeGPIL);
}
// ************************************************************************
//
// Private Member Functions
//
// ************************************************************************
/////////////////////////////////////////////////////////
inline void G4SteppingManager::DefinePhysicalStepLength()
/////////////////////////////////////////////////////////
{
// ReSet the counter etc.
PhysicalStep = DBL_MAX; // Initialize by a huge number
physIntLength = DBL_MAX; // Initialize by a huge number
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->DPSLStarted();
#endif
// Obtain the user defined maximum allowed Step in the volume
// 1997.12.13 adds argument for GetMaxAllowedStep by K.Kurashige
G4UserLimits* ul= fCurrentVolume->GetLogicalVolume()->GetUserLimits();
if (ul) {
physIntLength = ul->GetMaxAllowedStep(*fTrack);
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->DPSLUserLimit();
#endif
}
if(physIntLength < PhysicalStep ){
PhysicalStep = physIntLength;
fStepStatus = fUserDefinedLimit;
fStep->GetPostStepPoint()
->SetProcessDefinedStep(NULL);
// Take note that the process pointer is 'NULL' if the Step
// is defined by the user defined limit.
}
// GetPhysicalInteractionLength for PostStep
fPostStepDoItProcTriggered = MAXofPostStepLoops;
for(size_t np=0; np < MAXofPostStepLoops; np++){
fCurrentProcess = (*fPostStepGetPhysIntVector)(np);
if (fCurrentProcess== NULL) {
(*fSelectedPostStepDoItVector)(np) = 0;
continue;
} // NULL means the process is inactivated by a user on fly.
physIntLength = fCurrentProcess->
PostStepGetPhysicalInteractionLength( *fTrack,
fPreviousStepSize,
&fCondition );
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->DPSLPostStep();
#endif
switch (fCondition) {
case ExclusivelyForced:
(*fSelectedPostStepDoItVector)(np) = 4;
fStepStatus = fExclusivelyForcedProc;
fStep->GetPostStepPoint()
->SetProcessDefinedStep(fCurrentProcess);
break;
case Conditionally:
(*fSelectedPostStepDoItVector)(np) = 3;
break;
case Forced:
(*fSelectedPostStepDoItVector)(np) = 2;
break;
default:
(*fSelectedPostStepDoItVector)(np) = 0;
if(physIntLength < PhysicalStep ){
PhysicalStep = physIntLength;
fStepStatus = fPostStepDoItProc;
fPostStepDoItProcTriggered = G4int(np);
fStep->GetPostStepPoint()
->SetProcessDefinedStep(fCurrentProcess);
}
}
if (fCondition==ExclusivelyForced) return; // Take note the 'return' at here !!!
}
if(fPostStepDoItProcTriggered<MAXofPostStepLoops)
(*fSelectedPostStepDoItVector)(fPostStepDoItProcTriggered) = 1;
// GetPhysicalInteractionLength for AlongStep
proposedSafety = DBL_MAX;
G4double safetyProposedToAndByProcess = proposedSafety;
for(size_t kp=0; kp < MAXofAlongStepLoops; kp++){
fCurrentProcess = (*fAlongStepGetPhysIntVector)(kp);
if (fCurrentProcess== NULL) continue;
// NULL means the process is inactivated by a user on fly.
physIntLength = fCurrentProcess->
AlongStepGetPhysicalInteractionLength( *fTrack,
fPreviousStepSize,
PhysicalStep,
safetyProposedToAndByProcess,
&fGPILSelection );
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->DPSLAlongStep();
#endif
if(physIntLength < PhysicalStep){
PhysicalStep = physIntLength;
// Check if the process wants to be the GPIL winner. For example,
// multi-scattering proposes Step limit, but won't be the winner.
if(fGPILSelection==CandidateForSelection){
fStepStatus = fAlongStepDoItProc;
fStep->GetPostStepPoint()
->SetProcessDefinedStep(fCurrentProcess);
}
// Transportation is assumed to be the last process in the vector
if(kp == MAXofAlongStepLoops-1) fStepStatus = fGeomBoundary;
}
// Make sure to check the safety, even if Step is not limited
// by this process. J. Apostolakis, June 20, 1998
//
if (safetyProposedToAndByProcess < proposedSafety)
// proposedSafety keeps the smallest value:
proposedSafety = safetyProposedToAndByProcess;
else
// safetyProposedToAndByProcess always proposes a valid safety:
safetyProposedToAndByProcess = proposedSafety;
}
} // void G4SteppingManager::DefinePhysicalStepLength() //
//////////////////////////////////////////////////////
inline void G4SteppingManager::InvokeAtRestDoItProcs()
//////////////////////////////////////////////////////
{
// Select the rest process which has the shortest time before
// it is invoked. In rest processes, GetPhysicalInteractionLength()
// returns the time before a process occurs.
G4double lifeTime, shortestLifeTime;
fN2ndariesAtRestDoIt = 0;
shortestLifeTime = DBL_MAX;
for( size_t ri=0 ; ri < MAXofAtRestLoops ; ri++ ){
fCurrentProcess = (*fAtRestGetPhysIntVector)(ri);
if (fCurrentProcess== NULL) {
(*fSelectedAtRestDoItVector)(ri) = 0;
continue;
} // NULL means the process is inactivated by a user on fly.
lifeTime =
fCurrentProcess->AtRestGetPhysicalInteractionLength(
*fTrack,
&fCondition );
if(fCondition==Forced){
(*fSelectedAtRestDoItVector)(ri) = 2;
}
else{
(*fSelectedAtRestDoItVector)(ri) = 0;
if(lifeTime < shortestLifeTime ){
shortestLifeTime = lifeTime;
fAtRestDoItProcTriggered = G4int(int(ri));
}
}
}
(*fSelectedAtRestDoItVector)(fAtRestDoItProcTriggered) = 1;
fStep->SetStepLength( 0. ); //the particle has stopped
fTrack->SetStepLength( 0. );
// invoke selected process
for(size_t np=0; np < MAXofAtRestLoops; np++){
//
// Note: DoItVector has inverse order against GetPhysIntVector
// and SelectedAtRestDoItVector.
//
if((*fSelectedAtRestDoItVector)(MAXofAtRestLoops-np-1) != 0){
fCurrentProcess = (*fAtRestDoItVector)(np);
fParticleChange
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
// Set the current process as a process which defined this Step length
fStep->GetPostStepPoint()
->SetProcessDefinedStep(fCurrentProcess);
// Update Step
fParticleChange->UpdateStepForAtRest(fStep);
// Now Store the secondaries from ParticleChange to SecondaryList
G4Track* tempSecondaryTrack;
G4bool tApplyCutFlag;
G4double tProdThreshold;
G4Material* tMaterial;
G4double tBelowCutEnergyAndSafety;
fN2ndariesAtRestDoIt = fParticleChange->GetNumberOfSecondaries();
for(G4int DSecLoop=0 ; DSecLoop< fN2ndariesAtRestDoIt; DSecLoop++){
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
tApplyCutFlag = tempSecondaryTrack->GetDefinition()
->GetApplyCutsFlag();
// Check if the particle should be passed without coherent cut
if(tApplyCutFlag){
tBelowCutEnergyAndSafety = false;
tMaterial = fPostStepPoint->GetMaterial();
tProdThreshold = tempSecondaryTrack->GetDefinition()
-> GetEnergyThreshold(tMaterial);
if( tempSecondaryTrack->GetKineticEnergy()<tProdThreshold ){
G4double currentRange
= G4EnergyLossTables::GetRange(
tempSecondaryTrack->GetDefinition(),
tempSecondaryTrack->GetKineticEnergy(),
tMaterial
);
if (currentRange < CalculateSafety() ){
tBelowCutEnergyAndSafety = true;
}
}
if( tBelowCutEnergyAndSafety ){
if( !(tempSecondaryTrack->IsGoodForTracking()) ){
//// G4cout << "!! Warning - G4SteppingManager:" << endl;
//// << " This physics process generated a secondary"
//// << " of which energy is below cut but"
//// << " GoodForTracking is off !!!!!" << endl;
// Add kinetic energy to the total energy deposit
fStep->AddTotalEnergyDeposit(
tempSecondaryTrack->GetKineticEnergy() );
tempSecondaryTrack->SetKineticEnergy(0.0);
}
}
}
// If this 2ndry particle has 'zero' kinetic energy, make sure
// it invokes a rest process at the beginning of the tracking
if(tempSecondaryTrack->GetKineticEnergy() <= 0.){
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
}
// Set parentID
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
// Set the process pointer which created this track
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
fSecondary->insert( tempSecondaryTrack );
}
// clear ParticleChange
fParticleChange->Clear();
} //if(fSelectedAtRestDoItVector(np) != 0){
} //for(size_t np=0; np < MAXofAtRestLoops; np++){
fStep->UpdateTrack();
fTrack->SetTrackStatus( fStopAndKill );
}
/////////////////////////////////////////////////////////
inline void G4SteppingManager::InvokeAlongStepDoItProcs()
/////////////////////////////////////////////////////////
{
// If the current Step is defined by a 'ExclusivelyForced'
// PostStepDoIt, then don't invoke any AlongStepDoIt
if(fStepStatus == fExclusivelyForcedProc){
return; // Take note 'return' at here !!!
}
// Invoke the all active continuous processes
fN2ndariesAlongStepDoIt = 0;
for( size_t ci=0 ; ci<MAXofAlongStepLoops ; ci++ ){
fCurrentProcess = (*fAlongStepDoItVector)(ci);
if (fCurrentProcess== NULL) continue;
// NULL means the process is inactivated by a user on fly.
fParticleChange
= fCurrentProcess->AlongStepDoIt( *fTrack, *fStep );
// Update the PostStepPoint of Step according to ParticleChange
fParticleChange->UpdateStepForAlongStep(fStep);
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->AlongStepDoItOneByOne();
#endif
// Now Store the secondaries from ParticleChange to SecondaryList
G4Track* tempSecondaryTrack;
G4bool tApplyCutFlag;
G4double tProdThreshold;
G4Material* tMaterial;
G4double tBelowCutEnergyAndSafety;
fN2ndariesAlongStepDoIt = fParticleChange->GetNumberOfSecondaries();
for(G4int DSecLoop=0 ; DSecLoop< fN2ndariesAlongStepDoIt; DSecLoop++){
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
tApplyCutFlag = tempSecondaryTrack->GetDefinition()
->GetApplyCutsFlag();
// Check if the particle should be passed without coherent cut
if(tApplyCutFlag){
tBelowCutEnergyAndSafety = false;
tMaterial = fPostStepPoint->GetMaterial();
tProdThreshold = tempSecondaryTrack->GetDefinition()
-> GetEnergyThreshold(tMaterial);
if( tempSecondaryTrack->GetKineticEnergy()<tProdThreshold ){
G4double currentRange
= G4EnergyLossTables::GetRange(
tempSecondaryTrack->GetDefinition(),
tempSecondaryTrack->GetKineticEnergy(),
tMaterial
);
if (currentRange < CalculateSafety() ){
tBelowCutEnergyAndSafety = true;
}
}
if( tBelowCutEnergyAndSafety ){
if( !(tempSecondaryTrack->IsGoodForTracking()) ){
//// G4cout << "!! Warning - G4SteppingManager:" << endl;
//// << " This physics process generated a secondary"
//// << " of which energy is below cut but"
//// << " GoodForTracking is off !!!!!" << endl;
// Add kinetic energy to the total energy deposit
fStep->AddTotalEnergyDeposit(
tempSecondaryTrack->GetKineticEnergy() );
tempSecondaryTrack->SetKineticEnergy(0.0);
}
}
}
// If this 2ndry particle has 'zero' kinetic energy, make sure
// it invokes a rest process at the beginning of the tracking
if(tempSecondaryTrack->GetKineticEnergy() <= 0.){
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
}
// Set parentID
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
// Set the process pointer which created this track
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
fSecondary->insert( tempSecondaryTrack );
}
// Set the track status according to what the process defined
fTrack->SetTrackStatus( fParticleChange->GetStatusChange() );
// clear ParticleChange
fParticleChange->Clear();
}
}
////////////////////////////////////////////////////////
inline void G4SteppingManager::InvokePostStepDoItProcs()
////////////////////////////////////////////////////////
{
// Invoke the specified discrete processes
fN2ndariesPostStepDoIt = 0;
for(size_t np=0; np < MAXofPostStepLoops; np++){
//
// Note: DoItVector has inverse order against GetPhysIntVector
// and SelectedPostStepDoItVector.
//
size_t npGPIL = MAXofPostStepLoops-np-1;
G4int tmp= (*fSelectedPostStepDoItVector)(npGPIL);
if(tmp != 0){
if ( ((tmp == 1) && (fStepStatus == fPostStepDoItProc)) ||
((tmp == 2) && (fStepStatus != fExclusivelyForcedProc)) ||
((tmp == 3) && (fStepStatus == fAlongStepDoItProc)) ||
((tmp == 4) && (fStepStatus == fExclusivelyForcedProc)) ) {
fCurrentProcess = (*fPostStepDoItVector)(np);
fParticleChange
= fCurrentProcess->PostStepDoIt( *fTrack, *fStep);
// Update PostStepPoint of Step according to ParticleChange
fParticleChange->UpdateStepForPostStep(fStep);
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->PostStepDoItOneByOne();
#endif
// Update G4Track according to ParticleChange after each PostStepDoIt
fStep->UpdateTrack();
// Update safety after each invocation of PostStepDoIts
fStep->GetPostStepPoint()->SetSafety( CalculateSafety() );
// Now Store the secondaries from ParticleChange to SecondaryList
G4Track* tempSecondaryTrack;
G4bool tApplyCutFlag;
G4double tProdThreshold;
G4Material* tMaterial;
G4double tBelowCutEnergyAndSafety;
fN2ndariesPostStepDoIt = fParticleChange->GetNumberOfSecondaries();
for(G4int DSecLoop=0 ; DSecLoop< fN2ndariesPostStepDoIt; DSecLoop++){
tempSecondaryTrack = fParticleChange->GetSecondary(DSecLoop);
tApplyCutFlag = tempSecondaryTrack->GetDefinition()
->GetApplyCutsFlag();
// Check if the particle should be passed without coherent cut
if(tApplyCutFlag){
tBelowCutEnergyAndSafety = false;
tMaterial = fPostStepPoint->GetMaterial();
tProdThreshold = tempSecondaryTrack->GetDefinition()
-> GetEnergyThreshold(tMaterial);
if( tempSecondaryTrack->GetKineticEnergy()<tProdThreshold ){
G4double currentRange
= G4EnergyLossTables::GetRange(
tempSecondaryTrack->GetDefinition(),
tempSecondaryTrack->GetKineticEnergy(),
tMaterial
);
if (currentRange < CalculateSafety() ){
tBelowCutEnergyAndSafety = true;
}
}
if( tBelowCutEnergyAndSafety ){
if( !(tempSecondaryTrack->IsGoodForTracking()) ){
//// G4cout << "!! Warning - G4SteppingManager:" << endl;
//// << " This physics process generated a secondary"
//// << " of which energy is below cut but"
//// << " GoodForTracking is off !!!!!" << endl;
// Add kinetic energy to the total energy deposit
fStep->AddTotalEnergyDeposit(
tempSecondaryTrack->GetKineticEnergy() );
tempSecondaryTrack->SetKineticEnergy(0.0);
}
}
}
// If this 2ndry particle has 'zero' kinetic energy, make sure
// it invokes a rest process at the beginning of the tracking
if(tempSecondaryTrack->GetKineticEnergy() <= 0.){
tempSecondaryTrack->SetTrackStatus( fStopButAlive );
}
// Set parentID
tempSecondaryTrack->SetParentID( fTrack->GetTrackID() );
// Set the process pointer which created this track
tempSecondaryTrack->SetCreatorProcess( fCurrentProcess );
fSecondary->insert( tempSecondaryTrack );
}
// Set the track status according to what the process defined
fTrack->SetTrackStatus( fParticleChange->GetStatusChange() );
// clear ParticleChange
fParticleChange->Clear();
}
} //if(*fSelectedPostStepDoItVector(np) != 0){
// Exit from PostStepLoop if the track has been killed
if(fTrack->GetTrackStatus() == fStopAndKill) break;
} //for(size_t np=0; np < MAXofPostStepLoops; np++){
}
@@ -0,0 +1,175 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SteppingVerbose.hh,v 2.2 1998/08/26 02:36:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4SteppingVerbose.hh
//
// Description:
// This class manages the vervose outputs in G4SteppingManager.
//
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
class G4SteppingVerbose;
#ifndef G4SteppingVerose_h
#define G4SteppingVerose_h 1
#include <rw/tvordvec.h> // Include from 'RogueWave'
#include "G4ios.hh"
#include <iomanip.h>
#include "globals.hh" // Include from 'global'
#include "G4Navigator.hh" // Include from 'geometry'
#include "G4LogicalVolume.hh" // Include from 'geometry'
#include "G4VPhysicalVolume.hh" // Include from 'geometry'
#include "G4VSensitiveDetector.hh" // Include from 'hits/digi'
#include "G4ProcessManager.hh" // Include from 'piim'
class G4SteppingManager; // Include from 'tracking'
#include "G4Track.hh" // Include from 'tracking'
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'tracking'
#include "G4UserSteppingAction.hh" // Include from 'tracking'
#include "G4Step.hh" // Include from 'tracking'
#include "G4StepPoint.hh" // Include from 'tracking'
#include "G4VTouchable.hh" // Include from 'geometry'
#include "G4TouchableHistory.hh" // Include from 'geometry'
class G4SteppingVerbose{
public:
// Constructor/Destructor
G4SteppingVerbose();
G4SteppingVerbose(G4SteppingManager*);
~G4SteppingVerbose();
//
void NewStep();
void CopyState();
void AtRestDoItInvoked();
void AlongStepDoItAllDone();
void PostStepDoItAllDone();
void AlongStepDoItOneByOne();
void PostStepDoItOneByOne();
void StepInfo();
void TrackingStarted();
void DPSLStarted();
void DPSLUserLimit();
void DPSLPostStep();
void DPSLAlongStep();
void DPSLAlongStepDoItOneByOne();
void DPSLPostStepDoItOneByOne();
void VerboseTrack();
void VerboseParticleChange();
//
// Member data
private:
G4SteppingManager* fManager;
G4UserSteppingAction* fUserSteppingAction;
G4SteppingVerbose* fVerbose;
G4double PhysicalStep;
G4double GeometricalStep;
G4double CorrectedStep;
G4bool PreStepPointIsGeom;
G4bool FirstStep;
G4StepStatus fStepStatus;
G4double TempInitVelocity;
G4double TempVelocity;
G4double Mass;
G4double sumEnergyChange;
G4VParticleChange* fParticleChange;
G4Track* fTrack;
G4TrackVector* fSecondary;
G4Step* fStep;
G4StepPoint* fPreStepPoint;
G4StepPoint* fPostStepPoint;
G4VPhysicalVolume* fCurrentVolume;
G4VSensitiveDetector* fSensitive;
G4VProcess* fCurrentProcess;
// The pointer to the process of which DoIt or
// GetPhysicalInteractionLength has been just executed.
G4ProcessVector* fAtRestDoItVector;
G4ProcessVector* fAlongStepDoItVector;
G4ProcessVector* fPostStepDoItVector;
G4ProcessVector* fAtRestGetPhysIntVector;
G4ProcessVector* fAlongStepGetPhysIntVector;
G4ProcessVector* fPostStepGetPhysIntVector;
size_t MAXofAtRestLoops;
size_t MAXofAlongStepLoops;
size_t MAXofPostStepLoops;
G4double currentMinimumStep;
G4double numberOfInteractionLengthLeft;
size_t fAtRestDoItProcTriggered;
size_t fAlongStepDoItProcTriggered;
size_t fPostStepDoItProcTriggered;
G4int fN2ndariesAtRestDoIt;
G4int fN2ndariesAlongStepDoIt;
G4int fN2ndariesPostStepDoIt;
// These are the numbers of secondaries generated by the process
// just executed.
G4Navigator *fNavigator;
G4int verboseLevel;
typedef RWTValOrderedVector<G4int>
G4SelectedAtRestDoItVector;
typedef RWTValOrderedVector<G4int>
G4SelectedAlongStepDoItVector;
typedef RWTValOrderedVector<G4int>
G4SelectedPostStepDoItVector;
G4SelectedAtRestDoItVector *fSelectedAtRestDoItVector;
G4SelectedAlongStepDoItVector *fSelectedAlongStepDoItVector;
G4SelectedPostStepDoItVector *fSelectedPostStepDoItVector;
G4double fPreviousStepSize;
G4VTouchable* fTouchable1;
G4VTouchable* fTouchable2;
G4bool fIsTouchable1Free;
G4bool fIsTouchable2Free;
G4SteppingControl StepControlFlag;
G4double physIntLength;
G4ForceCondition fCondition;
G4GPILSelection fGPILSelection;
// Above three variables are for the method
// DefinePhysicalStepLength(). To pass these information to
// the method Verbose, they are kept at here. Need a more
// elegant mechanism.
};
#endif
+39
View File
@@ -0,0 +1,39 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TrackVector.hh,v 2.2 1998/08/26 01:55:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4TrackVector.hh
//
// Description:
// This class keeps a List of G4Track objects. It is implemented
// as a RougeWave pointer ordered vector.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4TrackVector_h
#define G4TrackVector_h 1
#include <rw/tpordvec.h> // Include from 'RogueWave'
#include "G4Track.hh" // Include form 'tracking'
///////////////////////////////////////////////////
typedef RWTPtrOrderedVector<G4Track> G4TrackVector;
///////////////////////////////////////////////////
#endif
@@ -0,0 +1,178 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TrackingManager.hh,v 2.1 1998/07/12 03:09:00 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4TrackingManager.hh
//
// Description:
// This class represents the manager who steers the tracking
// of a particle given from the event manager.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
class G4TrackingManager;
#ifndef G4TrackingManager_h
#define G4TrackingManager_h 1
#include "globals.hh" // Include from 'global'
/////#include "G4Hit.hh" // Include from 'Hit/dig'
#include "G4SteppingManager.hh" // Include from 'tracking'
#include "G4Track.hh" // Include from 'tracking'
#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4TrackStatus.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'tracking'
#include "G4UserTrackingAction.hh" // Include from 'tracking'
#include "G4UserSteppingAction.hh" // Include from 'tracking'
#include "G4Trajectory.hh" // Include from 'tracking'
////////////////////////
class G4TrackingManager
////////////////////////
{
//--------
public:
//--------
// Constructor/Destructor
G4TrackingManager();
// TrackingManger should be dynamic persistent, therefore you
// need to invoke new() when you call this constructor.
// "G4SteppingManger' and "G4UserTrackingAction" will be
// constructed in this constructor. "This" pointer will be
// passed to "G4UserTrackingAction".
~G4TrackingManager();
// Get/Set functions
G4Track* GetTrack() const;
G4bool GetStoreTrajectory() const;
void SetStoreTrajectory(G4bool value);
G4SteppingManager* GetSteppingManager() const;
G4UserTrackingAction* GetUserTrackingAction() const;
G4Trajectory* GimmeTrajectory() const;
G4TrackVector* GimmeSecondaries() const;
void SetNavigator(G4Navigator* apValue);
void SetUserAction(G4UserTrackingAction* apAction);
void SetUserAction(G4UserSteppingAction* apAction);
void SetVerboseLevel(G4int vLevel);
G4int GetVerboseLevel() const;
// Other member functions
void ProcessOneTrack(G4Track* apValueG4Track);
// Invoking this function, a G4Track given by the argument
// will be tracked.
void EventAborted();
// Invoking this function, the current tracking will be
// aborted immediately. The tracking will return the
// G4TrackStatus in 'fUserKillTrackAndSecondaries'.
// By this the EventManager deletes the current track and all
// its accoicated csecondaries.
//---------
private:
//---------
// Member functions
void Verbose(G4String select);
// Output messages according to the current value of the
// Verbose level.
// Member data
G4Track* fpTrack;
G4SteppingManager* fpSteppingManager;
G4UserTrackingAction* fpUserTrackingAction;
G4Trajectory* fpTrajectory;
G4bool StoreTrajectory;
G4int verboseLevel;
};
//*******************************************************************
//
// Inline function
//
//*******************************************************************
inline G4Track* G4TrackingManager::GetTrack() const {
return fpTrack;
}
inline G4bool G4TrackingManager::GetStoreTrajectory() const {
return StoreTrajectory;
}
inline void G4TrackingManager::SetStoreTrajectory(G4bool value){
StoreTrajectory = value;
}
inline G4SteppingManager* G4TrackingManager::GetSteppingManager() const {
return fpSteppingManager;
}
inline G4UserTrackingAction* G4TrackingManager::GetUserTrackingAction() const {
return fpUserTrackingAction;
}
inline G4Trajectory* G4TrackingManager::GimmeTrajectory() const {
return fpTrajectory ;
}
inline G4TrackVector* G4TrackingManager::GimmeSecondaries() const {
return fpSteppingManager->GetSecondary();
}
inline void G4TrackingManager::SetUserAction(G4UserTrackingAction* apAction){
if (fpUserTrackingAction) delete fpUserTrackingAction;
fpUserTrackingAction = apAction;
apAction->SetTrackingManagerPointer(this);
}
inline void G4TrackingManager::SetUserAction(G4UserSteppingAction* apAction){
fpSteppingManager->SetUserAction(apAction);
apAction->SetSteppingManagerPointer(fpSteppingManager);
}
inline void G4TrackingManager::SetVerboseLevel(G4int vLevel){
verboseLevel = vLevel;
fpSteppingManager -> SetVerboseLevel( vLevel );
}
inline G4int G4TrackingManager::GetVerboseLevel() const {
return verboseLevel;
}
#endif
@@ -0,0 +1,69 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TrackingMessenger.hh,v 2.3 1998/07/12 03:55:58 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4TrackingMessenger.hh
//
// Description:
// This is a messenger class to interface to exchange information
// between tracking/stepping and UI.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Makoto Asai (e-mail: asai@kekvax.kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#ifndef G4TrackingMessenger_h
#define G4TrackingMessenger_h 1
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class G4TrackingManager;
class G4SteppingManager;
#include "G4UImessenger.hh"
///////////////////////////////////////////////
class G4TrackingMessenger: public G4UImessenger
///////////////////////////////////////////////
{
//--------
public:
//--------
G4TrackingMessenger(G4TrackingManager* trMan);
~G4TrackingMessenger();
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
//---------
private:
//---------
G4TrackingManager* trackingManager;
G4SteppingManager* steppingManager;
// commands
G4UIdirectory * TrackingDirectory;
G4UIcmdWithoutParameter * AbortCmd;
G4UIcmdWithoutParameter * ResumeCmd;
G4UIcmdWithAnInteger * StoreTrajectoryCmd;
G4UIcmdWithAnInteger * VerboseCmd;
};
#endif
+110
View File
@@ -0,0 +1,110 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Trajectory.hh,v 2.2 1998/07/13 17:28:53 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4Trajectory.hh
//
// Description:
// This class represents the trajectory of a particle tracked.
// It includes information of
// 1) List of trajectory points which compose the trajectory,
// 2) static information of particle which generated the
// trajectory,
// 3) trackID and parent particle ID of the trajectory,
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Makoto Asai (e-mail: asai@kekvax.kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
class G4Trajectory;
#ifndef G4Trajectory_h
#define G4Trajectory_h 1
#include <stdlib.h> // Include from 'system'
#include "G4ios.hh" // Include from 'system'
#include <rw/tvordvec.h> // RWTValOrderedVector
#include "globals.hh" // Include from 'global'
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
#include "G4TrajectoryPoint.hh" // Include from 'tracking'
#include "G4Track.hh"
#include "G4Step.hh"
class G4Polyline; // Forward declaration.
///////////////////
class G4Trajectory
///////////////////
{
//--------
public:
//--------
// Constructor/Destrcutor
G4Trajectory(G4Track* aTrack);
G4Trajectory(G4Trajectory &);
~G4Trajectory();
// Operators
inline int operator == (const G4Trajectory& right){return (this==&right);};
// Get/Set functions
inline G4int GetTrackID() const
{ return fTrackID; }
inline G4int GetParentID() const
{ return fParentID; }
inline G4String GetParticleName() const
{ return ParticleName; }
inline G4double GetCharge() const
{ return PDGCharge; }
inline G4int GetPDGEncoding() const
{ return PDGEncoding; }
// Other member functions
void ShowTrajectory();
// Print all information of the trajectory to stdout
void DrawTrajectory(G4int i_mode=0);
void AppendStep(G4Step* aStep);
G4ParticleDefinition* GetParticleDefinition();
//---------
private:
//---------
RWTValOrderedVector<G4TrajectoryPoint> positionRecord;
G4int fTrackID;
G4int fParentID;
G4String ParticleName;
G4double PDGCharge;
G4int PDGEncoding;
};
#endif
@@ -0,0 +1,93 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TrajectoryPoint.hh,v 2.1 1998/07/12 03:09:01 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4TrajectoryPoint.hh
//
// Description:
// This class represents the trajectory of a particle tracked.
// It includes information of
// 1) List of trajectory points which compose the trajectory,
// 2) static information of particle which generated the
// trajectory,
// 3) trackID and parent particle ID of the trajectory,
// 4) termination condition of the trajectory.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
class G4TrajectoryPoint;
#ifndef G4TrajectoryPoint_h
#define G4TrajectoryPoint_h 1
#include "globals.hh" // Include from 'global'
#include "G4ThreeVector.hh" // Include from 'geometry'
#include "G4Allocator.hh" // Include from 'particle+matter'
////////////////////////
class G4TrajectoryPoint
////////////////////////
{
//--------
public:
//--------
// Constructor/Destructor
G4TrajectoryPoint();
G4TrajectoryPoint(G4ThreeVector pos);
G4TrajectoryPoint(const G4TrajectoryPoint &right);
~G4TrajectoryPoint();
// Operators
inline void *operator new(size_t);
inline void operator delete(void *aTrajectoryPoint);
inline int operator==(const G4TrajectoryPoint& right) const
{ return (this==&right); };
// Get/Set functions
inline const G4ThreeVector GetPosition() const
{ return fPosition; };
//---------
private:
//---------
// Member data
G4ThreeVector fPosition;
};
extern G4Allocator<G4TrajectoryPoint> aTrajectoryPointAllocator;
inline void* G4TrajectoryPoint::operator new(size_t)
{
void *aTrajectoryPoint;
aTrajectoryPoint = (void *) aTrajectoryPointAllocator.MallocSingle();
return aTrajectoryPoint;
}
inline void G4TrajectoryPoint::operator delete(void *aTrajectoryPoint)
{
aTrajectoryPointAllocator.FreeSingle((G4TrajectoryPoint *) aTrajectoryPoint);
}
#endif
@@ -0,0 +1,76 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserSteppingAction.hh,v 2.0 1998/07/02 17:29:16 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4UserSteppingAction.hh
//
// Description:
// This class represents actions taken place by the user at each
// end of stepping.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
class G4UserSteppingAction;
#ifndef G4UserSteppingAction_h
#define G4UserSteppingAction_h 1
#include "globals.hh" // Include from 'global'
#include "G4Track.hh" // Include from 'tracking'
class G4SteppingManager; // Forward declaration
///////////////////////////
class G4UserSteppingAction
///////////////////////////
{
//--------
public:
//--------
// Constructor and destructors
G4UserSteppingAction(){}
virtual ~G4UserSteppingAction(){}
// Member functions
void SetSteppingManagerPointer(G4SteppingManager* pValue);
virtual void UserSteppingAction(){}
//-----------
protected:
//-----------
// Member functions
inline const G4SteppingManager* GetSteppingManager() {
return fpSteppingManager;
}
inline G4SteppingManager* GetOmnipotentSteppingManager() {
return fpSteppingManager;
}
//---------
private:
//---------
// Member data
G4SteppingManager* fpSteppingManager;
};
#endif
@@ -0,0 +1,75 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserTrackingAction.hh,v 2.0 1998/07/02 17:29:18 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4UserTrackingAction.hh
//
// Description:
// This class represents actions taken place by the user at each
// end of stepping.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
class G4UserTrackingAction;
#ifndef G4UserTrackingAction_h
#define G4UserTrackingAction_h 1
class G4TrackingManager; // Forward declaration
///////////////////////////
class G4UserTrackingAction
///////////////////////////
{
//--------
public:
//--------
// Constructor & Destructor
G4UserTrackingAction(){};
virtual ~G4UserTrackingAction(){}
// Member functions
void SetTrackingManagerPointer(G4TrackingManager* pValue);
virtual void PreUserTrackingAction(){}
virtual void PostUserTrackingAction(){}
//-----------
protected:
//-----------
// Member functions
inline const G4TrackingManager* GetTrackingManager() {
return fpTrackingManager;
}
inline G4TrackingManager* GetOmnipotentTrackingManager() {
return fpTrackingManager;
}
//---------
private:
//---------
// Member data
G4TrackingManager* fpTrackingManager;
};
#endif
+2
View File
@@ -0,0 +1,2 @@
*.d
TAGS
+273
View File
@@ -0,0 +1,273 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SteppingManager.cc,v 2.4 1998/11/25 05:50:44 tsasaki Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4SteppingManager.cc
//
// Description:
// This class represents the manager who steers to move the give
// particle from the TrackingManger by one Step.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#include "G4SteppingManager.hh"
#include "G4UImanager.hh"
#include "G4ForceCondition.hh"
#include "G4GPILSelection.hh"
#include "G4SteppingControl.hh"
#include "G4TransportationManager.hh"
#include "G4UserLimits.hh"
//////////////////////////////////////
G4SteppingManager::G4SteppingManager()
//////////////////////////////////////
: verboseLevel(0), fUserSteppingAction(NULL)
{
// Construct simple 'has-a' related objects
fSecondary = new G4TrackVector();
fStep = new G4Step();
fPreStepPoint = fStep->GetPreStepPoint();
fPostStepPoint = fStep->GetPostStepPoint();
#ifdef G4VERBOSE
fVerbose = new G4SteppingVerbose(this);
#endif
fSelectedAtRestDoItVector
= new G4SelectedAtRestDoItVector(SIZEofSelectedDoIt);
fSelectedAlongStepDoItVector
= new G4SelectedAlongStepDoItVector(SIZEofSelectedDoIt);
fSelectedPostStepDoItVector
= new G4SelectedPostStepDoItVector(SIZEofSelectedDoIt);
SetNavigator(G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking());
fTouchable1 = new G4TouchableHistory();
fTouchable2 = new G4TouchableHistory();
}
///////////////////////////////////////
G4SteppingManager::~G4SteppingManager()
///////////////////////////////////////
{
// Destruct simple 'has-a' objects
delete fSecondary;
delete fStep;
delete fSelectedAtRestDoItVector;
delete fSelectedAlongStepDoItVector;
delete fSelectedPostStepDoItVector;
delete fTouchable1;
delete fTouchable2;
if (fUserSteppingAction) delete fUserSteppingAction;
#ifdef G4VERBOSE
delete fVerbose;
#endif
}
//////////////////////////////////////////
G4StepStatus G4SteppingManager::Stepping()
//////////////////////////////////////////
{
//--------
// Prelude
//--------
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->NewStep();
#endif
// Store last PostStepPoint to PreStepPoint, and swap current and nex
// volume information of G4Track. Reset total energy deposit in one Step.
fStep->CopyPostToPreStepPoint();
fStep->ResetTotalEnergyDeposit();
// Switch next touchable in track to current one
fTrack->SetTouchable(fTrack->GetNextTouchable());
// Free the touchable which is not used
SetAnotherTouchableFree(fPostStepPoint->GetTouchable());
// Reset the secondary particles
fN2ndariesAtRestDoIt = 0;
fN2ndariesAlongStepDoIt = 0;
fN2ndariesPostStepDoIt = 0;
//-----------------
// AtRest Processes
//-----------------
if( fTrack->GetTrackStatus() == fStopButAlive ){
if( MAXofAtRestLoops>0 ){
InvokeAtRestDoItProcs();
fStepStatus = fAtRestDoItProc;
fStep->GetPostStepPoint()->SetStepStatus( fStepStatus );
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->AtRestDoItInvoked();
#endif
}
// Make sure the track is killed
fTrack->SetTrackStatus( fStopAndKill );
}
//---------------------------------
// AlongStep and PostStep Processes
//---------------------------------
else{
// Find minimum Step length demanded by active disc./cont. processes
DefinePhysicalStepLength();
// Store the Step length (geometrical length) to G4Step and G4Track
fStep->SetStepLength( PhysicalStep );
fTrack->SetStepLength( PhysicalStep );
// Store StepStatus to PostStepPoint
fStep->GetPostStepPoint()->SetStepStatus( fStepStatus );
// Invoke AlongStepDoIt
InvokeAlongStepDoItProcs();
// Update track by taking into account all changes by AlongStepDoIt
fStep->UpdateTrack();
// Update safety after invocation of all AlongStepDoIts
endpointSafOrigin= fPostStepPoint->GetPosition();
endpointSafety= max( proposedSafety -
(fPostStepPoint->GetPosition() -
fPreStepPoint->GetPosition()
).mag(),
0.);
fStep->GetPostStepPoint()->SetSafety( endpointSafety );
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->AlongStepDoItAllDone();
#endif
// Invoke PostStepDoIt
InvokePostStepDoItProcs();
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->PostStepDoItAllDone();
#endif
}
//-------
// Finale
//-------
// Update 'TrackLength' and remeber the Step length of the current Step
fTrack->AddTrackLength(fStep->GetStepLength());
fPreviousStepSize = fStep->GetStepLength();
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->StepInfo();
#endif
// Send G4Step information to Hit/Dig if the volume is sensitive
fCurrentVolume = fStep->GetPreStepPoint()->GetPhysicalVolume();
StepControlFlag = fStep->GetControlFlag();
if( fCurrentVolume != 0 && StepControlFlag != AvoidHitInvocation) {
fSensitive = fCurrentVolume->GetLogicalVolume()->
GetSensitiveDetector();
if( fSensitive != 0 ) {
fSensitive->Hit(fStep);
}
}
// User intervention process.
fStep->SetTrack(fTrack);
if( fUserSteppingAction != NULL ) {
fUserSteppingAction->UserSteppingAction();
}
// Stepping process finish. Return the value of the StepStatus.
return fStepStatus;
}
///////////////////////////////////////////////////////////
void G4SteppingManager::SetInitialStep(G4Track* valueTrack)
///////////////////////////////////////////////////////////
{
// Set up several local variables.
PreStepPointIsGeom = false;
FirstStep = true;
fParticleChange = NULL;
fPreviousStepSize = 0.;
fStepStatus = fUndefined;
fTrack = valueTrack;
Mass = fTrack->GetDynamicParticle()->GetMass();
fIsTouchable1Free = TRUE;
fIsTouchable2Free = TRUE;
// If the primary track has 'Suspend' or 'PostponeToNextEvent' state,
// set the track state to 'Alive'.
if( (fTrack->GetTrackStatus()==fSuspend) ||
(fTrack->GetTrackStatus()==fPostponeToNextEvent) ){
fTrack->SetTrackStatus(fAlive);
}
// If the primary track has 'zero' kinetic energy, set the track
// state to 'StopButAlive'.
if(fTrack->GetKineticEnergy() <= 0.0){
fTrack->SetTrackStatus( fStopButAlive );
}
// Initialize VTouchable using the point in the global coordinate
// system.
G4VTouchable* pTouchableFree = GetFreeTouchable();
fNavigator->LocateGlobalPointAndUpdateTouchable(
fTrack->GetPosition(),
pTouchableFree,
true );
// Set Touchable to track and a private attribute of G4SteppingManager
fTrack->SetTouchable( pTouchableFree );
fTrack->SetNextTouchable( pTouchableFree );
// Set vertex information of G4Track at here
fTrack->SetVertexPosition( fTrack->GetPosition() );
fTrack->SetVertexMomentumDirection( fTrack->GetMomentumDirection() );
fTrack->SetVertexKineticEnergy( fTrack->GetKineticEnergy() );
// Initial set up for attributes of 'G4SteppingManager'
fCurrentVolume = pTouchableFree->GetVolume();
// Initial set up for attribues of 'Step'
fStep->InitializeStep( fTrack );
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) fVerbose->TrackingStarted();
#endif
// If track is already outside the world boundary, kill it
if( fTrack->GetVolume()==0 ){
fTrack->SetTrackStatus( fStopAndKill );
}
}
+809
View File
@@ -0,0 +1,809 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SteppingVerbose.cc,v 2.8 1998/11/05 17:13:44 maire Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4SteppingVerbose.cc
//
// Description:
// Implementation of the G4SteppingVerbose class
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#include "G4SteppingVerbose.hh"
#include "G4SteppingManager.hh"
///#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
#include "G4UnitsTable.hh"
#else
#define G4BestUnit(a,b) a
#endif
//////////////////////////////////////////////////
G4SteppingVerbose::G4SteppingVerbose()
//////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////
G4SteppingVerbose::G4SteppingVerbose(G4SteppingManager* fMan)
:fManager(fMan)
//////////////////////////////////////////////////
{
//get the pointer of SteppingManager Object
}
//////////////////////////////////////////////////
G4SteppingVerbose::~G4SteppingVerbose()
//////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////
void G4SteppingVerbose::NewStep()
//////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////
void G4SteppingVerbose::CopyState()
//////////////////////////////////////////////////
{
fUserSteppingAction = fManager->GetUserAction();
fVerbose = this;
PhysicalStep = fManager->GetPhysicalStep();
GeometricalStep = fManager->GetGeometricalStep();
CorrectedStep = fManager->GetCorrectedStep();
PreStepPointIsGeom = fManager->GetPreStepPointIsGeom();
FirstStep = fManager->GetFirstStep();
fStepStatus = fManager->GetfStepStatus();
TempInitVelocity = fManager->GetTempInitVelocity();
TempVelocity = fManager->GetTempVelocity();
Mass = fManager->GetMass();
sumEnergyChange = fManager->GetsumEnergyChange();
fParticleChange = fManager->GetfParticleChange();
fTrack = fManager->GetfTrack();
fSecondary = fManager->GetfSecondary();
fStep = fManager->GetfStep();
fPreStepPoint = fManager->GetfPreStepPoint();
fPostStepPoint = fManager->GetfPostStepPoint();
fCurrentVolume = fManager->GetfCurrentVolume();
fSensitive = fManager->GetfSensitive();
fCurrentProcess = fManager->GetfCurrentProcess();
fAtRestDoItVector = fManager->GetfAtRestDoItVector();
fAlongStepDoItVector = fManager->GetfAlongStepDoItVector();
fPostStepDoItVector = fManager->GetfPostStepDoItVector();
fAtRestGetPhysIntVector = fManager->GetfAtRestGetPhysIntVector();
fAlongStepGetPhysIntVector = fManager->GetfAlongStepGetPhysIntVector();
fPostStepGetPhysIntVector = fManager->GetfPostStepGetPhysIntVector();
MAXofAtRestLoops = fManager->GetMAXofAtRestLoops();
MAXofAlongStepLoops = fManager->GetMAXofAlongStepLoops();
MAXofPostStepLoops = fManager->GetMAXofPostStepLoops();
currentMinimumStep = fManager->GetcurrentMinimumStep();
numberOfInteractionLengthLeft = fManager->GetnumberOfInteractionLengthLeft();
fAtRestDoItProcTriggered = fManager->GetfAtRestDoItProcTriggered();
fAlongStepDoItProcTriggered = fManager->GetfAlongStepDoItProcTriggered();
fPostStepDoItProcTriggered = fManager->GetfPostStepDoItProcTriggered();
fN2ndariesAtRestDoIt = fManager->GetfN2ndariesAtRestDoIt();
fN2ndariesAlongStepDoIt = fManager->GetfN2ndariesAlongStepDoIt();
fN2ndariesPostStepDoIt = fManager->GetfN2ndariesPostStepDoIt();
fNavigator = fManager->GetfNavigator();
verboseLevel = fManager->GetverboseLevel();
fSelectedAtRestDoItVector = fManager->GetfSelectedAtRestDoItVector();
fSelectedAlongStepDoItVector = fManager->GetfSelectedAlongStepDoItVector();
fSelectedPostStepDoItVector = fManager->GetfSelectedPostStepDoItVector();
fPreviousStepSize = fManager->GetfPreviousStepSize();
fTouchable1 = fManager->GetfTouchable1();
fTouchable2 = fManager->GetfTouchable2();
fIsTouchable1Free = fManager->GetfIsTouchable1Free();
fIsTouchable2Free = fManager->GetfIsTouchable2Free();
StepControlFlag = fManager->GetStepControlFlag();
physIntLength = fManager->GetphysIntLength();
fCondition = fManager->GetfCondition();
fGPILSelection = fManager->GetfGPILSelection();
}
//////////////////////////////////////////////////
void G4SteppingVerbose::AtRestDoItInvoked()
//////////////////////////////////////////////////
{
G4VProcess* ptProcManager;
CopyState();
if(verboseLevel >= 3 ){
G4int npt=0;
G4cout << " **List of AtRestDoIt invoked:" << endl;
for(size_t np=0; np < MAXofAtRestLoops; np++){
size_t npGPIL = MAXofAtRestLoops-np-1;
if( (*fSelectedAtRestDoItVector)(npGPIL) == 2 ){
npt++;
ptProcManager = (*fAtRestDoItVector)(np);
G4cout << " # " << npt << " : "
<< ptProcManager->GetProcessName()
<< " (Forced)" << endl;
} else if ( (*fSelectedAtRestDoItVector)(npGPIL) == 1 ){
npt++;
ptProcManager = (*fAtRestDoItVector)(np);
G4cout << " # " << npt << " : "
<< ptProcManager->GetProcessName() << endl;
}
}
G4cout << " Generated secondries # : " << fN2ndariesAtRestDoIt << endl;
if( fN2ndariesAtRestDoIt > 0 ){
G4cout << " -- List of secondaries generated : "
<< "(x,y,z,kE,t,PID) --" << endl;
for( G4int lp1=(*fSecondary).entries()-fN2ndariesAtRestDoIt;
lp1<(*fSecondary).entries(); lp1++){
G4cout << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time") << " "
<< setw(18)
<< (*fSecondary)[lp1]->GetDefinition()
->GetParticleName();
G4cout << endl;
}
}
}
if( verboseLevel >= 4 ){
fStep->ShowStep();
G4cout << endl;
}
}
/////////////////////////////////////////////////////
void G4SteppingVerbose::AlongStepDoItAllDone()
/////////////////////////////////////////////////////
{
G4VProcess* ptProcManager;
CopyState();
if(verboseLevel >= 3){
G4cout << endl;
G4cout << " >>AlongStepDoIt (after all invocations):" << endl;
G4cout << " ++List of invoked processes " << endl;
for(size_t ci=0; ci<MAXofAlongStepLoops; ci++){
ptProcManager = (*fAlongStepDoItVector)(ci);
G4cout << " " << ci+1 << ") ";
if(ptProcManager != NULL){
G4cout << ptProcManager->GetProcessName() << endl;
}
}
fStep->ShowStep();
G4cout << endl;
G4cout << " ++List of secondaries generated "
<< "(x,y,z,kE,t,PID):"
<< " No. of secodaries = "
<< (*fSecondary).entries() << endl;
if((*fSecondary).entries()>0){
for(G4int lp1=0; lp1<(*fSecondary).entries(); lp1++){
G4cout << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time") << " "
<< setw(18)
<< (*fSecondary)[lp1]->GetDefinition()
->GetParticleName();
G4cout << endl;
}
}
}
}
////////////////////////////////////////////////////
void G4SteppingVerbose::PostStepDoItAllDone()
////////////////////////////////////////////////////
{
G4VProcess* ptProcManager;
CopyState();
if(fStepStatus != fPostStepDoItProc) return;
if(verboseLevel >= 3){
G4int npt=0;
G4cout << endl;
G4cout << " **PostStepDoIt (after all invocations):" << endl;
G4cout << " ++List of invoked processes " << endl;
for(size_t np=0; np < MAXofPostStepLoops; np++){
size_t npGPIL = MAXofPostStepLoops-np-1;
if((*fSelectedPostStepDoItVector)(npGPIL) == 2){
npt++;
ptProcManager = (*fPostStepDoItVector)(np);
G4cout << " " << npt << ") "
<< ptProcManager->GetProcessName()
<< " (Forced)" << endl;
} else if ((*fSelectedPostStepDoItVector)(npGPIL) == 1){
npt++;
ptProcManager = (*fPostStepDoItVector)(np);
G4cout << " " << npt << ") "
<< ptProcManager->GetProcessName() << endl;
}
}
fStep->ShowStep();
G4cout << endl;
G4cout << " ++List of secondaries generated "
<< "(x,y,z,kE,t,PID):"
<< " No. of secodaries = "
<< (*fSecondary).entries() << endl;
G4cout << " [Note]Secondaries from AlongStepDoIt included."
<< endl;
if((*fSecondary).entries()>0){
for(G4int lp1=0; lp1<(*fSecondary).entries(); lp1++){
G4cout << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime() , "Time") << " "
<< setw(18)
<< (*fSecondary)[lp1]->GetDefinition()
->GetParticleName();
G4cout << endl;
}
}
}
}
/////////////////////////////////////////
void G4SteppingVerbose::StepInfo()
/////////////////////////////////////////
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << endl;
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
G4cout << setw( 5) << "#Step#" << " "
<< setw( 8) << "X" << " "
<< setw( 8) << "Y" << " "
<< setw( 8) << "Z" << " "
<< setw( 9) << "KineE" << " "
<< setw( 8) << "dE" << " "
<< setw(12) << "StepLeng" << " "
<< setw(12) << "TrackLeng" << " "
<< setw(12) << "NextVolume" << " "
<< setw( 8) << "ProcName" << endl;
#else
G4cout << setw( 5) << "#Step#" << " "
<< setw( 8) << "X(mm)" << " "
<< setw( 8) << "Y(mm)" << " "
<< setw( 8) << "Z(mm)" << " "
<< setw( 9) << "KinE(MeV)" << " "
<< setw( 8) << "dE(MeV)" << " "
<< setw( 8) << "StepLeng" << " "
<< setw( 9) << "TrackLeng" << " "
<< setw(11) << "NextVolume" << " "
<< setw( 8) << "ProcName" << endl;
#endif
}
G4cout << setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< setw( 8) << G4BestUnit(fTrack->GetPosition().x() , "Length") << " "
<< setw( 8) << G4BestUnit(fTrack->GetPosition().y() , "Length") << " "
<< setw( 8) << G4BestUnit(fTrack->GetPosition().z() , "Length") << " "
<< setw( 9) << G4BestUnit(fTrack->GetKineticEnergy() , "Energy") << " "
<< setw( 8) << G4BestUnit(fStep->GetTotalEnergyDeposit(), "Energy") << " "
<< setw( 8) << G4BestUnit(fStep->GetStepLength() , "Length") << " "
<< setw( 9) << G4BestUnit(fTrack->GetTrackLength() , "Length") << " ";
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << setw(11) << fTrack->GetNextVolume()->GetName() << " ";
} else {
G4cout << setw(11) << "OutOfWorld" << " ";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << "User Limit";
}
G4cout << endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << setw(3) << tN2ndariesTot
<< "(Rest=" << setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << setw(3) << (*fSecondary).entries()
<< " ---------------"
<< endl;
for(G4int lp1=(*fSecondary).entries()-tN2ndariesTot;
lp1<(*fSecondary).entries(); lp1++){
G4cout << " : "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length")<< " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy")<< " "
<< setw(18)
<< (*fSecondary)[lp1]->GetDefinition()
->GetParticleName();
G4cout << endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< endl;
}
}
}
G4cout.precision(prec);
}
////////////////////////////////////////////////
void G4SteppingVerbose::TrackingStarted()
////////////////////////////////////////////////
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
G4cout << setw( 5) << "Step#" << " "
<< setw( 8) << "X" << " "
<< setw( 8) << "Y" << " "
<< setw( 8) << "Z" << " "
<< setw( 9) << "KineE" << " "
<< setw( 8) << "dE" << " "
<< setw(12) << "StepLeng" << " "
<< setw(12) << "TrackLeng" << " "
<< setw(12) << "NextVolume" << " "
<< setw( 8) << "ProcName" << endl;
#else
G4cout << setw( 5) << "Step#" << " "
<< setw( 8) << "X(mm)" << " "
<< setw( 8) << "Y(mm)" << " "
<< setw( 8) << "Z(mm)" << " "
<< setw( 9) << "KinE(MeV)" << " "
<< setw( 8) << "dE(MeV)" << " "
<< setw( 8) << "StepLeng" << " "
<< setw( 9) << "TrackLeng" << " "
<< setw(11) << "NextVolume" << " "
<< setw( 8) << "ProcName" << endl;
#endif
G4cout << setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< setw( 8) << G4BestUnit(fTrack->GetPosition().x(),"Length")<< " "
<< setw( 8) << G4BestUnit(fTrack->GetPosition().y(),"Length") << " "
<< setw( 8) << G4BestUnit(fTrack->GetPosition().z(),"Length")<< " "
<< setw( 9) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")<< " "
<< setw( 8) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy") << " "
<< setw( 8) << G4BestUnit(fStep->GetStepLength(),"Length")<< " "
<< setw( 9) << G4BestUnit(fTrack->GetTrackLength(),"Length") << " ";
if(fTrack->GetNextVolume()){
G4cout << setw(11) << fTrack->GetNextVolume()->GetName() << " ";
} else {
G4cout << setw(11) << "OutOfWorld" << " ";
}
G4cout << "initStep" << endl;
}
G4cout.precision(prec);
}
////////////////////////////////////////////
void G4SteppingVerbose::DPSLStarted()
////////////////////////////////////////////
{
CopyState();
if( verboseLevel > 5 ){
G4cout << endl;
G4cout << " >>DefinePhysicalStepLength (List of proposed StepLengths): "
<< endl;
}
}
//////////////////////////////////////////////
void G4SteppingVerbose::DPSLUserLimit()
//////////////////////////////////////////////
{
CopyState();
if( verboseLevel > 5 ){
G4cout << endl << endl;
G4cout << "=== Defined Physical Step Length (DPSL)" << endl;
G4cout << " ++ProposedStep(UserLimit) = "
<< setw( 9) << physIntLength
<< " : ProcName = User defined maximum allowed Step"
<< endl;
}
}
/////////////////////////////////////////////
void G4SteppingVerbose::DPSLPostStep()
/////////////////////////////////////////////
{
CopyState();
if( verboseLevel > 5 ){
G4cout << " ++ProposedStep(PostStep ) = "
<< setw( 9) << physIntLength
<< " : ProcName = "
<< fCurrentProcess->GetProcessName()
<< " (";
if(fCondition==ExclusivelyForced){
G4cout << "ExclusivelyForced)" << endl;
}
else if(fCondition==Conditionally){
G4cout << "Conditionally)" << endl;
}
else if(fCondition==Forced){
G4cout << "Forced)" << endl;
}
else{
G4cout << "No ForceCondition)" << endl;
}
}
}
/////////////////////////////////////////////
void G4SteppingVerbose::DPSLAlongStep()
/////////////////////////////////////////////
{
CopyState();
if( verboseLevel > 5 ){
G4cout << " ++ProposedStep(AlongStep) = "
<< setw( 9) << G4BestUnit(physIntLength , "Length")
<< " : ProcName = "
<< fCurrentProcess->GetProcessName()
<< " (";
if(fGPILSelection==CandidateForSelection){
G4cout << "CandidateForSelection)" << endl;
}
else if(fGPILSelection==NotCandidateForSelection){
G4cout << "NotCandidateForSelection)" << endl;
}
else{
G4cout << "???)" << endl;
}
}
}
//////////////////////////////////////////////////////
void G4SteppingVerbose::AlongStepDoItOneByOne()
//////////////////////////////////////////////////////
{
CopyState();
if(verboseLevel >= 4){
G4cout << endl;
G4cout << " >>AlongStepDoIt (process by process): "
<< " Process Name = "
<< fCurrentProcess->GetProcessName() << endl;
fStep->ShowStep();
G4cout << " "
<< "!Note! Safety of PostStep is only valid "
<< "after all DoIt invocations."
<< endl;
VerboseParticleChange();
G4cout << endl;
G4cout << " ++List of secondaries generated "
<< "(x,y,z,kE,t,PID):"
<< " No. of secodaries = "
<< fN2ndariesAlongStepDoIt << endl;
if(fN2ndariesAlongStepDoIt>0){
for(G4int lp1=(*fSecondary).entries()-fN2ndariesAlongStepDoIt;
lp1<(*fSecondary).entries(); lp1++){
G4cout << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y() , "Length")<< " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z() , "Length")<< " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy() , "Energy")<< " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime() , "Time")<< " "
<< setw(18)
<< (*fSecondary)[lp1]->GetDefinition()
->GetParticleName();
G4cout << endl;
}
}
}
}
//////////////////////////////////////////////////////
void G4SteppingVerbose::PostStepDoItOneByOne()
//////////////////////////////////////////////////////
{
CopyState();
if(fStepStatus != fPostStepDoItProc) return;
if(verboseLevel >= 4){
G4cout << endl;
G4cout << " >>PostStepDoIt (process by process): "
<< " Process Name = "
<< fCurrentProcess->GetProcessName() << endl;
fStep->ShowStep();
G4cout << endl;
VerboseParticleChange();
G4cout << endl;
G4cout << " ++List of secondaries generated "
<< "(x,y,z,kE,t,PID):"
<< " No. of secodaries = "
<< fN2ndariesPostStepDoIt << endl;
if(fN2ndariesPostStepDoIt>0){
for(G4int lp1=(*fSecondary).entries()-fN2ndariesPostStepDoIt;
lp1<(*fSecondary).entries(); lp1++){
G4cout << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x() , "Length")<< " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(), "Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(), "Length") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(), "Energy") << " "
<< setw( 9)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(), "Time") << " "
<< setw(18)
<< (*fSecondary)[lp1]->GetDefinition()
->GetParticleName();
G4cout << endl;
}
}
}
}
//////////////////////////////////////
void G4SteppingVerbose::VerboseTrack()
//////////////////////////////////////
{
CopyState();
// Show header
G4cout << endl;
G4cout << " ++G4Track Information " << endl;
G4int prec = G4cout.precision(3);
G4cout << " -----------------------------------------------"
<< endl;
G4cout << " G4Track Information " << setw(20) << endl;
G4cout << " -----------------------------------------------"
<< endl;
G4cout << " Step number : "
<< setw(20) << fTrack->GetCurrentStepNumber()
<< endl;
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
G4cout << " Position - x : "
<< setw(20) << G4BestUnit(fTrack->GetPosition().x(), "Length")
<< endl;
G4cout << " Position - y : "
<< setw(20) << G4BestUnit(fTrack->GetPosition().y(), "Length")
<< endl;
G4cout << " Position - z : "
<< setw(20) << G4BestUnit(fTrack->GetPosition().z(), "Length")
<< endl;
G4cout << " Global Time : "
<< setw(20) << G4BestUnit(fTrack->GetGlobalTime(), "Time")
<< endl;
G4cout << " Local Time : "
<< setw(20) << G4BestUnit(fTrack->GetLocalTime(), "Time")
<< endl;
#else
G4cout << " Position - x (mm) : "
<< setw(20) << fTrack->GetPosition().x() /mm
<< endl;
G4cout << " Position - y (mm) : "
<< setw(20) << fTrack->GetPosition().y() /mm
<< endl;
G4cout << " Position - z (mm) : "
<< setw(20) << fTrack->GetPosition().z() /mm
<< endl;
G4cout << " Global Time (ns) : "
<< setw(20) << fTrack->GetGlobalTime() /ns
<< endl;
G4cout << " Local Time (ns) : "
<< setw(20) << fTrack->GetLocalTime() /ns
<< endl;
#endif
G4cout << " Momentum Direct - x : "
<< setw(20) << fTrack->GetMomentumDirection().x()
<< endl;
G4cout << " Momentum Direct - y : "
<< setw(20) << fTrack->GetMomentumDirection().y()
<< endl;
G4cout << " Momentum Direct - z : "
<< setw(20) << fTrack->GetMomentumDirection().z()
<< endl;
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
G4cout << " Kinetic Energy : "
#else
G4cout << " Kinetic Energy (MeV): "
#endif
<< setw(20) << G4BestUnit(fTrack->GetKineticEnergy(), "Energy")
<< endl;
G4cout << " Polarization - x : "
<< setw(20) << fTrack->GetPolarization().x()
<< endl;
G4cout << " Polarization - y : "
<< setw(20) << fTrack->GetPolarization().y()
<< endl;
G4cout << " Polarization - z : "
<< setw(20) << fTrack->GetPolarization().z()
<< endl;
G4cout << " Track Length : "
<< setw(20) << G4BestUnit(fTrack->GetTrackLength(), "Length")
<< endl;
G4cout << " Track ID # : "
<< setw(20) << fTrack->GetTrackID()
<< endl;
G4cout << " Parent Track ID # : "
<< setw(20) << fTrack->GetParentID()
<< endl;
G4cout << " Next Volume : "
<< setw(20);
if( fTrack->GetNextVolume() != 0 ) {
G4cout << fTrack->GetNextVolume()->GetName() << " ";
} else {
G4cout << "OutOfWorld" << " ";
}
G4cout << endl;
G4cout << " Track Status : "
<< setw(20);
if( fTrack->GetTrackStatus() == fAlive ){
G4cout << " Alive";
} else if( fTrack->GetTrackStatus() == fStopButAlive ){
G4cout << " StopButAlive";
} else if( fTrack->GetTrackStatus() == fStopAndKill ){
G4cout << " StopAndKill";
} else if( fTrack->GetTrackStatus() == fKillTrackAndSecondaries ){
G4cout << " KillTrackAndSecondaries";
} else if( fTrack->GetTrackStatus() == fSuspend ){
G4cout << " Suspend";
} else if( fTrack->GetTrackStatus() == fPostponeToNextEvent ){
G4cout << " PostponeToNextEvent";
}
G4cout << endl;
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
G4cout << " Vertex - x : "
<< setw(20) << G4BestUnit(fTrack->GetVertexPosition().x(),"Length")
<< endl;
G4cout << " Vertex - y : "
<< setw(20) << G4BestUnit(fTrack->GetVertexPosition().y(),"Length")
<< endl;
G4cout << " Vertex - z : "
<< setw(20) << G4BestUnit(fTrack->GetVertexPosition().z(),"Length")
<< endl;
#else
G4cout << " Vertex - x (mm) : "
<< setw(20) << fTrack->GetVertexPosition().x()/mm
<< endl;
G4cout << " Vertex - y (mm) : "
<< setw(20) << fTrack->GetVertexPosition().y()/mm
<< endl;
G4cout << " Vertex - z (mm) : "
<< setw(20) << fTrack->GetVertexPosition().z()/mm
<< endl;
#endif
G4cout << " Vertex - Px (MomDir): "
<< setw(20) << fTrack->GetVertexMomentumDirection().x()
<< endl;
G4cout << " Vertex - Py (MomDir): "
<< setw(20) << fTrack->GetVertexMomentumDirection().y()
<< endl;
G4cout << " Vertex - Pz (MomDir): "
<< setw(20) << fTrack->GetVertexMomentumDirection().z()
<< endl;
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
G4cout << " Vertex - KineE : "
#else
G4cout << " Vertex - KineE (MeV): "
#endif
<< setw(20) << G4BestUnit(fTrack->GetVertexKineticEnergy(),"Energy")
<< endl;
G4cout << " Creator Process : "
<< setw(20);
if( fTrack->GetCreatorProcess() == NULL){
G4cout << " Event Generator" << endl;
} else {
G4cout << fTrack->GetCreatorProcess()->GetProcessName() << endl;
}
G4cout << " -----------------------------------------------"
<< endl;
G4cout.precision(prec);
}
///////////////////////////////////////////////
void G4SteppingVerbose::VerboseParticleChange()
///////////////////////////////////////////////
{
// Show header
G4cout << endl;
G4cout << " ++G4ParticleChange Information " << endl;
fParticleChange->DumpInfo();
}
+170
View File
@@ -0,0 +1,170 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TrackingManager.cc,v 2.4 1998/11/25 02:17:00 tsasaki Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4TrackingManager.cc
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#include "G4TrackingManager.hh"
#include "G4TrackingMessenger.hh"
#include "G4ios.hh"
G4TrackingMessenger * messenger;
//////////////////////////////////////
G4TrackingManager::G4TrackingManager()
//////////////////////////////////////
: verboseLevel(0),StoreTrajectory(false),
fpTrajectory(NULL), fpUserTrackingAction(NULL)
{
fpSteppingManager = new G4SteppingManager();
messenger = new G4TrackingMessenger(this);
}
///////////////////////////////////////
G4TrackingManager::~G4TrackingManager()
///////////////////////////////////////
{
delete messenger;
delete fpSteppingManager;
if (fpUserTrackingAction) delete fpUserTrackingAction;
}
////////////////////////////////////////////////////////////////
void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
////////////////////////////////////////////////////////////////
{
// Receiving a G4Track from the EventManager, this funciton has the
// responsibility to trace the track till it stops.
fpTrack = apValueG4Track;
// Clear 2ndary particle vector
GimmeSecondaries()->clearAndDestroy();
// Pre tracking user intervention process.
if( fpUserTrackingAction != NULL ) {
fpUserTrackingAction->PreUserTrackingAction();
}
#ifdef G4_STORE_TRAJECTORY
// Construct a trajectory if it is requested
if(StoreTrajectory) {
fpTrajectory = new G4Trajectory(fpTrack);
}
else {
fpTrajectory = NULL;
}
#endif
#ifdef G4VERBOSE
// !!!!! Verbose
if(verboseLevel>0) Verbose("ProcessOneTrack");
#endif
// Give SteppingManger the pointer to the track which will be tracked
fpSteppingManager->SetInitialStep(fpTrack);
// Give SteppingManger the maxmimum number of processes
fpSteppingManager->GetProcessNumber();
// Give track the pointer to the Step
fpTrack->SetStep(fpSteppingManager->GetStep());
// Inform beginning of tracking to physics processes
fpTrack->GetDefinition()->GetProcessManager()->StartTracking();
// Track the particle Step-by-Step while it is alive
G4StepStatus stepStatus;
while( (fpTrack->GetTrackStatus() == fAlive) ||
(fpTrack->GetTrackStatus() == fStopButAlive) ){
fpTrack->IncrementCurrentStepNumber();
stepStatus = fpSteppingManager->Stepping();
#ifdef G4_STORE_TRAJECTORY
if(StoreTrajectory) fpTrajectory->
AppendStep(fpSteppingManager->GetStep());
#endif
}
// Inform end of tracking to physics processes
fpTrack->GetDefinition()->GetProcessManager()->EndTracking();
// Post tracking user intervention process.
if( fpUserTrackingAction != NULL ) {
fpUserTrackingAction->PostUserTrackingAction();
}
// Destruct the trajectory if it was created
#ifdef G4VERBOSE
if(StoreTrajectory&&verboseLevel>10) fpTrajectory->ShowTrajectory();
#endif
if( (!StoreTrajectory)&&fpTrajectory ) {
delete fpTrajectory;
}
}
//////////////////////////////////////
void G4TrackingManager::EventAborted()
//////////////////////////////////////
{
}
//************************************************************************
//
// Private Member Functions
//
//************************************************************************
////////////////////////////////////////////////
void G4TrackingManager::Verbose(G4String select)
////////////////////////////////////////////////
{
// !!!!! Verbose
if( select == "ProcessOneTrack" ){
#ifdef G4VERBOSE
if(verboseLevel >= 1) {
G4cout << endl;
G4cout << "*******************************************************"
<< "**************************************************"
<< endl;
G4cout << "* G4Track Information: "
<< " Particle = " << fpTrack->GetDefinition()->GetParticleName()
<< ","
<< " Track ID = " << fpTrack->GetTrackID()
<< ","
<< " Parent ID = " << fpTrack->GetParentID()
<< endl;
G4cout << "*******************************************************"
<< "**************************************************"
<< endl;
G4cout << endl;
}
#endif
}
}
+157
View File
@@ -0,0 +1,157 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TrackingMessenger.cc,v 2.4 1998/07/13 17:28:59 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4TrackingMessenger.cc
//
// Description:
// This is a messenger class to interface to exchange information
// between tracking and stepping managers and UI.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Makoto Asai (e-mail: asai@kekvax.kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#include "G4TrackingMessenger.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include "G4TrackingManager.hh"
#include "G4SteppingManager.hh"
#include "G4TrackStatus.hh"
#include "G4ios.hh"
#ifdef WIN32
# include <Strstrea.h>
#else
# include <strstream.h>
#endif
///////////////////////////////////////////////////////////////////
G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager * trMan)
///////////////////////////////////////////////////////////////////
: trackingManager(trMan)
{
steppingManager = trackingManager->GetSteppingManager();
TrackingDirectory = new G4UIdirectory("/tracking/");
TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
AbortCmd->SetGuidance("Abort current G4Track processing.");
ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
ResumeCmd->SetGuidance("Resume current G4Track processing.");
StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
StoreTrajectoryCmd->SetGuidance(" 1 : Store trajectories.");
StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
StoreTrajectoryCmd->SetParameterName("Store",true);
StoreTrajectoryCmd->SetDefaultValue(0);
StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 1");
VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
#ifdef G4VERBOSE
VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
VerboseCmd->SetGuidance(" 0 : Silent.");
VerboseCmd->SetGuidance(" 1 : Minium information of each Step.");
VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
VerboseCmd->SetGuidance(" after all AlongStep/PostStep process executions.");
VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
VerboseCmd->SetGuidance(" at each AlongStepPostStep process execuation.");
VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
VerboseCmd->SetParameterName("verbose_level",true);
VerboseCmd->SetDefaultValue(0);
VerboseCmd->SetRange("verbose_level >=0 ");
#else
VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
#endif
}
////////////////////////////////////////////
G4TrackingMessenger::~G4TrackingMessenger()
////////////////////////////////////////////
{
delete TrackingDirectory;
delete AbortCmd;
delete ResumeCmd;
delete StoreTrajectoryCmd;
delete VerboseCmd;
}
///////////////////////////////////////////////////////////////////////////////
void G4TrackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
///////////////////////////////////////////////////////////////////////////////
{
if( command == VerboseCmd ){
G4int vl;
const char* t = newValues;
istrstream is((char*)t);
is >> vl;
trackingManager->SetVerboseLevel(vl);
}
if( command == AbortCmd ){
steppingManager->GetTrack()->SetTrackStatus(fStopAndKill);
G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
}
if( command == ResumeCmd ){
G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
}
if( command == StoreTrajectoryCmd ){
G4int vl;
const char* t = newValues;
istrstream is((char*)t);
is >> vl;
trackingManager->SetStoreTrajectory(vl!=0);
}
}
////////////////////////////////////////////////////////////////////
G4String G4TrackingMessenger::GetCurrentValue(G4UIcommand * command)
////////////////////////////////////////////////////////////////////
{
if( command == VerboseCmd ){
char line[100];
ostrstream os(line,100);
os << trackingManager->GetVerboseLevel() << '\0';
return G4String(line);
}
return G4String('\0');
}
+137
View File
@@ -0,0 +1,137 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Trajectory.cc,v 2.2 1998/07/13 17:29:00 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ---------------------------------------------------------------
//
// G4Trajectory.cc
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Makoto Asai (e-mail: asai@kekvax.kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
#include "G4Trajectory.hh"
#include "G4ParticleTable.hh"
#include "G4ThreeVector.hh"
#include "G4Polyline.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
///////////////////////////////////////////
G4Trajectory::G4Trajectory(G4Track* aTrack)
///////////////////////////////////////////
{
G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
ParticleName = fpParticleDefinition->GetParticleName();
PDGCharge = fpParticleDefinition->GetPDGCharge();
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
fTrackID = aTrack->GetTrackID();
fParentID = aTrack->GetParentID();
positionRecord.insert(aTrack->GetPosition());
}
//////////////////////////////////////////
G4Trajectory::G4Trajectory(G4Trajectory &)
//////////////////////////////////////////
{
}
/////////////////////////////
G4Trajectory::~G4Trajectory()
/////////////////////////////
{
}
///////////////////////////////////
void G4Trajectory::ShowTrajectory()
///////////////////////////////////
{
G4cout << endl << "TrackID =" << fTrackID
<< ":ParentID=" << fParentID << endl;
G4cout << "Particle name : " << ParticleName
<< " Charge : " << PDGCharge << endl;
G4cout << " Current trajectory has " << positionRecord.entries()
<< " points." << endl;
for( size_t i=0 ; i < positionRecord.entries() ; i++){
G4cout << "Point[" << i << "]"
<< " Position= " << positionRecord[i].GetPosition() << endl;
}
}
///////////////////////////////////////////////
void G4Trajectory::DrawTrajectory(G4int i_mode)
///////////////////////////////////////////////
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
G4ThreeVector pos;
if(i_mode>=0)
{
G4Polyline pPolyline;
for (int i = 0; i < positionRecord.entries() ; i++) {
pos = positionRecord[i].GetPosition();
pPolyline.append( pos );
}
G4Colour colour;
if(PDGCharge<0.)
colour = G4Colour(1.,0.,0.);
else if(PDGCharge>0.)
colour = G4Colour(0.,0.,1.);
else
colour = G4Colour(0.,1.,0.);
G4VisAttributes attribs(colour);
pPolyline.SetVisAttributes(attribs);
if(pVVisManager) pVVisManager->Draw(pPolyline);
}
if(i_mode!=0)
{
for(int j=0; j<positionRecord.entries(); j++) {
pos = positionRecord[j].GetPosition();
G4Circle circle( pos );
circle.SetScreenSize(0.001*i_mode);
circle.SetFillStyle(G4Circle::filled);
G4Colour colSpot(0.,0.,0.);
G4VisAttributes attSpot(colSpot);
circle.SetVisAttributes(attSpot);
if(pVVisManager) pVVisManager->Draw(circle);
}
}
}
////////////////////////////////////////////
void G4Trajectory::AppendStep(G4Step* aStep)
////////////////////////////////////////////
{
positionRecord.append( aStep->GetPostStepPoint()->
GetPosition() );
}
/////////////////////////////////////////////
G4ParticleDefinition* G4Trajectory::GetParticleDefinition()
/////////////////////////////////////////////
{
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
}
+54
View File
@@ -0,0 +1,54 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4TrajectoryPoint.cc,v 2.0 1998/07/02 17:29:30 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ---------------------------------------------------------------
//
// G4TrajectoryPoint.cc
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
#include "G4TrajectoryPoint.hh"
G4Allocator<G4TrajectoryPoint> aTrajectoryPointAllocator;
//////////////////////////////////////
G4TrajectoryPoint::G4TrajectoryPoint()
//////////////////////////////////////
{
fPosition = G4ThreeVector(0.,0.,0.);
}
///////////////////////////////////////////////////////
G4TrajectoryPoint::G4TrajectoryPoint(G4ThreeVector pos)
///////////////////////////////////////////////////////
{
fPosition = pos;
}
////////////////////////////////////////////////////////////////////
G4TrajectoryPoint::G4TrajectoryPoint(const G4TrajectoryPoint &right)
////////////////////////////////////////////////////////////////////
: fPosition(right.fPosition)
{
}
///////////////////////////////////////
G4TrajectoryPoint::~G4TrajectoryPoint()
///////////////////////////////////////
{
}
@@ -0,0 +1,39 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserSteppingAction.cc,v 2.0 1998/07/02 17:29:32 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ---------------------------------------------------------------
//
// G4UserSteppingAction.cc
//
// Description:
// This class represents actions taken place by the user at each
// end of stepping.
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
#include "G4UserSteppingAction.hh"
/////////////////////////////////////////////////////////
void G4UserSteppingAction::
SetSteppingManagerPointer(G4SteppingManager* pValue)
/////////////////////////////////////////////////////////
{
fpSteppingManager = pValue;
}
@@ -0,0 +1,39 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserTrackingAction.cc,v 2.0 1998/07/02 17:29:34 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ---------------------------------------------------------------
//
// G4UserTrackingAction.cc
//
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
// ---------------------------------------------------------------
#include "G4UserTrackingAction.hh"
/////////////////////////////////////////////////////////
void G4UserTrackingAction::
SetTrackingManagerPointer(G4TrackingManager* pValue)
/////////////////////////////////////////////////////////
{
fpTrackingManager = pValue;
}