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
+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;
}