All secondaries generated along a track was accumulated in G4SteppingManager and there is no direct way of accessing to the secondaries produced by a particular step. From your UserSteppingAction, you can get all such information by accessing appropriately to G4SteppingManager. List of processes which not only limited but also involved to the step can be listed as well. Further information beyond this tip can be found in the implementation of G4SteppingVerbose class.
Here is the sample implementation of G4UserSteppingAction
| Source file (T01SteppingAction.cc) |
#include "T01SteppingAction.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
void T01SteppingAction::UserSteppingAction(const G4Step * theStep)
{
G4cout << "Step is limited by "
<< theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()
<< G4endl;
G4cout << "Processes involved to the step" << G4endl;
G4StepStatus stepStatus = fpSteppingManager->GetfStepStatus();
if(stepStatus==fAtRestDoItProc)
{
G4ProcessVector* procAtRest = fpSteppingManager->GetfAtRestDoItVector();
G4SelectedAtRestDoItVector* selProcAtRest
= fpSteppingManager->GetfSelectedAtRestDoItVector();
size_t MAXofAtRestLoops = fpSteppingManager->GetMAXofAtRestLoops();
for(size_t i1=0;i1<MAXofAtRestLoops;i1++)
{
if((*selProcAtRest)[MAXofAtRestLoops-i1-1]==2)
{ G4cout << " At rest : " << (*procAtRest)[i1]->GetProcessName() << " (forced)" << G4endl; }
else if((*selProcAtRest)[MAXofAtRestLoops-i1-1]==1)
{ G4cout << " At rest : " << (*procAtRest)[i1]->GetProcessName() << G4endl; }
}
}
if(stepStatus!=fExclusivelyForcedProc && stepStatus!=fAtRestDoItProc)
{
G4ProcessVector* procAlong = fpSteppingManager->GetfAlongStepDoItVector();
size_t MAXofAlongStepLoops = fpSteppingManager->GetMAXofAlongStepLoops();
for(size_t i2=0;i2<MAXofAlongStepLoops;i2++)
{
if((*procAlong)[i2]!=0)
G4cout << " Along step : " << (*procAlong)[i2]->GetProcessName() << G4endl;
}
}
if(stepStatus!=fAtRestDoItProc)
{
G4ProcessVector* procPost = fpSteppingManager->GetfPostStepDoItVector();
G4SelectedPostStepDoItVector* selProcPost
= fpSteppingManager->GetfSelectedPostStepDoItVector();
size_t MAXofPostStepLoops = fpSteppingManager->GetMAXofPostStepLoops();
for(size_t i3=0;i3<MAXofPostStepLoops;i3++)
{
if((*selProcPost)[MAXofPostStepLoops-i3-1]==2)
{ G4cout << " Post step : " << (*procPost)[i3]->GetProcessName() << " (forced)" << G4endl; }
else if((*selProcPost)[MAXofPostStepLoops-i3-1]==1)
{ G4cout << " Post step : " << (*procPost)[i3]->GetProcessName() << G4endl; }
}
}
G4int nSecAtRest = fpSteppingManager->GetfN2ndariesAtRestDoIt();
G4int nSecAlong = fpSteppingManager->GetfN2ndariesAlongStepDoIt();
G4int nSecPost = fpSteppingManager->GetfN2ndariesPostStepDoIt();
G4int nSecTotal = nSecAtRest+nSecAlong+nSecPost;
G4TrackVector* secVec = fpSteppingManager->GetfSecondary();
if(nSecTotal>0)
{
G4cout << " :----- List of 2ndaries - " << std::setw(3) << nSecTotal
<< " (Rest=" << std::setw(2) << nSecAtRest
<< ",Along=" << std::setw(2) << nSecAlong
<< ",Post=" << std::setw(2) << nSecPost << ")" << G4endl;
for(size_t lp1=(*secVec).size()-nSecTotal; lp1<(*secVec).size(); lp1++)
{
G4cout << " : "
<< G4BestUnit((*secVec)[lp1]->GetPosition(), "Length") << " "
<< std::setw( 9) << G4BestUnit((*secVec)[lp1]->GetKineticEnergy() , "Energy") << " "
<< std::setw(18) << (*secVec)[lp1]->GetDefinition()->GetParticleName()
<< " generated by " << (*secVec)[lp1]->GetCreatorProcess()->GetProcessName() << G4endl;
}
}
}
|
An example output of this class is the following. Please note that the following list was snipped out from lengthy output.
| sample output from T01SteppingAction.cc |
Step is limited by Transportation
Processes involved to the step
Along step : Transportation
Along step : msc
Along step : eIoni
Post step : Transportation
Post step : msc
Post step : eIoni (forced)
Step is limited by eIoni
Processes involved to the step
Along step : Transportation
Along step : msc
Along step : eIoni
Post step : Transportation
Post step : msc
Post step : eIoni (forced)
:----- List of 2ndaries - 1 (Rest= 0,Along= 0,Post= 1)
: -0.019113 6.51462 0.000138179 cm 1.95542 keV e- generated by eIoni
Step is limited by eBrem
Processes involved to the step
Along step : Transportation
Along step : msc
Along step : eIoni
Post step : Transportation
Post step : msc
Post step : eBrem (forced)
:----- List of 2ndaries - 1 (Rest= 0,Along= 0,Post= 1)
: -0.288498 25.3216 0.000807671 cm 63.393 MeV gamma generated by eBrem
Step is limited by conv
Processes involved to the step
Along step : Transportation
Post step : Transportation
Post step : conv (forced)
:----- List of 2ndaries - 2 (Rest= 0,Along= 0,Post= 2)
: -0.881643 51.3114 -0.000172928 cm 11.2898 MeV e- generated by conv
: -0.881643 51.3114 -0.000172928 cm 51.0812 MeV e+ generated by conv
Step is limited by annihil
Processes involved to the step
At rest : annihil (forced)
:----- List of 2ndaries - 2 (Rest= 2,Along= 0,Post= 0)
: -1.01094 51.7613 -0.00290133 cm 510.999 keV gamma generated by annihil
: -1.01094 51.7613 -0.00290133 cm 510.999 keV gamma generated by annihil
|
We are aware of the common requirement of doing this in sensitive detector. It will be available in near future release.
Makoto Asai
|
| |