Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCL::AvatarDumpAction Class Reference

#include <G4INCLAvatarDumpAction.hh>

+ Inheritance diagram for G4INCL::AvatarDumpAction:

Public Member Functions

 AvatarDumpAction ()
 
virtual ~AvatarDumpAction ()
 
virtual void beforeCascadeUserAction (IPropagationModel *)
 
virtual void afterAvatarUserAction (IAvatar *avatar, Nucleus *nucleus, FinalState *)
 
virtual void afterCascadeUserAction (Nucleus *)
 
- Public Member Functions inherited from G4INCL::CascadeAction
 CascadeAction ()
 
virtual ~CascadeAction ()
 
virtual void beforeRunUserAction (Config const *)
 
virtual void beforePropagationUserAction (IPropagationModel *)
 
virtual void beforeAvatarUserAction (IAvatar *, Nucleus *)
 
virtual void afterPropagationUserAction (IPropagationModel *, IAvatar *)
 
virtual void afterRunUserAction ()
 

Detailed Description

Definition at line 53 of file G4INCLAvatarDumpAction.hh.

Constructor & Destructor Documentation

◆ AvatarDumpAction()

G4INCL::AvatarDumpAction::AvatarDumpAction ( )

Definition at line 44 of file G4INCLAvatarDumpAction.cc.

44 :
45 oFile(0),
46 eventCounter(0)
47 {
48 }

◆ ~AvatarDumpAction()

G4INCL::AvatarDumpAction::~AvatarDumpAction ( )
virtual

Definition at line 50 of file G4INCLAvatarDumpAction.cc.

50{}

Member Function Documentation

◆ afterAvatarUserAction()

void G4INCL::AvatarDumpAction::afterAvatarUserAction ( IAvatar * avatar,
Nucleus * nucleus,
FinalState * finalState )
virtual

Reimplemented from G4INCL::CascadeAction.

Definition at line 58 of file G4INCLAvatarDumpAction.cc.

58 {
59 ParticleList particles = nucleus->getStore()->getParticles();
60 ParticleList highlight;
61 if(finalState) {
62 ParticleList const &modified = finalState->getModifiedParticles();
63 highlight.insert(highlight.end(), modified.begin(), modified.end());
64 ParticleList const &outgoing = finalState->getOutgoingParticles();
65 highlight.insert(highlight.end(), outgoing.begin(), outgoing.end());
66 ParticleList const &destroyed = finalState->getDestroyedParticles();
67 highlight.insert(highlight.end(), destroyed.begin(), destroyed.end());
68 ParticleList const &created = finalState->getCreatedParticles();
69 highlight.insert(highlight.end(), created.begin(), created.end());
70 ParticleList const &entering = finalState->getEnteringParticles();
71 highlight.insert(highlight.end(), entering.begin(), entering.end());
72 particles.insert(particles.end(), created.begin(), created.end());
73 particles.insert(particles.end(), entering.begin(), entering.end());
74 }
75
76 (*oFile) << avatar->getTime() << '\t' << avatar->getType() << '\t' << particles.size() << '\n';
77 for(ParticleIter p=particles.begin(), e=particles.end(); p!=e; ++p) {
78 ThreeVector const &pos = (*p)->getPosition();
79 ThreeVector const &vel = (*p)->getPropagationVelocity();
80 G4int highlightIt = highlight.contains(*p);
81 (*oFile)
82 << (*p)->getID() << '\t'
83 << (*p)->getParticipantType() << '\t'
84 << (*p)->getType() << '\t'
85 << pos.getX() << '\t'
86 << pos.getY() << '\t'
87 << pos.getZ() << '\t'
88 << vel.getX() << '\t'
89 << vel.getY() << '\t'
90 << vel.getZ() << '\t'
91 << (*p)->getKineticEnergy() << '\t'
92 << (*p)->getPotentialEnergy() << '\t'
93 << highlightIt << '\n';
94 }
95 }
int G4int
Definition G4Types.hh:85
ParticleList::const_iterator ParticleIter

◆ afterCascadeUserAction()

void G4INCL::AvatarDumpAction::afterCascadeUserAction ( Nucleus * )
virtual

Reimplemented from G4INCL::CascadeAction.

Definition at line 97 of file G4INCLAvatarDumpAction.cc.

97 {
98 oFile->close();
99 delete oFile;
100 ++eventCounter;
101 }

◆ beforeCascadeUserAction()

void G4INCL::AvatarDumpAction::beforeCascadeUserAction ( IPropagationModel * )
virtual

Reimplemented from G4INCL::CascadeAction.

Definition at line 52 of file G4INCLAvatarDumpAction.cc.

52 {
53 std::stringstream ss;
54 ss << "avatar-dump-" << eventCounter << ".dat";
55 oFile = new std::ofstream(ss.str().c_str());
56 }

The documentation for this class was generated from the following files: