12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

User ActionsG4UserSteppingActionExample 6.8. G4UserSteppingAction//---------------------------------------------------------------//// G4UserSteppingAction.hh//// Description:// This class represents actions taken place by the user at each// end of stepping.////---------------------------------------------------------------///////////////////////////class G4UserSteppingAction///////////////////////////{//--------public://--------// Constructor and destructorG4UserSteppingAction(){}virtual ~G4UserSteppingAction(){}// Member functionsvirtual void UserSteppingAction(const G4Step*){}//-----------protected://-----------// Member dataG4SteppingManager* fpSteppingManager;};6.2.2. Killing Tracks in User Actions and Energy ConservationIn either of user action classes described in the previous section, the user can implement an unnatural/unphysicalaction. A typical example is to kill a track, which is under the simulation, in the user stepping action. In this casethe user have to be cautious of the total energy conservation. The user stepping action itself does not take care theenergy or any physics quantity associated with the killed track. There<strong>for</strong>e if the user want to keep the total energyof an event in this case, the lost track energy need to be recorded by the user.The same is true <strong>for</strong> user stacking or tracking actions. If the user has killed a track in these actions the all physicsin<strong>for</strong>mation associated with it would be lost and, <strong>for</strong> example, the total energy conservation be broken.If the user wants the <strong>Geant4</strong> kernel to take care the total energy conservation automatically when he/she haskilled artificially a track, the user has to use a killer process. For example if the user uses G4UserLimits andG4UserSpecialCuts process, energy of the killed track is added to the total energy deposit.6.3. User In<strong>for</strong>mation ClassesAdditional user in<strong>for</strong>mation can be associated with various <strong>Geant4</strong> classes. There are basically two ways <strong>for</strong> theuser to do this:• derive concrete classes from base classes used in <strong>Geant4</strong>. These are classes <strong>for</strong> run, hit, digit, trajectory and trajectorypoint, which are discussed in Section 6.2 <strong>for</strong> G4Run, Section 4.4 <strong>for</strong> G4VHit, Section 4.5 <strong>for</strong> G4VDigit,and Section 5.1.6 <strong>for</strong> G4VTrajectory and G4VTrajectoryPoint• create concrete classes from provided abstract base classes and associate them with classes used in <strong>Geant4</strong>.<strong>Geant4</strong> classes which can accommodate user in<strong>for</strong>mation classes are G4Event, G4Track, G4PrimaryVertex,G4PrimaryParticle and G4Region. These classes are discussed here.202

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!